Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/setupapi/tests/install.c | 11 ++++++----- dlls/setupapi/tests/misc.c | 9 +++++---- dlls/setupapi/tests/query.c | 20 +++++++++++--------- 3 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c index fd10fd913323..289328eed5a7 100644 --- a/dlls/setupapi/tests/install.c +++ b/dlls/setupapi/tests/install.c @@ -33,6 +33,7 @@ #include "shlobj.h" #include "fci.h"
+#include "wine/heap.h" #include "wine/test.h"
static const char inffile[] = "test.inf"; @@ -86,12 +87,12 @@ static BOOL file_exists(const char *path)
static void * CDECL mem_alloc(ULONG cb) { - return HeapAlloc(GetProcessHeap(), 0, cb); + return heap_alloc(cb); }
static void CDECL mem_free(void *memory) { - HeapFree(GetProcessHeap(), 0, memory); + heap_free(memory); }
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv) @@ -189,17 +190,17 @@ static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv) { LPSTR tempname;
- tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); + tempname = heap_alloc(MAX_PATH); GetTempFileNameA(".", "xx", 0, tempname);
if (tempname && (strlen(tempname) < (unsigned)cbTempName)) { lstrcpyA(pszTempName, tempname); - HeapFree(GetProcessHeap(), 0, tempname); + heap_free(tempname); return TRUE; }
- HeapFree(GetProcessHeap(), 0, tempname); + heap_free(tempname);
return FALSE; } diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c index 3bb308ef4a74..9477d4a63126 100644 --- a/dlls/setupapi/tests/misc.c +++ b/dlls/setupapi/tests/misc.c @@ -31,6 +31,7 @@ #include "setupapi.h" #include "cfgmgr32.h"
+#include "wine/heap.h" #include "wine/test.h"
static CHAR CURR_DIR[MAX_PATH]; @@ -105,7 +106,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest) res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size); ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError());
- pspii = HeapAlloc(GetProcessHeap(), 0, size); + pspii = heap_alloc(size);
res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL); ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError()); @@ -121,7 +122,7 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest) ok(!spofi.OriginalCatalogName[0], "spofi.OriginalCatalogName should have been "" instead of "%s"\n", spofi.OriginalCatalogName); ok(!strcmp(original, spofi.OriginalInfName), "spofi.OriginalInfName of %s didn't match real original name %s\n", spofi.OriginalInfName, original);
- HeapFree(GetProcessHeap(), 0, pspii); + heap_free(pspii);
SetupCloseInfFile(hinf); } @@ -367,12 +368,12 @@ static BOOL compare_file_data(LPSTR file, const BYTE *data, DWORD size) LPBYTE buffer;
handle = CreateFileA(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - buffer = HeapAlloc(GetProcessHeap(), 0, size); + buffer = heap_free(size); if (buffer) { ReadFile(handle, buffer, size, &read, NULL); if (read == size && !memcmp(data, buffer, size)) ret = TRUE; - HeapFree(GetProcessHeap(), 0, buffer); + heap_free(buffer); } CloseHandle(handle); return ret; diff --git a/dlls/setupapi/tests/query.c b/dlls/setupapi/tests/query.c index 6b6d1bd5c296..00b03b653809 100644 --- a/dlls/setupapi/tests/query.c +++ b/dlls/setupapi/tests/query.c @@ -21,6 +21,8 @@ #include <stdio.h> #include <windows.h> #include <setupapi.h> + +#include "wine/heap.h" #include "wine/test.h"
static CHAR CURR_DIR[MAX_PATH]; @@ -120,7 +122,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test) if (!SetupQueryInfFileInformationA(info, 0, NULL, 0, &size)) return FALSE;
- filename = HeapAlloc(GetProcessHeap(), 0, size); + filename = heap_alloc(size); if (!filename) return FALSE;
@@ -129,7 +131,7 @@ static BOOL check_info_filename(PSP_INF_INFORMATION info, LPSTR test) if (!lstrcmpiA(test, filename)) ret = TRUE;
- HeapFree(GetProcessHeap(), 0, filename); + heap_free(filename); return ret; }
@@ -142,7 +144,7 @@ static PSP_INF_INFORMATION alloc_inf_info(LPCSTR filename, DWORD search, PDWORD if (!ret) return NULL;
- info = HeapAlloc(GetProcessHeap(), 0, *size); + info = heap_alloc(*size); return info; }
@@ -234,7 +236,7 @@ static void test_SetupGetInfInformation(void) 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); + info = heap_alloc(size);
/* try valid ReturnBuffer but too small size */ SetLastError(0xbeefcafe); @@ -248,7 +250,7 @@ static void test_SetupGetInfInformation(void) 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); + heap_free(info);
/* try the INFINFO_INF_SPEC_IS_HINF search flag */ hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL); @@ -269,7 +271,7 @@ static void test_SetupGetInfInformation(void) } ok(ret, "can't create inf file %u\n", GetLastError());
- HeapFree(GetProcessHeap(), 0, info); + heap_free(info); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size);
/* check if system32 is searched for inf */ @@ -284,7 +286,7 @@ static void test_SetupGetInfInformation(void) lstrcatA(inf_one, "test.inf"); create_inf_file(inf_one, inf_data1, sizeof(inf_data1) - 1);
- HeapFree(GetProcessHeap(), 0, info); + heap_free(info); info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size);
/* test the INFINFO_DEFAULT_SEARCH search flag */ @@ -292,7 +294,7 @@ static void test_SetupGetInfInformation(void) 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); + heap_free(info); info = alloc_inf_info("test.inf", INFINFO_REVERSE_DEFAULT_SEARCH, &size);
/* test the INFINFO_REVERSE_DEFAULT_SEARCH search flag */ @@ -301,7 +303,7 @@ static void test_SetupGetInfInformation(void) ok(check_info_filename(info, revfile), "Expected returned filename to be equal\n");
done: - HeapFree(GetProcessHeap(), 0, info); + heap_free(info); DeleteFileA(inf_filename); DeleteFileA(inf_one); DeleteFileA(inf_two);