mirror of
https://github.com/reactos/reactos.git
synced 2024-11-03 13:25:57 +00:00
1e363204d6
- Add more tests for fpEnumPrinters. For some reason, using SEH here works only once. We experience a hang in the testing process when you run the test again for a second time without restarting spoolsv. Needs more investigation. - Ensure that the spooler service is running before starting any testing. - Do proper cleanup in every case. [LOCALSPL] - Implement LocalEnumPrinters level 1 based on the API-Tests. - Use DllAllocSplMem/DllFreeSplMem instead of HeapAlloc/HeapFree. - Use AllocSplStr with DllFreeSplStr now that DuplicateStringW is gone. - Use _countof where applicable. [SPOOLSS] - Found out that I was not the only one needing a wcsdup equivalent. My DuplicateStringW from localspl is actually exported as AllocSplStr in spoolss. This is actually part of a range of undocumented memory functions in spoolss, so implement and document AllocSplStr, DllAllocSplMem, DllFreeSplMem, DllFreeSplStr, ReallocSplMem and ReallocSplStr. Information about some of them was gathered through black box testing and DDK samples (down to Win95 DDK), which at least contained prototypes of them. - Implement SplInitializeWinSpoolDrv based on the API-Test and simply return FALSE for SplIsUpgrade. [SPOOLSS_APITEST] - Add a test for ReallocSplStr, which was actually the most undocumented function of spoolss' memory functions. [WINSPOOL] SplInitializeWinSpoolDrv shows that we can't just auto-assign an ordinal to all winspool.drv functions. We even need to export some nameless functions by ordinal only. Redo the whole .spec file based on the ordinals found in Windows Server 2003's winspool.drv. Trust WINE for the nameless stubs. svn path=/branches/colins-printing-for-freedom/; revision=68089
66 lines
1.9 KiB
C
66 lines
1.9 KiB
C
/*
|
|
* PROJECT: ReactOS Spooler Router API Tests
|
|
* LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation
|
|
* PURPOSE: Tests for ReallocSplStr
|
|
* COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
|
|
*/
|
|
|
|
#include <apitest.h>
|
|
|
|
#define WIN32_NO_STATUS
|
|
#include <windef.h>
|
|
#include <winbase.h>
|
|
#include <spoolss.h>
|
|
|
|
START_TEST(ReallocSplStr)
|
|
{
|
|
const WCHAR wszTestString1[] = L"Test";
|
|
const WCHAR wszTestString2[] = L"New";
|
|
|
|
DWORD dwResult;
|
|
PWSTR pwszBackup;
|
|
PWSTR pwszTest;
|
|
|
|
// Verify that ReallocSplStr raises an exception if all parameters are NULL.
|
|
_SEH2_TRY
|
|
{
|
|
dwResult = 0;
|
|
ReallocSplStr(NULL, NULL);
|
|
}
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
{
|
|
dwResult = _SEH2_GetExceptionCode();
|
|
}
|
|
_SEH2_END;
|
|
|
|
ok(dwResult == EXCEPTION_ACCESS_VIOLATION, "dwResult is %lx!\n", dwResult);
|
|
|
|
// Allocate a string for testing.
|
|
pwszTest = AllocSplStr(wszTestString1);
|
|
if (!pwszTest)
|
|
{
|
|
skip("AllocSplStr failed with error %lu!\n", GetLastError());
|
|
return;
|
|
}
|
|
|
|
// Verify that ReallocSplStr frees the old string even if pwszInput is NULL.
|
|
ok(ReallocSplStr(&pwszTest, NULL), "ReallocSplStr is FALSE!\n");
|
|
ok(pwszTest == NULL, "pwszTest is %p\n", pwszTest);
|
|
|
|
// Now verify that ReallocSplStr copies the new string into a new block and frees the old one.
|
|
pwszBackup = pwszTest;
|
|
ok(ReallocSplStr(&pwszTest, wszTestString2), "ReallocSplStr is FALSE!\n");
|
|
ok(wcscmp(pwszTest, wszTestString2) == 0, "New string was not copied into pwszTest!\n");
|
|
|
|
_SEH2_TRY
|
|
{
|
|
dwResult = (DWORD)wcscmp(pwszBackup, wszTestString1);
|
|
}
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
{
|
|
dwResult = _SEH2_GetExceptionCode();
|
|
}
|
|
_SEH2_END;
|
|
|
|
ok(dwResult == EXCEPTION_ACCESS_VIOLATION, "dwResult is %lx!\n", dwResult);
|
|
}
|