Add a semi-working stub of GetDefaultPrinter[A/W] ported from WINE.

This isnt right but its needed to get comdlg32.dll working.

svn path=/trunk/; revision=7592
This commit is contained in:
Steven Edwards 2004-01-12 23:42:23 +00:00
parent 27e99ffec4
commit 4e26cd81eb
5 changed files with 227 additions and 112 deletions

View file

@ -1,4 +1,6 @@
# $Id: Makefile,v 1.2 2003/08/07 04:03:24 royce Exp $
#
# Fix this
#
PATH_TO_TOP = ../..
@ -15,6 +17,8 @@ TARGET_CFLAGS = \
-Wall \
-Werror \
-fno-builtin \
-D__REACTOS__ \
-D__USE_W32API \
-DUNICODE \
-DLE \
-DDBG
@ -24,9 +28,9 @@ TARGET_CFLAGS += -D_DISABLE_TIDENTS
TARGET_LFLAGS = -nostartfiles -nostdlib
TARGET_SDKLIBS = kernel32.a
TARGET_SDKLIBS = libwine.a libwine_unicode.a ntdll.a kernel32.a
TARGET_OBJECTS = stubs.o
TARGET_OBJECTS = info.o stubs.o
TARGET_CLEAN = $(DEP_FILES)

106
reactos/lib/winspool/info.c Normal file
View file

