static void test_SetupGetSourceFileLocation(void) { char buffer[MAX_PATH] = "not empty", inf_filename[MAX_PATH]; UINT source_id; DWORD required, error; HINF hinf; BOOL ret; lstrcpyA(inf_filename, CURR_DIR); lstrcatA(inf_filename, "\\"); lstrcatA(inf_filename, "test.inf"); create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); required = 0; source_id = 0; ret = SetupGetSourceFileLocationA(hinf, NULL, "lanconf.exe", &source_id, buffer, sizeof(buffer), &required); ok(ret, "SetupGetSourceFileLocation failed\n"); ok(required == 1, "unexpected required size: %d\n", required); ok(source_id == 2, "unexpected source id: %d\n", source_id); ok(!lstrcmpA("", buffer), "unexpected result string: %s\n", buffer); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); create_inf_file(inf_filename, inf_data2, sizeof(inf_data2) - 1); SetLastError(0xdeadbeef); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); error = GetLastError(); ok(hinf == INVALID_HANDLE_VALUE, "could open inf file\n"); ok(error == ERROR_WRONG_INF_STYLE, "got wrong error: %d\n", error); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_OLDNT, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); ret = SetupGetSourceFileLocationA(hinf, NULL, "", &source_id, buffer, sizeof(buffer), &required); ok(!ret, "SetupGetSourceFileLocation succeeded\n"); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); }
static void test_SetupGetSourceInfo(void) { char buffer[MAX_PATH], inf_filename[MAX_PATH]; DWORD required; HINF hinf; BOOL ret; lstrcpyA(inf_filename, CURR_DIR); lstrcatA(inf_filename, "\\"); lstrcatA(inf_filename, "test.inf"); create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); required = 0; ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_PATH, buffer, sizeof(buffer), &required); ok(ret, "SetupGetSourceInfoA failed\n"); ok(required == 1, "unexpected required size: %d\n", required); ok(!lstrcmpA("", buffer), "unexpected result string: %s\n", buffer); required = 0; buffer[0] = 0; ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_TAGFILE, buffer, sizeof(buffer), &required); ok(ret, "SetupGetSourceInfoA failed\n"); ok(required == 28, "unexpected required size: %d\n", required); ok(!lstrcmpA("LANCOM\\LANtools\\lanconf.cab", buffer), "unexpected result string: %s\n", buffer); required = 0; buffer[0] = 0; ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_DESCRIPTION, buffer, sizeof(buffer), &required); ok(ret, "SetupGetSourceInfoA failed\n"); ok(required == 19, "unexpected required size: %d\n", required); ok(!lstrcmpA("LANCOM Software CD", buffer), "unexpected result string: %s\n", buffer); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); }
static void test_original_file_name(LPCSTR original, LPCSTR dest) { HINF hinf; PSP_INF_INFORMATION pspii; SP_ORIGINAL_FILE_INFO spofi; BOOL res; DWORD size; if (!pSetupQueryInfOriginalFileInformationA) { win_skip("SetupQueryInfOriginalFileInformationA is not available\n"); return; } hinf = SetupOpenInfFileA(dest, NULL, INF_STYLE_WIN4, NULL); ok(hinf != NULL, "SetupOpenInfFileA failed with error %d\n", GetLastError()); res = SetupGetInfInformation(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size); ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError()); pspii = HeapAlloc(GetProcessHeap(), 0, size); res = SetupGetInfInformation(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL); ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError()); spofi.cbSize = 0; res = pSetupQueryInfOriginalFileInformationA(pspii, 0, NULL, &spofi); ok(!res && GetLastError() == ERROR_INVALID_USER_BUFFER, "SetupQueryInfOriginalFileInformationA should have failed with ERROR_INVALID_USER_BUFFER instead of %d\n", GetLastError()); spofi.cbSize = sizeof(spofi); res = pSetupQueryInfOriginalFileInformationA(pspii, 0, NULL, &spofi); ok(res, "SetupQueryInfOriginalFileInformationA failed with error %d\n", GetLastError()); ok(!spofi.OriginalCatalogName[0], "spofi.OriginalCatalogName should have been \"\" instead of \"%s\"\n", spofi.OriginalCatalogName); todo_wine ok(!strcmp(original, spofi.OriginalInfName), "spofi.OriginalInfName of %s didn't match real original name %s\n", spofi.OriginalInfName, original); HeapFree(GetProcessHeap(), 0, pspii); SetupCloseInfFile(hinf); }
/*********************************************************************** * DoInfInstall (ADVPACK.@) */ BOOL WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup) { BOOL ret; HINF hinf; void *callback_context; TRACE("%p %s %s %s %s\n", setup->hwnd, debugstr_a(setup->title), debugstr_a(setup->inf_name), debugstr_a(setup->dir), debugstr_a(setup->section_name)); hinf = SetupOpenInfFileA(setup->inf_name, NULL, INF_STYLE_WIN4, NULL); if (hinf == (HINF)INVALID_HANDLE_VALUE) return FALSE; callback_context = SetupInitDefaultQueueCallback(setup->hwnd); ret = SetupInstallFromInfSectionA(0, hinf, setup->section_name, SPINST_ALL, 0, NULL, 0, SetupDefaultQueueCallbackA, callback_context, NULL, NULL); SetupTermDefaultQueueCallback(callback_context); SetupCloseInfFile(hinf); return ret; }
static void test_SetupGetTargetPath(void) { char buffer[MAX_PATH], inf_filename[MAX_PATH]; char destfile[MAX_PATH]; DWORD required; HINF hinf; INFCONTEXT ctx; BOOL ret; lstrcpyA(inf_filename, CURR_DIR); lstrcatA(inf_filename, "\\"); lstrcatA(inf_filename, "test.inf"); create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); ctx.Inf = hinf; ctx.CurrentInf = hinf; ctx.Section = 7; ctx.Line = 0; required = 0; ret = SetupGetTargetPathA(hinf, &ctx, NULL, buffer, sizeof(buffer), &required); ok(ret, "SetupGetTargetPathA failed\n"); ok(required == 10, "unexpected required size: %d\n", required); /* Retrieve the system drive from the windows directory. * (%SystemDrive% is not available on Win9x) */ lstrcpyA(destfile, WIN_DIR); destfile[3] = '\0'; lstrcatA(destfile, "LANCOM"); ok(!lstrcmpiA(destfile, buffer), "unexpected result string: %s\n", buffer); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); create_inf_file(inf_filename, inf_data3, sizeof(inf_data3) - 1); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); required = 0; ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.Windir.Files", buffer, sizeof(buffer), &required); ok(ret, "SetupGetTargetPathA failed\n"); lstrcpyA(destfile, WIN_DIR); ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required); ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); create_inf_file(inf_filename, inf_data4, sizeof(inf_data4) - 1); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); required = 0; ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.System32.Files", buffer, sizeof(buffer), &required); ok(ret, "SetupGetTargetPathA failed\n"); GetSystemDirectoryA(destfile, MAX_PATH); ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required); ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); create_inf_file(inf_filename, inf_data5, sizeof(inf_data5) - 1); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); required = 0; ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.Windir.Files", buffer, sizeof(buffer), &required); ok(ret, "SetupGetTargetPathA failed\n"); lstrcpyA(destfile, WIN_DIR); ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required); ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); create_inf_file(inf_filename, inf_data6, sizeof(inf_data6) - 1); hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n"); required = 0; ret = SetupGetTargetPathA(hinf, NULL, "CopyAlways.Windir.Files", buffer, sizeof(buffer), &required); ok(ret, "SetupGetTargetPathA failed\n"); lstrcpyA(destfile, WIN_DIR); ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required); ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer); SetupCloseInfFile(hinf); DeleteFileA(inf_filename); }
static void test_SetupGetInfInformation(void) { PSP_INF_INFORMATION info; CHAR inf_filename[MAX_PATH]; CHAR inf_one[MAX_PATH], inf_two[MAX_PATH]; LPSTR revfile; DWORD size; HINF hinf; BOOL ret; lstrcpyA(inf_filename, CURR_DIR); lstrcatA(inf_filename, "\\"); lstrcatA(inf_filename, "test.inf"); /* try an invalid inf handle */ size = 0xdeadbeef; SetLastError(0xbeefcafe); ret = SetupGetInfInformationA(NULL, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); ok(GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == ERROR_BAD_PATHNAME) || /* win95 */ broken(GetLastError() == ERROR_FILE_NOT_FOUND) || /* win98 */ broken(GetLastError() == ERROR_PATH_NOT_FOUND) || /* NT4 */ broken(GetLastError() == ERROR_INVALID_NAME) || /* win2k */ broken(GetLastError() == ERROR_GENERAL_SYNTAX), /* another win2k / winMe */ "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); ok(size == 0xdeadbeef, "Expected size to remain unchanged\n"); /* try an invalid inf filename */ /* do not use NULL as absolute inf filename on win9x/winMe (crash) */ if ((GetLastError() != ERROR_BAD_PATHNAME) && /* win95 */ (GetLastError() != ERROR_FILE_NOT_FOUND) && /* win98 */ (GetLastError() != ERROR_GENERAL_SYNTAX)) /* winMe */ { size = 0xdeadbeef; SetLastError(0xbeefcafe); ret = SetupGetInfInformationA(NULL, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); ok(size == 0xdeadbeef, "Expected size to remain unchanged\n"); } create_inf_file(inf_filename, inf_data1, sizeof(inf_data1) - 1); /* try an invalid search flag */ size = 0xdeadbeef; SetLastError(0xbeefcafe); ret = SetupGetInfInformationA(inf_filename, -1, NULL, 0, &size); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); ok(size == 0xdeadbeef, "Expected size to remain unchanged\n"); /* try a nonexistent inf file */ size = 0xdeadbeef; SetLastError(0xbeefcafe); ret = SetupGetInfInformationA("idontexist", INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); ok(size == 0xdeadbeef, "Expected size to remain unchanged\n"); /* successfully open the inf file */ size = 0xdeadbeef; ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(size != 0xdeadbeef, "Expected a valid size on return\n"); /* set ReturnBuffer to NULL and ReturnBufferSize to non-zero value 'size' */ SetLastError(0xbeefcafe); ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, &size); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); /* set ReturnBuffer to NULL and ReturnBufferSize to non-zero value 'size-1' */ ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size-1, &size); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); /* some tests for behaviour with a NULL RequiredSize pointer */ ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, NULL); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size - 1, NULL); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, NULL); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); info = HeapAlloc(GetProcessHeap(), 0, size); /* try valid ReturnBuffer but too small size */ SetLastError(0xbeefcafe); ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size - 1, &size); ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); /* successfully get the inf information */ ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size, &size); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n"); HeapFree(GetProcessHeap(), 0, info); /* try the INFINFO_INF_SPEC_IS_HINF search flag */ hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); info = alloc_inf_info(hinf, INFINFO_INF_SPEC_IS_HINF, &size); ret = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, info, size, &size); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(check_info_filename(info, inf_filename), "Expected returned filename to be equal\n"); SetupCloseInfFile(hinf); lstrcpyA(inf_two, WIN_DIR); lstrcatA(inf_two, "\\system32\\"); lstrcatA(inf_two, "test.inf"); create_inf_file(inf_two, inf_data1, sizeof(inf_data1) - 1); HeapFree(GetProcessHeap(), 0, info); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size); /* check if system32 is searched for inf */ ret = SetupGetInfInformationA("test.inf", INFINFO_DEFAULT_SEARCH, info, size, &size); if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND) revfile = inf_one; /* Vista */ else revfile = inf_two; lstrcpyA(inf_one, WIN_DIR); lstrcatA(inf_one, "\\inf\\"); lstrcatA(inf_one, "test.inf"); create_inf_file(inf_one, inf_data1, sizeof(inf_data1) - 1); HeapFree(GetProcessHeap(), 0, info); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size); /* test the INFINFO_DEFAULT_SEARCH search flag */ ret = SetupGetInfInformationA("test.inf", INFINFO_DEFAULT_SEARCH, info, size, &size); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed: %d\n", GetLastError()); ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n"); HeapFree(GetProcessHeap(), 0, info); info = alloc_inf_info("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, &size); /* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */ ret = SetupGetInfInformationA("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, info, size, &size); ok(ret == TRUE, "Expected SetupGetInfInformation to succeed\n"); ok(check_info_filename(info, revfile), "Expected returned filename to be equal\n"); HeapFree(GetProcessHeap(), 0, info); DeleteFileA(inf_filename); DeleteFileA(inf_one); DeleteFileA(inf_two); }
static void test_install_svc_from(void) { char inf[2048]; char path[MAX_PATH]; HINF infhandle; BOOL ret; SC_HANDLE scm_handle, svc_handle; /* Bail out if we are on win98 */ SetLastError(0xdeadbeef); scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL); if (!scm_handle && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) { win_skip("OpenSCManagerA is not implemented, we are most likely on win9x\n"); return; } CloseServiceHandle(scm_handle); /* Basic inf file to satisfy SetupOpenInfFileA */ strcpy(inf, "[Version]\nSignature=\"$Chicago$\"\n"); create_inf_file(inffile, inf); sprintf(path, "%s\\%s", CURR_DIR, inffile); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); /* Nothing but the Version section */ SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_SECTION_NOT_FOUND, "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* Add the section */ strcat(inf, "[Winetest.Services]\n"); create_inf_file(inffile, inf); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_SECTION_NOT_FOUND, "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* Add a reference */ strcat(inf, "AddService=Winetest,,Winetest.Service\n"); create_inf_file(inffile, inf); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* Add the section */ strcat(inf, "[Winetest.Service]\n"); create_inf_file(inffile, inf); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* Just the ServiceBinary */ strcat(inf, "ServiceBinary=%12%\\winetest.sys\n"); create_inf_file(inffile, inf); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* Add the ServiceType */ strcat(inf, "ServiceType=1\n"); create_inf_file(inffile, inf); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* Add the StartType */ strcat(inf, "StartType=4\n"); create_inf_file(inffile, inf); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT, "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* This should be it, the minimal entries to install a service */ strcat(inf, "ErrorControl=1"); create_inf_file(inffile, inf); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0); if (!ret && GetLastError() == ERROR_ACCESS_DENIED) { skip("Not enough rights to install the service\n"); SetupCloseInfFile(infhandle); DeleteFileA(inffile); return; } ok(ret, "Expected success\n"); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL); /* Open the service to see if it's really there */ svc_handle = OpenServiceA(scm_handle, "Winetest", DELETE); ok(svc_handle != NULL, "Service was not created\n"); SetLastError(0xdeadbeef); ret = DeleteService(svc_handle); ok(ret, "Service could not be deleted : %d\n", GetLastError()); CloseServiceHandle(svc_handle); CloseServiceHandle(scm_handle); strcpy(inf, "[Version]\nSignature=\"$Chicago$\"\n"); strcat(inf, "[XSP.InstallPerVer]\n"); strcat(inf, "AddReg=AspEventlogMsg.Reg,Perf.Reg,AspVersions.Reg,FreeADO.Reg,IndexServer.Reg\n"); create_inf_file(inffile, inf); sprintf(path, "%s\\%s", CURR_DIR, inffile); infhandle = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL); SetLastError(0xdeadbeef); ret = SetupInstallServicesFromInfSectionA(infhandle, "XSP.InstallPerVer", 0); ok(ret, "Expected success\n"); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError()); SetupCloseInfFile(infhandle); DeleteFileA(inffile); /* TODO: Test the Flags */ }