Author: akhaldi Date: Sun Jun 16 14:35:12 2013 New Revision: 59231
URL: http://svn.reactos.org/svn/reactos?rev=59231&view=rev Log: [LOCALSPL] * Sync with Wine 1.5.26.
Modified: trunk/reactos/dll/win32/localspl/CMakeLists.txt trunk/reactos/dll/win32/localspl/localmon.c trunk/reactos/dll/win32/localspl/localspl_private.h trunk/reactos/dll/win32/localspl/provider.c trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/localspl/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/localspl/CMakeLis... ============================================================================== --- trunk/reactos/dll/win32/localspl/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/localspl/CMakeLists.txt [iso-8859-1] Sun Jun 16 14:35:12 2013 @@ -16,15 +16,7 @@ add_library(localspl SHARED ${SOURCE} localspl.rc) set_module_type(localspl win32dll) target_link_libraries(localspl wine) - -add_importlibs(localspl - spoolss - user32 - advapi32 - msvcrt - kernel32 - ntdll) - +add_importlibs(localspl spoolss user32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET localspl DESTINATION reactos/system32 FOR all)
if(NOT MSVC)
Modified: trunk/reactos/dll/win32/localspl/localmon.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/localspl/localmon... ============================================================================== --- trunk/reactos/dll/win32/localspl/localmon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/localspl/localmon.c [iso-8859-1] Sun Jun 16 14:35:12 2013 @@ -515,7 +515,6 @@ static BOOL WINAPI localmon_OpenPortW(LPWSTR pName, PHANDLE phPort) { port_t * port; - DWORD len; DWORD type;
TRACE("%s, %p)\n", debugstr_w(pName), phPort); @@ -527,12 +526,11 @@ type = get_type_from_local_name(pName); if (!type) return FALSE;
- len = (lstrlenW(pName) + 1) * sizeof(WCHAR); - port = heap_alloc(sizeof(port_t) + len); + port = heap_alloc(FIELD_OFFSET(port_t, nameW[lstrlenW(pName) + 1])); if (!port) return FALSE;
port->type = type; - memcpy(port->nameW, pName, len); + lstrcpyW(port->nameW, pName); *phPort = port;
EnterCriticalSection(&port_handles_cs); @@ -736,16 +734,14 @@ */ static BOOL WINAPI localmon_XcvOpenPort(LPCWSTR pName, ACCESS_MASK GrantedAccess, PHANDLE phXcv) { - DWORD len; xcv_t * xcv;
TRACE("%s, 0x%x, %p)\n", debugstr_w(pName), GrantedAccess, phXcv); /* No checks for any field is done in Windows */ - len = (lstrlenW(pName) + 1) * sizeof(WCHAR); - xcv = heap_alloc( sizeof(xcv_t) + len); + xcv = heap_alloc(FIELD_OFFSET(xcv_t, nameW[lstrlenW(pName) + 1])); if (xcv) { xcv->GrantedAccess = GrantedAccess; - memcpy(xcv->nameW, pName, len); + lstrcpyW(xcv->nameW, pName); *phXcv = xcv; EnterCriticalSection(&xcv_handles_cs); list_add_tail(&xcv_handles, &xcv->entry);
Modified: trunk/reactos/dll/win32/localspl/localspl_private.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/localspl/localspl... ============================================================================== --- trunk/reactos/dll/win32/localspl/localspl_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/localspl/localspl_private.h [iso-8859-1] Sun Jun 16 14:35:12 2013 @@ -24,8 +24,8 @@ //#include <windef.h>
/* ## DLL-wide Globals ## */ -extern HINSTANCE LOCALSPL_hInstance; -void setup_provider(void); +extern HINSTANCE LOCALSPL_hInstance DECLSPEC_HIDDEN; +void setup_provider(void) DECLSPEC_HIDDEN;
/* ## Resource-ID ## */ #define IDS_LOCALPORT 500
Modified: trunk/reactos/dll/win32/localspl/provider.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/localspl/provider... ============================================================================== --- trunk/reactos/dll/win32/localspl/provider.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/localspl/provider.c [iso-8859-1] Sun Jun 16 14:35:12 2013 @@ -142,7 +142,8 @@ 'C','o','n','t','r','o','l','\', 'P','r','i','n','t','\', 'P','r','i','n','t','e','r','s',0}; -static const WCHAR spooldriversW[] = {'\','s','p','o','o','l','\','d','r','i','v','e','r','s','\',0}; +static const WCHAR spoolW[] = {'\','s','p','o','o','l',0}; +static const WCHAR driversW[] = {'\','d','r','i','v','e','r','s','\',0}; static const WCHAR spoolprtprocsW[] = {'\','s','p','o','o','l','\','p','r','t','p','r','o','c','s','\',0}; static const WCHAR version0_regpathW[] = {'\','V','e','r','s','i','o','n','-','0',0}; static const WCHAR version0_subdirW[] = {'\','0',0}; @@ -214,41 +215,29 @@ * Failure: FALSE * */ -static BOOL apd_copyfile(LPWSTR filename, apd_data_t *apd) -{ - LPWSTR ptr; - LPWSTR srcname; - DWORD res; +static BOOL apd_copyfile( WCHAR *pathname, WCHAR *file_part, apd_data_t *apd ) +{ + WCHAR *srcname; + DWORD res;
apd->src[apd->srclen] = '\0'; apd->dst[apd->dstlen] = '\0';
- if (!filename || !filename[0]) { + if (!pathname || !pathname[0]) { /* nothing to copy */ return TRUE; }
- ptr = strrchrW(filename, '\'); - if (ptr) { - ptr++; - } - else - { - ptr = filename; - } - - if (apd->copyflags & APD_COPY_FROM_DIRECTORY) { - /* we have an absolute Path */ - srcname = filename; - } + if (apd->copyflags & APD_COPY_FROM_DIRECTORY) + srcname = pathname; else { srcname = apd->src; - lstrcatW(srcname, ptr); - } - lstrcatW(apd->dst, ptr); - - TRACE("%s => %s\n", debugstr_w(filename), debugstr_w(apd->dst)); + strcatW( srcname, file_part ); + } + strcatW( apd->dst, file_part ); + + TRACE("%s => %s\n", debugstr_w(srcname), debugstr_w(apd->dst));
/* FIXME: handle APD_COPY_NEW_FILES */ res = CopyFileW(srcname, apd->dst, FALSE); @@ -1073,6 +1062,7 @@ { DWORD needed; const printenv_t * env; + WCHAR * const dir = (WCHAR *)pDriverDirectory;
TRACE("(%s, %s, %d, %p, %d, %p)\n", debugstr_w(pName), debugstr_w(pEnvironment), Level, pDriverDirectory, cbBuf, pcbNeeded); @@ -1090,7 +1080,8 @@ /* GetSystemDirectoryW returns number of WCHAR including the '\0' */ needed = GetSystemDirectoryW(NULL, 0); /* add the Size for the Subdirectories */ - needed += lstrlenW(spooldriversW); + needed += lstrlenW(spoolW); + needed += lstrlenW(driversW); needed += lstrlenW(env->subdir); needed *= sizeof(WCHAR); /* return-value is size in Bytes */
@@ -1101,18 +1092,22 @@ return FALSE; }
- if (pDriverDirectory == NULL) { + if (dir == NULL) { /* ERROR_INVALID_USER_BUFFER is NT, ERROR_INVALID_PARAMETER is win9x */ SetLastError(ERROR_INVALID_USER_BUFFER); return FALSE; }
- GetSystemDirectoryW((LPWSTR) pDriverDirectory, cbBuf/sizeof(WCHAR)); + GetSystemDirectoryW( dir, cbBuf / sizeof(WCHAR) ); /* add the Subdirectories */ - lstrcatW((LPWSTR) pDriverDirectory, spooldriversW); - lstrcatW((LPWSTR) pDriverDirectory, env->subdir); - - TRACE("=> %s\n", debugstr_w((LPWSTR) pDriverDirectory)); + lstrcatW( dir, spoolW ); + CreateDirectoryW( dir, NULL ); + lstrcatW( dir, driversW ); + CreateDirectoryW( dir, NULL ); + lstrcatW( dir, env->subdir ); + CreateDirectoryW( dir, NULL ); + + TRACE( "=> %s\n", debugstr_w( dir ) ); return TRUE; }
@@ -1286,6 +1281,12 @@ return (HANDLE)printer; }
+static inline WCHAR *get_file_part( WCHAR *name ) +{ + WCHAR *ptr = strrchrW( name, '\' ); + if (ptr) return ptr + 1; + return name; +}
/****************************************************************************** * myAddPrinterDriverEx [internal] @@ -1301,7 +1302,7 @@ DRIVER_INFO_8W di; BOOL (WINAPI *pDrvDriverEvent)(DWORD, DWORD, LPBYTE, LPARAM); HMODULE hui; - LPWSTR ptr; + WCHAR *file; HKEY hroot; HKEY hdrv; DWORD disposition; @@ -1369,54 +1370,53 @@ } RegCloseKey(hroot);
- if (disposition == REG_OPENED_EXISTING_KEY) { - TRACE("driver %s already installed\n", debugstr_w(di.pName)); - RegCloseKey(hdrv); - SetLastError(ERROR_PRINTER_DRIVER_ALREADY_INSTALLED); - return FALSE; - } - /* Verified with the Adobe PS Driver, that w2k does not use di.Version */ RegSetValueExW(hdrv, versionW, 0, REG_DWORD, (const BYTE*) &env->driverversion, sizeof(DWORD));
- RegSetValueExW(hdrv, driverW, 0, REG_SZ, (LPBYTE) di.pDriverPath, - (lstrlenW(di.pDriverPath)+1)* sizeof(WCHAR)); - apd_copyfile(di.pDriverPath, &apd); - - RegSetValueExW(hdrv, data_fileW, 0, REG_SZ, (LPBYTE) di.pDataFile, - (lstrlenW(di.pDataFile)+1)* sizeof(WCHAR)); - apd_copyfile(di.pDataFile, &apd); - - RegSetValueExW(hdrv, configuration_fileW, 0, REG_SZ, (LPBYTE) di.pConfigFile, - (lstrlenW(di.pConfigFile)+1)* sizeof(WCHAR)); - apd_copyfile(di.pConfigFile, &apd); + file = get_file_part( di.pDriverPath ); + RegSetValueExW( hdrv, driverW, 0, REG_SZ, (LPBYTE)file, (strlenW( file ) + 1) * sizeof(WCHAR) ); + apd_copyfile( di.pDriverPath, file, &apd ); + + file = get_file_part( di.pDataFile ); + RegSetValueExW( hdrv, data_fileW, 0, REG_SZ, (LPBYTE)file, (strlenW( file ) + 1) * sizeof(WCHAR) ); + apd_copyfile( di.pDataFile, file, &apd ); + + file = get_file_part( di.pConfigFile ); + RegSetValueExW( hdrv, configuration_fileW, 0, REG_SZ, (LPBYTE)file, (strlenW( file ) + 1) * sizeof(WCHAR) ); + apd_copyfile( di.pConfigFile, file, &apd );
/* settings for level 3 */ if (di.pHelpFile) - RegSetValueExW(hdrv, help_fileW, 0, REG_SZ, (LPBYTE) di.pHelpFile, - (lstrlenW(di.pHelpFile)+1)* sizeof(WCHAR)); + { + file = get_file_part( di.pHelpFile ); + RegSetValueExW( hdrv, help_fileW, 0, REG_SZ, (LPBYTE)file, (strlenW( file ) + 1) * sizeof(WCHAR) ); + apd_copyfile( di.pHelpFile, file, &apd ); + } else - RegSetValueExW(hdrv, help_fileW, 0, REG_SZ, (const BYTE*)emptyW, sizeof(emptyW)); - apd_copyfile(di.pHelpFile, &apd); - - - ptr = di.pDependentFiles; - if (ptr) - RegSetValueExW(hdrv, dependent_filesW, 0, REG_MULTI_SZ, (LPBYTE) di.pDependentFiles, - multi_sz_lenW(di.pDependentFiles)); + RegSetValueExW( hdrv, help_fileW, 0, REG_SZ, (const BYTE*)emptyW, sizeof(emptyW) ); + + if (di.pDependentFiles && *di.pDependentFiles) + { + WCHAR *reg, *reg_ptr, *in_ptr; + reg = reg_ptr = HeapAlloc( GetProcessHeap(), 0, multi_sz_lenW( di.pDependentFiles ) ); + + for (in_ptr = di.pDependentFiles; *in_ptr; in_ptr += strlenW( in_ptr ) + 1) + { + file = get_file_part( in_ptr ); + len = strlenW( file ) + 1; + memcpy( reg_ptr, file, len * sizeof(WCHAR) ); + reg_ptr += len; + apd_copyfile( in_ptr, file, &apd ); + } + *reg_ptr = 0; + + RegSetValueExW( hdrv, dependent_filesW, 0, REG_MULTI_SZ, (LPBYTE)reg, (reg_ptr - reg + 1) * sizeof(WCHAR) ); + HeapFree( GetProcessHeap(), 0, reg ); + } else RegSetValueExW(hdrv, dependent_filesW, 0, REG_MULTI_SZ, (const BYTE*)emptyW, sizeof(emptyW)); - while ((ptr != NULL) && (ptr[0])) { - if (apd_copyfile(ptr, &apd)) { - ptr += lstrlenW(ptr) + 1; - } - else - { - WARN("Failed to copy %s\n", debugstr_w(ptr)); - ptr = NULL; - } - } + /* The language-Monitor was already copied by the caller to "%SystemRoot%\system32" */ if (di.pMonitorName) RegSetValueExW(hdrv, monitorW, 0, REG_SZ, (LPBYTE) di.pMonitorName, @@ -1680,7 +1680,7 @@ else { FIXME("not implemented for %s (monitor %p: %s)\n", - debugstr_w(pMonitorName), pm, pm ? debugstr_w(pm->dllname) : NULL); + debugstr_w(pMonitorName), pm, pm ? debugstr_w(pm->dllname) : "(null)"); SetLastError(ERROR_INVALID_PARAMETER); res = FALSE; }
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=5... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 16 14:35:12 2013 @@ -83,7 +83,7 @@ reactos/dll/win32/itss # Synced to Wine-1.5.4 reactos/dll/win32/jscript # Synced to Wine-1.5.26 reactos/dll/win32/loadperf # Synced to Wine-1.5.19 -reactos/dll/win32/localspl # Synced to Wine-1.1.14? +reactos/dll/win32/localspl # Synced to Wine-1.5.26 reactos/dll/win32/localui # Synced to Wine-1.5.19 reactos/dll/win32/lz32 # Synced to Wine-1.5.19 reactos/dll/win32/mapi32 # Autosync