Page 1 of 1

FILE SIZE

Posted: Thu Nov 19, 2015 9:54 am
by wxperson99
I looked at a past post and saw some sample code from Francisco which determines the size of a file.

I am getting an error...

Unable to load plug-in library. Please rebuild you project and make sure all required plug-ins are installed... Action skilled.

What am I doing wrong?

~InstallAware Clipboard Data~
~End~
~{660C7FA7-512A-4224-9A9E-6C23906918ED}~
~End~
~{9104D369-3094-4841-B173-8EF0D2336534}~
~Call DLL Function~
~{7ADE70B7-B0F8-4239-AC88-F0DAFCF7BE36}~
~Kernel32.dll,CloseHandle,bool,RESULT,"double word",$FILE_HANDLE$,$~
~~mIDEFunc.dll\mEXEFunc.dll~~
~Set Variable~
~{CF67D496-D683-4AFF-9AFF-E4F2208897DB}~
~RESULT$MYAH$MYAH$FALSE~
~FALSE~
~Comment~
~{B56C7CEA-354F-44C5-AE37-8DD955942C9B}~
~~
~MessageBox~
~{AC62A368-ACDE-45D1-B9ED-9B224BE08144}~
~DEBUG~
~File size = $FILE_SIZE$~
~0~
~1~
~~
~Call DLL Function~
~{6ED0BE5C-52C5-43FF-A52B-B5694C5D86C3}~
~Kernel32.dll,GetFileSize,"double word",FILE_SIZE,"double word",$FILE_HANDLE$,"double word",0,$~
~~mIDEFunc.dll\mEXEFunc.dll~~
~If~
~{47E98F08-F178-4BD8-B3D9-0FCA36912ED8}~
~FILE_HANDLE~
~4~
~4294967295~
~TRUE~
~If~
~{15B3848B-4E82-4DBE-830C-47A38FDC3D30}~
~FILE_HANDLE~
~2~
~0~
~FALSE~
~Call DLL Function~
~{42B983EC-EBF5-4AE9-B54F-03AA423C7084}~
~Kernel32.dll,CreateFileA,"double word",FILE_HANDLE,"pointer to string",$TARGETDIR$\database\obs.mdb,"double word",2147483648,"double word",0,long,0,"double word",3,"double word",128,"double word",0,$~
~~mIDEFunc.dll\mEXEFunc.dll~~
~Set Variable~
~{0D20EF2A-F690-44B5-8519-9CAD927C4023}~
~FILE_HANDLE$MYAH$MYAH$FALSE~
~0~

Re: FILE SIZE

Posted: Thu Nov 19, 2015 12:24 pm
by FrancescoT
I can only suppose that you missed to install the "Call DLL Function" plugin.

Regards

Re: FILE SIZE

Posted: Thu Nov 19, 2015 4:12 pm
by wxperson99
I have DLL calls in other installation projects and they work fine.

Is the DLL function installed by project?

Re: FILE SIZE

Posted: Thu Nov 19, 2015 4:24 pm
by wxperson99
ACTUALLY I have some CALL DLL function code within this same project.... and it works... so something it weird

~InstallAware Clipboard Data~
~Call DLL Function~
~{AC44D0D3-A023-453B-A51D-ECEDE8ADEF65}~
~$WINSYSDIR$Kernel32.dll,CopyFile,bool,RESULTDLL,"pointer to UNICODE string",$SUPPORTDIR$killtasks.exe,"pointer to UNICODE string",$TARGETDIR$\killtasks.exe,bool,FALSE,$~
~mIDEFunc.dll\mEXEFunc.dll~

works

~InstallAware Clipboard Data~
~Call DLL Function~
~{42B983EC-EBF5-4AE9-B54F-03AA423C7084}~
~$WINSYSDIR$Kernel32.dll,CreateFileA,"double word",FILE_HANDLE,"pointer to string",$TARGETDIR$\database\obs.mdb,"double word",2147483648,"double word",0,long,0,"double word",3,"double word",128,"double word",0,$~
~~mIDEFunc.dll\mEXEFunc.dll~~

does not.

Ideas?

Re: FILE SIZE

Posted: Fri Nov 20, 2015 11:21 am
by FrancescoT
Do you have any chance to send me a very very minimal project that replicates the issue?

Regards

Re: FILE SIZE

Posted: Fri Nov 20, 2015 1:15 pm
by wxperson99
I just created a blank install with just the code I copied from the article on file size. It is small so I just pasted it below. You would have to change the file being examined. Thx... George


