#include #include #include #include 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; }