~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/spoolss/spoolss_main.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Implementation of the Spooler-Service helper DLL
  3  *
  4  * Copyright 2006 Detlef Riekenberg
  5  *
  6  * This library is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Lesser General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2.1 of the License, or (at your option) any later version.
 10  *
 11  * This library is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * Lesser General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU Lesser General Public
 17  * License along with this library; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include <stdarg.h>
 22 
 23 #include "windef.h"
 24 #include "winbase.h"
 25 #include "winerror.h"
 26 #include "winreg.h"
 27 
 28 #include "wingdi.h"
 29 #include "winspool.h"
 30 #include "ddk/winsplp.h"
 31 #include "spoolss.h"
 32 
 33 #include "wine/debug.h"
 34 
 35 WINE_DEFAULT_DEBUG_CHANNEL(spoolss);
 36 
 37 /* ################################ */
 38 
 39 static HMODULE hwinspool;
 40 
 41 static const WCHAR winspooldrvW[] = {'w','i','n','s','p','o','o','l','.','d','r','v',0};
 42 
 43 /******************************************************************************
 44  *
 45  */
 46 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 47 {
 48     TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
 49 
 50     switch (fdwReason) {
 51         case DLL_WINE_PREATTACH:
 52             return FALSE;  /* prefer native version */
 53         case DLL_PROCESS_ATTACH: {
 54             DisableThreadLibraryCalls(hinstDLL);
 55             break;
 56 
 57         case DLL_PROCESS_DETACH:
 58             backend_unload_all();
 59             break;
 60         }
 61     }
 62     return TRUE;
 63 }
 64 
 65 /******************************************************************
 66  *   AllocSplStr   [SPOOLSS.@]
 67  *
 68  * Create a copy from the String on the Spooler-Heap
 69  *
 70  * PARAMS
 71  *  pwstr [I] PTR to the String to copy
 72  *
 73  * RETURNS
 74  *  Failure: NULL
 75  *  Success: PTR to the copied String
 76  *
 77  */
 78 LPWSTR WINAPI AllocSplStr(LPCWSTR pwstr)
 79 {
 80     LPWSTR  res = NULL;
 81     DWORD   len;
 82 
 83     TRACE("(%s)\n", debugstr_w(pwstr));
 84     if (!pwstr) return NULL;
 85 
 86     len = (lstrlenW(pwstr) + 1) * sizeof(WCHAR);
 87     res = HeapAlloc(GetProcessHeap(), 0, len);
 88     if (res) lstrcpyW(res, pwstr);
 89         
 90     TRACE("returning %p\n", res);
 91     return res;
 92 }
 93 
 94 /******************************************************************
 95  *   BuildOtherNamesFromMachineName   [SPOOLSS.@]
 96  */
 97 BOOL WINAPI BuildOtherNamesFromMachineName(LPVOID * ptr1, LPVOID * ptr2)
 98 {
 99     FIXME("(%p, %p) stub\n", ptr1, ptr2);
100 
101     *ptr1 = NULL;
102     *ptr2 = NULL;
103     return FALSE;
104 }
105 
106 /******************************************************************
107  *   DllAllocSplMem   [SPOOLSS.@]
108  *
109  * Allocate cleared memory from the spooler heap
110  *
111  * PARAMS
112  *  size [I] Number of bytes to allocate
113  *
114  * RETURNS
115  *  Failure: NULL
116  *  Success: PTR to the allocated memory
117  *
118  * NOTES
119  *  We use the process heap (Windows use a separate spooler heap)
120  *
121  */
122 LPVOID WINAPI DllAllocSplMem(DWORD size)
123 {
124     LPVOID  res;
125 
126     res = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
127     TRACE("(%d) => %p\n", size, res);
128     return res;
129 }
130 
131 /******************************************************************
132  *   DllFreeSplMem   [SPOOLSS.@]
133  *
134  * Free the allocated spooler memory
135  *
136  * PARAMS
137  *  memory [I] PTR to the memory allocated by DllAllocSplMem
138  *
139  * RETURNS
140  *  Failure: FALSE
141  *  Success: TRUE
142  *
143  * NOTES
144  *  We use the process heap (Windows use a separate spooler heap)
145  *
146  */
147 
148 BOOL WINAPI DllFreeSplMem(LPBYTE memory)
149 {
150     TRACE("(%p)\n", memory);
151     return HeapFree(GetProcessHeap(), 0, memory);
152 }
153 
154 /******************************************************************
155  *   DllFreeSplStr   [SPOOLSS.@]
156  *
157  * Free the allocated Spooler-String
158  *
159  * PARAMS
160  *  pwstr [I] PTR to the WSTR, allocated by AllocSplStr
161  *
162  * RETURNS
163  *  Failure: FALSE
164  *  Success: TRUE
165  *
166  */
167 
168 BOOL WINAPI DllFreeSplStr(LPWSTR pwstr)
169 {
170     TRACE("(%s) PTR: %p\n", debugstr_w(pwstr), pwstr);
171     return HeapFree(GetProcessHeap(), 0, pwstr);
172 }
173 
174 
175 /******************************************************************
176  *   ImpersonatePrinterClient   [SPOOLSS.@]
177  */
178 BOOL WINAPI ImpersonatePrinterClient(HANDLE hToken)
179 {
180     FIXME("(%p) stub\n", hToken);
181     return TRUE;
182 }
183 
184 /******************************************************************
185  *   InitializeRouter   [SPOOLSS.@]
186  */
187 BOOL WINAPI InitializeRouter(void)
188 {
189     TRACE("()\n");
190     return backend_load_all();
191 }
192 
193 /******************************************************************
194  *   IsLocalCall    [SPOOLSS.@]
195  */
196 BOOL WINAPI IsLocalCall(void)
197 {
198     FIXME("() stub\n");
199     return TRUE;
200 }
201 
202 /******************************************************************
203  *   RevertToPrinterSelf   [SPOOLSS.@]
204  */
205 HANDLE WINAPI RevertToPrinterSelf(void)
206 {
207     FIXME("() stub\n");
208     return (HANDLE) 0xdead0947;
209 }
210 
211 /******************************************************************
212  *   SplInitializeWinSpoolDrv   [SPOOLSS.@]
213  *
214  * Dynamic load "winspool.drv" and fill an array with some function-pointer
215  *
216  * PARAMS
217  *  table  [I] array of function-pointer to fill
218  *
219  * RETURNS
220  *  Success: TRUE
221  *  Failure: FALSE
222  *
223  * NOTES
224  *  Native "spoolss.dll" from w2k fill the table with 11 Function-Pointer.
225  *  We implement the XP-Version (The table has only 9 Pointer)
226  *
227  */
228 BOOL WINAPI SplInitializeWinSpoolDrv(LPVOID * table)
229 {
230     DWORD res;
231 
232     TRACE("(%p)\n", table);
233 
234     hwinspool = LoadLibraryW(winspooldrvW);
235     if (!hwinspool) return FALSE;
236 
237     table[0] = (void *) GetProcAddress(hwinspool, "OpenPrinterW");
238     table[1] = (void *) GetProcAddress(hwinspool, "ClosePrinter");
239     table[2] = (void *) GetProcAddress(hwinspool, "SpoolerDevQueryPrintW");
240     table[3] = (void *) GetProcAddress(hwinspool, "SpoolerPrinterEvent");
241     table[4] = (void *) GetProcAddress(hwinspool, "DocumentPropertiesW");
242     table[5] = (void *) GetProcAddress(hwinspool, (LPSTR) 212);  /* LoadPrinterDriver */
243     table[6] = (void *) GetProcAddress(hwinspool, (LPSTR) 213);  /* RefCntLoadDriver */
244     table[7] = (void *) GetProcAddress(hwinspool, (LPSTR) 214);  /* RefCntUnloadDriver */
245     table[8] = (void *) GetProcAddress(hwinspool, (LPSTR) 215);  /* ForceUnloadDriver */
246 
247     for (res = 0; res < 9; res++) {
248         if (table[res] == NULL) return FALSE;
249     }
250 
251     return TRUE;
252 
253 }
254 
255 /******************************************************************
256  *   SplIsUpgrade   [SPOOLSS.@]
257  */
258 BOOL WINAPI SplIsUpgrade(void)
259 {
260     FIXME("() stub\n");
261     return FALSE;
262 }
263 
264 /******************************************************************
265  *   SpoolerHasInitialized  [SPOOLSS.@]
266  */
267 BOOL WINAPI SpoolerHasInitialized(void)
268 {
269     FIXME("() stub\n");
270     return TRUE;
271 }
272 
273 /******************************************************************
274  *   SpoolerInit   [SPOOLSS.@]
275  */
276 BOOL WINAPI SpoolerInit(void)
277 {
278     FIXME("() stub\n");
279     return TRUE;
280 }
281 
282 /******************************************************************
283  *   WaitForSpoolerInitialization   [SPOOLSS.@]
284  */
285 BOOL WINAPI WaitForSpoolerInitialization(void)
286 {
287     FIXME("() stub\n");
288     return TRUE;
289 }
290 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.