~ [ 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 "wine/debug.h"
 27 
 28 WINE_DEFAULT_DEBUG_CHANNEL(spoolss);
 29 
 30 /* ################################ */
 31 
 32 static HMODULE hwinspool;
 33 static const WCHAR winspooldrvW[] = {'w','i','n','s','p','o','o','l','.','d','r','v',0};
 34 
 35 /******************************************************************
 36  *
 37  */
 38 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 39 {
 40     TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
 41 
 42     switch (fdwReason) {
 43         case DLL_WINE_PREATTACH:
 44             return FALSE;  /* prefer native version */
 45         case DLL_PROCESS_ATTACH: {
 46             DisableThreadLibraryCalls(hinstDLL);
 47             break;
 48         }
 49     }
 50     return TRUE;
 51 }
 52 
 53 /******************************************************************
 54  *   AllocSplStr   [SPOOLSS.@]
 55  *
 56  * Create a copy from the String on the Spooler-Heap
 57  *
 58  * PARAMS
 59  *  pwstr [I] PTR to the String to copy
 60  *
 61  * RETURNS
 62  *  Failure: NULL
 63  *  Success: PTR to the copied String
 64  *
 65  */
 66 LPWSTR WINAPI AllocSplStr(LPCWSTR pwstr)
 67 {
 68     LPWSTR  res = NULL;
 69     DWORD   len;
 70 
 71     TRACE("(%s)\n", debugstr_w(pwstr));
 72     if (!pwstr) return NULL;
 73 
 74     len = (lstrlenW(pwstr) + 1) * sizeof(WCHAR);
 75     res = HeapAlloc(GetProcessHeap(), 0, len);
 76     if (res) lstrcpyW(res, pwstr);
 77         
 78     TRACE("returning %p\n", res);
 79     return res;
 80 }
 81 
 82 /******************************************************************
 83  *   BuildOtherNamesFromMachineName   [SPOOLSS.@]
 84  */
 85 BOOL WINAPI BuildOtherNamesFromMachineName(LPVOID * ptr1, LPVOID * ptr2)
 86 {
 87     FIXME("(%p, %p) stub\n", ptr1, ptr2);
 88 
 89     *ptr1 = NULL;
 90     *ptr2 = NULL;
 91     return FALSE;
 92 }
 93 
 94 /******************************************************************
 95  *   DllAllocSplMem   [SPOOLSS.@]
 96  *
 97  * Allocate cleared memory from the spooler heap
 98  *
 99  * PARAMS
100  *  size [I] Number of bytes to allocate
101  *
102  * RETURNS
103  *  Failure: NULL
104  *  Success: PTR to the allocated memory
105  *
106  * NOTES
107  *  We use the process heap (Windows use a separate spooler heap)
108  *
109  */
110 LPVOID WINAPI DllAllocSplMem(DWORD size)
111 {
112     LPVOID  res;
113 
114     res = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
115     TRACE("(%d) => %p\n", size, res);
116     return res;
117 }
118 
119 /******************************************************************
120  *   DllFreeSplMem   [SPOOLSS.@]
121  *
122  * Free the allocated spooler memory
123  *
124  * PARAMS
125  *  memory [I] PTR to the memory allocated by DllAllocSplMem
126  *
127  * RETURNS
128  *  Failure: FALSE
129  *  Success: TRUE
130  *
131  * NOTES
132  *  We use the process heap (Windows use a separate spooler heap)
133  *
134  */
135 
136 BOOL WINAPI DllFreeSplMem(LPBYTE memory)
137 {
138     TRACE("(%p)\n", memory);
139     return HeapFree(GetProcessHeap(), 0, memory);
140 }
141 
142 /******************************************************************
143  *   DllFreeSplStr   [SPOOLSS.@]
144  *
145  * Free the allocated Spooler-String
146  *
147  * PARAMS
148  *  pwstr [I] PTR to the WSTR, allocated by AllocSplStr
149  *
150  * RETURNS
151  *  Failure: FALSE
152  *  Success: TRUE
153  *
154  */
155 
156 BOOL WINAPI DllFreeSplStr(LPWSTR pwstr)
157 {
158     TRACE("(%s) PTR: %p\n", debugstr_w(pwstr), pwstr);
159     return HeapFree(GetProcessHeap(), 0, pwstr);
160 }
161 
162 
163 /******************************************************************
164  *   ImpersonatePrinterClient   [SPOOLSS.@]
165  */
166 BOOL WINAPI ImpersonatePrinterClient(HANDLE hToken)
167 {
168     FIXME("(%p) stub\n", hToken);
169     return TRUE;
170 }
171 
172 /******************************************************************
173  *   RevertToPrinterSelf   [SPOOLSS.@]
174  */
175 HANDLE WINAPI RevertToPrinterSelf(void)
176 {
177     FIXME("() stub\n");
178     return (HANDLE) 0xdead0947;
179 }
180 
181 /******************************************************************
182  *   SplInitializeWinSpoolDrv   [SPOOLSS.@]
183  *
184  * Dynamic load "winspool.drv" and fill an array with some function-pointer
185  *
186  * PARAMS
187  *  table  [I] array of function-pointer to fill
188  *
189  * RETURNS
190  *  Success: TRUE
191  *  Failure: FALSE
192  *
193  * NOTES
194  *  Native "spoolss.dll" from w2k fill the table with 11 Function-Pointer.
195  *  We implement the XP-Version (The table has only 9 Pointer)
196  *
197  */
198 BOOL WINAPI SplInitializeWinSpoolDrv(LPVOID * table)
199 {
200     DWORD res;
201 
202     TRACE("(%p)\n", table);
203 
204     hwinspool = LoadLibraryW(winspooldrvW);
205     if (!hwinspool) return FALSE;
206 
207     table[0] = (void *) GetProcAddress(hwinspool, "OpenPrinterW");
208     table[1] = (void *) GetProcAddress(hwinspool, "ClosePrinter");
209     table[2] = (void *) GetProcAddress(hwinspool, "SpoolerDevQueryPrintW");
210     table[3] = (void *) GetProcAddress(hwinspool, "SpoolerPrinterEvent");
211     table[4] = (void *) GetProcAddress(hwinspool, "DocumentPropertiesW");
212     table[5] = (void *) GetProcAddress(hwinspool, (LPSTR) 212);  /* LoadPrinterDriver */
213     table[6] = (void *) GetProcAddress(hwinspool, (LPSTR) 213);  /* RefCntLoadDriver */
214     table[7] = (void *) GetProcAddress(hwinspool, (LPSTR) 214);  /* RefCntUnloadDriver */
215     table[8] = (void *) GetProcAddress(hwinspool, (LPSTR) 215);  /* ForceUnloadDriver */
216 
217     for (res = 0; res < 9; res++) {
218         if (table[res] == NULL) return FALSE;
219     }
220 
221     return TRUE;
222 
223 }
224 
225 /******************************************************************
226  *   SplIsUpgrade   [SPOOLSS.@]
227  */
228 BOOL WINAPI SplIsUpgrade(void)
229 {
230     FIXME("() stub\n");
231     return FALSE;
232 }
233 
234 /******************************************************************
235  *   SpoolerHasInitialized  [SPOOLSS.@]
236  */
237 BOOL WINAPI SpoolerHasInitialized(void)
238 {
239     FIXME("() stub\n");
240     return TRUE;
241 }
242 
243 /******************************************************************
244  *   SpoolerInit   [SPOOLSS.@]
245  */
246 BOOL WINAPI SpoolerInit(void)
247 {
248     FIXME("() stub\n");
249     return TRUE;
250 }
251 

~ [ 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.