~InstallAware Clipboard Data~
~Terminate Install~
~{FF0520EF-47E2-44D8-B5E4-757B1660D1D3}~
~End~
~{66801707-2C28-4D38-BFF0-58B05948A29D}~
~End~
~{74D1A3E9-ECC1-436C-84F0-02982B2964E5}~
~Call DLL Function~
~{F6A2F35B-DF68-42C8-99ED-62F4E3186AE9}~
~$WINSYSDIR$Kernel32.dll,CloseHandle,bool,RESULT,"double word",$FILE_HANDLE$,$~
~~mIDEFunc.dll\mEXEFunc.dll~~
~Set Variable~
~{FD9675D8-3D74-4C75-981F-2AC8FB9C82D0}~
~RESULT$MYAH$MYAH$FALSE~
~FALSE~
~Comment~
~{DE71D7F6-6011-4D41-BDD9-40127F744C4F}~
~~
~MessageBox~
~{7D0C3A5A-7A86-4458-B3FF-0B68B6A0C3FF}~
~DEBUG~
~File size = $FILE_SIZE$~
~0~
~1~
~~
~Call DLL Function~
~{A9CA304A-89D9-40FC-8816-3ADD28FDED69}~
~$WINSYSDIR$Kernel32.dll,GetFileSize,"double word",FILE_SIZE,"double word",$FILE_HANDLE$,"double word",0,$~
~~mIDEFunc.dll\mEXEFunc.dll~~
~If~
~{1699C564-460B-449C-AA3D-18699A6D2512}~
~FILE_HANDLE~
~4~
~4294967295~
~TRUE~
~If~
~{62C64879-4D46-4158-A795-0E1336CDFFBC}~
~FILE_HANDLE~
~2~
~0~
~FALSE~
~Call DLL Function~
~{CA5FC24C-BF19-4FD9-B70F-EAAD68E5E18C}~
~$WINSYSDIR$Kernel32.dll,CreateFileA,"double word",FILE_HANDLE,"pointer to string",c:\temp\str.png,"double word",2147483648,"double word",0,long,0,"double word",3,"double word",128,"double word",0,$~
~~mIDEFunc.dll\mEXEFunc.dll~~
~Set Variable~
~{2E367B45-9F29-4A61-960D-F373A2DC3DE5}~
~FILE_SIZE$MYAH$MYAH$FALSE~
~~
~Set Variable~
~{306B6D19-5CF4-490F-973F-23C920EFAD21}~
~FILE_HANDLE$MYAH$MYAH$FALSE~
~~~~

Re: FILE SIZE

Posted: Fri Nov 20, 2015 1:45 pm
by FrancescoT
I'll let you know!

Regards

Re: FILE SIZE

Posted: Fri Nov 20, 2015 3:10 pm
by wxperson99
OK..

I have tried this on several PC workstations with the same resulting error... and I really need a way to determine file size pretty badly.

THanks,

George

Re: FILE SIZE

Posted: Mon Nov 23, 2015 12:30 pm
by FrancescoT
Dear George,

I have been able to replicate the error you reported, but it looks a very strange error.
I am able to call other functions from the same "kernel32.dll" or to call very complex functions from my custom dlls, but it fails using a similar call to "CreateFile" WINAPI.

I need more time to work on this.

Regards

Re: FILE SIZE

Posted: Mon Nov 23, 2015 12:43 pm
by wxperson99
Glad you see it too :-)

I see the same behavior as you.

Let me know when you have figured it out.

Re: FILE SIZE

Posted: Tue Nov 24, 2015 7:09 am
by FrancescoT
Dear George,

try this (just copy and past the following IA Clipboard Data in your script).

NOTE! The code assumes the existence of the "c:\test\myfile.png" file.

Code: Select all

~InstallAware Clipboard Data~
~End~
~{7DD4533E-9456-40CB-A555-C44646DF4F7D}~
~Call DLL Function~
~{E25A863D-CF97-4BD9-A74E-89C17804A707}~
~Kernel32.dll,CloseHandle,bool,,"pointer to long",$FILE_HANDLE$,$~
~mIDEFunc.dll\mEXEFunc.dll~
~MessageBox~
~{CBA3904C-A5CF-448F-BC92-84B6C17C4FF1}~
~Debug~
~FILE_SIZE = $FILE_SIZE$~
~0~
~1~
~~
~Call DLL Function~
~{12221607-943B-40F0-9F4B-EB4617982E9A}~
~Kernel32.dll,GetFileSize,word,FILE_SIZE,"pointer to long",$FILE_HANDLE$,long,0,$~
~mIDEFunc.dll\mEXEFunc.dll~
~If~
~{8C03170C-C4CD-43C5-90D3-978BA4339F04}~
~FILE_HANDLE~
~2~
~0~
~FALSE~
~Comment~
~{2BEB9410-0158-4A44-911E-48F9EF21ACB7}~
~~
~MessageBox~
~{352E47D8-0599-46F8-95C2-30D0BD19476D}~
~Debug~
~FILE_HANDLE = $FILE_HANDLE$~
~0~
~1~
~~
~Call DLL Function~
~{A78AB7F1-D97C-450F-BB97-152FE74EF29A}~
~Kernel32.dll,CreateFileA,long,FILE_HANDLE,"pointer to string","$FILE_TO OPEN$","double word",2147483648,"double word",1,long,0,"double word",3,"double word",80,long,0,$~
~mIDEFunc.dll\mEXEFunc.dll~
~Set Variable~
~{738DE363-C1C9-4555-9DD1-EA3243962C52}~
~FILE_SIZE$MYAH$MYAH$FALSE~
~0~
~Set Variable~
~{B5C6AA9D-3712-458E-8151-44493D480742}~
~FILE_TO OPEN$MYAH$MYAH$FALSE~
~c:\test\myfile.png~
~Set Variable~
~{F59AF835-6BB7-4E8A-BA77-9B49FC66B3A9}~
~FILE_HANDLE$MYAH$MYAH$FALSE~
~~

