ReactOS  0.4.14-dev-293-g2b39b42
main.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Standard Print Processor API Tests
3  * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE: Main functions
5  * COPYRIGHT: Copyright 2016 Colin Finck (colin@reactos.org)
6  */
7 
8 #include <apitest.h>
9 
10 #define WIN32_NO_STATUS
11 #include <windef.h>
12 #include <winbase.h>
13 #include <wingdi.h>
14 #include <winspool.h>
15 
16 PVOID
18 {
19  DWORD cbNeeded;
20  HMODULE hWinprint;
21  PVOID pFunc;
22  WCHAR wszWinprintPath[MAX_PATH];
23 
24  // Build the path to the default Print Processor winprint.dll in the Print Processor directory.
25  if (!GetPrintProcessorDirectoryW(NULL, NULL, 1, (LPBYTE)wszWinprintPath, sizeof(wszWinprintPath), &cbNeeded))
26  {
27  skip("Could not determine the path to the Print Processor directory, last error is %lu!\n", GetLastError());
28  return NULL;
29  }
30 
31  wcscat(wszWinprintPath, L"\\winprint.dll");
32 
33  // Try loading it.
34  hWinprint = LoadLibraryW(wszWinprintPath);
35  if (!hWinprint)
36  {
38  {
39  skip("LoadLibraryW failed for %S with error %lu!\n", wszWinprintPath, GetLastError());
40  return NULL;
41  }
42 
43  // winprint.dll does not exist prior to NT6.
44  // The default Print Processor is implemented in localspl.dll instead.
45  hWinprint = LoadLibraryW(L"localspl.dll");
46  if (!hWinprint)
47  {
48  skip("LoadLibraryW failed for localspl.dll with error %lu!\n", GetLastError());
49  return NULL;
50  }
51  }
52 
53  // Get the function we are looking for.
54  pFunc = GetProcAddress(hWinprint, FunctionName);
55  if (!pFunc)
56  {
57  skip("GetProcAddress failed for %s with error %lu!\n", FunctionName, GetLastError());
58  return NULL;
59  }
60 
61  return pFunc;
62 }
PVOID GetWinprintFunc(const char *FunctionName)
Definition: main.c:17
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned char * LPBYTE
Definition: typedefs.h:52
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
WINBOOL WINAPI GetPrintProcessorDirectoryW(LPWSTR pName, LPWSTR pEnvironment, DWORD Level, LPBYTE pPrintProcessorInfo, DWORD cbBuf, LPDWORD pcbNeeded)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char * FunctionName
Definition: acpixf.h:1264
#define skip(...)
Definition: atltest.h:64
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:94
#define GetProcAddress(x, y)
Definition: compat.h:410