"Rolf Kalbermatter" <[EMAIL PROTECTED]> wrote:

From a quick check it seems to take three parameters, with the first being
a CLSID or other GUID and the other two being DWORDs. The second parameter
is checked to be higher than 0 and smaller or equal to 0xDC and the third
parameter is checked to be higher than 0 and smaller or equal to 0x454.
(This is XP SP2 fully patched).
When any of the three parameters are 0, the function sets last error to 0x57
and returns with 0. When the second and third parameter is above the limits
the function sets last error to 0x0D and returns with 0. When everything was
successful the function returns with 1.

This appears to be a correct description, at least attached test shows exactly
the same behaviour as described above. If I add 2 more parameters as Andrey
suggested I get a crash due to stack corruption.

This information should be enough to create a stub.

--
Dmitry.
#include <windows.h>
#include <objbase.h>
#include <stdio.h>
#include <assert.h>

typedef struct
{
   DWORD dwSize;
   char unused[0xd8];
} UNK_1;

typedef struct
{
   DWORD dwSize;
   char unused[0x450];
} UNK_2;

int main(void)
{
   BOOL (WINAPI *pSetupQueryRegisteredOsComponent)(const IID *const iid, LPVOID 
component_data, LPVOID exception_data);
   BOOL ret;
   IID guid;
   HRESULT hres;
   HANDLE hDll;
   UNK_1 unk_1;
   UNK_2 unk_2;

   hres = IIDFromString(L"{473FF9A0-D659-11D1-A4B2-006008AF820E}", &guid);
   assert(hres == S_OK);

   hDll = LoadLibrary("syssetup.dll");
   assert(hDll);
   pSetupQueryRegisteredOsComponent = (void *)GetProcAddress(hDll, 
"SetupQueryRegisteredOsComponent");
   assert(pSetupQueryRegisteredOsComponent);

   SetLastError(0xdeadbeef);
   ret = pSetupQueryRegisteredOsComponent(NULL, NULL, NULL);
   printf("(NULL, NULL, NULL) ret = %d, error %u\n", ret, GetLastError());
   assert(GetLastError() == ERROR_INVALID_PARAMETER);

   unk_1.dwSize = sizeof(unk_1);
   unk_2.dwSize = sizeof(unk_2);
   SetLastError(0xdeadbeef);
   ret = pSetupQueryRegisteredOsComponent(&guid, &unk_1, &unk_2);
   printf("(&guid, &unk_1, &unk_2) ret = %d, error %u\n", ret, GetLastError());
   assert(GetLastError() == ERROR_FILE_NOT_FOUND);

   unk_1.dwSize = sizeof(unk_1) + 1;
   unk_2.dwSize = sizeof(unk_2) + 1;
   SetLastError(0xdeadbeef);
   ret = pSetupQueryRegisteredOsComponent(&guid, &unk_1, &unk_2);
   printf("(&guid, &unk_1, &unk_2) ret = %d, error %u\n", ret, GetLastError());
   assert(GetLastError() == ERROR_INVALID_DATA);

   FreeLibrary(hDll);
   return 0;
}


Reply via email to