Hi,
to get over the problem of msi installs requiring the original media on an uninstall I'm using CopyFileA to copy files and MoveFileEx to remove files, both from kernel32.dll.
CopyFileA seems to work correctly but I'm having problems getting MoveFileEx to work.
If I use the follwing with c++ :
MoveFileEx(directory + "\\\\" + filename, NULL ,MOVEFILE_DELAY_UNTIL_REBOOT)
everything works fine however when calling it from the install script it looks as though for some reason it doesn't like '0' or 'NULL' as the second parameter, I can see this from what it puts in the registry, it creates a multi string, for each entry the 1st line is the original file inc path and the second line should be NULL, calling it from the install script it's trying to put a path in for the second line and as a result the files aren't removed on a reboot.
Has anyone had any success using this function or know why it might not like the second parameter?
Thanks
Paul
NULL as parameter for a dll function call
-
- Posts: 3452
- Joined: Thu Dec 22, 2005 7:17 pm
- Contact:
I'd try the following values to represent NULL:
double word, 0 (zero)
pointer to string, empty string
allocated string buffer, script variable that is set to an empty string
Let me know if none of these work.
double word, 0 (zero)
pointer to string, empty string
allocated string buffer, script variable that is set to an empty string
Let me know if none of these work.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
Re: NULL as parameter for a dll function call
Hi there.
I'm using the Call DLL function to execute the CreateFile Windows API function (from Kernel32.dll) to retrieve the HANDLE for a specific file.
MSDN documentation (http://msdn.microsoft.com/en-us/library ... 85%29.aspx) says I have to pass 7 parameters:
The third parameter is an optional structure and since I'm supposing IA9 Call DLL Plugin does not support structure pointers, I'm passing an empty Allocated String Buffer, but the plugin is returning EXTERNALEXCEPTION.
Am I doing something wrong on this one?
Thanks in advance!
I'm using the Call DLL function to execute the CreateFile Windows API function (from Kernel32.dll) to retrieve the HANDLE for a specific file.
MSDN documentation (http://msdn.microsoft.com/en-us/library ... 85%29.aspx) says I have to pass 7 parameters:
__in LPCTSTR lpFileName,
__in DWORD dwDesiredAccess,
__in DWORD dwShareMode,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes,
__in DWORD dwCreationDisposition,
__in DWORD dwFlagsAndAttributes,
__in_opt HANDLE hTemplateFile
The third parameter is an optional structure and since I'm supposing IA9 Call DLL Plugin does not support structure pointers, I'm passing an empty Allocated String Buffer, but the plugin is returning EXTERNALEXCEPTION.
Code: Select all
~InstallAware Clipboard Data~
~Call DLL Function~
~{D55CB94D-5AA7-4066-806F-76E16F4EBEE4}~
~Kernel32.dll,CreateFile,"double word",FILE_HANDLE,"pointer to string",D:\Pacote\CompBin\PCF_DCMServer.exe,"double word",8,"double word",1,"allocated string buffer (MAX_PATH length)",,"double word",3,"double word",128,$~
~mIDEFunc.dll\mEXEFunc.dll~
~Set Variable~
~{2EB18E33-0BE7-4DE0-8F99-500D30204322}~
~FILE_HANDLE$MYAH$MYAH$FALSE~
~~
Am I doing something wrong on this one?
Thanks in advance!
-
- Posts: 155
- Joined: Mon Nov 12, 2007 11:59 am
Re: NULL as parameter for a dll function call
Tiago,
I am running into the same issue and was wondering if you have figured out how to get the CreateFile function to run? If you did I would like to see the code you are passing in.
I am running into the same issue and was wondering if you have figured out how to get the CreateFile function to run? If you did I would like to see the code you are passing in.
Re: NULL as parameter for a dll function call
Hi, Roostar2004.
Not really. I'm avoiding at all costs this kind of API with complex parameters in MSICode. When I really have to, I write an external application to do the dirty work. I was hoping someone from IA team would shed some light on this topic, but still we haven't got a reply.
I am sorry...
Not really. I'm avoiding at all costs this kind of API with complex parameters in MSICode. When I really have to, I write an external application to do the dirty work. I was hoping someone from IA team would shed some light on this topic, but still we haven't got a reply.
I am sorry...
Re: NULL as parameter for a dll function call
Make sure you're passing valid arguments for the rest of the besides what you want NULL as well.
I was able to create a file with this:
I was able to create a file with this:
Code: Select all
~InstallAware Clipboard Data~
~Call DLL Function~
~{6F6985E4-0F18-427C-8E0A-82114735C5AD}~
~Kernel32.dll,CreateFile,"double word",FILE_HANDLE,"pointer to string",C:\PCF_DCMServer.txt,"double word","GENERIC_READ | GENERIC_WRITE","double word",0,long,NULL,"double word",1,"double word",128,long,NULL,$~
~mIDEFunc.dll\mEXEFunc.dll~
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.
Who is online
Users browsing this forum: No registered users and 17 guests