What is the difference if any?

G

George Hester

This in Windows 2000 SP3. What is the difference between these two
commands:

"C:\WINNT\System32\rundll32.exe"
"C:\WINNT\System32\divxdec.ax",DllRegisterServer

and

regsvr32 divxdec.ax

Thanks.
 
A

Alex Blekhman

George said:
This in Windows 2000 SP3. What is the difference between
these two commands:

"C:\WINNT\System32\rundll32.exe"
"C:\WINNT\System32\divxdec.ax",DllRegisterServer

and

regsvr32 divxdec.ax

First is wrong and second is not. RunDll32.exe requires that
function entry point will be with specific signature:

void CALLBACK
EntryPoint(
HWND hwnd,
HINSTANCE hinst,
LPSTR lpszCmdLine,
int nCmdShow);

DllRegisterServer doesn't have such signature:

STDAPI DllRegisterServer(void);

RegSvr32.exe is documented way to register COM modules.
RunDll32.exe is not.
 
G

George Hester

Thank you very much Alex. Although the first was "wrong" that is what the
installation of DivX 6 put in the resgistry for reboot. RunOnce. Windows
2000 SP3. But I knew I could do what looked to be the same thing right in
Run | regsvr32 divxdec.ax | OK. But I thought I'd ask about it first.
 
A

Alex Blekhman

George said:
Although the first was "wrong"
that is what the installation of DivX 6 put in the
resgistry for reboot.

Yes, I think that Rundll32.exe is one of most abused
programs in the world.
But I
knew I could do what looked to be the same thing right in
Run | regsvr32 divxdec.ax | OK.

If you want to register silently, then there is /s flag for
regsvr32.exe. Type "regsvr32.exe /?" in command prompt to
see all options.
 
T

Tim Roberts

George Hester said:
Thank you very much Alex. Although the first was "wrong" that is what the
installation of DivX 6 put in the resgistry for reboot. RunOnce. Windows
2000 SP3. But I knew I could do what looked to be the same thing right in
Run | regsvr32 divxdec.ax | OK. But I thought I'd ask about it first.

There is a very good reason for this. When an INF file puts rundll32 into
a RunOnce key, the device manager runs the commands as soon as the
installation ends, without a reboot. If an INF file puts anything other
than rundll32 into a RunOnce key, a reboot is required.

Because of that, ChkInf will fail any RunOnce command other than rundll32,
which means the driver cannot be signed.

The fact that the function signature doesn't match causes a general
protection fault in rundll32 when the DLL function returns, but the
exception is trapped and ignored. This is the "official" and approved
method of registering DLLs in an INF.
 
A

Alex Blekhman

Tim said:
The fact that the function signature doesn't match causes
a general protection fault in rundll32 when the DLL
function returns, but the exception is trapped and
ignored. This is the "official" and approved method of
registering DLLs in an INF.

All that in order to prevent reboot? Why not to run
"regsvr32 /s <filename>" during install?
 
T

Tim Roberts

Alex Blekhman said:
All that in order to prevent reboot? Why not to run
"regsvr32 /s <filename>" during install?

If you have an installer, of course you can do that. But if you're trying
to do an INF-only install, you have to use some tricks. There is no way to
force an application to be run immediately during an INF install. RunOnce
is the only opportunity to do so.

We are lucky that it special-cases rundll32. Otherwise, it would be
difficult to have ANY non-reboot installs.n
 
A

Alex Blekhman

Tim said:
We are lucky that it special-cases rundll32. Otherwise,
it would be difficult to have ANY non-reboot installs.

I can understand that. However, calling function with wrong
signature in assumption that Rundll32 will catch exception
looks quite dirty to me. I'd write a function with correct
signature that will call DllRegisterServer in turn.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top