@ -0,0 +1,106 @@
/*
* WINSPOOL functions
*
* Copyright 1996 John Harvey
* Copyright 1998 Andreas Mohr
* Copyright 1999 Klaas van Gend
* Copyright 1999, 2000 Huw D M Davies
* Copyright 2001 Marcus Meissner
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stddef.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "winspool.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "winnls.h"
WINE_DEFAULT_DEBUG_CHANNEL(winspool);
/******************************************************************************
* GetDefaultPrinterA (WINSPOOL.@)
*/
BOOL WINAPI GetDefaultPrinterA(LPSTR name, LPDWORD namesize)
{
char *ptr;
if (*namesize < 1)
{
SetLastError (ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
if (!GetProfileStringA ("windows", "device", "", name, *namesize))
{
SetLastError (ERROR_FILE_NOT_FOUND);
return FALSE;
}
if ((ptr = strchr (name, ',')) == NULL)
{
SetLastError (ERROR_FILE_NOT_FOUND);
return FALSE;
}
*ptr = '\0';
*namesize = strlen (name) + 1;
return TRUE;
}
/******************************************************************************
* GetDefaultPrinterW (WINSPOOL.@)
*/
BOOL WINAPI GetDefaultPrinterW(LPWSTR name, LPDWORD namesize)
{
char *buf;
BOOL ret;
if (*namesize < 1)
{
SetLastError (ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
buf = HeapAlloc (GetProcessHeap (), 0, *namesize);
ret = GetDefaultPrinterA (buf, namesize);
if (ret)
{
DWORD len = MultiByteToWideChar (CP_ACP, 0, buf, -1, name, *namesize);
if (!len)
{
SetLastError (ERROR_INSUFFICIENT_BUFFER);
ret = FALSE;
}
else *namesize = len;
}
HeapFree (GetProcessHeap (), 0, buf);
return ret;
}

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.2 2003/07/10 21:48:16 chorns Exp $
/* $Id: stubs.c,v 1.3 2004/01/12 23:42:23 sedwards Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS winspool DRV
@ -8,6 +8,7 @@
* REVISIONS:
*/
#undef __USE_W32API
#include <windows.h>
/*

View file

@ -1,4 +1,4 @@
; $Id: winspool.def,v 1.1 2003/04/30 20:44:06 gvg Exp $
; $Id: winspool.def,v 1.2 2004/01/12 23:42:23 sedwards Exp $
;
; winspool.drv - Printer spooler
@ -76,6 +76,8 @@ FindClosePrinterChangeNotification@4
FindFirstPrinterChangeNotification@16
FindNextPrinterChangeNotification@16
FreePrinterNotifyInfo@4
GetDefaultPrinterA@8
GetDefaultPrinterW@8
GetFormA@24
GetFormW@24
GetJobA@24

View file

@ -1,114 +1,116 @@
; $Id: winspool.edf,v 1.1 2003/04/30 20:44:06 gvg Exp $
; $Id: winspool.edf,v 1.2 2004/01/12 23:42:23 sedwards Exp $
;
; winspool.drv - Printer spooler
LIBRARY winspool.drv
EXPORTS
AbortPrinter=AbortPrinter@4
AddFormA=AddFormA@12
AddFormW=AddFormW@12
AddJobA=AddJobA@20
AddJobW=AddJobW@20
AddMonitorA=AddMonitorA@12
AddMonitorW=AddMonitorW@12
AddPortA=AddPortA@12
AddPortW=AddPortW@12
AddPrinterA=AddPrinterA@12
AddPrinterConnectionA=AddPrinterConnectionA@4
AddPrinterConnectionW=AddPrinterConnectionW@4
AddPrinterDriverA=AddPrinterDriverA@12
AddPrinterDriverW=AddPrinterDriverW@12
AddPrinterW=AddPrinterW@12
AddPrintProcessorA=AddPrintProcessorA@16
AddPrintProcessorW=AddPrintProcessorW@16
AddPrintProvidorA=AddPrintProvidorA@12
AddPrintProvidorW=AddPrintProvidorW@12
AdvancedDocumentPropertiesA=AdvancedDocumentPropertiesA@20
AdvancedDocumentPropertiesW=AdvancedDocumentPropertiesW@20
ClosePrinter=ClosePrinter@4
ConfigurePortA=ConfigurePortA@12
ConfigurePortW=ConfigurePortW@12
ConnectToPrinterDlg=ConnectToPrinterDlg@8
DeleteFormA=DeleteFormA@8
DeleteFormW=DeleteFormW@8
DeleteMonitorA=DeleteMonitorA@12
DeleteMonitorW=DeleteMonitorW@12
DeletePortA=DeletePortA@12
DeletePortW=DeletePortW@12
DeletePrinter=DeletePrinter@4
DeletePrinterConnectionA=DeletePrinterConnectionA@4
DeletePrinterConnectionW=DeletePrinterConnectionW@4
DeletePrinterDataA=DeletePrinterDataA@8
DeletePrinterDataW=DeletePrinterDataW@8
DeletePrinterDriverA=DeletePrinterDriverA@12
DeletePrinterDriverW=DeletePrinterDriverW@12
DeletePrintProcessorA=DeletePrintProcessorA@12
DeletePrintProcessorW=DeletePrintProcessorW@12
DeletePrintProvidorA=DeletePrintProvidorA@12
AbortPrinter=AbortPrinter@4
AddFormA=AddFormA@12
AddFormW=AddFormW@12
AddJobA=AddJobA@20
AddJobW=AddJobW@20
AddMonitorA=AddMonitorA@12
AddMonitorW=AddMonitorW@12
AddPortA=AddPortA@12
AddPortW=AddPortW@12
AddPrinterA=AddPrinterA@12
AddPrinterConnectionA=AddPrinterConnectionA@4
AddPrinterConnectionW=AddPrinterConnectionW@4
AddPrinterDriverA=AddPrinterDriverA@12
AddPrinterDriverW=AddPrinterDriverW@12
AddPrinterW=AddPrinterW@12
AddPrintProcessorA=AddPrintProcessorA@16
AddPrintProcessorW=AddPrintProcessorW@16
AddPrintProvidorA=AddPrintProvidorA@12
AddPrintProvidorW=AddPrintProvidorW@12
AdvancedDocumentPropertiesA=AdvancedDocumentPropertiesA@20
AdvancedDocumentPropertiesW=AdvancedDocumentPropertiesW@20
ClosePrinter=ClosePrinter@4
ConfigurePortA=ConfigurePortA@12
ConfigurePortW=ConfigurePortW@12
ConnectToPrinterDlg=ConnectToPrinterDlg@8
DeleteFormA=DeleteFormA@8
DeleteFormW=DeleteFormW@8
DeleteMonitorA=DeleteMonitorA@12
DeleteMonitorW=DeleteMonitorW@12
DeletePortA=DeletePortA@12
DeletePortW=DeletePortW@12
DeletePrinter=DeletePrinter@4
DeletePrinterConnectionA=DeletePrinterConnectionA@4
DeletePrinterConnectionW=DeletePrinterConnectionW@4
DeletePrinterDataA=DeletePrinterDataA@8
DeletePrinterDataW=DeletePrinterDataW@8
DeletePrinterDriverA=DeletePrinterDriverA@12
DeletePrinterDriverW=DeletePrinterDriverW@12
DeletePrintProcessorA=DeletePrintProcessorA@12
DeletePrintProcessorW=DeletePrintProcessorW@12
DeletePrintProvidorA=DeletePrintProvidorA@12
DeletePrintProvidorW=DeletePrintProvidorW@12
DeviceCapabilitiesA=DeviceCapabilitiesA@20
DeviceCapabilitiesW=DeviceCapabilitiesW@20
DllMain=DllMain@12
DocumentPropertiesA=DocumentPropertiesA@24
DocumentPropertiesW=DocumentPropertiesW@24
EndDocPrinter=EndDocPrinter@4
EndPagePrinter=EndPagePrinter@4
EnumFormsA=EnumFormsA@24
EnumFormsW=EnumFormsW@24
EnumJobsA=EnumJobsA@32
EnumJobsW=EnumJobsW@32
EnumMonitorsA=EnumMonitorsA@24
EnumMonitorsW=EnumMonitorsW@24
EnumPortsA=EnumPortsA@24
EnumPortsW=EnumPortsW@24
EnumPrinterDataA=EnumPrinterDataA@36
EnumPrinterDataW=EnumPrinterDataW@36
EnumPrinterDriversA=EnumPrinterDriversA@28
EnumPrinterDriversW=EnumPrinterDriversW@28
EnumPrintersA=EnumPrintersA@28
EnumPrintersW=EnumPrintersW@28
EnumPrintProcessorDatatypesA=EnumPrintProcessorDatatypesA@28
EnumPrintProcessorDatatypesW=EnumPrintProcessorDatatypesW@28
EnumPrintProcessorsA=EnumPrintProcessorsA@28
EnumPrintProcessorsW=EnumPrintProcessorsW@28
FindClosePrinterChangeNotification=FindClosePrinterChangeNotification@4
FindFirstPrinterChangeNotification=FindFirstPrinterChangeNotification@16
FindNextPrinterChangeNotification=FindNextPrinterChangeNotification@16
FreePrinterNotifyInfo=FreePrinterNotifyInfo@4
GetFormA=GetFormA@24
GetFormW=GetFormW@24
GetJobA=GetJobA@24
GetJobW=GetJobW@24
GetPrinterA=GetPrinterA@20
GetPrinterDataA=GetPrinterDataA@24
GetPrinterDataW=GetPrinterDataW@24
GetPrinterDriverA=GetPrinterDriverA@24
GetPrinterDriverDirectoryA=GetPrinterDriverDirectoryA@24
GetPrinterDriverDirectoryW=GetPrinterDriverDirectoryW@24
GetPrinterDriverW=GetPrinterDriverW@24
GetPrinterW=GetPrinterW@20
GetPrintProcessorDirectoryA=GetPrintProcessorDirectoryA@24
GetPrintProcessorDirectoryW=GetPrintProcessorDirectoryW@24
OpenPrinterA=OpenPrinterA@12
OpenPrinterW=OpenPrinterW@12
PrinterMessageBoxA=PrinterMessageBoxA@24
PrinterMessageBoxW=PrinterMessageBoxW@24
PrinterProperties=PrinterProperties@8
ReadPrinter=ReadPrinter@16
ResetPrinterA=ResetPrinterA@8
ResetPrinterW=ResetPrinterW@8
ScheduleJob=ScheduleJob@8
SetFormA=SetFormA@16
SetFormW=SetFormW@16
SetJobA=SetJobA@20
SetJobW=SetJobW@20
SetPrinterA=SetPrinterA@16
SetPrinterDataA=SetPrinterDataA@20
SetPrinterDataW=SetPrinterDataW@20
SetPrinterW=SetPrinterW@16
StartDocPrinterA=StartDocPrinterA@12
StartDocPrinterW=StartDocPrinterW@12
StartPagePrinter=StartPagePrinter@4
WaitForPrinterChange=WaitForPrinterChange@8
WritePrinter=WritePrinter@16
DeviceCapabilitiesA=DeviceCapabilitiesA@20
DeviceCapabilitiesW=DeviceCapabilitiesW@20
DllMain=DllMain@12
DocumentPropertiesA=DocumentPropertiesA@24
DocumentPropertiesW=DocumentPropertiesW@24
EndDocPrinter=EndDocPrinter@4
EndPagePrinter=EndPagePrinter@4
EnumFormsA=EnumFormsA@24
EnumFormsW=EnumFormsW@24
EnumJobsA=EnumJobsA@32
EnumJobsW=EnumJobsW@32
EnumMonitorsA=EnumMonitorsA@24
EnumMonitorsW=EnumMonitorsW@24
EnumPortsA=EnumPortsA@24
EnumPortsW=EnumPortsW@24
EnumPrinterDataA=EnumPrinterDataA@36
EnumPrinterDataW=EnumPrinterDataW@36
EnumPrinterDriversA=EnumPrinterDriversA@28
EnumPrinterDriversW=EnumPrinterDriversW@28
EnumPrintersA=EnumPrintersA@28
EnumPrintersW=EnumPrintersW@28
EnumPrintProcessorDatatypesA=EnumPrintProcessorDatatypesA@28
EnumPrintProcessorDatatypesW=EnumPrintProcessorDatatypesW@28
EnumPrintProcessorsA=EnumPrintProcessorsA@28
EnumPrintProcessorsW=EnumPrintProcessorsW@28
FindClosePrinterChangeNotification=FindClosePrinterChangeNotification@4
FindFirstPrinterChangeNotification=FindFirstPrinterChangeNotification@16
FindNextPrinterChangeNotification=FindNextPrinterChangeNotification@16
FreePrinterNotifyInfo=FreePrinterNotifyInfo@4
GetDefaultPrinterA=GetDefaultPrinterA@8
GetDefaultPrinterW=GetDefaultPrinterW@8
GetFormA=GetFormA@24
GetFormW=GetFormW@24
GetJobA=GetJobA@24
GetJobW=GetJobW@24
GetPrinterA=GetPrinterA@20
GetPrinterDataA=GetPrinterDataA@24
GetPrinterDataW=GetPrinterDataW@24
GetPrinterDriverA=GetPrinterDriverA@24
GetPrinterDriverDirectoryA=GetPrinterDriverDirectoryA@24
GetPrinterDriverDirectoryW=GetPrinterDriverDirectoryW@24
GetPrinterDriverW=GetPrinterDriverW@24
GetPrinterW=GetPrinterW@20
GetPrintProcessorDirectoryA=GetPrintProcessorDirectoryA@24
GetPrintProcessorDirectoryW=GetPrintProcessorDirectoryW@24
OpenPrinterA=OpenPrinterA@12
OpenPrinterW=OpenPrinterW@12
PrinterMessageBoxA=PrinterMessageBoxA@24
PrinterMessageBoxW=PrinterMessageBoxW@24
PrinterProperties=PrinterProperties@8
ReadPrinter=ReadPrinter@16
ResetPrinterA=ResetPrinterA@8
ResetPrinterW=ResetPrinterW@8
ScheduleJob=ScheduleJob@8
SetFormA=SetFormA@16
SetFormW=SetFormW@16
SetJobA=SetJobA@20
SetJobW=SetJobW@20
SetPrinterA=SetPrinterA@16
SetPrinterDataA=SetPrinterDataA@20
SetPrinterDataW=SetPrinterDataW@20
SetPrinterW=SetPrinterW@16
StartDocPrinterA=StartDocPrinterA@12
StartDocPrinterW=StartDocPrinterW@12
StartPagePrinter=StartPagePrinter@4
WaitForPrinterChange=WaitForPrinterChange@8
WritePrinter=WritePrinter@16