Using System.dll to call Win32 APIs
I was looking for a simple installer package the other day, and found this one. It seems to be very straight forward to use. My only problem though so far is the following:
I have written a program to be run as a service and would like to install this service using NSIS scripting. The commands should be as follows:
System::Call 'advapi32::OpenSCManagerA(t, t, l) l(Null, Null, 2).r0'
System::Call 'advapi32::CreateServiceA(l, t, t, l, l, l, l, t, t, t, t, t, t) l(r0, "ServiceName", "Service Description", 983551, 16, 2, 1, "ServiceLocation.exe", Null, Null, Null, "LocalSystem", Null).r1'
The first calls returns a handle from the Service Control Managage Database and passes that handle into the first variable in the next call which creates the service. The first call seeems to be working correctly, but the second does not, and I think it is because the handle being returned from the first call is getting changed into a string variable which needs to remain a long to be passed into the second call.
I know that I could create my own extension dll to do this or I could do the install in my program, but if I could get this to work it would be very simply and elegant.
If anyone could help, I would greatly appreciate it.
-tim