[LOCALSPL_APITEST]
[reactos.git] / rostests / apitests / localspl / dll / main.c
index 0a0e1b1..fb2885b 100644 (file)
@@ -2,7 +2,7 @@
  * PROJECT:     ReactOS Local Spooler API Tests Injected DLL
  * LICENSE:     GNU GPLv2 or any later version as published by the Free Software Foundation
  * PURPOSE:     Main functions
- * COPYRIGHT:   Copyright 2015 Colin Finck <colin@reactos.org>
+ * COPYRIGHT:   Copyright 2015-2016 Colin Finck <colin@reactos.org>
  */
 
 #define __ROS_LONG64__
 
 // Test list
 extern void func_fpEnumPrinters(void);
+extern void func_fpGetPrintProcessorDirectory(void);
 
 const struct test winetest_testlist[] =
 {
     { "fpEnumPrinters", func_fpEnumPrinters },
-
+    { "fpGetPrintProcessorDirectory", func_fpGetPrintProcessorDirectory },
     { 0, 0 }
 };
 
+BOOL
+GetLocalsplFuncs(LPPRINTPROVIDOR pp)
+{
+    HMODULE hLocalspl;
+    PInitializePrintProvidor pfnInitializePrintProvidor;
+
+    // Get us a handle to the loaded localspl.dll.
+    hLocalspl = GetModuleHandleW(L"localspl");
+    if (!hLocalspl)
+    {
+        skip("GetModuleHandleW failed with error %u!\n", GetLastError());
+        return FALSE;
+    }
+
+    // Get a pointer to its InitializePrintProvidor function.
+    pfnInitializePrintProvidor = (PInitializePrintProvidor)GetProcAddress(hLocalspl, "InitializePrintProvidor");
+    if (!pfnInitializePrintProvidor)
+    {
+        skip("GetProcAddress failed with error %u!\n", GetLastError());
+        return FALSE;
+    }
+
+    // Get localspl's function pointers.
+    if (!pfnInitializePrintProvidor(pp, sizeof(PRINTPROVIDOR), NULL))
+    {
+        skip("pfnInitializePrintProvidor failed with error %u!\n", GetLastError());
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
 // Running the tests from the injected DLL and redirecting their output to the pipe.
 BOOL WINAPI
 DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)