This works!
The problem you had was caused by some wrong parameters passed to the "CreateFileA" WINAPI.

Regards

Re: FILE SIZE

Posted: Tue Nov 24, 2015 9:25 am
by wxperson99
I keep getting a -1 return on the FILE_HANDLE.

The FILE_TO OPEN file does exist. I tried several different file names...

~InstallAware Clipboard Data~
~End~
~{A1634BC8-024A-4146-A39B-CC336D9D9C45}~
~Call DLL Function~
~{4265D061-6AC2-4883-91D3-FBED34BA0975}~
~Kernel32.dll,CloseHandle,bool,,"pointer to long",$FILE_HANDLE$,$~
~mIDEFunc.dll\mEXEFunc.dll~
~MessageBox~
~{F698CC43-0C24-45E3-9477-5ADA77A76D43}~
~Debug~
~FILE_SIZE = $FILE_SIZE$~
~0~
~1~
~~
~Call DLL Function~
~{EDEDDC9A-8430-476B-B65C-FB8A90AE4087}~
~Kernel32.dll,GetFileSize,word,FILE_SIZE,"pointer to long",$FILE_HANDLE$,long,0,$~
~mIDEFunc.dll\mEXEFunc.dll~
~If~
~{D62697D2-2229-4122-AD00-DC1044568B88}~
~FILE_HANDLE~
~2~
~0~
~FALSE~
~Comment~
~{0D606974-5C6F-4763-A5C8-22D3EA8BC8C3}~
~~
~MessageBox~
~{384CFFEC-A75A-49BD-BB76-040EEB54669F}~
~Debug~
~FILE_HANDLE = $FILE_HANDLE$~
~0~
~1~
~~
~Call DLL Function~
~{CE5A5108-7F3A-4CC2-9249-57B82F772DC8}~
~Kernel32.dll,CreateFileA,long,FILE_HANDLE,"pointer to string",$FILE_TO_OPEN$,"double word",2147483648,"double word",1,long,0,"double word",3,"double word",80,long,0,$~
~mIDEFunc.dll\mEXEFunc.dll~
~Set Variable~
~{3C82E85B-9FB6-43ED-83E2-BD51B6BE53DC}~
~FILE_SIZE$MYAH$MYAH$FALSE~
~0~
~Set Variable~
~{0EA24FA3-EB9D-4486-BC0B-A321DCBD9454}~
~FILE_TO_OPEN$MYAH$MYAH$FALSE~
~c:\test\eastusa.gif~
~Set Variable~
~{30820C37-6D5D-42DF-8A63-5DB3CB1F503C}~
~FILE_HANDLE$MYAH$MYAH$FALSE~
~~~~

Re: FILE SIZE

Posted: Tue Nov 24, 2015 11:22 am
by FrancescoT
Dear George,

honestly I cannot be sure on how you used my code. Due of this, attached you find a small project that demonstrates the various WINAPI calls.
To avoid any possible error, the sample also creates a target directory with a small TXT file.

However due the fact that the "GetFileSize" may also return the "high-order doubleword of the file size" with its second parameter, it may be difficult to handle the file size properly via script. In addition MSDN recommends to use "GetFileSizeEx" in place of "GetFileSize", where a Large Integer is used to return the size value.

That said it may be preferable to release a custom DLL at such purpose.

Hope this helps you.

Regards

Re: FILE SIZE

Posted: Tue Nov 24, 2015 12:52 pm
by wxperson99
Hi,

Over the weekend I wrote a small program that writes a file's size to a text file.

I am running that inside my script and reading the results into a variable.

Easier than trying to figure the DLL thing out.

Thanks,

George

Re: FILE SIZE

Posted: Tue Nov 24, 2015 4:45 pm
by bokkie
George,

I have a plugin I wrote a while ago to get a file's size. I think I stopped coding it when I think there were other solutions to the same problem. If you're quite happy that doing it via a DLL call was the only way you see it working I'll be happy to look at it quickly and see if I can finish it off and test it and then add it here for you to use. Then again, it seems you "solved" the problem using an external file so perhaps you don't need a plugin? Let me know your thoughts on the matter before I commit any time to what might be a one-off problem.