[LOCALSPL]

* Sync with Wine 1.5.26.

svn path=/trunk/; revision=59231
This commit is contained in:
Amine Khaldi 2013-06-16 14:35:12 +00:00
parent a2949de657
commit 86fb632442
5 changed files with 72 additions and 84 deletions

View file

@ -16,15 +16,7 @@ list(APPEND SOURCE
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)

View file

@ -515,7 +515,6 @@ cleanup:
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 @@ static BOOL WINAPI localmon_OpenPortW(LPWSTR pName, PHANDLE phPort)
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 DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
*/
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);

View file

@ -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

View file

@ -142,7 +142,8 @@ static const WCHAR printersW[] = {'S','y','s','t','e','m','\\',
'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 @@ static LPWSTR strdupW(LPCWSTR p)
* Failure: FALSE
*
*/
static BOOL apd_copyfile(LPWSTR filename, apd_data_t *apd)
static BOOL apd_copyfile( WCHAR *pathname, WCHAR *file_part, apd_data_t *apd )
{
LPWSTR ptr;
LPWSTR srcname;
DWORD res;
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);
strcatW( srcname, file_part );
}
lstrcatW(apd->dst, ptr);
strcatW( apd->dst, file_part );
TRACE("%s => %s\n", debugstr_w(filename), debugstr_w(apd->dst));
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 @@ static BOOL WINAPI fpGetPrinterDriverDirectory(LPWSTR pName, LPWSTR pEnvironment
{
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 @@ static BOOL WINAPI fpGetPrinterDriverDirectory(LPWSTR pName, LPWSTR pEnvironment
/* 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 @@ static BOOL WINAPI fpGetPrinterDriverDirectory(LPWSTR pName, LPWSTR pEnvironment
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);
lstrcatW( dir, spoolW );
CreateDirectoryW( dir, NULL );
lstrcatW( dir, driversW );
CreateDirectoryW( dir, NULL );
lstrcatW( dir, env->subdir );
CreateDirectoryW( dir, NULL );
TRACE("=> %s\n", debugstr_w((LPWSTR) pDriverDirectory));
TRACE( "=> %s\n", debugstr_w( dir ) );
return TRUE;
}
@ -1286,6 +1281,12 @@ end:
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 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo
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 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo
}
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);
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 );
RegSetValueExW(hdrv, data_fileW, 0, REG_SZ, (LPBYTE) di.pDataFile,
(lstrlenW(di.pDataFile)+1)* sizeof(WCHAR));
apd_copyfile(di.pDataFile, &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 );
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.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);
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 ) );
ptr = di.pDependentFiles;
if (ptr)
RegSetValueExW(hdrv, dependent_filesW, 0, REG_MULTI_SZ, (LPBYTE) di.pDependentFiles,
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 @@ static BOOL WINAPI fpAddPortEx(LPWSTR pName, DWORD level, LPBYTE pBuffer, LPWSTR
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;
}

View file

@ -83,7 +83,7 @@ reactos/dll/win32/itircl # Synced to Wine-1.5.19
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