Regsvr32.exe gives error 'The specified procedure could not be found'

Just got a problem where the COM DLL was compiled on Windows XP and while registering the DLL, it was giving error saying "The specified procedure could not be found"..

While debugging the regsvr32 process, found that it was loading the DLL (customer's COM dll) and at that time, one method from Kernel32.dll was getting loaded named GetThreadId.. checking it, we found that on Windows XP kernel32.dll this method was not shipped.. and it was getting successful on the windows 2003 machine because this method is available on win2003 onwards operating system.

The reason of blogging this thing is, the error message that regsvr32.exe gives is somewhat strange. Because when I saw this error, I first checked the export table of the DLL and found everything proper. Then checked import table and found this method GetThreadId which was causing the DLL load failure.. So, in regsvr32.exe still the COM component registration code was not even started (no registry entries were created).

While again talking to customer, found that in his code, he used GetThreadId method at one location, just by commenting that function out, we could successfully register the COM component.

I personally feel that, Regsvr32.exe should give more proper error message!!!