diff options
Diffstat (limited to 'sal/systools/win32/uwinapi')
71 files changed, 5880 insertions, 0 deletions
diff --git a/sal/systools/win32/uwinapi/CheckTokenMembership.cpp b/sal/systools/win32/uwinapi/CheckTokenMembership.cpp new file mode 100644 index 000000000000..b3a30c4b3f31 --- /dev/null +++ b/sal/systools/win32/uwinapi/CheckTokenMembership.cpp @@ -0,0 +1,34 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if defined(_MSC_VER) && (_MSC_VER>=1400) +#pragma warning(disable : 4273) +#endif +#include "macros.h" + + +DEFINE_DEFAULT_THUNK( advapi32, TRYLOAD, BOOL, WINAPI, CheckTokenMembership, (HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember) ) diff --git a/sal/systools/win32/uwinapi/CommandLineToArgvW.cpp b/sal/systools/win32/uwinapi/CommandLineToArgvW.cpp new file mode 100644 index 000000000000..282e1aa6b283 --- /dev/null +++ b/sal/systools/win32/uwinapi/CommandLineToArgvW.cpp @@ -0,0 +1,172 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4740) +#endif + +#include "macros.h" + +#ifdef __cplusplus +#define local inline +#else +#define local static +#endif + +local LPCWSTR SkipBlanks( LPCWSTR lpScan ) +{ + while ( ' ' == *lpScan || '\t' == *lpScan ) + lpScan++; + + return lpScan; +} + + +local LPCWSTR SkipArgument( LPCWSTR lpScan ) +{ + BOOL fQuoted = FALSE; + LPCWSTR lpArgEnd = NULL; + + do + { + switch ( *lpScan ) + { + case ' ': + case '\t': + if ( fQuoted ) + lpScan++; + else + lpArgEnd = lpScan; + break; + case '\"': + lpScan++; + fQuoted = !fQuoted; + break; + case '\0': + lpArgEnd = lpScan; + break; + default: + lpScan++; + break; + } + } while( *lpScan && !lpArgEnd ); + + return lpScan; +} + + +IMPLEMENT_THUNK( shell32, WINDOWS, LPWSTR *, WINAPI, CommandLineToArgvW, ( LPCWSTR lpCmdLineW, int *pNumArgs ) ) +{ + LPWSTR *lpArgvW = NULL; + + if ( !lpCmdLineW || !*lpCmdLineW ) + { + CHAR szFileName[MAX_PATH]; + + DWORD dwResult = GetModuleFileNameA( NULL, szFileName, MAX_PATH ); + + if ( dwResult && dwResult < MAX_PATH ) + { + int cchNeeded = MultiByteToWideChar( CP_ACP, 0, szFileName, -1, NULL, 0 ); + + lpArgvW = (LPWSTR *)GlobalAlloc( 0, cchNeeded * sizeof(WCHAR) + sizeof(LPWSTR) ); + + if ( lpArgvW ) + { + lpArgvW[0] = (LPWSTR)(lpArgvW + 1); + + MultiByteToWideChar( CP_ACP, 0, szFileName, -1, lpArgvW[0], cchNeeded ); + *pNumArgs = 1; + } + else + SetLastError( ERROR_OUTOFMEMORY ); + } + } + else + { + LPCWSTR lpScan = lpCmdLineW; + int nTokens = 0; + int cchNeeded = 0; + + // Count arguments and required size + + while ( *lpScan ) + { + lpScan = SkipBlanks( lpScan ); + if ( *lpScan ) + { + LPCWSTR lpArgEnd = SkipArgument( lpScan ); + + nTokens++; + cchNeeded += lpArgEnd - lpScan + 1; + lpScan = lpArgEnd; + } + } + + // Allocate space for one additional NULL pointer to terminate list + + lpArgvW = (LPWSTR *)GlobalAlloc( 0, sizeof(LPWSTR) * (nTokens + 1) + sizeof(WCHAR) * cchNeeded ); + + if ( lpArgvW ) + { + // Collect arguments + + LPWSTR lpDestination = (LPWSTR)&lpArgvW[nTokens + 1]; + + lpScan = lpCmdLineW; + nTokens = 0; + + while ( *lpScan ) + { + lpScan = SkipBlanks( lpScan ); + if ( *lpScan ) + { + LPCWSTR lpArgEnd = SkipArgument( lpScan ); + + lpArgvW[nTokens++] = lpDestination; + + while ( lpScan < lpArgEnd ) + { + if ( '\"' != *lpScan ) + *lpDestination++ = *lpScan; + + lpScan++; + } + *lpDestination++ = 0; + } + } + + lpArgvW[nTokens] = NULL; + + *pNumArgs = nTokens; + } + else + SetLastError( ERROR_OUTOFMEMORY ); + + } + + return lpArgvW; +}
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/CopyFileExA.cpp b/sal/systools/win32/uwinapi/CopyFileExA.cpp new file mode 100644 index 000000000000..9369a6deee60 --- /dev/null +++ b/sal/systools/win32/uwinapi/CopyFileExA.cpp @@ -0,0 +1,167 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4740) +#endif + +#define _WIN32_WINNT 0x0400 +#include "macros.h" + +#define BUFSIZE 16384 + +static DWORD CALLBACK DefCopyProgressRoutine( + LARGE_INTEGER TotalFileSize, // total file size, in bytes + LARGE_INTEGER TotalBytesTransferred, + // total number of bytes transferred + LARGE_INTEGER StreamSize, // total number of bytes for this stream + LARGE_INTEGER StreamBytesTransferred, + // total number of bytes transferred for + // this stream + DWORD dwStreamNumber, // the current stream + DWORD dwCallbackReason, // reason for callback + HANDLE hSourceFile, // handle to the source file + HANDLE hDestinationFile, // handle to the destination file + LPVOID lpData // passed by CopyFileEx +) +{ + return PROGRESS_CONTINUE; +} + + +IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, CopyFileExA, ( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ) ) +{ + BOOL fSuccess = FALSE; // Assume failure + + HANDLE hSourceFile = CreateFileA( + lpExistingFileNameA, + GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, + NULL + ); + + if ( IsValidHandle(hSourceFile) ) + { + LARGE_INTEGER FileSize, BytesTransferred; + HANDLE hTargetFile = NULL; + + SetLastError( ERROR_SUCCESS ); + FileSize.LowPart = GetFileSize( hSourceFile, (LPDWORD)&FileSize.HighPart ); + BytesTransferred.QuadPart = 0; + + if ( (DWORD)-1 != FileSize.LowPart || ERROR_SUCCESS == GetLastError() ) + hTargetFile = CreateFileA( + lpNewFileNameA, + GENERIC_WRITE, + 0, + NULL, + (DWORD) ((dwCopyFlags & COPY_FILE_FAIL_IF_EXISTS) ? CREATE_NEW : CREATE_ALWAYS), + 0, + NULL + ); + + if ( IsValidHandle(hTargetFile) ) + { + DWORD dwProgressResult = PROGRESS_CONTINUE; + + fSuccess = SetEndOfFile( hTargetFile ); + + if ( fSuccess ) + { + if ( !lpProgressRoutine ) + lpProgressRoutine = DefCopyProgressRoutine; + + dwProgressResult = lpProgressRoutine( + FileSize, + BytesTransferred, + FileSize, + BytesTransferred, + 1, + CALLBACK_STREAM_SWITCH, + hSourceFile, + hTargetFile, + lpData + ); + + // Suppress further notifications + + if ( PROGRESS_QUIET == dwProgressResult ) + { + lpProgressRoutine = DefCopyProgressRoutine; + dwProgressResult = PROGRESS_CONTINUE; + } + } + + while ( fSuccess && PROGRESS_CONTINUE == dwProgressResult ) + { + BYTE buffer[BUFSIZE]; + DWORD dwBytesRead, dwBytesWritten = 0; + + fSuccess = ReadFile( hSourceFile, buffer, BUFSIZE, &dwBytesRead, NULL ); + + if ( !dwBytesRead ) break; + + if ( fSuccess ) + fSuccess = WriteFile( hTargetFile, buffer, dwBytesRead, &dwBytesWritten, NULL ); + + if ( fSuccess ) + { + BytesTransferred.QuadPart += (LONGLONG)dwBytesWritten; + + if ( pbCancel && *pbCancel ) + dwProgressResult = PROGRESS_CANCEL; + else + dwProgressResult = lpProgressRoutine( + FileSize, + BytesTransferred, + FileSize, + BytesTransferred, + 1, + CALLBACK_CHUNK_FINISHED, + hSourceFile, + hTargetFile, + lpData + ); + + } + + } + + CloseHandle( hTargetFile ); + + if ( PROGRESS_CANCEL == dwProgressResult ) + DeleteFileA( lpNewFileNameA ); + } + + + CloseHandle( hSourceFile ); + } + + return fSuccess; +}
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/CopyFileExW.cpp b/sal/systools/win32/uwinapi/CopyFileExW.cpp new file mode 100644 index 000000000000..73870beb1754 --- /dev/null +++ b/sal/systools/win32/uwinapi/CopyFileExW.cpp @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4740) +#endif + +#define _WIN32_WINNT 0x0400 +#include "macros.h" + +IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, CopyFileExW, ( LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ) ) +{ + AUTO_WSTR2STR( lpExistingFileName ); + AUTO_WSTR2STR( lpNewFileName ); + + return CopyFileExA( lpExistingFileNameA, lpNewFileNameA, lpProgressRoutine, lpData, pbCancel, dwCopyFlags ); +}
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/DeleteVolumeMountPointA.cpp b/sal/systools/win32/uwinapi/DeleteVolumeMountPointA.cpp new file mode 100644 index 000000000000..c2d23c3d0064 --- /dev/null +++ b/sal/systools/win32/uwinapi/DeleteVolumeMountPointA.cpp @@ -0,0 +1,33 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4740) +#endif + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, DeleteVolumeMountPointA, (LPCSTR lpszVolumeMountPoint) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/DeleteVolumeMountPointW.cpp b/sal/systools/win32/uwinapi/DeleteVolumeMountPointW.cpp new file mode 100644 index 000000000000..1b98ab0b56db --- /dev/null +++ b/sal/systools/win32/uwinapi/DeleteVolumeMountPointW.cpp @@ -0,0 +1,33 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4740) +#endif + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, DeleteVolumeMountPointW, (LPCWSTR lpszVolumeMountPoint) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/DllGetVersion.cpp b/sal/systools/win32/uwinapi/DllGetVersion.cpp new file mode 100644 index 000000000000..cb21d82f3885 --- /dev/null +++ b/sal/systools/win32/uwinapi/DllGetVersion.cpp @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define WIN32_LEAN_AND_MEAN +#ifdef _MSC_VER +#pragma warning(push,1) +#endif +#include <windows.h> +#include <shlwapi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#include <malloc.h> + +extern HMODULE UWINAPI_BaseAddress; + +// This function should be exported by every DLL that wants to provide it's version number. +// This code automaticly generates the information from the version resource + +extern "C" HRESULT CALLBACK DllGetVersion( DLLVERSIONINFO *pdvi ) +{ + TCHAR szModulePath[MAX_PATH]; + BOOL fSuccess = FALSE; + + if ( UWINAPI_BaseAddress && GetModuleFileName( UWINAPI_BaseAddress, szModulePath, MAX_PATH ) ) + { + DWORD dwHandle = 0; + DWORD dwSize = GetFileVersionInfoSize( szModulePath, &dwHandle ); + LPVOID lpData = _alloca( dwSize ); + + if ( GetFileVersionInfo( szModulePath, dwHandle, dwSize, lpData ) ) + { + VS_FIXEDFILEINFO *lpBuffer = NULL; + UINT uLen = 0; + + if ( VerQueryValue( lpData, TEXT("\\"), (LPVOID *)&lpBuffer, &uLen ) ) + { + pdvi->dwMajorVersion = HIWORD( lpBuffer->dwFileVersionMS ); + pdvi->dwMinorVersion = LOWORD( lpBuffer->dwFileVersionMS ); + pdvi->dwBuildNumber = HIWORD( lpBuffer->dwFileVersionLS ); + pdvi->dwPlatformID = (DWORD) ((lpBuffer->dwFileOS & VOS_NT) ? DLLVER_PLATFORM_NT : DLLVER_PLATFORM_WINDOWS); + + fSuccess = TRUE; + } + } + } + + return fSuccess ? HRESULT_FROM_WIN32( GetLastError() ) : HRESULT_FROM_WIN32( NO_ERROR ); +} diff --git a/sal/systools/win32/uwinapi/DllMain.cpp b/sal/systools/win32/uwinapi/DllMain.cpp new file mode 100644 index 000000000000..94f6c34fec24 --- /dev/null +++ b/sal/systools/win32/uwinapi/DllMain.cpp @@ -0,0 +1,235 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define WIN32_LEAN_AND_MEAN +#ifdef _MSC_VER +#pragma warning(push,1) // disable warnings within system headers +#endif +#include <windows.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#include <malloc.h> +#define _MBCS +#include <tchar.h> + + +HMODULE UWINAPI_BaseAddress = NULL; +const CHAR szUnicowsModuleName[] = "UNICOWS.DLL"; + +static HMODULE WINAPI _LoadUnicowsLibrary(VOID) +{ + CHAR szModulePath[MAX_PATH]; + HMODULE hModuleUnicows = NULL; + + // First search in the same directory as UWINAPI.DLL was loaded from. This is because + // UWINAPI.DLL not always resides in the same directory as the actual application. + + if ( UWINAPI_BaseAddress && GetModuleFileNameA( UWINAPI_BaseAddress, szModulePath, MAX_PATH ) ) + { + char *lpLastBkSlash = _tcsrchr( szModulePath, '\\' ); + + if ( lpLastBkSlash ) + { + size_t nParentDirSize = (size_t) (_tcsinc( lpLastBkSlash ) - szModulePath); + LPSTR lpUnicowsModulePath = (LPTSTR)_alloca( nParentDirSize + sizeof(szUnicowsModuleName) ); + + if ( lpUnicowsModulePath ) + { + _tcsncpy( lpUnicowsModulePath, szModulePath, nParentDirSize ); + _tcscpy( lpUnicowsModulePath + nParentDirSize, szUnicowsModuleName ); + + hModuleUnicows = LoadLibraryA( lpUnicowsModulePath ); + } + } + } + + // Search at the common places + + if ( !hModuleUnicows ) + hModuleUnicows = LoadLibraryA(szUnicowsModuleName); + + return hModuleUnicows; +} + +static HMODULE WINAPI LoadUnicowsLibrary(VOID) +{ + HMODULE hModuleUnicows; + int idMsg = IDOK; + + do + { + hModuleUnicows = _LoadUnicowsLibrary(); + + if ( !hModuleUnicows ) + { + LPVOID lpMsgBuf; + + FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ERROR_DLL_NOT_FOUND /* GetLastError() */, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPSTR)&lpMsgBuf, + 0, + NULL + ); + // Process any inserts in lpMsgBuf. + CHAR szModuleFileName[MAX_PATH]; + + GetModuleFileNameA( NULL, szModuleFileName, sizeof(szModuleFileName) ); + LPSTR lpMessage = (LPSTR)_alloca( strlen( (LPCSTR)lpMsgBuf ) + sizeof(szUnicowsModuleName) + 1 ); + strcpy( lpMessage, (LPCSTR)lpMsgBuf ); + strcat( lpMessage, "\n" ); + strcat( lpMessage, szUnicowsModuleName ); + // Free the buffer. + LocalFree( lpMsgBuf ); + // Display the string. + idMsg = MessageBoxA( NULL, lpMessage, + szModuleFileName, MB_ABORTRETRYIGNORE | MB_ICONERROR | MB_TASKMODAL ); + + if ( IDABORT == idMsg ) + TerminateProcess( GetCurrentProcess(), 255 ); + } + } while ( !hModuleUnicows && IDRETRY == idMsg ); + + return hModuleUnicows; +} + +extern "C" { +FARPROC _PfnLoadUnicows = (FARPROC)LoadUnicowsLibrary; +} + +#ifdef __MINGW32__ + +extern "C" { + +typedef void (*func_ptr) (void); +extern func_ptr __CTOR_LIST__[]; +extern func_ptr __DTOR_LIST__[]; + +static void do_startup(void); +static void do_cleanup(void); + +HMODULE hModuleUnicowsDLL; + +void +__do_global_dtors (void) +{ + static func_ptr *p = __DTOR_LIST__ + 1; + + /* + * Call each destructor in the destructor list until a null pointer + * is encountered. + */ + while (*p) + { + (*(p)) (); + p++; + } +} + +void +__do_global_ctors (void) +{ + unsigned long nptrs = (unsigned long) __CTOR_LIST__[0]; + unsigned i; + + /* + * If the first entry in the constructor list is -1 then the list + * is terminated with a null entry. Otherwise the first entry was + * the number of pointers in the list. + */ + if (nptrs == static_cast<unsigned long>(-1)) + { + for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++) + ; + } + + /* + * Go through the list backwards calling constructors. + */ + for (i = nptrs; i >= 1; i--) + { + __CTOR_LIST__[i] (); + } + + /* + * Register the destructors for processing on exit. + */ + atexit (__do_global_dtors); +} + +static int initialized = 0; + +void +__main (void) +{ + if (!initialized) + { + initialized = 1; + do_startup(); + __do_global_ctors (); + } +} + +static void do_startup( void ) +{ + if (((LONG)GetVersion()&0x800000ff) == 0x80000004) + { + hModuleUnicowsDLL = LoadUnicowsLibrary(); + if (hModuleUnicowsDLL) + atexit(do_cleanup); + } +} + +void do_cleanup( void ) +{ + FreeLibrary(hModuleUnicowsDLL); +} +} + +#endif + +extern "C" BOOL WINAPI DllMain( HMODULE hModule, DWORD dwReason, LPVOID ) +{ + switch ( dwReason ) + { + case DLL_PROCESS_ATTACH: + UWINAPI_BaseAddress = hModule; +#ifdef __MINGW32__ + return TRUE; +#else + return DisableThreadLibraryCalls( hModule ); +#endif + default: + return TRUE; + } + +} diff --git a/sal/systools/win32/uwinapi/DrawStateW.cpp b/sal/systools/win32/uwinapi/DrawStateW.cpp new file mode 100644 index 000000000000..9143131b3bab --- /dev/null +++ b/sal/systools/win32/uwinapi/DrawStateW.cpp @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +IMPLEMENT_THUNK( user32, WINDOWS, BOOL, WINAPI, DrawStateW, +( + HDC hdc, // handle to device context + HBRUSH hbr, // handle to brush + DRAWSTATEPROC lpOutputFunc, // pointer to callback function + LPARAM lData, // image information + WPARAM wData, // more image information + int x, // horizontal location of image + int y, // vertical location of image + int cx, // width of image + int cy, // height of image + UINT fuFlags // image type and state + +)) +{ + switch ( fuFlags & 0x000F ) + { + case DST_TEXT: + case DST_PREFIXTEXT: + { + LPSTR lpTextA = NULL; + + if ( lData ) + { + int cchWideChar = (int) (wData ? wData : -1); + int cchNeeded = WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)lData, cchWideChar, NULL, 0, NULL, NULL ); + + lpTextA = (LPSTR)_alloca( cchNeeded * sizeof(CHAR) ); + + if ( !lpTextA ) + { + SetLastError( ERROR_OUTOFMEMORY ); + return FALSE; + } + + WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)lData, cchWideChar, lpTextA, cchNeeded, NULL, NULL ); + + } + + return DrawStateA( hdc, hbr, lpOutputFunc, (LPARAM)lpTextA, wData, x, y, cx, cy, fuFlags ); + } + default: + return DrawStateA( hdc, hbr, lpOutputFunc, lData, wData, x, y, cx, cy, fuFlags ); + } +} diff --git a/sal/systools/win32/uwinapi/EnumProcesses.cpp b/sal/systools/win32/uwinapi/EnumProcesses.cpp new file mode 100644 index 000000000000..b98541ff1f40 --- /dev/null +++ b/sal/systools/win32/uwinapi/EnumProcesses.cpp @@ -0,0 +1,41 @@ +#include "macros.h" +#include <tlhelp32.h> + +IMPLEMENT_THUNK( psapi, WINDOWS, BOOL, WINAPI, EnumProcesses, ( LPDWORD lpProcesses, DWORD cbSize, LPDWORD lpcbCopied ) ) +{ + BOOL fSuccess = FALSE; + HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); + + if ( IsValidHandle( hSnapshot ) ) + { + PROCESSENTRY32 pe; + + if ( lpcbCopied ) + *lpcbCopied = 0; + + pe.dwSize = sizeof(pe); + if ( Process32First( hSnapshot, &pe ) ) + { + fSuccess = TRUE; + + while ( cbSize >= sizeof(*lpProcesses) ) + { + *(lpProcesses++) = pe.th32ProcessID; + if ( lpcbCopied ) + *lpcbCopied += sizeof(*lpProcesses); + cbSize -= sizeof(*lpProcesses); + + if ( !Process32Next( hSnapshot, &pe ) ) + break; + } + } + + CloseHandle( hSnapshot ); + } + else + SetLastError( ERROR_INVALID_HANDLE ); + + return fSuccess; +} + + diff --git a/sal/systools/win32/uwinapi/FindFirstVolumeA.cpp b/sal/systools/win32/uwinapi/FindFirstVolumeA.cpp new file mode 100644 index 000000000000..b174623b3d4f --- /dev/null +++ b/sal/systools/win32/uwinapi/FindFirstVolumeA.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, HANDLE, WINAPI, FindFirstVolumeA, (LPSTR lpszVolumeName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/FindFirstVolumeMountPointA.cpp b/sal/systools/win32/uwinapi/FindFirstVolumeMountPointA.cpp new file mode 100644 index 000000000000..436eb9c84428 --- /dev/null +++ b/sal/systools/win32/uwinapi/FindFirstVolumeMountPointA.cpp @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "macros.h" +#ifdef __MINGW32__ +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, HANDLE, WINAPI, FindFirstVolumeMountPointA, (LPSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength) ) +#else +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, HANDLE, WINAPI, FindFirstVolumeMountPointA, (LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength) ) +#endif +/* +extern "C" _declspec( dllexport ) FARPROC kernel32_FindFirstVolumeMountPointA_Ptr; +static HANDLE __stdcall FindFirstVolumeMountPointA_Failure (LPSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength); +static _declspec ( naked ) void FindFirstVolumeMountPointA_Thunk() +{ + ResolveThunk_TRYLOAD( &kernel32_FindFirstVolumeMountPointA_Ptr, "kernel32" ".dll", "FindFirstVolumeMountPointA", 0, (FARPROC)FindFirstVolumeMountPointA_Failure ); + _asm jmp [kernel32_FindFirstVolumeMountPointA_Ptr] } + +//extern "C" _declspec( naked ) HANDLE __stdcall +//extern "C" HANDLE WINAPI +extern "C" _declspec( naked ) HANDLE __stdcall FindFirstVolumeMountPointA (LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength) +{ + _asm jmp [kernel32_FindFirstVolumeMountPointA_Ptr] +} + +extern "C" _declspec( dllexport ) FARPROC kernel32_FindFirstVolumeMountPointA_Ptr = (FARPROC)FindFirstVolumeMountPointA_Thunk; +static HANDLE __stdcall FindFirstVolumeMountPointA_Failure (LPSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength) +{ SetLastError( 120L ); return (HANDLE)0; } +*/ diff --git a/sal/systools/win32/uwinapi/FindFirstVolumeMountPointW.cpp b/sal/systools/win32/uwinapi/FindFirstVolumeMountPointW.cpp new file mode 100644 index 000000000000..54f4d7307970 --- /dev/null +++ b/sal/systools/win32/uwinapi/FindFirstVolumeMountPointW.cpp @@ -0,0 +1,32 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "macros.h" +#ifdef __MINGW32__ +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, HANDLE, WINAPI, FindFirstVolumeMountPointW, (LPWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength) ) +#else +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, HANDLE, WINAPI, FindFirstVolumeMountPointW, (LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength) ) +#endif diff --git a/sal/systools/win32/uwinapi/FindFirstVolumeW.cpp b/sal/systools/win32/uwinapi/FindFirstVolumeW.cpp new file mode 100644 index 000000000000..f6444c8e97df --- /dev/null +++ b/sal/systools/win32/uwinapi/FindFirstVolumeW.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, HANDLE, WINAPI, FindFirstVolumeW, (LPWSTR lpszVolumeName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/FindNextVolumeA.cpp b/sal/systools/win32/uwinapi/FindNextVolumeA.cpp new file mode 100644 index 000000000000..6ec46a67e28a --- /dev/null +++ b/sal/systools/win32/uwinapi/FindNextVolumeA.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, FindNextVolumeA, (HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/FindNextVolumeMountPointA.cpp b/sal/systools/win32/uwinapi/FindNextVolumeMountPointA.cpp new file mode 100644 index 000000000000..b2ad8810b1d9 --- /dev/null +++ b/sal/systools/win32/uwinapi/FindNextVolumeMountPointA.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, FindNextVolumeMountPointA, (HANDLE hFindVolumeMountPoint, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/FindNextVolumeMountPointW.cpp b/sal/systools/win32/uwinapi/FindNextVolumeMountPointW.cpp new file mode 100644 index 000000000000..2ff5017c2abe --- /dev/null +++ b/sal/systools/win32/uwinapi/FindNextVolumeMountPointW.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, FindNextVolumeMountPointW, (HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/FindNextVolumeW.cpp b/sal/systools/win32/uwinapi/FindNextVolumeW.cpp new file mode 100644 index 000000000000..eb06a2755c18 --- /dev/null +++ b/sal/systools/win32/uwinapi/FindNextVolumeW.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, FindNextVolumeW, (HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/FindVolumeClose.cpp b/sal/systools/win32/uwinapi/FindVolumeClose.cpp new file mode 100644 index 000000000000..fdee78575095 --- /dev/null +++ b/sal/systools/win32/uwinapi/FindVolumeClose.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, FindVolumeClose, (HANDLE hFindVolume) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/FindVolumeMountPointClose.cpp b/sal/systools/win32/uwinapi/FindVolumeMountPointClose.cpp new file mode 100644 index 000000000000..f821e9c018ab --- /dev/null +++ b/sal/systools/win32/uwinapi/FindVolumeMountPointClose.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, FindVolumeMountPointClose, (HANDLE hFindVolumeMountPoint ) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/GetDiskFreeSpaceExA.cpp b/sal/systools/win32/uwinapi/GetDiskFreeSpaceExA.cpp new file mode 100644 index 000000000000..a217b961de03 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetDiskFreeSpaceExA.cpp @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +// GetDiskSpaceExA wrapper for Win 95A + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, GetDiskFreeSpaceExA,( + LPCSTR lpRootPathName, // directory name + PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller + PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk + PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk +)) +{ + DWORD dwSectorsPerCluster, dwBytesPerSector, dwNumberOfFreeClusters, dwTotalNumberOfClusters; + + BOOL fSuccess = GetDiskFreeSpaceA( lpRootPathName, &dwSectorsPerCluster, &dwBytesPerSector, &dwNumberOfFreeClusters, &dwTotalNumberOfClusters ); + + if ( fSuccess ) + { + ULONGLONG ulBytesPerCluster = (ULONGLONG)dwSectorsPerCluster * (ULONGLONG)dwBytesPerSector; + + if ( lpFreeBytesAvailable ) + lpFreeBytesAvailable->QuadPart = ulBytesPerCluster * (ULONGLONG)dwNumberOfFreeClusters; + + if ( lpTotalNumberOfBytes ) + lpTotalNumberOfBytes->QuadPart = ulBytesPerCluster * (ULONGLONG)dwTotalNumberOfClusters; + + if ( lpTotalNumberOfFreeBytes ) + lpTotalNumberOfFreeBytes->QuadPart = ulBytesPerCluster * (ULONGLONG)dwNumberOfFreeClusters; + } + + return fSuccess; +} + diff --git a/sal/systools/win32/uwinapi/GetDiskFreeSpaceExW.cpp b/sal/systools/win32/uwinapi/GetDiskFreeSpaceExW.cpp new file mode 100644 index 000000000000..6e6f4cbe32c5 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetDiskFreeSpaceExW.cpp @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, GetDiskFreeSpaceExW,( + LPCWSTR lpRootPathNameW, // directory name + PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller + PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk + PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk +)) +{ + AUTO_WSTR2STR( lpRootPathName ); + + return GetDiskFreeSpaceExA( lpRootPathNameA, lpFreeBytesAvailable, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes ); +} + diff --git a/sal/systools/win32/uwinapi/GetLogicalDriveStringsW.cpp b/sal/systools/win32/uwinapi/GetLogicalDriveStringsW.cpp new file mode 100644 index 000000000000..9f49c72d3431 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetLogicalDriveStringsW.cpp @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +IMPLEMENT_THUNK( kernel32, WINDOWS, DWORD, WINAPI, GetLogicalDriveStringsW, ( DWORD cchBuffer, LPWSTR lpBufferW ) ) +{ + AUTO_STR( lpBuffer, cchBuffer ); + + DWORD dwResult = GetLogicalDriveStringsA( cchBuffer, lpBufferA ); + + + if ( dwResult && dwResult < cchBuffer ) + STRBUF2WSTR( lpBuffer, (int) (dwResult + 1), (int) cchBuffer ); + + return dwResult; +}
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/GetLongPathName.cpp b/sal/systools/win32/uwinapi/GetLongPathName.cpp new file mode 100644 index 000000000000..fc10d64ee5b0 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetLongPathName.cpp @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +{ + DWORD dwResult = 0; // Assume failure + + if ( IsBadStringPtr( lpShortPath, MAX_PATH ) ) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return dwResult; + } + + // Assume a not existing buffer means a bufsize of zero + if ( !lpLongPath ) + cchBuffer = 0; + + if ( _tcslen( lpShortPath ) == 2 && lpShortPath[1] == ':' ) + { + _tcscpy( lpLongPath, lpShortPath ); + dwResult = _tcslen( lpLongPath ); + } + else + { + HANDLE hFind; + WIN32_FIND_DATA aFindFileData; + + if ( lpShortPath[_tcslen(lpShortPath)-1] == '\\' ) + { + TCHAR szFilePath[MAX_PATH]; + + _tcscpy( szFilePath, lpShortPath ); + _tcscat( szFilePath, TEXT("*.*") ); + hFind = FindFirstFile( szFilePath, &aFindFileData );; + aFindFileData.cFileName[0] = 0; + } + else + { + hFind = FindFirstFile( lpShortPath, &aFindFileData ); + if ( !IsValidHandle( hFind ) ) + { + TCHAR szFilePath[MAX_PATH]; + + _tcscpy( szFilePath, lpShortPath ); + _tcscat( szFilePath, TEXT("\\*.*") ); + hFind = FindFirstFile( szFilePath, &aFindFileData );; + aFindFileData.cFileName[0] = 0; + } + } + + if ( IsValidHandle( hFind ) ) + { + FindClose( hFind ); + + LPCTSTR lpLastSlash = _tcsrchr( lpShortPath, '\\' ); + + if ( lpLastSlash ) + { + int nParentLen = lpLastSlash - lpShortPath; + LPTSTR lpParentPath = (LPTSTR)_alloca( (nParentLen + 1) * sizeof(TCHAR) ); + + CopyMemory( lpParentPath, lpShortPath, nParentLen * sizeof(TCHAR) ); + lpParentPath[nParentLen] = 0; + + dwResult = GetLongPathName( lpParentPath, lpLongPath, cchBuffer ); + + if ( !dwResult ) + _tcscpy( lpLongPath, lpParentPath ); + } + else + { + _tcscpy( lpLongPath, lpShortPath ); + dwResult = _tcslen( lpLongPath ); + } + + if ( dwResult < cchBuffer ) + { + _tcscat( lpLongPath, TEXT("\\") ); + _tcscat( lpLongPath, aFindFileData.cFileName ); + dwResult = _tcslen( lpLongPath ); + } + else + dwResult += _tcslen( aFindFileData.cFileName ) + 1; + } + } + + return dwResult; +} + diff --git a/sal/systools/win32/uwinapi/GetLongPathNameA.cpp b/sal/systools/win32/uwinapi/GetLongPathNameA.cpp new file mode 100644 index 000000000000..d3d458ad9ae1 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetLongPathNameA.cpp @@ -0,0 +1,31 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +IMPLEMENT_THUNK( kernel32, WINDOWS, DWORD, WINAPI, GetLongPathNameA, ( LPCTSTR lpShortPath, LPTSTR lpLongPath, DWORD cchBuffer ) ) +#include "GetLongPathName.cpp"
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/GetLongPathNameW.cpp b/sal/systools/win32/uwinapi/GetLongPathNameW.cpp new file mode 100644 index 000000000000..42fded1195a0 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetLongPathNameW.cpp @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define UNICODE +#include "macros.h" + +EXTERN_C DWORD WINAPI GetLongPathNameW_NT( LPCWSTR lpShortPath, LPWSTR lpLongPath, DWORD cchBuffer ) +#include "GetLongPathName.cpp" + +EXTERN_C DWORD WINAPI GetLongPathNameW_WINDOWS( LPCWSTR lpShortPathW, LPWSTR lpLongPathW, DWORD cchBuffer ) +{ + AUTO_WSTR2STR( lpShortPath ); + AUTO_STR( lpLongPath, cchBuffer ); + + DWORD dwResult = GetLongPathNameA( lpShortPathA, lpLongPathA, cchBuffer ); + + if ( dwResult && dwResult < cchBuffer ) + STR2WSTR( lpLongPath, cchBuffer ); + + return dwResult; +} + + +EXTERN_C void WINAPI ResolveThunk_GetLongPathNameW( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName ) +{ + if ( (LONG)GetVersion() < 0 ) + *lppfn = (FARPROC)GetLongPathNameW_WINDOWS; + else + { + FARPROC lpfnResult = GetProcAddress( LoadLibraryA( lpLibFileName ), lpFuncName ); + if ( !lpfnResult ) + lpfnResult = (FARPROC)GetLongPathNameW_NT; + + *lppfn = lpfnResult; + } +} + + +DEFINE_CUSTOM_THUNK( kernel32, GetLongPathNameW, DWORD, WINAPI, GetLongPathNameW, ( LPCWSTR lpShortPathW, LPWSTR lpLongPathW, DWORD cchBuffer ) ); diff --git a/sal/systools/win32/uwinapi/GetModuleFileNameExA.cpp b/sal/systools/win32/uwinapi/GetModuleFileNameExA.cpp new file mode 100644 index 000000000000..b66ebf6dab70 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetModuleFileNameExA.cpp @@ -0,0 +1,53 @@ +#include "macros.h" +#ifdef _MSC_VER +#pragma warning(push,1) // disable warnings within system headers +#endif +#include <psapi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif +#include <tlhelp32.h> + +IMPLEMENT_THUNK( psapi, WINDOWS, DWORD, WINAPI, GetModuleFileNameExA, (HANDLE hProcess, HMODULE hModule, LPSTR lpFileName, DWORD nSize ) ) +{ + DWORD dwProcessId = 0; + DWORD dwResult = 0; + + if ( !hProcess || hProcess == GetCurrentProcess() || GetCurrentProcessId() == (dwProcessId = GetProcessId( hProcess )) ) + return GetModuleFileNameA( hModule, lpFileName, nSize ); + + HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwProcessId ); + + if ( IsValidHandle( hSnapshot ) ) + { + MODULEENTRY32 me; + + me.dwSize = sizeof(me); + if ( Module32First( hSnapshot, &me ) ) + { + BOOL fFound = FALSE; + + if ( NULL == hModule ) + fFound = TRUE; + else do + { + fFound = (me.hModule == hModule); + } while ( !fFound && Module32Next( hSnapshot, &me ) ); + + if ( fFound ) + { + dwResult = _tcslen( me.szExePath ); + + if ( dwResult > nSize && nSize > 0 ) + lpFileName[nSize -1] = 0; + + _tcsncpy( lpFileName, me.szExePath, nSize ); + } + } + + CloseHandle( hSnapshot ); + } + + return dwResult; +} + diff --git a/sal/systools/win32/uwinapi/GetModuleFileNameExW.cpp b/sal/systools/win32/uwinapi/GetModuleFileNameExW.cpp new file mode 100644 index 000000000000..1f952792241f --- /dev/null +++ b/sal/systools/win32/uwinapi/GetModuleFileNameExW.cpp @@ -0,0 +1,18 @@ +#include "macros.h" +#ifdef _MSC_VER +#pragma warning(push,1) // disable warnings within system headers +#endif +#include <psapi.h> +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +IMPLEMENT_THUNK( psapi, WINDOWS, DWORD, WINAPI, GetModuleFileNameExW, (HANDLE hProcess, HMODULE hModule, LPWSTR lpFileNameW, DWORD nSize ) ) +{ + AUTO_STR( lpFileName, 2 * nSize ); + + if ( GetModuleFileNameExA( hProcess, hModule, lpFileNameA, 2 * nSize ) ) + return (DWORD) STR2WSTR( lpFileName, nSize ); + else + return 0; +}
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/GetProcessId.cpp b/sal/systools/win32/uwinapi/GetProcessId.cpp new file mode 100644 index 000000000000..10251e498ba2 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetProcessId.cpp @@ -0,0 +1,164 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" +#include "win95sys.h" +#include <tlhelp32.h> +static FARPROC WINAPI GetRealProcAddress( HMODULE hModule, LPCSTR lpProcName ) +{ + FARPROC lpfn = GetProcAddress( hModule, lpProcName ); + + if ( lpfn ) + { + if ( 0x68 == *(LPBYTE)lpfn ) + { + /* + 82C9F460 68 36 49 F8 BF push 0BFF84936h + 82C9F465 E9 41 62 2F 3D jmp BFF956AB + */ + + lpfn = (FARPROC)*(LPDWORD)((LPBYTE)lpfn + 1); + + /* + BFF956AB 9C pushfd + BFF956AC FC cld + BFF956AD 50 push eax + BFF956AE 53 push ebx + BFF956AF 52 push edx + BFF956B0 64 8B 15 20 00 00 00 mov edx,dword ptr fs:[20h] + BFF956B7 0B D2 or edx,edx + BFF956B9 74 09 je BFF956C4 + BFF956BB 8B 42 04 mov eax,dword ptr [edx+4] + BFF956BE 0B C0 or eax,eax + BFF956C0 74 07 je BFF956C9 + BFF956C2 EB 42 jmp BFF95706 + BFF956C4 5A pop edx + BFF956C5 5B pop ebx + BFF956C6 58 pop eax + BFF956C7 9D popfd + BFF956C8 C3 ret + */ + } + } + + return lpfn; +} + + +typedef DWORD (WINAPI OBFUSCATE)( DWORD dwPTID ); +typedef OBFUSCATE *LPOBFUSCATE; + +static DWORD WINAPI Obfuscate( DWORD dwPTID ) +{ + static LPOBFUSCATE lpfnObfuscate = NULL; + + if ( !lpfnObfuscate ) + { + LPBYTE lpCode = (LPBYTE)GetRealProcAddress( GetModuleHandleA("KERNEL32"), "GetCurrentThreadId" ); + + if ( lpCode ) + { + /* + GetCurrentThreadId: + lpCode + 00 BFF84936 A1 DC 9C FC BF mov eax,[BFFC9CDC] ; This is the real thread id + lpcode + 05 BFF8493B FF 30 push dword ptr [eax] + lpCode + 07 BFF8493D E8 17 C5 FF FF call BFF80E59 ; call Obfuscate function + lpcode + 0C BFF84942 C3 ret + */ + + DWORD dwOffset = *(LPDWORD)(lpCode + 0x08); + + lpfnObfuscate = (LPOBFUSCATE)(lpCode + 0x0C + dwOffset); + /* + Obfuscate: + BFF80E59 A1 CC 98 FC BF mov eax,[BFFC98CC] + BFF80E5E 85 C0 test eax,eax + BFF80E60 75 04 jne BFF80E66 + BFF80E62 33 C0 xor eax,eax + BFF80E64 EB 04 jmp BFF80E6A + BFF80E66 33 44 24 04 xor eax,dword ptr [esp+4] + BFF80E6A C2 04 00 ret 4 + */ + } + + } + + return lpfnObfuscate ? lpfnObfuscate( dwPTID ) : 0; +} + + +EXTERN_C DWORD WINAPI GetProcessId_WINDOWS( HANDLE hProcess ) +{ + if ( GetCurrentProcess() == hProcess ) + return GetCurrentProcessId(); + + DWORD dwProcessId = 0; + PPROCESS_DATABASE pPDB = (PPROCESS_DATABASE)Obfuscate( GetCurrentProcessId() ); + + if ( pPDB && K32OBJ_PROCESS == pPDB->Type ) + { + DWORD dwHandleNumber = (DWORD)hProcess >> 2; + + if ( 0 == ((DWORD)hProcess & 0x03) && dwHandleNumber < pPDB->pHandleTable->cEntries ) + { + if ( + pPDB->pHandleTable->array[dwHandleNumber].pObject && + K32OBJ_PROCESS == pPDB->pHandleTable->array[dwHandleNumber].pObject->Type + ) + dwProcessId = Obfuscate( (DWORD)pPDB->pHandleTable->array[dwHandleNumber].pObject ); + } + + SetLastError( ERROR_INVALID_HANDLE ); + } + + return dwProcessId; +} + + +EXTERN_C DWORD WINAPI GetProcessId_NT( HANDLE hProcess ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return 0; +} + + +EXTERN_C void WINAPI ResolveThunk_GetProcessId( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName ) +{ + if ( (LONG)GetVersion() < 0 ) + *lppfn = (FARPROC)GetProcessId_WINDOWS; + else + { + FARPROC lpfnResult = GetProcAddress( LoadLibraryA( lpLibFileName ), lpFuncName ); + if ( !lpfnResult ) + lpfnResult = (FARPROC)GetProcessId_NT; + + *lppfn = lpfnResult; + } +} + + +DEFINE_CUSTOM_THUNK( kernel32, GetProcessId, DWORD, WINAPI, GetProcessId, ( HANDLE hProcess ) ); diff --git a/sal/systools/win32/uwinapi/GetUserDefaultUILanguage.cpp b/sal/systools/win32/uwinapi/GetUserDefaultUILanguage.cpp new file mode 100644 index 000000000000..843f3049a166 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetUserDefaultUILanguage.cpp @@ -0,0 +1,34 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +IMPLEMENT_THUNK( kernel32, WINDOWS, LANGID, WINAPI, GetUserDefaultUILanguage,()) +{ + return LANGIDFROMLCID(GetUserDefaultLCID()); +} + diff --git a/sal/systools/win32/uwinapi/GetUserDomainA.cpp b/sal/systools/win32/uwinapi/GetUserDomainA.cpp new file mode 100644 index 000000000000..880e53648d91 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetUserDomainA.cpp @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include "macros.h" + +EXTERN_C DWORD WINAPI GetUserDomainA_NT( LPSTR lpBuffer, DWORD nSize ) +#include "GetUserDomain_NT.cpp" + +EXTERN_C DWORD WINAPI GetUserDomainA_WINDOWS( LPSTR lpBuffer, DWORD nSize ) +#include "GetUserDomain_WINDOWS.cpp" + +EXTERN_C void WINAPI ResolveThunk_GetUserDomainA( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName ) +{ + if ( (LONG)GetVersion() < 0 ) + *lppfn = (FARPROC)GetUserDomainA_WINDOWS; + else + *lppfn = (FARPROC)GetUserDomainA_NT; +} + +DEFINE_CUSTOM_THUNK( kernel32, GetUserDomainA, DWORD, WINAPI, GetUserDomainA, ( LPSTR lpBuffer, DWORD nSize ) ); + diff --git a/sal/systools/win32/uwinapi/GetUserDomainW.cpp b/sal/systools/win32/uwinapi/GetUserDomainW.cpp new file mode 100644 index 000000000000..c49aa79da905 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetUserDomainW.cpp @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define UNICODE +#include "macros.h" + +EXTERN_C DWORD WINAPI GetUserDomainW_NT( LPWSTR lpBuffer, DWORD nSize ) +#include "GetUserDomain_NT.cpp" + + +EXTERN_C DWORD WINAPI GetUserDomainW_WINDOWS( LPWSTR lpBuffer, DWORD nSize ) +#include "GetUserDomain_WINDOWS.cpp" + +EXTERN_C void WINAPI ResolveThunk_GetUserDomainW( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName ) +{ + if ( (LONG)GetVersion() < 0 ) + *lppfn = (FARPROC)GetUserDomainW_WINDOWS; + else + *lppfn = (FARPROC)GetUserDomainW_NT; +} + +DEFINE_CUSTOM_THUNK( kernel32, GetUserDomainW, DWORD, WINAPI, GetUserDomainW, ( LPWSTR lpBuffer, DWORD cchBuffer ) ); + diff --git a/sal/systools/win32/uwinapi/GetUserDomain_NT.cpp b/sal/systools/win32/uwinapi/GetUserDomain_NT.cpp new file mode 100644 index 000000000000..289cf80f74d5 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetUserDomain_NT.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +{ + return GetEnvironmentVariable( TEXT("USERDOMAIN"), lpBuffer, nSize ); +} diff --git a/sal/systools/win32/uwinapi/GetUserDomain_WINDOWS.cpp b/sal/systools/win32/uwinapi/GetUserDomain_WINDOWS.cpp new file mode 100644 index 000000000000..20f86ab3c78d --- /dev/null +++ b/sal/systools/win32/uwinapi/GetUserDomain_WINDOWS.cpp @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +{ + HKEY hkeyLogon; + HKEY hkeyWorkgroup; + DWORD dwResult = 0; + + + if ( ERROR_SUCCESS == RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + TEXT("Network\\Logon"), + 0, KEY_READ, &hkeyLogon ) ) + { + DWORD dwLogon = 0; + DWORD dwLogonSize = sizeof(dwLogon); + RegQueryValueEx( hkeyLogon, TEXT("LMLogon"), 0, NULL, (LPBYTE)&dwLogon, &dwLogonSize ); + RegCloseKey( hkeyLogon ); + + if ( dwLogon ) + { + HKEY hkeyNetworkProvider; + + if ( ERROR_SUCCESS == RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + TEXT("SYSTEM\\CurrentControlSet\\Services\\MSNP32\\NetworkProvider"), + 0, KEY_READ, &hkeyNetworkProvider ) ) + { + DWORD dwBufferSize = nSize; + LONG lResult = RegQueryValueEx( hkeyNetworkProvider, TEXT("AuthenticatingAgent"), 0, NULL, (LPBYTE)lpBuffer, &dwBufferSize ); + + if ( ERROR_SUCCESS == lResult || ERROR_MORE_DATA == lResult ) + dwResult = dwBufferSize / sizeof(TCHAR); + + RegCloseKey( hkeyNetworkProvider ); + } + } + } + else if ( ERROR_SUCCESS == RegOpenKeyEx( + HKEY_LOCAL_MACHINE, + TEXT("SYSTEM\\CurrentControlSet\\Services\\VxD\\VNETSUP"), + 0, KEY_READ, &hkeyWorkgroup ) ) + { + DWORD dwBufferSize = nSize; + LONG lResult = RegQueryValueEx( hkeyWorkgroup, TEXT("Workgroup"), 0, NULL, (LPBYTE)lpBuffer, &dwBufferSize ); + + if ( ERROR_SUCCESS == lResult || ERROR_MORE_DATA == lResult ) + dwResult = dwBufferSize / sizeof(TCHAR); + + RegCloseKey( hkeyWorkgroup ); + } + + + return dwResult; +} diff --git a/sal/systools/win32/uwinapi/GetVolumeNameForVolumeMountPointA.cpp b/sal/systools/win32/uwinapi/GetVolumeNameForVolumeMountPointA.cpp new file mode 100644 index 000000000000..9b02baa76b26 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetVolumeNameForVolumeMountPointA.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, GetVolumeNameForVolumeMountPointA, (LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/GetVolumeNameForVolumeMountPointW.cpp b/sal/systools/win32/uwinapi/GetVolumeNameForVolumeMountPointW.cpp new file mode 100644 index 000000000000..c3b72ba3cf02 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetVolumeNameForVolumeMountPointW.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, GetVolumeNameForVolumeMountPointW, (LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/GetVolumePathNameA.cpp b/sal/systools/win32/uwinapi/GetVolumePathNameA.cpp new file mode 100644 index 000000000000..9df190b2f69c --- /dev/null +++ b/sal/systools/win32/uwinapi/GetVolumePathNameA.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, GetVolumePathNameA, (LPCSTR lpszFileName, LPSTR lpszVolumePathName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/GetVolumePathNameW.cpp b/sal/systools/win32/uwinapi/GetVolumePathNameW.cpp new file mode 100644 index 000000000000..8989ea4ff032 --- /dev/null +++ b/sal/systools/win32/uwinapi/GetVolumePathNameW.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, GetVolumePathNameW, (LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/MCIWndCreateW.cpp b/sal/systools/win32/uwinapi/MCIWndCreateW.cpp new file mode 100644 index 000000000000..13f334745d7b --- /dev/null +++ b/sal/systools/win32/uwinapi/MCIWndCreateW.cpp @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" +#include <vfw.h> + +IMPLEMENT_THUNK( kernel32, WINDOWS, HWND, VFWAPIV, MCIWndCreateW, +( + HWND hwndParent, + HINSTANCE hInstance, + DWORD dwStyle, + LPCWSTR lpFileW +)) +{ + AUTO_WSTR2STR( lpFile ); + + return MCIWndCreateA( hwndParent, hInstance, dwStyle, lpFileA ); +}
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/MoveFileExA.cpp b/sal/systools/win32/uwinapi/MoveFileExA.cpp new file mode 100644 index 000000000000..e3525bbcc312 --- /dev/null +++ b/sal/systools/win32/uwinapi/MoveFileExA.cpp @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define WININIT_FILENAME "wininit.ini" +#define RENAME_SECTION "rename" + +IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, MoveFileExA, ( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags ) ) +{ + BOOL fSuccess = FALSE; // assume failure + + // Windows 9x has a special mechanism to move files after reboot + + if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT ) + { + CHAR szExistingFileNameA[MAX_PATH]; + CHAR szNewFileNameA[MAX_PATH] = "NUL"; + + // Path names in WININIT.INI must be in short path name form + + if ( + GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) && + (!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH )) + ) + { + CHAR szBuffer[32767]; // The buffer size must not exceed 32K + DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, elementsof(szBuffer), WININIT_FILENAME ); + + CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters + strcpy( szRename, szNewFileNameA ); + strcat( szRename, "=" ); + strcat( szRename, szExistingFileNameA ); + size_t lnRename = strlen(szRename); + + if ( dwBufLen + lnRename + 2 <= elementsof(szBuffer) ) + { + CopyMemory( &szBuffer[dwBufLen], szRename, lnRename ); + szBuffer[dwBufLen + lnRename ] = 0; + szBuffer[dwBufLen + lnRename + 1 ] = 0; + + fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME ); + } + else + SetLastError( ERROR_BUFFER_OVERFLOW ); + } + } + else + { + + fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA ); + + if ( !fSuccess && 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) ) + { + BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING); + + fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist ); + + // In case of successfull copy do not return FALSE if delete fails. + // Error detection is done by GetLastError() + + if ( fSuccess ) + { + SetLastError( NO_ERROR ); + DeleteFileA( lpExistingFileNameA ); + } + } + + } + + return fSuccess; +} + diff --git a/sal/systools/win32/uwinapi/MoveFileExW.cpp b/sal/systools/win32/uwinapi/MoveFileExW.cpp new file mode 100644 index 000000000000..134a1f4571c3 --- /dev/null +++ b/sal/systools/win32/uwinapi/MoveFileExW.cpp @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +IMPLEMENT_THUNK( kernel32, WINDOWS, BOOL, WINAPI, MoveFileExW, ( LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, DWORD dwFlags ) ) +{ + AUTO_WSTR2STR( lpExistingFileName ); + AUTO_WSTR2STR( lpNewFileName ); + + return MoveFileExA( lpExistingFileNameA, lpNewFileNameA, dwFlags ); +} + + diff --git a/sal/systools/win32/uwinapi/PathAddBackslashW.cpp b/sal/systools/win32/uwinapi/PathAddBackslashW.cpp new file mode 100644 index 000000000000..a6acecf6982e --- /dev/null +++ b/sal/systools/win32/uwinapi/PathAddBackslashW.cpp @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, LPWSTR, WINAPI, PathAddBackslashW, +( + LPWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + PathAddBackslashA(lpPathA); + STR2WSTR(lpPath, MAX_PATH); + return lpPathW + wcslen(lpPathW); +} diff --git a/sal/systools/win32/uwinapi/PathCompactPathExW.cpp b/sal/systools/win32/uwinapi/PathCompactPathExW.cpp new file mode 100644 index 000000000000..8c3ad013b744 --- /dev/null +++ b/sal/systools/win32/uwinapi/PathCompactPathExW.cpp @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, BOOL, WINAPI, PathCompactPathExW, +( + LPWSTR pszOut, + LPCWSTR lpPathW, + UINT cchMax, + DWORD dwFlags +)) +{ + AUTO_WSTR2STR(lpPath); + char* pOutA = (LPSTR)_alloca( cchMax * sizeof(CHAR) ); + BOOL bret = PathCompactPathExA(pOutA, lpPathA, cchMax, dwFlags); + MultiByteToWideChar(CP_ACP, 0, pOutA, -1, pszOut, (int) cchMax); + return bret; +}
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/PathFileExistsW.cpp b/sal/systools/win32/uwinapi/PathFileExistsW.cpp new file mode 100644 index 000000000000..9cf9c513cc0a --- /dev/null +++ b/sal/systools/win32/uwinapi/PathFileExistsW.cpp @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, BOOL, WINAPI, PathFileExistsW, +( + LPCWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + return PathFileExistsA(lpPathA); +} diff --git a/sal/systools/win32/uwinapi/PathFindExtensionW.cpp b/sal/systools/win32/uwinapi/PathFindExtensionW.cpp new file mode 100644 index 000000000000..1617f3b86b5e --- /dev/null +++ b/sal/systools/win32/uwinapi/PathFindExtensionW.cpp @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +#include <tchar.h> +#include <mbstring.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, LPWSTR, WINAPI, PathFindExtensionW, +( + LPCWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + char* pExt = PathFindExtensionA(lpPathA); + + if (*pExt) + { + *pExt = '\0'; + LPWSTR pOutW = const_cast<LPWSTR>(lpPathW); + return (pOutW + _mbslen(reinterpret_cast<unsigned char*>(lpPathA))); + } + else + return const_cast<LPWSTR>(lpPathW) + wcslen(lpPathW); +} diff --git a/sal/systools/win32/uwinapi/PathFindFileNameW.cpp b/sal/systools/win32/uwinapi/PathFindFileNameW.cpp new file mode 100644 index 000000000000..6d9854e6102a --- /dev/null +++ b/sal/systools/win32/uwinapi/PathFindFileNameW.cpp @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +#include <mbstring.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, LPWSTR, WINAPI, PathFindFileNameW, +( + LPCWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + char* pFname = PathFindFileNameA(lpPathA); + + if (pFname > lpPathA) + { + *pFname = '\0'; + LPWSTR pOutW = const_cast<LPWSTR>(lpPathW); + return (pOutW + _mbslen(reinterpret_cast<unsigned char*>(lpPathA))); + } + else + return const_cast<LPWSTR>(lpPathW); +} diff --git a/sal/systools/win32/uwinapi/PathIsFileSpecW.cpp b/sal/systools/win32/uwinapi/PathIsFileSpecW.cpp new file mode 100644 index 000000000000..eaf037c1dea1 --- /dev/null +++ b/sal/systools/win32/uwinapi/PathIsFileSpecW.cpp @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, BOOL, WINAPI, PathIsFileSpecW, +( + LPCWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + return PathIsFileSpecA(lpPathA); +} diff --git a/sal/systools/win32/uwinapi/PathIsUNCW.cpp b/sal/systools/win32/uwinapi/PathIsUNCW.cpp new file mode 100644 index 000000000000..a86c66236749 --- /dev/null +++ b/sal/systools/win32/uwinapi/PathIsUNCW.cpp @@ -0,0 +1,40 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, BOOL, WINAPI, PathIsUNCW, +( + LPCWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + return PathIsUNCA(lpPathA); +} diff --git a/sal/systools/win32/uwinapi/PathRemoveExtensionW.cpp b/sal/systools/win32/uwinapi/PathRemoveExtensionW.cpp new file mode 100644 index 000000000000..04a466c149bd --- /dev/null +++ b/sal/systools/win32/uwinapi/PathRemoveExtensionW.cpp @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, void, WINAPI, PathRemoveExtensionW, +( + LPWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + PathRemoveExtensionA(lpPathA); + STR2WSTR(lpPath, wcslen(lpPathW) + 1); +} diff --git a/sal/systools/win32/uwinapi/PathRemoveFileSpecW.cpp b/sal/systools/win32/uwinapi/PathRemoveFileSpecW.cpp new file mode 100644 index 000000000000..100eeedf2b6c --- /dev/null +++ b/sal/systools/win32/uwinapi/PathRemoveFileSpecW.cpp @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, BOOL, WINAPI, PathRemoveFileSpecW, +( + LPWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + BOOL bret = PathRemoveFileSpecA(lpPathA); + STR2WSTR(lpPath, wcslen(lpPathW) + 1); + return bret; +} diff --git a/sal/systools/win32/uwinapi/PathSetDlgItemPathW.cpp b/sal/systools/win32/uwinapi/PathSetDlgItemPathW.cpp new file mode 100644 index 000000000000..e855e674e47f --- /dev/null +++ b/sal/systools/win32/uwinapi/PathSetDlgItemPathW.cpp @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, void, WINAPI, PathSetDlgItemPathW, +( + HWND hDlg, + int id, + LPCWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + PathSetDlgItemPathA(hDlg, id, lpPathA); +} diff --git a/sal/systools/win32/uwinapi/PathStripToRootW.cpp b/sal/systools/win32/uwinapi/PathStripToRootW.cpp new file mode 100644 index 000000000000..bd912527a2bc --- /dev/null +++ b/sal/systools/win32/uwinapi/PathStripToRootW.cpp @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +#define _SHLWAPI_ +#include <shlwapi.h> + +IMPLEMENT_THUNK( shlwapi, WINDOWS, BOOL, WINAPI, PathStripToRootW, +( + LPWSTR lpPathW +)) +{ + AUTO_WSTR2STR(lpPath); + BOOL bret = PathStripToRootA(lpPathA); + STR2WSTR(lpPath, wcslen(lpPathW) + 1); + return bret; +} diff --git a/sal/systools/win32/uwinapi/ResolveThunk.cpp b/sal/systools/win32/uwinapi/ResolveThunk.cpp new file mode 100644 index 000000000000..d635b8c43b64 --- /dev/null +++ b/sal/systools/win32/uwinapi/ResolveThunk.cpp @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + + +EXTERN_C void WINAPI ResolveThunk_WINDOWS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ) +{ + FARPROC lpfnResult = (LONG)GetVersion() < 0 ? lpfnEmulate : GetProcAddress( LoadLibraryA( lpLibFileName ), lpFuncName ); + + if ( !lpfnResult ) + lpfnResult = lpfnEmulate; + + if ( !lpfnResult ) + lpfnResult = lpfnFailure; + + *lppfn = lpfnResult; +} + + +EXTERN_C void WINAPI ResolveThunk_TRYLOAD( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ) +{ + FARPROC lpfnResult = GetProcAddress( LoadLibraryA( lpLibFileName ), lpFuncName ); + + if ( !lpfnResult ) + lpfnResult = lpfnEmulate; + + if ( !lpfnResult ) + lpfnResult = lpfnFailure; + + *lppfn = lpfnResult; +} + + +EXTERN_C void WINAPI ResolveThunk_ALLWAYS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ) +{ + *lppfn = lpfnEmulate ? lpfnEmulate : lpfnFailure; +} + + diff --git a/sal/systools/win32/uwinapi/ResolveUnicows.cpp b/sal/systools/win32/uwinapi/ResolveUnicows.cpp new file mode 100644 index 000000000000..cd5943004f17 --- /dev/null +++ b/sal/systools/win32/uwinapi/ResolveUnicows.cpp @@ -0,0 +1,510 @@ +#ifdef __MINGW32__ +#define _GDI32_ +#include "macros.h" +#include <multimon.h> +extern "C" { +extern HMODULE hModuleUnicowsDLL; +} + +EXTERN_C void WINAPI ResolveThunk_UNICOWS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnFailure ) +{ + FARPROC lpfnResult = (((LONG)GetVersion()&0x800000ff) == 0x80000004) ? GetProcAddress( hModuleUnicowsDLL, lpFuncName ) : GetProcAddress( LoadLibraryA( lpLibFileName ), lpFuncName ); + + if ( !lpfnResult ) + lpfnResult = lpfnFailure; + + *lppfn = lpfnResult; +} + +static void GetProcAddress_Thunk(); +EXTERN_C { _declspec( dllexport ) FARPROC kernel32_GetProcAddress_Ptr = (FARPROC)GetProcAddress_Thunk; } +static FARPROC WINAPI GetProcAddress_Failure (HINSTANCE,LPCSTR); +static void GetProcAddress_Thunk() +{ + ResolveThunk_UNICOWS( &kernel32_GetProcAddress_Ptr, "kernel32.dll", "GetProcAddress", (FARPROC)GetProcAddress_Failure ); + asm(" movl %ebp, %esp"); + asm(" popl %ebp"); + asm(" jmp *(%0)"::"m"(kernel32_GetProcAddress_Ptr)); +} +EXTERN_C FARPROC WINAPI Internal_GetProcAddress (HINSTANCE,LPCSTR) +{ + asm(" popl %ebp"); + asm(" jmp *(%0)"::"m"(kernel32_GetProcAddress_Ptr)); +} +static FARPROC WINAPI GetProcAddress_Failure (HINSTANCE,LPCSTR) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return (FARPROC)0; +} + +#define DEFINE_UNICOWS_THUNK( module, rettype, calltype, func, params ) \ +static void func##_Thunk(); \ +EXTERN_C { _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; } \ +static rettype calltype func##_##Failure params; \ +static void func##_Thunk() \ +{ \ + ResolveThunk_UNICOWS( &module##_##func##_Ptr, #module ".dll", #func, (FARPROC)func##_##Failure ); \ + asm(" movl %ebp, %esp"); \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} \ +EXTERN_C rettype calltype func params \ +{ \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} \ +static rettype calltype func##_##Failure params \ +{ \ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); \ + return (rettype)0; \ +} + +DEFINE_UNICOWS_THUNK( kernel32, ATOM, WINAPI, AddAtomW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, AddFontResourceW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, AddJobW, (HANDLE,DWORD,PBYTE,DWORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, AddPortW, (LPWSTR,HWND,LPWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, AddPrintProcessorW, (LPWSTR,LPWSTR,LPWSTR,LPWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, AddPrintProvidorW, (LPWSTR,DWORD,PBYTE) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, AddPrinterDriverW, (LPWSTR,DWORD,PBYTE) ) +DEFINE_UNICOWS_THUNK( winspool, HANDLE, WINAPI, AddPrinterW, (LPWSTR,DWORD,PBYTE) ) +DEFINE_UNICOWS_THUNK( winspool, LONG, WINAPI, AdvancedDocumentPropertiesW, (HWND,HANDLE,LPWSTR,PDEVMODE,PDEVMODEW) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, AppendMenuW, (HMENU,UINT,UINT_PTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, BeginUpdateResourceW, (LPCWSTR,BOOL) ) +DEFINE_UNICOWS_THUNK( user32, long, WINAPI, BroadcastSystemMessageW, (DWORD,LPDWORD,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, BuildCommDCBAndTimeoutsW, (LPCWSTR,LPDCB,LPCOMMTIMEOUTS) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, BuildCommDCBW, (LPCWSTR,LPDCB) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, CallMsgFilterW, (LPMSG,int) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, CallNamedPipeW, (LPCWSTR,PVOID,DWORD,PVOID,DWORD,PDWORD,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, CallWindowProcA, (WNDPROC,HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, CallWindowProcW, (WNDPROC,HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, ChangeDisplaySettingsExW, (LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, ChangeDisplaySettingsW, (PDEVMODEW,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, ChangeMenuW, (HMENU,UINT,LPCWSTR,UINT,UINT) ) +DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, CharLowerBuffW, (LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, LPWSTR, WINAPI, CharLowerW, (LPWSTR) ) +DEFINE_UNICOWS_THUNK( user32, LPWSTR, WINAPI, CharNextW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, LPWSTR, WINAPI, CharPrevW, (LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, CharToOemBuffW, (LPCWSTR,LPSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, CharToOemW, (LPCWSTR,LPSTR) ) +DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, CharUpperBuffW, (LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, LPWSTR, WINAPI, CharUpperW, (LPWSTR) ) +DEFINE_UNICOWS_THUNK( comdlg32, BOOL, WINAPI, ChooseColorW, (LPCHOOSECOLORW) ) +DEFINE_UNICOWS_THUNK( comdlg32, BOOL, WINAPI, ChooseFontW, (LPCHOOSEFONTW) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, CommConfigDialogW, (LPCWSTR,HWND,LPCOMMCONFIG) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, CompareStringW, (LCID,DWORD,LPCWSTR,int,LPCWSTR,int) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, ConfigurePortW, (LPWSTR,HWND,LPWSTR) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, CopyAcceleratorTableW, (HACCEL,LPACCEL,int) ) +DEFINE_UNICOWS_THUNK( gdi32, HENHMETAFILE, WINAPI, CopyEnhMetaFileW, (HENHMETAFILE,LPCWSTR) ) +//DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, CopyFileExW, (LPCWSTR,LPCWSTR,LPPROGRESS_ROUTINE,LPVOID,LPBOOL,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, CopyFileW, (LPCWSTR,LPCWSTR,BOOL) ) +DEFINE_UNICOWS_THUNK( gdi32, HMETAFILE, WINAPI, CopyMetaFileW, (HMETAFILE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HACCEL, WINAPI, CreateAcceleratorTableW, (LPACCEL,int) ) +DEFINE_UNICOWS_THUNK( gdi32, HCOLORSPACE, WINAPI, CreateColorSpaceW, (LPLOGCOLORSPACEW) ) +DEFINE_UNICOWS_THUNK( gdi32, HDC, WINAPI, CreateDCW, (LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*) ) +DEFINE_UNICOWS_THUNK( user32, HWND, WINAPI, CreateDialogIndirectParamW, (HINSTANCE,LPCDLGTEMPLATE,HWND,DLGPROC,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, HWND, WINAPI, CreateDialogParamW, (HINSTANCE,LPCWSTR,HWND,DLGPROC,LPARAM) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, CreateDirectoryExW, (LPCWSTR,LPCWSTR,LPSECURITY_ATTRIBUTES) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, CreateDirectoryW, (LPCWSTR,LPSECURITY_ATTRIBUTES) ) +DEFINE_UNICOWS_THUNK( gdi32, HDC, WINAPI, CreateEnhMetaFileW, (HDC,LPCWSTR,LPCRECT,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, CreateEventW, (LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, CreateFileMappingW, (HANDLE,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, CreateFileW, (LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE) ) +DEFINE_UNICOWS_THUNK( gdi32, HFONT, WINAPI, CreateFontIndirectW, (const LOGFONTW*) ) +DEFINE_UNICOWS_THUNK( gdi32, HFONT, WINAPI, CreateFontW, (int,int,int,int,int,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, HDC, WINAPI, CreateICW, (LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*) ) +DEFINE_UNICOWS_THUNK( user32, HWND, WINAPI, CreateMDIWindowW, (LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HINSTANCE,LPARAM) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, CreateMailslotW, (LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES) ) +DEFINE_UNICOWS_THUNK( gdi32, HDC, WINAPI, CreateMetaFileW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, CreateMutexW, (LPSECURITY_ATTRIBUTES,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, CreateProcessW, (LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCWSTR,LPSTARTUPINFOW,LPPROCESS_INFORMATION) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, CreateScalableFontResourceW, (DWORD,LPCWSTR,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, CreateSemaphoreW, (LPSECURITY_ATTRIBUTES,LONG,LONG,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( oeacc, HRESULT, STDAPICALLTYPE, CreateStdAccessibleProxyW, (HWND, LPCWSTR, LONG, REFIID, void**) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, CreateWaitableTimerW, (LPSECURITY_ATTRIBUTES,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HWND, WINAPI, CreateWindowExW, (DWORD,LPCWSTR,LPCWSTR,DWORD,int,int,int,int,HWND,HMENU,HINSTANCE,LPVOID) ) +DEFINE_UNICOWS_THUNK( user32, HCONV, WINAPI, DdeConnect, (DWORD,HSZ,HSZ,PCONVCONTEXT) ) +DEFINE_UNICOWS_THUNK( user32, HCONVLIST, WINAPI, DdeConnectList, (DWORD,HSZ,HSZ,HCONVLIST,PCONVCONTEXT) ) +DEFINE_UNICOWS_THUNK( user32, HSZ, WINAPI, DdeCreateStringHandleW, (DWORD,LPCWSTR,int) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, DdeInitializeW, (PDWORD,PFNCALLBACK,DWORD,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, DdeQueryConvInfo, (HCONV,DWORD,PCONVINFO) ) +DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, DdeQueryStringW, (DWORD,HSZ,LPWSTR,DWORD,int) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, DefDlgProcW, (HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, DefFrameProcW, (HWND,HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, DefMDIChildProcW, (HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, DefWindowProcW, (HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, DeleteFileW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, DeleteMonitorW, (LPWSTR,LPWSTR,LPWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, DeletePortW, (LPWSTR,HWND,LPWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, DeletePrintProcessorW, (LPWSTR,LPWSTR,LPWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, DeletePrintProvidorW, (LPWSTR,LPWSTR,LPWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, DeletePrinterDriverW, (LPWSTR,LPWSTR,LPWSTR) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, DialogBoxIndirectParamW, (HINSTANCE,LPCDLGTEMPLATE,HWND,DLGPROC,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, DialogBoxParamW, (HINSTANCE,LPCWSTR,HWND,DLGPROC,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, DispatchMessageW, (const MSG*) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, DlgDirListComboBoxW, (HWND,LPWSTR,int,int,UINT) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, DlgDirListW, (HWND,LPWSTR,int,int,UINT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, DlgDirSelectComboBoxExW, (HWND,LPWSTR,int,int) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, DlgDirSelectExW, (HWND,LPWSTR,int,int) ) +DEFINE_UNICOWS_THUNK( shell32, UINT, WINAPI, DragQueryFileW, (HDROP,UINT,LPWSTR,UINT) ) +//DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, DrawStateW, (HDC,HBRUSH,DRAWSTATEPROC,LPARAM,WPARAM,int,int,int,int,UINT) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, DrawTextExW, (HDC,LPWSTR,int,LPRECT,UINT,LPDRAWTEXTPARAMS) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, DrawTextW, (HDC,LPCWSTR,int,LPRECT,UINT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, EnableWindow, (HWND,BOOL) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EndUpdateResourceW, (HANDLE,BOOL) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EnumCalendarInfoExW, (CALINFO_ENUMPROCEXW,LCID,CALID,CALTYPE) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EnumCalendarInfoW, (CALINFO_ENUMPROCW,LCID,CALID,CALTYPE) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, EnumClipboardFormats, (UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EnumDateFormatsExW, (DATEFMT_ENUMPROCEXW,LCID,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EnumDateFormatsW, (DATEFMT_ENUMPROCW,LCID,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, EnumDisplayDevicesW, (LPCWSTR,DWORD,PDISPLAY_DEVICEW,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, EnumDisplaySettingsExW, (LPCWSTR,DWORD,LPDEVMODEW,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, EnumDisplaySettingsW, (LPCWSTR,DWORD,PDEVMODEW) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, EnumFontFamiliesExW, (HDC,PLOGFONTW,FONTENUMPROCW,LPARAM,DWORD) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, EnumFontFamiliesW, (HDC,LPCWSTR,FONTENUMPROCW,LPARAM) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, EnumFontsW, (HDC,LPCWSTR,FONTENUMPROCW,LPARAM) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, EnumICMProfilesW, (HDC,ICMENUMPROCW,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, EnumPropsA, (HWND,PROPENUMPROCA) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, EnumPropsExA, (HWND,PROPENUMPROCEXA,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, EnumPropsExW, (HWND,PROPENUMPROCEXW,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, EnumPropsW, (HWND,PROPENUMPROCW) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EnumSystemCodePagesW, (CODEPAGE_ENUMPROCW,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EnumSystemLocalesW, (LOCALE_ENUMPROCW,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, EnumTimeFormatsW, (TIMEFMT_ENUMPROCW,LCID,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, ExpandEnvironmentStringsW, (LPCWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, ExtTextOutW, (HDC,int,int,UINT,LPCRECT,LPCWSTR,UINT,const INT*) ) +DEFINE_UNICOWS_THUNK( shell32, UINT, WINAPI, ExtractIconExW, (LPCWSTR,int,HICON*,HICON*,UINT) ) +DEFINE_UNICOWS_THUNK( shell32, HICON, WINAPI, ExtractIconW, (HINSTANCE,LPCWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, void, WINAPI, FatalAppExitW, (UINT,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FillConsoleOutputCharacterW, (HANDLE,WCHAR,DWORD,COORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, ATOM, WINAPI, FindAtomW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, FindFirstChangeNotificationW, (LPCWSTR,BOOL,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, FindFirstFileW, (LPCWSTR,LPWIN32_FIND_DATAW) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FindNextFileW, (HANDLE,LPWIN32_FIND_DATAW) ) +DEFINE_UNICOWS_THUNK( kernel32, HRSRC, WINAPI, FindResourceExW, (HINSTANCE,LPCWSTR,LPCWSTR,WORD) ) +DEFINE_UNICOWS_THUNK( kernel32, HRSRC, WINAPI, FindResourceW, (HINSTANCE,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( comdlg32, HWND, WINAPI, FindTextW, (LPFINDREPLACEW) ) +DEFINE_UNICOWS_THUNK( user32, HWND, WINAPI, FindWindowExW, (HWND,HWND,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HWND, WINAPI, FindWindowW, (LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, FormatMessageW, (DWORD,PCVOID,DWORD,DWORD,LPWSTR,DWORD,va_list*) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FreeEnvironmentStringsW, (LPWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FtpCreateDirectoryW, (HANDLE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FtpDeleteFileW, (HANDLE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, FtpFindFirstFileW, (HANDLE,LPCWSTR,LPWIN32_FIND_DATA,DWORD,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FtpGetCurrentDirectoryW, (HANDLE,LPWSTR,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FtpRemoveDirectoryW, (HANDLE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, FtpSetCurrentDirectoryW, (HANDLE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GetAltTabInfoW, (HWND,int,PALTTABINFO,LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetAtomNameW, (ATOM,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetCPInfo, (UINT,LPCPINFO) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetCPInfoExA, (UINT,DWORD,LPCPINFOEXA) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetCPInfoExW, (UINT,DWORD,LPCPINFOEXW) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, GetCalendarInfoW, (LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetCharABCWidthsW, (HDC,UINT,UINT,LPABC) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetCharWidthFloatW, (HDC,UINT,UINT,PFLOAT) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetCharWidthW, (HDC,UINT,UINT,LPINT) ) +DEFINE_UNICOWS_THUNK( gdi32, DWORD, WINAPI, GetCharacterPlacementW, (HDC,LPCWSTR,int,int,LPGCP_RESULTSW,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GetClassInfoExW, (HINSTANCE,LPCWSTR,LPWNDCLASSEXW) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GetClassInfoW, (HINSTANCE,LPCWSTR,LPWNDCLASSW) ) +DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, GetClassLongW, (HWND,int) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, GetClassNameW, (HWND,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( user32, HANDLE, WINAPI, GetClipboardData, (UINT) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, GetClipboardFormatNameW, (UINT,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetComputerNameW, (LPWSTR,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetConsoleTitleW, (LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, GetCurrencyFormatW, (LCID,DWORD,LPCWSTR,const CURRENCYFMTW*,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetCurrentDirectoryW, (DWORD,LPWSTR) ) +DEFINE_UNICOWS_THUNK( advapi32, BOOL, WINAPI, GetCurrentHwProfileW, (LPHW_PROFILE_INFOW) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, GetDateFormatW, (LCID,DWORD,const SYSTEMTIME*,LPCWSTR,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetDefaultCommConfigW, (LPCWSTR,LPCOMMCONFIG,PDWORD) ) +//DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetDiskFreeSpaceExW, (LPCWSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetDiskFreeSpaceW, (LPCWSTR,PDWORD,PDWORD,PDWORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, GetDlgItemTextW, (HWND,int,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetDriveTypeW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, UINT, WINAPI, GetEnhMetaFileDescriptionW, (HENHMETAFILE,UINT,LPWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, HENHMETAFILE, WINAPI, GetEnhMetaFileW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, LPWSTR, WINAPI, GetEnvironmentStringsW, (void) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetEnvironmentVariableW, (LPCWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetFileAttributesExW, (LPCWSTR,GET_FILEEX_INFO_LEVELS,PVOID) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetFileAttributesW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( comdlg32, short, WINAPI, GetFileTitleW, (LPCWSTR,LPWSTR,WORD) ) +DEFINE_UNICOWS_THUNK( version, DWORD, WINAPI, GetFileVersionInfoSizeW, (LPWSTR,PDWORD) ) +DEFINE_UNICOWS_THUNK( version, BOOL, WINAPI, GetFileVersionInfoW, (LPWSTR,DWORD,DWORD,PVOID) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetFullPathNameW, (LPCWSTR,DWORD,LPWSTR,LPWSTR*) ) +DEFINE_UNICOWS_THUNK( gdi32, DWORD, WINAPI, GetGlyphOutlineW, (HDC,UINT,UINT,LPGLYPHMETRICS,DWORD,PVOID,const MAT2*) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetICMProfileW, (HDC,LPDWORD,LPWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, DWORD, WINAPI, GetKerningPairsW, (HDC,DWORD,LPKERNINGPAIR) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, GetKeyNameTextW, (LONG,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GetKeyboardLayoutNameW, (LPWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, GetLocaleInfoW, (LCID,LCTYPE,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetLogColorSpaceW, (HCOLORSPACE,LPLOGCOLORSPACEW,DWORD) ) +//DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetLogicalDriveStringsW, (DWORD,LPWSTR) ) +//DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetLongPathNameW, (LPCWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GetMenuItemInfoW, (HMENU,UINT,BOOL,LPMENUITEMINFOW) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, GetMenuStringW, (HMENU,UINT,LPWSTR,int,UINT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GetMessageW, (LPMSG,HWND,UINT,UINT) ) +DEFINE_UNICOWS_THUNK( gdi32, HMETAFILE, WINAPI, GetMetaFileW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetModuleFileNameW, (HINSTANCE,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, HMODULE, WINAPI, GetModuleHandleW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GetMonitorInfoW, (HMONITOR,LPMONITORINFO) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetNamedPipeHandleStateW, (HANDLE,PDWORD,PDWORD,PDWORD,PDWORD,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, GetNumberFormatW, (LCID,DWORD,LPCWSTR,const NUMBERFMTW*,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, GetObjectW, (HGDIOBJ,int,PVOID) ) +DEFINE_UNICOWS_THUNK( msvfw32, BOOL, WINAPI, GetOpenFileNamePreviewW, (LPOPENFILENAMEW) ) +DEFINE_UNICOWS_THUNK( comdlg32, BOOL, WINAPI, GetOpenFileNameW, (LPOPENFILENAMEW) ) +DEFINE_UNICOWS_THUNK( gdi32, UINT, WINAPI, GetOutlineTextMetricsW, (HDC,UINT,LPOUTLINETEXTMETRICW) ) +DEFINE_UNICOWS_THUNK( winspool, DWORD, WINAPI, GetPrintProcessorDirectoryW, (LPWSTR,LPWSTR,DWORD,PBYTE,DWORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetPrivateProfileIntW, (LPCWSTR,LPCWSTR,INT,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetPrivateProfileSectionNamesW, (LPWSTR,DWORD,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetPrivateProfileSectionW, (LPCWSTR,LPWSTR,DWORD,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetPrivateProfileStringW, (LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,DWORD,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetPrivateProfileStructW, (LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetProfileIntW, (LPCWSTR,LPCWSTR,INT) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetProfileSectionW, (LPCWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetProfileStringW, (LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, HANDLE, WINAPI, GetPropA, (HWND,LPCSTR) ) +DEFINE_UNICOWS_THUNK( user32, HANDLE, WINAPI, GetPropW, (HWND,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( oleacc, UINT, WINAPI, GetRoleTextW, (DWORD,LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( msvfw32, BOOL, WINAPI, GetSaveFileNamePreviewW, (LPOPENFILENAMEW) ) +DEFINE_UNICOWS_THUNK( comdlg32, BOOL, WINAPI, GetSaveFileNameW, (LPOPENFILENAMEW) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetShortPathNameW, (LPCWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, VOID, WINAPI, GetStartupInfoW, (LPSTARTUPINFOW) ) +DEFINE_UNICOWS_THUNK( oleacc, UINT, WINAPI, GetStateTextW, (DWORD,LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetStringTypeExW, (LCID,DWORD,LPCWSTR,int,LPWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetStringTypeW, (DWORD,LPCWSTR,int,LPWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetSystemDirectoryW, (LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetSystemWindowsDirectoryW, (LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, GetTabbedTextExtentW, (HDC,LPCWSTR,int,int,CONST INT*) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetTempFileNameW, (LPCWSTR,LPCWSTR,UINT,LPWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, GetTempPathW, (DWORD,LPWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetTextExtentExPointW, ( HDC,LPCWSTR,int,int,LPINT,LPINT,LPSIZE ) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetTextExtentPoint32W, ( HDC,LPCWSTR,int,LPSIZE) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetTextExtentPointW, (HDC,LPCWSTR,int,LPSIZE) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, GetTextFaceW, (HDC,int,LPWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, GetTextMetricsW, (HDC,LPTEXTMETRICW) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, GetTimeFormatW, (LCID,DWORD,const SYSTEMTIME*,LPCWSTR,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( advapi32, BOOL, WINAPI, GetUserNameW, (LPWSTR,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetVersionExW, (LPOSVERSIONINFOW) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, GetVolumeInformationW, (LPCWSTR,LPWSTR,DWORD,PDWORD,PDWORD,PDWORD,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, GetWindowLongA, (HWND,int) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, GetWindowLongW, (HWND,int) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, GetWindowModuleFileNameW, (HWND,LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, GetWindowTextLengthW, (HWND) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, GetWindowTextW, (HWND,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GetWindowsDirectoryW, (LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, ATOM, WINAPI, GlobalAddAtomW, ( LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, ATOM, WINAPI, GlobalFindAtomW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, UINT, WINAPI, GlobalGetAtomNameW, (ATOM,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, GopherFindFirstFileW, (HANDLE,LPCWSTR,LPCWSTR,LPVOID,DWORD,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, GrayStringW, (HDC,HBRUSH,GRAYSTRINGPROC,LPARAM,int,int,int,int,int) ) +DEFINE_UNICOWS_THUNK( user32, HANDLE, WINAPI, ImageList_LoadImageW, (HINSTANCE,LPCWSTR,int,int,COLORREF,UINT,UINT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, InsertMenuItemW, (HMENU,UINT,BOOL,LPCMENUITEMINFOW) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, InsertMenuW, (HMENU,UINT,UINT,UINT,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, InternetFindNextFileW, (HANDLE,PVOID) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, IsBadStringPtrW, (LPCWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, IsCharAlphaNumericW, (WCHAR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, IsCharAlphaW, (WCHAR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, IsCharLowerW, (WCHAR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, IsCharUpperW, (WCHAR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, IsClipboardFormatAvailable, (UINT) ) +DEFINE_UNICOWS_THUNK( sensapi, BOOL, APIENTRY, IsDestinationReachableW, (LPCWSTR,LPVOID) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, IsDialogMessageW, (HWND,LPMSG) ) +DEFINE_UNICOWS_THUNK( advapi32, BOOL, WINAPI, IsTextUnicode, (PCVOID,int,LPINT) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, IsValidCodePage, (UINT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, IsWindowUnicode, (HWND) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, LCMapStringW, (LCID,DWORD,LPCWSTR,int,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( user32, HACCEL, WINAPI, LoadAcceleratorsW, (HINSTANCE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HBITMAP, WINAPI, LoadBitmapW, (HINSTANCE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HCURSOR, WINAPI, LoadCursorFromFileW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HCURSOR, WINAPI, LoadCursorW, (HINSTANCE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HICON, WINAPI, LoadIconW, (HINSTANCE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HANDLE, WINAPI, LoadImageW, (HINSTANCE,LPCWSTR,UINT,int,int,UINT) ) +DEFINE_UNICOWS_THUNK( user32, HKL, WINAPI, LoadKeyboardLayoutW, (LPCWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, HINSTANCE, WINAPI, LoadLibraryExW, (LPCWSTR,HANDLE,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, HINSTANCE, WINAPI, LoadLibraryW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HMENU, WINAPI, LoadMenuIndirectW, (const MENUTEMPLATE*) ) +DEFINE_UNICOWS_THUNK( user32, HMENU, WINAPI, LoadMenuW, (HINSTANCE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, LoadStringW, (HINSTANCE,UINT,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( user32, HINSTANCE, WINAPI, MLLoadLibraryW, (LPCWSTR,HANDLE,DWORD,LPCWSTR,BOOL) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, MapVirtualKeyExW, (UINT,UINT,HKL) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, MapVirtualKeyW, (UINT,UINT) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, MessageBoxExW, (HWND,LPCWSTR,LPCWSTR,UINT,WORD) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, MessageBoxIndirectW, (CONST MSGBOXPARAMSW*) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, MessageBoxW, (HWND,LPCWSTR,LPCWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, ModifyMenuW, (HMENU,UINT,UINT,UINT,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, MoveFileW, (LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, MultiByteToWideChar, (UINT,DWORD,LPCSTR,int,LPWSTR,int) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, MultinetGetConnectionPerformanceW, (LPNETRESOURCEW,LPNETCONNECTINFOSTRUCT) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, OemToCharBuffW, (LPCSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, OemToCharW, (LPCSTR,LPWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, OpenEventW, (DWORD,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, OpenFileMappingW, (DWORD,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, OpenMutexW, (DWORD,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, OpenPrinterW, (LPWSTR,PHANDLE,LPPRINTER_DEFAULTSW) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, OpenSemaphoreW, (DWORD,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, HANDLE, WINAPI, OpenWaitableTimerW, (DWORD,BOOL,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, void, WINAPI, OutputDebugStringW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( comdlg32, BOOL, WINAPI, PageSetupDlgW, (LPPAGESETUPDLGW) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, PeekConsoleInputW, (HANDLE,PINPUT_RECORD,DWORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, PeekMessageW, (LPMSG,HWND,UINT,UINT,UINT) ) +DEFINE_UNICOWS_THUNK( winmm, BOOL, WINAPI, PlaySoundW, (LPCWSTR,HMODULE,DWORD) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, PolyTextOutW, (HDC,const POLYTEXTW*,int) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, PostMessageW, (HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, PostThreadMessageW, (DWORD,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( comdlg32, BOOL, WINAPI, PrintDlgW, (LPPRINTDLGW) ) +DEFINE_UNICOWS_THUNK( comdlg32, DWORD, WINAPI, PrinterMessageBoxW, (HANDLE,DWORD,HWND,LPWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, QueryDosDeviceW, (LPCWSTR,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasConnectionNotificationW, (HANDLE, HANDLE, DWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasCreatePhonebookEntryW, (HWND, LPCWSTR) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasDeleteEntryW, (LPCWSTR, LPCWSTR) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasDeleteSubEntryW, (LPCWSTR, LPCWSTR, DWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasEditPhonebookEntryW, (HWND, LPCWSTR, LPCWSTR) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasEnumConnectionsW, (LPVOID, LPDWORD, LPDWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasEnumDevicesW, (LPVOID, LPDWORD, LPDWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasEnumEntriesW, (LPCWSTR, LPCWSTR, LPVOID, LPDWORD, LPDWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasGetConnectStatusW, (HANDLE, LPVOID) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasGetEntryDialParamsW, (LPCWSTR, LPVOID, LPBOOL) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasGetEntryPropertiesW, (LPCWSTR, LPCWSTR, LPVOID, LPDWORD, LPBYTE, LPDWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasGetErrorStringW, (UINT, LPWSTR, DWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasHangUpW, (HANDLE) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasRenameEntryW, (LPCWSTR, LPCWSTR, LPCWSTR) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasSetEntryDialParamsW, (LPCWSTR, LPVOID, BOOL) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasSetEntryPropertiesW, (LPCWSTR, LPCWSTR, LPVOID, DWORD, LPBYTE, DWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasSetSubEntryPropertiesW, (LPCWSTR, LPCWSTR, DWORD, LPVOID, DWORD, LPBYTE, DWORD) ) +DEFINE_UNICOWS_THUNK( rasapi32, DWORD, APIENTRY, RasValidateEntryNameW, (LPCWSTR, LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, ReadConsoleInputW, (HANDLE,PINPUT_RECORD,DWORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, ReadConsoleOutputCharacterW, (HANDLE,LPWSTR,DWORD,COORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, ReadConsoleOutputW, (HANDLE,PCHAR_INFO,COORD,COORD,PSMALL_RECT) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, ReadConsoleW, (HANDLE,PVOID,DWORD,PDWORD,PVOID) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegConnectRegistryW, (LPCWSTR,HKEY,PHKEY) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegCreateKeyExW, (HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,LPSECURITY_ATTRIBUTES,PHKEY,PDWORD) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegCreateKeyW, (HKEY,LPCWSTR,PHKEY) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegDeleteKeyW, (HKEY,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegDeleteValueW, (HKEY,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegEnumKeyExW, (HKEY,DWORD,LPWSTR,PDWORD,PDWORD,LPWSTR,PDWORD,PFILETIME) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegEnumKeyW, (HKEY,DWORD,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegEnumValueW, (HKEY,DWORD,LPWSTR,PDWORD,PDWORD,PDWORD,LPBYTE,PDWORD) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegLoadKeyW, (HKEY,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegOpenKeyExW, (HKEY,LPCWSTR,DWORD,REGSAM,PHKEY) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegOpenKeyW, (HKEY,LPCWSTR,PHKEY) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegQueryInfoKeyW, (HKEY,LPWSTR,PDWORD,PDWORD,PDWORD,PDWORD,PDWORD,PDWORD,PDWORD,PDWORD,PDWORD,PFILETIME) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegQueryMultipleValuesW, (HKEY,PVALENTW,DWORD,LPWSTR,LPDWORD) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegQueryValueExW, (HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegQueryValueW, (HKEY,LPCWSTR,LPWSTR,PLONG) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegReplaceKeyW, (HKEY,LPCWSTR,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegSaveKeyW, (HKEY,LPCWSTR,LPSECURITY_ATTRIBUTES) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegSetValueExW, (HKEY,LPCWSTR,DWORD,DWORD,const BYTE*,DWORD) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegSetValueW, (HKEY,LPCWSTR,DWORD,LPCWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( advapi32, LONG, WINAPI, RegUnLoadKeyW, (HKEY,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, ATOM, WINAPI, RegisterClassExW, (CONST WNDCLASSEXW*) ) +DEFINE_UNICOWS_THUNK( user32, ATOM, WINAPI, RegisterClassW, (CONST WNDCLASSW*) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, RegisterClipboardFormatW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HDEVNOTIFY, WINAPI, RegisterDeviceNotificationW, (HANDLE,LPVOID,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, UINT, WINAPI, RegisterWindowMessageW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, RemoveDirectoryW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, RemoveFontResourceW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HANDLE, WINAPI, RemovePropA, (HWND,LPCSTR) ) +DEFINE_UNICOWS_THUNK( user32, HANDLE, WINAPI, RemovePropW, (HWND,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( comdlg32, HWND, WINAPI, ReplaceTextW, (LPFINDREPLACEW) ) +DEFINE_UNICOWS_THUNK( gdi32, HDC, WINAPI, ResetDCW, (HDC,const DEVMODEW*) ) +DEFINE_UNICOWS_THUNK( shell32, LPVOID, WINAPI, SHBrowseForFolderW, (LPVOID) ) +DEFINE_UNICOWS_THUNK( shell32, void, WINAPI, SHChangeNotify, (LONG,UINT,PCVOID,PCVOID) ) +DEFINE_UNICOWS_THUNK( shell32, INT, WINAPI, SHCreateDirectoryExW, (HWND,LPCWSTR,LPSECURITY_ATTRIBUTES) ) +DEFINE_UNICOWS_THUNK( shell32, int, WINAPI, SHFileOperationW, (LPSHFILEOPSTRUCTW) ) +DEFINE_UNICOWS_THUNK( shell32, DWORD, WINAPI, SHGetFileInfoW, (LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT) ) +DEFINE_UNICOWS_THUNK( shell32, BOOL, WINAPI, SHGetNewLinkInfoW, (LPCWSTR,DWORD,SHFILEINFOW*,UINT,UINT) ) +DEFINE_UNICOWS_THUNK( shell32, BOOL, WINAPI, SHGetPathFromIDListW, (LPVOID,LPWSTR) ) +DEFINE_UNICOWS_THUNK( shell32, int, __stdcall, SQLGetPrivateProfileStringW, (LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,int,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( shell32, BOOL, __stdcall, SQLWritePrivateProfileStringW, (LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, ScrollConsoleScreenBufferW, (HANDLE,const SMALL_RECT*,const SMALL_RECT*,COORD,const CHAR_INFO*) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, SearchPathW, (LPCWSTR,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPWSTR*) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, SendDlgItemMessageW, (HWND,int,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SendMessageCallbackW, (HWND,UINT,WPARAM,LPARAM,SENDASYNCPROC,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, SendMessageTimeoutW, (HWND,UINT,WPARAM,LPARAM,UINT,UINT,PDWORD) ) +DEFINE_UNICOWS_THUNK( user32, LRESULT, WINAPI, SendMessageW, (HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SendNotifyMessageW, (HWND,UINT,WPARAM,LPARAM) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, SetCalendarInfoW, (LCID,CALID,CALTYPE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, SetClassLongW, (HWND,int,LONG) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetComputerNameW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetConsoleTitleW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetCurrentDirectoryW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetDefaultCommConfigW, (LPCWSTR,LPCOMMCONFIG,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SetDlgItemTextW, (HWND,int,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetEnvironmentVariableW, (LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetFileAttributesW, (LPCWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, SetICMProfileW, (HDC,LPWSTR) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, SetJobW, (HANDLE,DWORD,DWORD,PBYTE,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetLocaleInfoW, (LCID,LCTYPE,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SetMenuItemInfoW, ( HMENU,UINT,BOOL,LPCMENUITEMINFOW) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, SetPrinterDataW, (HANDLE,LPWSTR,DWORD,PBYTE,DWORD) ) +DEFINE_UNICOWS_THUNK( winspool, BOOL, WINAPI, SetPrinterW, (HANDLE,DWORD,PBYTE,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SetPropA, (HWND,LPCSTR,HANDLE) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SetPropW, (HWND,LPCWSTR,HANDLE) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, SetVolumeLabelW, (LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, SetWindowLongA, (HWND,int,LONG) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, SetWindowLongW, (HWND,int,LONG) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SetWindowTextW, (HWND,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( user32, HHOOK, WINAPI, SetWindowsHookExW, (int,HOOKPROC,HINSTANCE,DWORD) ) +DEFINE_UNICOWS_THUNK( user32, HHOOK, WINAPI, SetWindowsHookW, (int,HOOKPROC) ) +DEFINE_UNICOWS_THUNK( shell32, int, WINAPI, ShellAboutW, (HWND,LPCWSTR,LPCWSTR,HICON) ) +DEFINE_UNICOWS_THUNK( shell32, BOOL, WINAPI, ShellExecuteExW, (LPSHELLEXECUTEINFOW) ) +DEFINE_UNICOWS_THUNK( shell32, HINSTANCE, WINAPI, ShellExecuteW, (HWND,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR,INT) ) +DEFINE_UNICOWS_THUNK( shell32, BOOL, WINAPI, Shell_NotifyIconW, (DWORD,PNOTIFYICONDATAW) ) +DEFINE_UNICOWS_THUNK( winspool, DWORD, WINAPI, StartDocPrinterW, (HANDLE,DWORD,PBYTE) ) +DEFINE_UNICOWS_THUNK( gdi32, int, WINAPI, StartDocW, (HDC,const DOCINFOW*) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, SystemParametersInfoW, (UINT,UINT,PVOID,UINT) ) +DEFINE_UNICOWS_THUNK( user32, LONG, WINAPI, TabbedTextOutW, (HDC,int,int,LPCWSTR,int,int,CONST INT*,int) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, TextOutW, (HDC,int,int,LPCWSTR,int) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, TranslateAcceleratorW, (HWND,HACCEL,LPMSG) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, UnregisterClassW, (LPCWSTR,HINSTANCE) ) +DEFINE_UNICOWS_THUNK( gdi32, BOOL, WINAPI, UpdateICMRegKeyW, (DWORD,LPWSTR,LPWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, UpdateResourceW, (HANDLE,LPCWSTR,LPCWSTR,WORD,PVOID,DWORD) ) +DEFINE_UNICOWS_THUNK( version, DWORD, WINAPI, VerFindFileW, (DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT,LPWSTR,PUINT) ) +DEFINE_UNICOWS_THUNK( version, DWORD, WINAPI, VerInstallFileW, (DWORD,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,LPWSTR,PUINT) ) +DEFINE_UNICOWS_THUNK( kernel32, DWORD, WINAPI, VerLanguageNameW, (DWORD,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( version, BOOL, WINAPI, VerQueryValueW, (const LPVOID,LPWSTR,LPVOID*,PUINT) ) +DEFINE_UNICOWS_THUNK( user32, SHORT, WINAPI, VkKeyScanExW, (WCHAR,HKL) ) +DEFINE_UNICOWS_THUNK( user32, SHORT, WINAPI, VkKeyScanW, (WCHAR) ) +DEFINE_UNICOWS_THUNK( user32, DWORD, WINAPI, SetupDecompressOrCopyFileW, (PCWSTR,PCWSTR,PUINT) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetAddConnection2W, (LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetAddConnection3W, (HWND,LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetAddConnectionW, (LPCWSTR,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetCancelConnection2W, (LPCWSTR,DWORD,BOOL) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetCancelConnectionW, (LPCWSTR,BOOL) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetConnectionDialog1W, (LPCONNECTDLGSTRUCTW) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetDisconnectDialog1W, (LPDISCDLGSTRUCTW) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetEnumResourceW, (HANDLE,PDWORD,PVOID,PDWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetConnectionW, (LPCWSTR,LPWSTR,PDWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetLastErrorW, (PDWORD,LPWSTR,DWORD,LPWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetNetworkInformationW, (LPCWSTR,LPNETINFOSTRUCT) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetProviderNameW, (DWORD,LPWSTR,PDWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetResourceInformationW, (LPNETRESOURCEW,LPVOID,LPDWORD,LPWSTR*) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetResourceParentW, (LPNETRESOURCEW,LPVOID,LPDWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetUniversalNameW, (LPCWSTR,DWORD,PVOID,PDWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetGetUserW, (LPCWSTR,LPWSTR,PDWORD) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetOpenEnumW, (DWORD,DWORD,DWORD,LPNETRESOURCEW,LPHANDLE) ) +DEFINE_UNICOWS_THUNK( mpr, DWORD, APIENTRY, WNetUseConnectionW, (HWND,LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD,LPWSTR,PDWORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WaitNamedPipeW, (LPCWSTR,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, WideCharToMultiByte, (UINT,DWORD,LPCWSTR,int,LPSTR,int,LPCSTR,LPBOOL) ) +DEFINE_UNICOWS_THUNK( user32, BOOL, WINAPI, WinHelpW, (HWND,LPCWSTR,UINT,DWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WriteConsoleInputW, (HANDLE,const INPUT_RECORD*,DWORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WriteConsoleOutputCharacterW, (HANDLE,LPCWSTR,DWORD,COORD,PDWORD) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WriteConsoleOutputW, (HANDLE,const CHAR_INFO*,COORD,COORD,PSMALL_RECT) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WriteConsoleW, (HANDLE,PCVOID,DWORD,PDWORD,PVOID) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WritePrivateProfileSectionW, (LPCWSTR,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WritePrivateProfileStringW, (LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WritePrivateProfileStructW, (LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WriteProfileSectionW, (LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, BOOL, WINAPI, WriteProfileStringW, (LPCWSTR,LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( avicap32, HWND, WINAPI, capCreateCaptureWindowW, (LPCWSTR, DWORD, int, int, int, int, HWND, int) ) +DEFINE_UNICOWS_THUNK( avicap32, BOOL, WINAPI, capGetDriverDescriptionW, (UINT, LPWSTR, int, LPWSTR, int) ) +DEFINE_UNICOWS_THUNK( kernel32, LPWSTR, WINAPI, lstrcatW, (LPWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, lstrcmpW, (LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, lstrcmpiW, ( LPCWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, LPWSTR, WINAPI, lstrcpyW, (LPWSTR,LPCWSTR) ) +DEFINE_UNICOWS_THUNK( kernel32, LPWSTR, WINAPI, lstrcpynW, (LPWSTR,LPCWSTR,int) ) +DEFINE_UNICOWS_THUNK( kernel32, int, WINAPI, lstrlenW, (LPCWSTR) ) +DEFINE_UNICOWS_THUNK( winmm, BOOL, WINAPI, sndPlaySoundW, (LPCWSTR,UINT) ) +DEFINE_UNICOWS_THUNK( winmm, PROC, WINAPI, wglGetProcAddress, (LPCSTR) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPIV, wsprintfW, (LPWSTR,LPCWSTR,...) ) +DEFINE_UNICOWS_THUNK( user32, int, WINAPI, wvsprintfW, (LPWSTR,LPCWSTR,va_list arglist) ) +#endif diff --git a/sal/systools/win32/uwinapi/SHCreateItemFromParsingName.cpp b/sal/systools/win32/uwinapi/SHCreateItemFromParsingName.cpp new file mode 100644 index 000000000000..e3be7348eb73 --- /dev/null +++ b/sal/systools/win32/uwinapi/SHCreateItemFromParsingName.cpp @@ -0,0 +1,33 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4740) +#endif + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( shell32, TRYLOAD, HRESULT, WINAPI, SHCreateItemFromParsingName, (PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/SHILCreateFromPathW.cpp b/sal/systools/win32/uwinapi/SHILCreateFromPathW.cpp new file mode 100644 index 000000000000..f00eae8025b6 --- /dev/null +++ b/sal/systools/win32/uwinapi/SHILCreateFromPathW.cpp @@ -0,0 +1,32 @@ +#include "uwinapi.h" + +EXTERN_C LPITEMIDLIST WINAPI SHSimpleIDListFromPathW_Failure( LPCWSTR lpPathW ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return NULL; +} + +EXTERN_C LPITEMIDLIST WINAPI SHSimpleIDListFromPathW_WINDOWS( LPCWSTR lpPathW ) +{ + AUTO_WSTR2STR( lpPath ); + + return SHSimpleIDListFromPathA( lpPathA ); +} + + +EXTERN_C void WINAPI ResolveThunk_SHSimpleIDListFromPathW( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName ) +{ + if ( (LONG)GetVersion < 0 ) + *lppfn = (FARPROC)SHSimpleIDListFromPathW_WINDOWS; + else + { + FARPROC lpfnResult = GetProcAddress( LoadLibraryA( lpLibFileName ), MAKEINTRESOURCE(162) ); + if ( !lpfnResult ) + lpfnResult = (FARPROC)SHSimpleIDListFromPathW_Failure; + + *lppfn = lpfnResult; + } +} + + +DEFINE_CUSTOM_THUNK( kernel32, GetLongPathNameW, DWORD, WINAPI, GetLongPathNameW, ( LPCWSTR lpShortPathW, LPWSTR lpLongPathW, DWORD cchBuffer ) ); diff --git a/sal/systools/win32/uwinapi/SetVolumeMountPointA.cpp b/sal/systools/win32/uwinapi/SetVolumeMountPointA.cpp new file mode 100644 index 000000000000..597bdd6ca3bd --- /dev/null +++ b/sal/systools/win32/uwinapi/SetVolumeMountPointA.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, SetVolumeMountPointA, (LPCSTR lpszVolumeMountPoint, LPCSTR lpszVolumeName) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/SetVolumeMountPointW.cpp b/sal/systools/win32/uwinapi/SetVolumeMountPointW.cpp new file mode 100644 index 000000000000..e438b742ee91 --- /dev/null +++ b/sal/systools/win32/uwinapi/SetVolumeMountPointW.cpp @@ -0,0 +1,30 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "macros.h" + +DEFINE_DEFAULT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, SetVolumeMountPointW, (LPCWSTR lpszVolumeMountPoint, LPCWSTR lpszVolumeName) )
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/Uwinapi.def b/sal/systools/win32/uwinapi/Uwinapi.def new file mode 100644 index 000000000000..58893d5a54ad --- /dev/null +++ b/sal/systools/win32/uwinapi/Uwinapi.def @@ -0,0 +1,22 @@ +EXPORTS
+ CommandLineToArgvW
+ CopyFileW
+ CopyFileExW
+ CopyFileExA
+ DeleteFileW
+ DrawStateW
+ GetLogicalDriveStringsW
+ GetLongPathNameA
+ GetLongPathNameW
+ LoadLibraryExW
+ LoadLibraryW
+ MoveFileExA
+ MoveFileExW
+ MoveFileW
+ GetVersion
+ DllGetVersion
+ lstrrchrA
+ lstrrchrW
+ lstrchrA
+ lstrchrW
+
diff --git a/sal/systools/win32/uwinapi/Uwinapi.h b/sal/systools/win32/uwinapi/Uwinapi.h new file mode 100644 index 000000000000..45a8645f43e4 --- /dev/null +++ b/sal/systools/win32/uwinapi/Uwinapi.h @@ -0,0 +1,137 @@ +#pragma once + +#ifdef _UWINAPI_ +#define _KERNEL32_ +#define _USER32_ +#define _SHELL32_ +#endif + +#include <windows.h> +#include <malloc.h> + +#ifndef _UWINAPI_ +EXTERN_C WINBASEAPI DWORD UWINAPI_dwFakedVersion; +#endif + +EXTERN_C WINBASEAPI DWORD SetVersion( DWORD dwVersion ); + +/* Version macros */ + +#define MAKE_VER_WIN32( major, minor, build, isWindows ) \ +((DWORD)MAKELONG( MAKEWORD( major, minor ), (build) | ( isWindows ? 0x8000 : 0 ) )) + +#define MAKE_VER_WIN32_NT( major, minor, build ) \ + MAKE_VER_WIN32( major, minor, build, FALSE ) + +#define MAKE_VER_WIN32_WINDOWS( major, minor, build ) \ + MAKE_VER_WIN32( major, minor, build, TRUE ) + +#define VER_WIN32_WINDOWS_95 MAKE_VER_WIN32_WINDOWS( 4, 0, 0 ) +#define VER_WIN32_WINDOWS_98 MAKE_VER_WIN32_WINDOWS( 4, 10, 0 ) +#define VER_WIN32_WINDOWS_ME MAKE_VER_WIN32_WINDOWS( 4, 90, 0 ) +#define VER_WIN32_NT_NT4 MAKE_VER_WIN32_NT( 4, 0, 0 ) +#define VER_WIN32_NT_2000 MAKE_VER_WIN32_NT( 5, 0, 0 ) +#define VER_WIN32_NT_XP MAKE_VER_WIN32_NT( 5, 1, 0 ) + + +EXTERN_C WINBASEAPI LPSTR WINAPI lstrchrA( LPCSTR lpString, CHAR c ); +EXTERN_C WINBASEAPI LPWSTR WINAPI lstrchrW( LPCWSTR lpString, WCHAR c ); +EXTERN_C WINBASEAPI LPSTR WINAPI lstrrchrA( LPCSTR lpString, CHAR c ); +EXTERN_C WINBASEAPI LPWSTR WINAPI lstrrchrW( LPCWSTR lpString, WCHAR c ); + +#ifdef UNICODE +#define lstrrchr lstrrchrW +#define lstrchr lstrchrW +#else +#define lstrrchr lstrrchrA +#define lstrchr lstrchrA +#endif + +// macro that calculates the count of elements of a static array + +#define bufsizeof(buf) (sizeof(buf) / sizeof((buf)[0])) + + +#define IsValidHandle(Handle) ((DWORD)(Handle) + 1 > 1) + +#ifdef __cplusplus + +#define _AUTO_WSTR2STR( lpStrA, lpStrW ) \ +LPSTR lpStrA; \ +if ( lpStrW ) \ +{ \ + int cNeeded = WideCharToMultiByte( CP_ACP, 0, lpStrW, -1, NULL, 0, NULL, NULL ); \ + lpStrA = (LPSTR)_alloca( cNeeded * sizeof(CHAR) ); \ + WideCharToMultiByte( CP_ACP, 0, lpStrW, -1, lpStrA, cNeeded, NULL, NULL ); \ +} \ +else \ + lpStrA = NULL; + + +#define AUTO_WSTR2STR( lpStr ) \ + _AUTO_WSTR2STR( lpStr##A, lpStr##W ) + +#define AUTO_STR( lpStr, cchBuffer ) \ +LPSTR lpStr##A = lpStr##W ? (LPSTR)_alloca( (cchBuffer) * sizeof(CHAR) ) : NULL; + +#endif // __cplusplus + +#define STRBUF2WSTR( lpStr, cchSrcBuffer, cchDestBuffer ) \ + MultiByteToWideChar( CP_ACP, 0, lpStr##A, cchSrcBuffer, lpStr##W, cchDestBuffer ) + +#define STR2WSTR( lpStr, cchBuffer ) \ + STRBUF2WSTR( lpStr, -1, cchBuffer ) + +#define WSTR2STR( lpStr, cchBuffer ) \ + WideCharToMultiByte( CP_ACP, 0, lpStr##W, -1, lpStr##A, cchBuffer, NULL, NULL ) + +EXTERN_C void WINAPI ResolveThunk_WINDOWS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ); +EXTERN_C void WINAPI ResolveThunk_TRYLOAD( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ); +EXTERN_C void WINAPI ResolveThunk_ALLWAYS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ); + + + + +#define IMPLEMENT_THUNK( module, resolve, rettype, calltype, func, params ) \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr; \ +EXTERN_C rettype calltype func##_##resolve params; \ +static rettype calltype func##_##Failure params; \ +static _declspec ( naked ) func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func, (FARPROC)func##_##resolve, (FARPROC)func##_##Failure ); \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( naked ) rettype calltype func params \ +{ \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; \ +static rettype calltype func##_##Failure params \ +{ \ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); \ + return (rettype)0; \ +} \ +EXTERN_C rettype calltype func##_##resolve params + + + + + + + + + + + +#define DEFINE_CUSTOM_THUNK( module, resolve, rettype, calltype, func, params ) \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr; \ +static _declspec ( naked ) func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func ); \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( naked ) rettype calltype func params \ +{ \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk;
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/macros.h b/sal/systools/win32/uwinapi/macros.h new file mode 100644 index 000000000000..b75926be9d0f --- /dev/null +++ b/sal/systools/win32/uwinapi/macros.h @@ -0,0 +1,232 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define _UWINAPI_ +#include <systools/win32/uwinapi.h> + +#ifndef _INC_MALLOC +# include <malloc.h> +#endif + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4740) +#endif + +#ifndef _INC_TCHAR +# ifdef UNICODE +# define _UNICODE +# endif +# include <TCHAR.H> +#endif + +// Globally disable "warning C4100: unreferenced formal parameter" caused by +// IMPLEMENT_THUNK: +#ifdef _MSC_VER +#pragma warning(disable:4100) +#endif + +/* Version macros */ + +#define MAKE_VER_WIN32( major, minor, build, isWindows ) \ +((DWORD)MAKELONG( MAKEWORD( major, minor ), (build) | ( isWindows ? 0x8000 : 0 ) )) + +#define MAKE_VER_WIN32_NT( major, minor, build ) \ + MAKE_VER_WIN32( major, minor, build, FALSE ) + +#define MAKE_VER_WIN32_WINDOWS( major, minor, build ) \ + MAKE_VER_WIN32( major, minor, build, TRUE ) + +#define VER_WIN32_WINDOWS_95 MAKE_VER_WIN32_WINDOWS( 4, 0, 0 ) +#define VER_WIN32_WINDOWS_98 MAKE_VER_WIN32_WINDOWS( 4, 10, 0 ) +#define VER_WIN32_WINDOWS_ME MAKE_VER_WIN32_WINDOWS( 4, 90, 0 ) +#define VER_WIN32_NT_NT4 MAKE_VER_WIN32_NT( 4, 0, 0 ) +#define VER_WIN32_NT_2000 MAKE_VER_WIN32_NT( 5, 0, 0 ) +#define VER_WIN32_NT_XP MAKE_VER_WIN32_NT( 5, 1, 0 ) + + +#ifdef __cplusplus + +#define _AUTO_WSTR2STR( lpStrA, lpStrW ) \ +LPSTR lpStrA; \ +if ( lpStrW ) \ +{ \ + int cNeeded = WideCharToMultiByte( CP_ACP, 0, lpStrW, -1, NULL, 0, NULL, NULL ); \ + lpStrA = (LPSTR)_alloca( cNeeded * sizeof(CHAR) ); \ + WideCharToMultiByte( CP_ACP, 0, lpStrW, -1, lpStrA, cNeeded, NULL, NULL ); \ +} \ +else \ + lpStrA = NULL; + + +#define AUTO_WSTR2STR( lpStr ) \ + _AUTO_WSTR2STR( lpStr##A, lpStr##W ) + +#define AUTO_STR( lpStr, cchBuffer ) \ +LPSTR lpStr##A = lpStr##W ? (LPSTR)_alloca( (cchBuffer) * sizeof(CHAR) ) : NULL; + +#endif /* __cplusplus */ + + +#define STRBUF2WSTR( lpStr, cchSrcBuffer, cchDestBuffer ) \ + MultiByteToWideChar( CP_ACP, 0, lpStr##A, cchSrcBuffer, lpStr##W, (int) cchDestBuffer ) + +#define STR2WSTR( lpStr, cchBuffer ) \ + STRBUF2WSTR( lpStr, -1, cchBuffer ) + +#define WSTR2STR( lpStr, cchBuffer ) \ + WideCharToMultiByte( CP_ACP, 0, lpStr##W, -1, lpStr##A, cchBuffer, NULL, NULL ) + +EXTERN_C void WINAPI ResolveThunk_WINDOWS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ); +EXTERN_C void WINAPI ResolveThunk_TRYLOAD( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ); +EXTERN_C void WINAPI ResolveThunk_ALLWAYS( FARPROC *lppfn, LPCSTR lpLibFileName, LPCSTR lpFuncName, FARPROC lpfnEmulate, FARPROC lpfnFailure ); + + + + +#ifdef __MINGW32__ +#define IMPLEMENT_THUNK( module, resolve, rettype, calltype, func, params ) \ +static void func##_Thunk(); \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; \ +EXTERN_C rettype calltype func params \ +{ \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} \ +EXTERN_C rettype calltype func##_##resolve params; \ +static rettype calltype func##_##Failure params; \ +static void func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func, (FARPROC)func##_##resolve, (FARPROC)func##_##Failure ); \ + asm(" movl %ebp, %esp"); \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} \ +static rettype calltype func##_##Failure params \ +{ \ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); \ + return (rettype)0; \ +} \ +EXTERN_C rettype calltype func##_##resolve params +#else +#define IMPLEMENT_THUNK( module, resolve, rettype, calltype, func, params ) \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr; \ +EXTERN_C rettype calltype func##_##resolve params; \ +static rettype calltype func##_##Failure params; \ +static _declspec ( naked ) void func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func, (FARPROC)func##_##resolve, (FARPROC)func##_##Failure ); \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( naked ) rettype calltype func params \ +{ \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; \ +static rettype calltype func##_##Failure params \ +{ \ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); \ + return (rettype)0; \ +} \ +EXTERN_C rettype calltype func##_##resolve params +#endif + + + +#ifdef __MINGW32__ +#define DEFINE_CUSTOM_THUNK( module, resolve, rettype, calltype, func, params ) \ +static void func##_Thunk(); \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; \ +static void func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func ); \ + asm(" movl %ebp, %esp"); \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} \ +EXTERN_C rettype calltype func params \ +{ \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} +#else +#define DEFINE_CUSTOM_THUNK( module, resolve, rettype, calltype, func, params ) \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr; \ +static _declspec ( naked ) void func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func ); \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( naked ) rettype calltype func params \ +{ \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; +#endif + + +#ifdef __MINGW32__ +#define DEFINE_DEFAULT_THUNK( module, resolve, rettype, calltype, func, params ) \ +static void func##_Thunk(); \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; \ +static rettype calltype func##_##Failure params; \ +static _declspec ( naked ) void func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func, NULL, (FARPROC)func##_##Failure ); \ + asm(" movl %ebp, %esp"); \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} \ +EXTERN_C _declspec( naked ) rettype calltype func params \ +{ \ + asm(" popl %ebp"); \ + asm(" jmp *(%0)"::"m"(module##_##func##_Ptr)); \ +} \ +static rettype calltype func##_##Failure params \ +{ \ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); \ + return (rettype)0; \ +} +#else +#define DEFINE_DEFAULT_THUNK( module, resolve, rettype, calltype, func, params ) \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr; \ +static rettype calltype func##_##Failure params; \ +static _declspec ( naked ) void func##_Thunk() \ +{ \ + ResolveThunk_##resolve( &module##_##func##_Ptr, #module ".dll", #func, NULL, (FARPROC)func##_##Failure ); \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( naked ) rettype calltype func params \ +{ \ + _asm jmp [module##_##func##_Ptr] \ +} \ +EXTERN_C _declspec( dllexport ) FARPROC module##_##func##_Ptr = (FARPROC)func##_Thunk; \ +static rettype calltype func##_##Failure params \ +{ \ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); \ + return (rettype)0; \ +} +#endif diff --git a/sal/systools/win32/uwinapi/makefile.mk b/sal/systools/win32/uwinapi/makefile.mk new file mode 100644 index 000000000000..4893bfefae07 --- /dev/null +++ b/sal/systools/win32/uwinapi/makefile.mk @@ -0,0 +1,167 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. +PRJNAME=sal +TARGET=uwinapi + +USE_DEFFILE=TRUE +LIBTARGET=NO + +# --- Settings ---------------------------------- + +.INCLUDE : settings.mk + +CFLAGS+= $(LFS_CFLAGS) +CXXFLAGS+= $(LFS_CFLAGS) + +# --- Targets ---------------------------------- + + +.IF "$(GUI)"=="WNT" +.IF "$(COM)"=="GCC" +CFLAGSCXX+=-Wno-unused-parameter -Wno-return-type +.ENDIF + +.IF "$(COMEX)"=="9" +.IF "$(PSDK_HOME)"!="" +# Since the 02/2003 PSDK the "new" linker is needed here. +LINK=$(WRAPCMD) "$(PSDK_HOME)$/Bin$/Win64$/LINK.EXE" +.ENDIF +.ENDIF + +SLOFILES=\ + $(SLO)$/CheckTokenMembership.obj\ + $(SLO)$/CommandLineToArgvW.obj\ + $(SLO)$/CopyFileExA.obj\ + $(SLO)$/CopyFileExW.obj\ + $(SLO)$/DrawStateW.obj\ + $(SLO)$/EnumProcesses.obj\ + $(SLO)$/GetLogicalDriveStringsW.obj\ + $(SLO)$/GetLongPathNameA.obj\ + $(SLO)$/GetLongPathNameW.obj\ + $(SLO)$/GetModuleFileNameExA.obj\ + $(SLO)$/GetModuleFileNameExW.obj\ + $(SLO)$/GetProcessId.obj\ + $(SLO)$/GetUserDefaultUILanguage.obj\ + $(SLO)$/GetUserDomainA.obj\ + $(SLO)$/GetUserDomainW.obj\ + $(SLO)$/GetDiskFreeSpaceExA.obj\ + $(SLO)$/GetDiskFreeSpaceExW.obj\ + $(SLO)$/MoveFileExA.obj\ + $(SLO)$/MoveFileExW.obj\ + $(SLO)$/toolhelp.obj\ + $(SLO)$/DllGetVersion.obj\ + $(SLO)$/DllMain.obj\ + $(SLO)$/ResolveThunk.obj\ + $(SLO)$/ResolveUnicows.obj\ + $(SLO)$/snprintf.obj\ + $(SLO)$/snwprintf.obj\ + $(SLO)$/FindFirstVolumeA.obj\ + $(SLO)$/FindFirstVolumeW.obj\ + $(SLO)$/FindNextVolumeA.obj\ + $(SLO)$/FindNextVolumeW.obj\ + $(SLO)$/FindVolumeClose.obj\ + $(SLO)$/FindFirstVolumeMountPointA.obj\ + $(SLO)$/FindFirstVolumeMountPointW.obj\ + $(SLO)$/FindNextVolumeMountPointA.obj\ + $(SLO)$/FindNextVolumeMountPointW.obj\ + $(SLO)$/FindVolumeMountPointClose.obj\ + $(SLO)$/GetVolumeNameForVolumeMountPointA.obj\ + $(SLO)$/GetVolumeNameForVolumeMountPointW.obj\ + $(SLO)$/DeleteVolumeMountPointA.obj\ + $(SLO)$/DeleteVolumeMountPointW.obj\ + $(SLO)$/GetVolumePathNameA.obj\ + $(SLO)$/GetVolumePathNameW.obj\ + $(SLO)$/SetVolumeMountPointA.obj\ + $(SLO)$/SetVolumeMountPointW.obj\ + $(SLO)$/PathAddBackslashW.obj\ + $(SLO)$/PathCompactPathExW.obj\ + $(SLO)$/PathFileExistsW.obj\ + $(SLO)$/PathFindExtensionW.obj\ + $(SLO)$/PathFindFileNameW.obj\ + $(SLO)$/PathIsFileSpecW.obj\ + $(SLO)$/PathIsUNCW.obj\ + $(SLO)$/PathRemoveExtensionW.obj\ + $(SLO)$/PathRemoveFileSpecW.obj\ + $(SLO)$/PathSetDlgItemPathW.obj\ + $(SLO)$/PathStripToRootW.obj\ + $(SLO)$/SHCreateItemFromParsingName.obj + +SHL1TARGET=$(TARGET) +SHL1IMPLIB=$(SHL1TARGET) +SHL1DEF=$(MISC)/$(SHL1TARGET).def +DEF1NAME=$(SHL1TARGET) +.IF "$(COM)"=="GCC" +DEF1EXPORTFILE=\ + $(SHL1TARGET)_mingw.dxp\ + unicows_mingw.dxp +.ELSE +DEF1EXPORTFILE=\ + $(SHL1TARGET).dxp\ + unicows.dxp +.ENDIF +DEF1DEPN=\ + $(DEF1EXPORTFILE)\ + makefile.mk + +#SHL1VERINFO=$(SHL1TARGET).rc +SHL1OBJS=$(SLOFILES) + +#No default libraries +STDSHL= + +.IF "$(COM)"=="GCC" +SHL1STDLIBS=\ + -lmingw32 \ + $(MINGW_LIBGCC) +MINGWSSTDOBJ= +MINGWSSTDENDOBJ= +.ELSE +SHL1STDLIBS=\ + unicows.lib +.ENDIF + +SHL1STDLIBS+=\ + $(KERNEL32LIB)\ + $(USER32LIB)\ + $(ADVAPI32LIB)\ + $(VERSIONLIB)\ + $(LIBCMT)\ + $(SHLWAPILIB) + + +.ENDIF + +.IF "$(COM)"=="GCC" +ALL: ALLTAR $(LB)$/libuwinapi.a + +$(LB)$/libuwinapi.a: $(MISC)$/uwinapi.def + dlltool --dllname uwinapi.dll --input-def=$(MISC)$/uwinapi.def --kill-at --output-lib=$(LB)$/libuwinapi.a +.ENDIF + +.INCLUDE : target.mk diff --git a/sal/systools/win32/uwinapi/snprintf.c b/sal/systools/win32/uwinapi/snprintf.c new file mode 100644 index 000000000000..694eef21fbf9 --- /dev/null +++ b/sal/systools/win32/uwinapi/snprintf.c @@ -0,0 +1,10 @@ +/* Not unicode */ +#undef _UNICODE + +/* Support MBCS and SBCS */ + +#ifndef _MBCS +#define _MBCS +#endif + +#include "sntprintf.c" diff --git a/sal/systools/win32/uwinapi/sntprintf.c b/sal/systools/win32/uwinapi/sntprintf.c new file mode 100644 index 000000000000..69d47821311c --- /dev/null +++ b/sal/systools/win32/uwinapi/sntprintf.c @@ -0,0 +1,118 @@ +#define _SNPRINTF_DLLIMPORT __declspec( dllexport ) + +#include <stdarg.h> +#include <stdio.h> + +#include <tchar.h> +#include <systools/win32/snprintf.h> + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#pragma warning(disable:4273) // inconsistent dll linkage +#endif + +#if (defined(_MSC_VER) && (_MSC_VER < 1300)) || (defined(__MINGW32_VERSION) && ((__MINGW32_MAJOR_VERSION < 3)||((__MINGW32_MAJOR_VERSION == 3)&&(__MINGW32_MINOR_VERSION < 18)))) + +/* The non-debug versions of _vscprintf/_scprintf are just calls + to _vsprintf/_sprintf with string buffer pointer set to NULL, + requires MSVCRT version 7.0 */ +#ifdef __MINGW32__ +static int __cdecl _vsctprintf( const TCHAR *format, va_list ap ) +#else +static int __cdecl _vsctprintf( const _TXCHAR *format, va_list ap ) +#endif +{ + FILE *fp = _tfopen( _T("NUL"), _T("wb") ); + + if ( fp ) + { + int retval = _vftprintf( fp, format, ap ); + fclose( fp ); + + return retval; + } + + return -1; +} +#endif + +/* This function retrieves the pointer to the last character of a buffer. + That is the pointer to the last character of the buffer that fits + completly into that buffer or the position of the terminating zero. + + buffer Pointer to a _TXCHAR buffer to be examined + count size of the buffer to be examined + + return The pointer to the last character that fits into the buffer or + NULL if count is zero or count is one and the first byte was a + leading DBCS character +*/ + +static _TCHAR *GetLastBufferChar( _TCHAR *buffer, size_t count ) +{ + _TCHAR *last = NULL; + _TCHAR *cur = buffer; + + while ( (size_t)(cur - buffer) < count ) + { + last = cur; + + if ( !*last ) + break; + + cur = _tcsinc(last); + } + + return last; +} + +/* Implementation of snprintf following the ISO/IEC 9899:1999 (ISO C99) standard */ + +_SNPRINTF_DLLIMPORT int __cdecl vsntprintf( _TCHAR *buffer, size_t count, const _TCHAR *format, va_list list ) +{ + int retval; + + /* First of all call the existing non POSIX standard function assuming + the buffer size will be large enough */ + + retval = _vsntprintf( buffer, count, format, list ); + + if ( retval < 0 ) + { + /* If the buffer wasn't large enough ensure that the buffer will be + zero terminated */ + + _TCHAR *last = GetLastBufferChar( buffer, count ); + if (last ) + *last = 0; + + /* Retrieve the count of characters that would have been written + if the buffer were large enough */ + + retval = _vsctprintf( format, list ); + } + else if ( (size_t)retval == count && count ) + { + /* If the buffer was large enough but not large enough for the trailing + zero make the buffer zero terminated */ + + _TCHAR *last = GetLastBufferChar( buffer, count ); + if (last ) + *last = 0; + } + + return retval; +} + +/* Implementation of snprintf following the ISO/IEC 9899:1999 (ISO C99) standard */ + +_SNPRINTF_DLLIMPORT int __cdecl sntprintf( _TCHAR *buffer, size_t count, const _TCHAR *format, ... ) +{ + va_list list; + int retval; + + va_start( list, format ); + retval = vsntprintf( buffer, count, format, list ); + va_end( list ); + + return retval; +} diff --git a/sal/systools/win32/uwinapi/snwprintf.c b/sal/systools/win32/uwinapi/snwprintf.c new file mode 100644 index 000000000000..80a5760c86f1 --- /dev/null +++ b/sal/systools/win32/uwinapi/snwprintf.c @@ -0,0 +1,5 @@ +#ifndef _UNICODE +#define _UNICODE +#endif + +#include "sntprintf.c" diff --git a/sal/systools/win32/uwinapi/toolhelp.cpp b/sal/systools/win32/uwinapi/toolhelp.cpp new file mode 100644 index 000000000000..7b651581bae7 --- /dev/null +++ b/sal/systools/win32/uwinapi/toolhelp.cpp @@ -0,0 +1,57 @@ +#include "macros.h" +#include <tlhelp32.h> + + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Module32First, (HANDLE hSnapshot, LPMODULEENTRY32 lpme ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Module32FirstW, (HANDLE hSnapshot, LPMODULEENTRY32W lpme ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Module32Next, (HANDLE hSnapshot, LPMODULEENTRY32 lpme ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Module32NextW, (HANDLE hSnapshot, LPMODULEENTRY32W lpme ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Process32First, (HANDLE hSnapshot, LPPROCESSENTRY32 lppe ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Process32FirstW, (HANDLE hSnapshot, LPPROCESSENTRY32W lppe ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Process32Next, (HANDLE hSnapshot, LPPROCESSENTRY32 lppe ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, BOOL, WINAPI, Process32NextW, (HANDLE hSnapshot, LPPROCESSENTRY32W lppe ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return FALSE; +} + +IMPLEMENT_THUNK( kernel32, TRYLOAD, HANDLE, WINAPI, CreateToolhelp32Snapshot, (DWORD dwFlags, DWORD th32ProcessID ) ) +{ + SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); + return NULL; +} diff --git a/sal/systools/win32/uwinapi/unicows.dxp b/sal/systools/win32/uwinapi/unicows.dxp new file mode 100644 index 000000000000..771782a76b7b --- /dev/null +++ b/sal/systools/win32/uwinapi/unicows.dxp @@ -0,0 +1,546 @@ +;************************************************************************* +; +; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +; +; Copyright 2000, 2010 Oracle and/or its affiliates. +; +; OpenOffice.org - a multi-platform office productivity suite +; +; This file is part of OpenOffice.org. +; +; OpenOffice.org is free software: you can redistribute it and/or modify +; it under the terms of the GNU Lesser General Public License version 3 +; only, as published by the Free Software Foundation. +; +; OpenOffice.org 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 version 3 for more details +; (a copy is included in the LICENSE file that accompanied this code). +; +; You should have received a copy of the GNU Lesser General Public License +; version 3 along with OpenOffice.org. If not, see +; <http://www.openoffice.org/license.html> +; for a copy of the LGPLv3 License. +; +;************************************************************************* +; +; Functions that are exported but not implemented by unicows.dll +; are only inserted as comment. +; +; In addition to MSDN Platform SDK documentation the following functions +; are not implemented too: +; AddMonitorW, FreeContextBufferW, GetPrinterDriverDirectoryW, +; MCIWndCreateW +; +; The following functions of unicows.dll are buggy: +; DrawStateW, GetLogicalDriveStringsW (both implemented in uwinapi.dll) +; +; The following functions of unicows.dll are wrapped but the ANSI versions +; do not exist on Win9x so the wrapper is useless: +; MoveFileExW, CopyFileExW (both implemented in uwinapi.dll along with the +; ANSI versions ) +; +; These functions do not exist on Win 95 and NT neither as Unicode +; nor as ANSI version, so the wrapper will fail on NT4 and Win 95 +; GetLongPathNameW ( implemented in uwinapi.dll along with the +; ANSI version ) +; +; These essential functions aren't implemented by unicows.dll because +; there's no ANSI version: +; CommandLineToArgvW (implemented by uwinapi.dll) +; +;************************************************************************* + +;AcquireCredentialsHandleW +AddAtomW +AddFontResourceW +AddJobW +;AddMonitorW +AddPortW +AddPrintProcessorW +AddPrintProvidorW +AddPrinterDriverW +AddPrinterW +AdvancedDocumentPropertiesW +AppendMenuW +BeginUpdateResourceW +BroadcastSystemMessageW +BuildCommDCBAndTimeoutsW +BuildCommDCBW +CallMsgFilterW +CallNamedPipeW +CallWindowProcA +CallWindowProcW +ChangeDisplaySettingsExW +ChangeDisplaySettingsW +ChangeMenuW +CharLowerBuffW +CharLowerW +CharNextW +CharPrevW +CharToOemBuffW +CharToOemW +CharUpperBuffW +CharUpperW +ChooseColorW +ChooseFontW +CommConfigDialogW +CompareStringW +ConfigurePortW +CopyAcceleratorTableW +CopyEnhMetaFileW +CopyFileExW +CopyFileW +CopyMetaFileW +CreateAcceleratorTableW +CreateColorSpaceW +CreateDCW +CreateDialogIndirectParamW +CreateDialogParamW +CreateDirectoryExW +CreateDirectoryW +CreateEnhMetaFileW +CreateEventW +CreateFileMappingW +CreateFileW +CreateFontIndirectW +CreateFontW +CreateICW +CreateMDIWindowW +CreateMailslotW +CreateMetaFileW +CreateMutexW +;CreateNamedPipeW +CreateProcessW +CreateScalableFontResourceW +CreateSemaphoreW +CreateStdAccessibleProxyW +CreateWaitableTimerW +CreateWindowExW +DdeConnect +DdeConnectList +DdeCreateStringHandleW +DdeInitializeW +DdeQueryConvInfo +DdeQueryStringW +DefDlgProcW +DefFrameProcW +DefMDIChildProcW +DefWindowProcW +DeleteFileW +DeleteMonitorW +DeletePortW +DeletePrintProcessorW +DeletePrintProvidorW +DeletePrinterDriverW +;DeviceCapabilitiesW +DialogBoxIndirectParamW +DialogBoxParamW +DispatchMessageW +DlgDirListComboBoxW +DlgDirListW +DlgDirSelectComboBoxExW +DlgDirSelectExW +;DocumentPropertiesW +DragQueryFileW +DrawStateW +DrawTextExW +DrawTextW +EnableWindow +EndUpdateResourceW +EnumCalendarInfoExW +EnumCalendarInfoW +EnumClipboardFormats +EnumDateFormatsExW +EnumDateFormatsW +EnumDisplayDevicesW +EnumDisplaySettingsExW +EnumDisplaySettingsW +EnumFontFamiliesExW +EnumFontFamiliesW +EnumFontsW +EnumICMProfilesW +;EnumMonitorsW +;EnumPortsW +;EnumPrintProcessorDatatypesW +;EnumPrintProcessorsW +;EnumPrinterDriversW +;EnumPrintersW +EnumPropsA +EnumPropsExA +EnumPropsExW +EnumPropsW +EnumSystemCodePagesW +EnumSystemLocalesW +EnumTimeFormatsW +;EnumerateSecurityPackagesW +ExpandEnvironmentStringsW +ExtTextOutW +ExtractIconExW +ExtractIconW +FatalAppExitW +FillConsoleOutputCharacterW +FindAtomW +;FindExecutableW +FindFirstChangeNotificationW +FindFirstFileW +FindNextFileW +FindResourceExW +FindResourceW +FindTextW +FindWindowExW +FindWindowW +FormatMessageW +;FreeContextBufferW +FreeEnvironmentStringsW +GetAltTabInfoW +GetAtomNameW +GetCPInfo +GetCPInfoExW +GetCalendarInfoW +;GetCharABCWidthsFloatW +GetCharABCWidthsW +GetCharWidthFloatW +GetCharWidthW +GetCharacterPlacementW +GetClassInfoExW +GetClassInfoW +GetClassLongW +GetClassNameW +GetClipboardData +GetClipboardFormatNameW +GetComputerNameW +GetConsoleTitleW +GetCurrencyFormatW +GetCurrentDirectoryW +GetCurrentHwProfileW +GetDateFormatW +GetDefaultCommConfigW +GetDiskFreeSpaceExW +GetDiskFreeSpaceW +GetDlgItemTextW +GetDriveTypeW +GetEnhMetaFileDescriptionW +GetEnhMetaFileW +GetEnvironmentStringsW +GetEnvironmentVariableW +GetFileAttributesExW +GetFileAttributesW +GetFileTitleW +GetFileVersionInfoSizeW +GetFileVersionInfoW +GetFullPathNameW +GetGlyphOutlineW +GetICMProfileW +;GetJobW +GetKerningPairsW +GetKeyNameTextW +GetKeyboardLayoutNameW +GetLocaleInfoW +GetLogColorSpaceW +GetLogicalDriveStringsW +GetLongPathNameW +GetMenuItemInfoW +GetMenuStringW +GetMessageW +GetMetaFileW +GetModuleFileNameW +GetModuleHandleW +GetMonitorInfoW +GetNamedPipeHandleStateW +GetNumberFormatW +GetObjectW +GetOpenFileNamePreviewW +GetOpenFileNameW +GetOutlineTextMetricsW +GetPrintProcessorDirectoryW +;GetPrinterDataW +;GetPrinterDriverDirectoryW +;GetPrinterDriverW +;GetPrinterW +GetPrivateProfileIntW +GetPrivateProfileSectionNamesW +GetPrivateProfileSectionW +GetPrivateProfileStringW +GetPrivateProfileStructW +;GetProcAddress +GetProfileIntW +GetProfileSectionW +GetProfileStringW +GetPropA +GetPropW +GetRoleTextW +GetSaveFileNamePreviewW +GetSaveFileNameW +GetShortPathNameW +GetStartupInfoW +GetStateTextW +GetStringTypeExW +GetStringTypeW +GetSystemDirectoryW +GetSystemWindowsDirectoryW +GetTabbedTextExtentW +GetTempFileNameW +GetTempPathW +GetTextExtentExPointW +GetTextExtentPoint32W +GetTextExtentPointW +GetTextFaceW +GetTextMetricsW +GetTimeFormatW +GetUserNameW +GetVersionExW +GetVolumeInformationW +GetWindowLongA +GetWindowLongW +GetWindowModuleFileNameW +GetWindowTextLengthW +GetWindowTextW +GetWindowsDirectoryW +GlobalAddAtomW +GlobalFindAtomW +GlobalGetAtomNameW +GrayStringW +;InitSecurityInterfaceW +;InitializeSecurityContextW +InsertMenuItemW +InsertMenuW +IsBadStringPtrW +IsCharAlphaNumericW +IsCharAlphaW +IsCharLowerW +IsCharUpperW +IsClipboardFormatAvailable +IsDestinationReachableW +IsDialogMessageW +IsTextUnicode +IsValidCodePage +IsWindowUnicode +LCMapStringW +LoadAcceleratorsW +LoadBitmapW +LoadCursorFromFileW +LoadCursorW +LoadIconW +LoadImageW +LoadKeyboardLayoutW +LoadLibraryExW +LoadLibraryW +LoadMenuIndirectW +LoadMenuW +LoadStringW +;MCIWndCreateW +MapVirtualKeyExW +MapVirtualKeyW +MessageBoxExW +MessageBoxIndirectW +MessageBoxW +ModifyMenuW +MoveFileW +MultiByteToWideChar +MultinetGetConnectionPerformanceW +OemToCharBuffW +OemToCharW +;OleUIAddVerbMenuW +;OleUIBusyW +;OleUIChangeIconW +;OleUIChangeSourceW +;OleUIConvertW +;OleUIEditLinksW +;OleUIInsertObjectW +;OleUIObjectPropertiesW +;OleUIPasteSpecialW +;OleUIPromptUserW +;OleUIUpdateLinksW +OpenEventW +OpenFileMappingW +OpenMutexW +OpenPrinterW +OpenSemaphoreW +OpenWaitableTimerW +OutputDebugStringW +PageSetupDlgW +PeekConsoleInputW +PeekMessageW +PlaySoundW +;PolyTextOutW +PostMessageW +PostThreadMessageW +PrintDlgW +;QueryContextAttributesW +;QueryCredentialsAttributesW +QueryDosDeviceW +;QuerySecurityPackageInfoW +RasConnectionNotificationW +RasCreatePhonebookEntryW +RasDeleteEntryW +RasDeleteSubEntryW +;RasDialW +RasEditPhonebookEntryW +RasEnumConnectionsW +RasEnumDevicesW +RasEnumEntriesW +RasGetConnectStatusW +RasGetEntryDialParamsW +RasGetEntryPropertiesW +RasGetErrorStringW +RasHangUpW +RasRenameEntryW +RasSetEntryDialParamsW +RasSetEntryPropertiesW +RasSetSubEntryPropertiesW +RasValidateEntryNameW +ReadConsoleInputW +ReadConsoleOutputCharacterW +ReadConsoleOutputW +ReadConsoleW +RegConnectRegistryW +RegCreateKeyExW +RegCreateKeyW +RegDeleteKeyW +RegDeleteValueW +RegEnumKeyExW +RegEnumKeyW +RegEnumValueW +RegLoadKeyW +RegOpenKeyExW +RegOpenKeyW +RegQueryInfoKeyW +RegQueryMultipleValuesW +RegQueryValueExW +RegQueryValueW +RegReplaceKeyW +RegSaveKeyW +RegSetValueExW +RegSetValueW +RegUnLoadKeyW +RegisterClassExW +RegisterClassW +RegisterClipboardFormatW +RegisterDeviceNotificationW +RegisterWindowMessageW +RemoveDirectoryW +RemoveFontResourceW +RemovePropA +RemovePropW +ReplaceTextW +ResetDCW +;ResetPrinterW +SHBrowseForFolderW +SHChangeNotify +SHFileOperationW +SHGetFileInfoW +SHGetNewLinkInfoW +SHGetPathFromIDListW +ScrollConsoleScreenBufferW +SearchPathW +SendDlgItemMessageW +SendMessageCallbackW +SendMessageTimeoutW +SendMessageW +SendNotifyMessageW +SetCalendarInfoW +SetClassLongW +SetComputerNameW +SetConsoleTitleW +SetCurrentDirectoryW +SetDefaultCommConfigW +SetDlgItemTextW +SetEnvironmentVariableW +SetFileAttributesW +SetICMProfileW +SetJobW +SetLocaleInfoW +SetMenuItemInfoW +SetPrinterDataW +SetPrinterW +SetPropA +SetPropW +SetVolumeLabelW +SetWindowLongA +SetWindowLongW +SetWindowTextW +SetWindowsHookExW +SetWindowsHookW +ShellAboutW +ShellExecuteExW +ShellExecuteW +Shell_NotifyIconW +StartDocPrinterW +StartDocW +SystemParametersInfoW +TabbedTextOutW +TextOutW +TranslateAcceleratorW +UnregisterClassW +UpdateResourceW +VerFindFileW +VerInstallFileW +VerLanguageNameW +VerQueryValueW +VkKeyScanExW +VkKeyScanW +WNetAddConnection2W +WNetAddConnection3W +WNetAddConnectionW +WNetCancelConnection2W +WNetCancelConnectionW +WNetConnectionDialog1W +WNetDisconnectDialog1W +WNetEnumResourceW +WNetGetConnectionW +WNetGetLastErrorW +WNetGetNetworkInformationW +WNetGetProviderNameW +WNetGetResourceInformationW +WNetGetResourceParentW +WNetGetUniversalNameW +WNetGetUserW +WNetOpenEnumW +WNetUseConnectionW +WaitNamedPipeW +WideCharToMultiByte +WinHelpW +WriteConsoleInputW +WriteConsoleOutputCharacterW +WriteConsoleOutputW +WriteConsoleW +WritePrivateProfileSectionW +WritePrivateProfileStringW +WritePrivateProfileStructW +WriteProfileSectionW +WriteProfileStringW +;auxGetDevCapsW +capCreateCaptureWindowW +capGetDriverDescriptionW +;joyGetDevCapsW +lstrcatW +lstrcmpW +lstrcmpiW +lstrcpyW +lstrcpynW +lstrlenW +;mciGetDeviceIDW +;mciGetErrorStringW +;mciSendCommandW +;mciSendStringW +;midiInGetDevCapsW +;midiInGetErrorTextW +;midiOutGetDevCapsW +;midiOutGetErrorTextW +;mixerGetControlDetailsW +;mixerGetDevCapsW +;mixerGetLineControlsW +;mixerGetLineInfoW +;mmioInstallIOProcW +;mmioOpenW +;mmioRenameW +;mmioStringToFOURCCW +sndPlaySoundW +;waveInGetDevCapsW +;waveInGetErrorTextW +;waveOutGetDevCapsW +;waveOutGetErrorTextW +wsprintfW +wvsprintfW
\ No newline at end of file diff --git a/sal/systools/win32/uwinapi/unicows_mingw.dxp b/sal/systools/win32/uwinapi/unicows_mingw.dxp new file mode 100644 index 000000000000..f898d4b2a27d --- /dev/null +++ b/sal/systools/win32/uwinapi/unicows_mingw.dxp @@ -0,0 +1,544 @@ +;************************************************************************* +; +; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +; +; Copyright 2000, 2010 Oracle and/or its affiliates. +; +; OpenOffice.org - a multi-platform office productivity suite +; +; This file is part of OpenOffice.org. +; +; OpenOffice.org is free software: you can redistribute it and/or modify +; it under the terms of the GNU Lesser General Public License version 3 +; only, as published by the Free Software Foundation. +; +; OpenOffice.org 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 version 3 for more details +; (a copy is included in the LICENSE file that accompanied this code). +; +; You should have received a copy of the GNU Lesser General Public License +; version 3 along with OpenOffice.org. If not, see +; <http://www.openoffice.org/license.html> +; for a copy of the LGPLv3 License. +; +;************************************************************************* +; +; Functions that are exported but not implemented by unicows.dll +; are only inserted as comment. +; +; In addition to MSDN Platform SDK documentation the following functions +; are not implemented too: +; AddMonitorW, FreeContextBufferW, GetPrinterDriverDirectoryW, +; MCIWndCreateW +; +; The following functions of unicows.dll are buggy: +; DrawStateW, GetLogicalDriveStringsW (both implemented in uwinapi.dll) +; +; The following functions of unicows.dll are wrapped but the ANSI versions +; do not exist on Win9x so the wrapper is useless: +; MoveFileExW, CopyFileExW (both implemented in uwinapi.dll along with the +; ANSI versions ) +; +; These functions do not exist on Win 95 and NT neither as Unicode +; nor as ANSI version, so the wrapper will fail on NT4 and Win 95 +; GetLongPathNameW ( implemented in uwinapi.dll along with the +; ANSI version ) +; +; These essential functions aren't implemented by unicows.dll because +; there's no ANSI version: +; CommandLineToArgvW (implemented by uwinapi.dll) +; +;************************************************************************* + +;AcquireCredentialsHandleW@36 +AddAtomW@4 +AddFontResourceW@4 +AddJobW@20 +AddPortW@12 +AddPrintProcessorW@16 +AddPrintProvidorW@12 +AddPrinterDriverW@12 +AddPrinterW@12 +AdvancedDocumentPropertiesW@20 +AppendMenuW@16 +BeginUpdateResourceW@8 +BroadcastSystemMessageW@20 +BuildCommDCBAndTimeoutsW@12 +BuildCommDCBW@8 +CallMsgFilterW@8 +CallNamedPipeW@28 +CallWindowProcA@20 +CallWindowProcW@20 +ChangeDisplaySettingsExW@20 +ChangeDisplaySettingsW@8 +ChangeMenuW@20 +CharLowerBuffW@8 +CharLowerW@4 +CharNextW@4 +CharPrevW@8 +CharToOemBuffW@12 +CharToOemW@8 +CharUpperBuffW@8 +CharUpperW@4 +ChooseColorW@4 +ChooseFontW@4 +CommConfigDialogW@12 +CompareStringW@24 +ConfigurePortW@12 +CopyAcceleratorTableW@12 +CopyEnhMetaFileW@8 +CopyFileExW@24 +CopyFileW@12 +CopyMetaFileW@8 +CreateAcceleratorTableW@8 +CreateColorSpaceW@4 +CreateDCW@16 +CreateDialogIndirectParamW@20 +CreateDialogParamW@20 +CreateDirectoryExW@12 +CreateDirectoryW@8 +CreateEnhMetaFileW@16 +CreateEventW@16 +CreateFileMappingW@24 +CreateFileW@28 +CreateFontIndirectW@4 +CreateFontW@56 +CreateICW@16 +CreateMDIWindowW@40 +CreateMailslotW@16 +CreateMetaFileW@4 +CreateMutexW@12 +;CreateNamedPipeW@32 +CreateProcessW@40 +CreateScalableFontResourceW@16 +CreateSemaphoreW@16 +CreateStdAccessibleProxyW@20 +CreateWaitableTimerW@12 +CreateWindowExW@48 +DdeConnect@16 +DdeConnectList@20 +DdeCreateStringHandleW@12 +DdeInitializeW@16 +DdeQueryConvInfo@12 +DdeQueryStringW@20 +DefDlgProcW@16 +DefFrameProcW@20 +DefMDIChildProcW@16 +DefWindowProcW@16 +DeleteFileW@4 +DeleteMonitorW@12 +DeletePortW@12 +DeletePrintProcessorW@12 +DeletePrintProvidorW@12 +DeletePrinterDriverW@12 +;DeviceCapabilitiesW@20 +DialogBoxIndirectParamW@20 +DialogBoxParamW@20 +DispatchMessageW@4 +DlgDirListComboBoxW@20 +DlgDirListW@20 +DlgDirSelectComboBoxExW@16 +DlgDirSelectExW@16 +;DocumentPropertiesW@24 +DragQueryFileW@16 +DrawStateW@40 +DrawTextExW@24 +DrawTextW@20 +EnableWindow@8 +EndUpdateResourceW@8 +EnumCalendarInfoExW@16 +EnumCalendarInfoW@16 +EnumClipboardFormats@4 +EnumDateFormatsExW@12 +EnumDateFormatsW@12 +EnumDisplayDevicesW@16 +EnumDisplaySettingsExW@16 +EnumDisplaySettingsW@12 +EnumFontFamiliesExW@20 +EnumFontFamiliesW@16 +EnumFontsW@16 +EnumICMProfilesW@12 +;EnumMonitorsW@24 +;EnumPortsW@24 +;EnumPrintProcessorDatatypesW@28 +;EnumPrintProcessorsW@28 +;EnumPrinterDriversW@28 +;EnumPrintersW@28 +EnumPropsA@8 +EnumPropsExA@12 +EnumPropsExW@12 +EnumPropsW@8 +EnumSystemCodePagesW@8 +EnumSystemLocalesW@8 +EnumTimeFormatsW@12 +;EnumerateSecurityPackagesW@8 +ExpandEnvironmentStringsW@12 +ExtTextOutW@32 +ExtractIconExW@20 +ExtractIconW@12 +FatalAppExitW@8 +FillConsoleOutputCharacterW@20 +FindAtomW@4 +;FindExecutableW@12 +FindFirstChangeNotificationW@12 +FindFirstFileW@8 +FindNextFileW@8 +FindResourceExW@16 +FindResourceW@12 +FindTextW@4 +FindWindowExW@16 +FindWindowW@8 +FormatMessageW@28 +;FreeContextBuffer@4 +FreeEnvironmentStringsW@4 +GetAltTabInfoW@20 +GetAtomNameW@12 +GetCPInfo@8 +GetCPInfoExW@12 +GetCalendarInfoW@24 +;GetCharABCWidthsFloatW@16 +GetCharABCWidthsW@16 +GetCharWidthFloatW@16 +GetCharWidthW@16 +GetCharacterPlacementW@24 +GetClassInfoExW@12 +GetClassInfoW@12 +GetClassLongW@8 +GetClassNameW@12 +GetClipboardData@4 +GetClipboardFormatNameW@12 +GetComputerNameW@8 +GetConsoleTitleW@8 +GetCurrencyFormatW@24 +GetCurrentDirectoryW@8 +GetCurrentHwProfileW@4 +GetDateFormatW@24 +GetDefaultCommConfigW@12 +GetDiskFreeSpaceExW@16 +GetDiskFreeSpaceW@20 +GetDlgItemTextW@16 +GetDriveTypeW@4 +GetEnhMetaFileDescriptionW@12 +GetEnhMetaFileW@4 +GetEnvironmentStringsW@0 +GetEnvironmentVariableW@12 +GetFileAttributesExW@12 +GetFileAttributesW@4 +GetFileTitleW@12 +GetFileVersionInfoSizeW@8 +GetFileVersionInfoW@16 +GetFullPathNameW@16 +GetGlyphOutlineW@28 +GetICMProfileW@12 +;GetJobW@24 +GetKerningPairsW@12 +GetKeyNameTextW@12 +GetKeyboardLayoutNameW@4 +GetLocaleInfoW@16 +GetLogColorSpaceW@12 +GetLogicalDriveStringsW@8 +GetLongPathNameW@12 +GetMenuItemInfoW@16 +GetMenuStringW@20 +GetMessageW@16 +GetMetaFileW@4 +GetModuleFileNameW@12 +GetModuleHandleW@4 +GetMonitorInfoW@8 +GetNamedPipeHandleStateW@28 +GetNumberFormatW@24 +GetObjectW@12 +GetOpenFileNamePreviewW@4 +GetOpenFileNameW@4 +GetOutlineTextMetricsW@12 +GetPrintProcessorDirectoryW@24 +;GetPrinterDataW@24 +;GetPrinterDriverDirectoryW24 +;GetPrinterDriverW@24 +;GetPrinterW@20 +GetPrivateProfileIntW@16 +GetPrivateProfileSectionNamesW@12 +GetPrivateProfileSectionW@16 +GetPrivateProfileStringW@24 +GetPrivateProfileStructW@20 +GetProcAddress@8=Internal_GetProcAddress@8 +GetProfileIntW@12 +GetProfileSectionW@12 +GetProfileStringW@20 +GetPropA@8 +GetPropW@8 +GetRoleTextW@12 +GetSaveFileNamePreviewW@4 +GetSaveFileNameW@4 +GetShortPathNameW@12 +GetStartupInfoW@4 +GetStateTextW@12 +GetStringTypeExW@20 +GetStringTypeW@16 +GetSystemDirectoryW@8 +GetSystemWindowsDirectoryW@8 +GetTabbedTextExtentW@20 +GetTempFileNameW@16 +GetTempPathW@8 +GetTextExtentExPointW@28 +GetTextExtentPoint32W@16 +GetTextExtentPointW@16 +GetTextFaceW@12 +GetTextMetricsW@8 +GetTimeFormatW@24 +GetUserNameW@8 +GetVersionExW@4 +GetVolumeInformationW@32 +GetWindowLongA@8 +GetWindowLongW@8 +GetWindowModuleFileNameW@12 +GetWindowTextLengthW@4 +GetWindowTextW@12 +GetWindowsDirectoryW@8 +GlobalAddAtomW@4 +GlobalFindAtomW@4 +GlobalGetAtomNameW@12 +GrayStringW@36 +;InitSecurityInterfaceW@0 +;InitializeSecurityContextW@48 +InsertMenuItemW@16 +InsertMenuW@20 +IsBadStringPtrW@8 +IsCharAlphaNumericW@4 +IsCharAlphaW@4 +IsCharLowerW@4 +IsCharUpperW@4 +IsClipboardFormatAvailable@4 +IsDestinationReachableW@8 +IsDialogMessageW@8 +IsTextUnicode@12 +IsValidCodePage@4 +IsWindowUnicode@4 +LCMapStringW@24 +LoadAcceleratorsW@8 +LoadBitmapW@8 +LoadCursorFromFileW@4 +LoadCursorW@8 +LoadIconW@8 +LoadImageW@24 +LoadKeyboardLayoutW@8 +LoadLibraryExW@12 +LoadLibraryW@4 +LoadMenuIndirectW@4 +LoadMenuW@8 +LoadStringW@16 +;MCIWndCreateW@4 +MapVirtualKeyExW@12 +MapVirtualKeyW@8 +MessageBoxExW@20 +MessageBoxIndirectW@4 +MessageBoxW@16 +ModifyMenuW@20 +MoveFileW@8 +MultiByteToWideChar@24 +MultinetGetConnectionPerformanceW@8 +OemToCharBuffW@12 +OemToCharW@8 +;OleUIAddVerbMenuW@36 +;OleUIBusyW@4 +;OleUIChangeIconW@4 +;OleUIChangeSourceW@4 +;OleUIConvertW@4 +;OleUIEditLinksW@4 +;OleUIInsertObjectW@4 +;OleUIObjectPropertiesW@4 +;OleUIPasteSpecialW@4 +;OleUIPromptUserW@8 +;OleUIUpdateLinksW@16 +OpenEventW@12 +OpenFileMappingW@12 +OpenMutexW@12 +OpenPrinterW@12 +OpenSemaphoreW@12 +OpenWaitableTimerW@12 +OutputDebugStringW@4 +PageSetupDlgW@4 +PeekConsoleInputW@16 +PeekMessageW@20 +PlaySoundW@12 +;PolyTextOutW@12 +PostMessageW@16 +PostThreadMessageW@16 +PrintDlgW@4 +;QueryContextAttributesW@12 +;QueryCredentialsAttributesW@12 +QueryDosDeviceW@12 +;QuerySecurityPackageInfoW@8 +RasConnectionNotificationW@12 +RasCreatePhonebookEntryW@8 +RasDeleteEntryW@8 +RasDeleteSubEntryW@12 +;RasDialW@24 +RasEditPhonebookEntryW@12 +RasEnumConnectionsW@12 +RasEnumDevicesW@12 +RasEnumEntriesW@20 +RasGetConnectStatusW@8 +RasGetEntryDialParamsW@12 +RasGetEntryPropertiesW@24 +RasGetErrorStringW@12 +RasHangUpW@4 +RasRenameEntryW@12 +RasSetEntryDialParamsW@12 +RasSetEntryPropertiesW@24 +RasSetSubEntryPropertiesW@28 +RasValidateEntryNameW@8 +ReadConsoleInputW@16 +ReadConsoleOutputCharacterW@20 +ReadConsoleOutputW@20 +ReadConsoleW@20 +RegConnectRegistryW@12 +RegCreateKeyExW@36 +RegCreateKeyW@12 +RegDeleteKeyW@8 +RegDeleteValueW@8 +RegEnumKeyExW@32 +RegEnumKeyW@16 +RegEnumValueW@32 +RegLoadKeyW@12 +RegOpenKeyExW@20 +RegOpenKeyW@12 +RegQueryInfoKeyW@48 +RegQueryMultipleValuesW@20 +RegQueryValueExW@24 +RegQueryValueW@16 +RegReplaceKeyW@16 +RegSaveKeyW@12 +RegSetValueExW@24 +RegSetValueW@20 +RegUnLoadKeyW@8 +RegisterClassExW@4 +RegisterClassW@4 +RegisterClipboardFormatW@4 +RegisterDeviceNotificationW@12 +RegisterWindowMessageW@4 +RemoveDirectoryW@4 +RemoveFontResourceW@4 +RemovePropA@8 +RemovePropW@8 +ReplaceTextW@4 +ResetDCW@8 +;ResetPrinterW@8 +SHBrowseForFolderW@4 +SHChangeNotify@16 +SHFileOperationW@4 +SHGetFileInfoW@20 +SHGetNewLinkInfoW@20 +SHGetPathFromIDListW@8 +ScrollConsoleScreenBufferW@20 +SearchPathW@24 +SendDlgItemMessageW@20 +SendMessageCallbackW@24 +SendMessageTimeoutW@28 +SendMessageW@16 +SendNotifyMessageW@16 +SetCalendarInfoW@16 +SetClassLongW@12 +SetComputerNameW@4 +SetConsoleTitleW@4 +SetCurrentDirectoryW@4 +SetDefaultCommConfigW@12 +SetDlgItemTextW@12 +SetEnvironmentVariableW@8 +SetFileAttributesW@8 +SetICMProfileW@8 +SetJobW@20 +SetLocaleInfoW@12 +SetMenuItemInfoW@16 +SetPrinterDataW@20 +SetPrinterW@16 +SetPropA@12 +SetPropW@12 +SetVolumeLabelW@8 +SetWindowLongA@12 +SetWindowLongW@12 +SetWindowTextW@8 +SetWindowsHookExW@16 +SetWindowsHookW@8 +ShellAboutW@16 +ShellExecuteExW@4 +ShellExecuteW@24 +Shell_NotifyIconW@8 +StartDocPrinterW@12 +StartDocW@8 +SystemParametersInfoW@16 +TabbedTextOutW@32 +TextOutW@20 +TranslateAcceleratorW@12 +UnregisterClassW@8 +UpdateICMRegKeyW@16 +UpdateResourceW@24 +VerFindFileW@32 +VerInstallFileW@32 +VerLanguageNameW@12 +VerQueryValueW@16 +VkKeyScanExW@8 +VkKeyScanW@4 +WNetAddConnection2W@16 +WNetAddConnection3W@20 +WNetAddConnectionW@12 +WNetCancelConnection2W@12 +WNetCancelConnectionW@8 +WNetConnectionDialog1W@4 +WNetDisconnectDialog1W@4 +WNetEnumResourceW@16 +WNetGetConnectionW@12 +WNetGetLastErrorW@20 +WNetGetNetworkInformationW@8 +WNetGetProviderNameW@12 +WNetGetResourceInformationW@16 +WNetGetResourceParentW@12 +WNetGetUniversalNameW@16 +WNetGetUserW@12 +WNetOpenEnumW@20 +WNetUseConnectionW@32 +WaitNamedPipeW@8 +WideCharToMultiByte@32 +WinHelpW@16 +WriteConsoleInputW@16 +WriteConsoleOutputCharacterW@20 +WriteConsoleOutputW@20 +WriteConsoleW@20 +WritePrivateProfileSectionW@12 +WritePrivateProfileStringW@16 +WritePrivateProfileStructW@20 +WriteProfileSectionW@8 +WriteProfileStringW@12 +;auxGetDevCapsW@12 +capCreateCaptureWindowW@32 +capGetDriverDescriptionW@20 +;joyGetDevCapsW@12 +lstrcatW@8 +lstrcmpW@8 +lstrcmpiW@8 +lstrcpyW@8 +lstrcpynW@12 +lstrlenW@4 +;mciGetDeviceIDW@4 +;mciGetErrorStringW@12 +;mciSendCommandW@16 +;mciSendStringW@16 +;midiInGetDevCapsW@12 +;midiInGetErrorTextW@12 +;midiOutGetDevCapsW@12 +;mixerGetControlDetailsW@12 +;mixerGetDevCapsW@12 +;mixerGetLineControlsW@12 +;mixerGetLineInfoW@12 +;mmioInstallIOProcW@12 +;mmioOpenW@@12 +;mmioRenameW@16 +;sndPlaySoundW@8 +;waveInGetDevCapsW@12 +;waveInGetErrorTextW@12 +;waveOutGetDevCapsW@12 +;waveOutGetErrorTextW@12 +wsprintfW +wvsprintfW@12 diff --git a/sal/systools/win32/uwinapi/uwinapi.dxp b/sal/systools/win32/uwinapi/uwinapi.dxp new file mode 100644 index 000000000000..551671853ae0 --- /dev/null +++ b/sal/systools/win32/uwinapi/uwinapi.dxp @@ -0,0 +1,86 @@ +;************************************************************************* +; +; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +; +; Copyright 2000, 2010 Oracle and/or its affiliates. +; +; OpenOffice.org - a multi-platform office productivity suite +; +; This file is part of OpenOffice.org. +; +; OpenOffice.org is free software: you can redistribute it and/or modify +; it under the terms of the GNU Lesser General Public License version 3 +; only, as published by the Free Software Foundation. +; +; OpenOffice.org 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 version 3 for more details +; (a copy is included in the LICENSE file that accompanied this code). +; +; You should have received a copy of the GNU Lesser General Public License +; version 3 along with OpenOffice.org. If not, see +; <http://www.openoffice.org/license.html> +; for a copy of the LGPLv3 License. +; +;************************************************************************* + +DllGetVersion +;CheckTokenMembership +CommandLineToArgvW +CopyFileExA +CopyFileExW +CreateToolhelp32Snapshot +DrawStateW +EnumProcesses +GetDiskFreeSpaceExA +GetDiskFreeSpaceExW +GetLogicalDriveStringsW +GetLongPathNameA +GetLongPathNameW +GetModuleFileNameExA +GetModuleFileNameExW +GetProcessId +GetUserDefaultUILanguage +GetUserDomainA +GetUserDomainW +Module32First +Module32FirstW +Module32Next +Module32NextW +MoveFileExA +MoveFileExW +Process32First +Process32FirstW +Process32Next +Process32NextW +FindFirstVolumeA +FindFirstVolumeW +FindNextVolumeA +FindNextVolumeW +FindVolumeClose +FindFirstVolumeMountPointA +FindFirstVolumeMountPointW +FindNextVolumeMountPointA +FindNextVolumeMountPointW +FindVolumeMountPointClose +GetVolumeNameForVolumeMountPointA +GetVolumeNameForVolumeMountPointW +DeleteVolumeMountPointA +DeleteVolumeMountPointW +GetVolumePathNameA +GetVolumePathNameW +SetVolumeMountPointA +SetVolumeMountPointW +PathAddBackslashW +PathCompactPathExW +PathFileExistsW +PathFindExtensionW +PathFindFileNameW +PathIsFileSpecW +PathIsUNCW +PathRemoveExtensionW +PathRemoveFileSpecW +PathSetDlgItemPathW +PathStripToRootW +SHCreateItemFromParsingName diff --git a/sal/systools/win32/uwinapi/uwinapi_mingw.dxp b/sal/systools/win32/uwinapi/uwinapi_mingw.dxp new file mode 100644 index 000000000000..81cc6faa0ea0 --- /dev/null +++ b/sal/systools/win32/uwinapi/uwinapi_mingw.dxp @@ -0,0 +1,90 @@ +;************************************************************************* +; +; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +; +; Copyright 2000, 2010 Oracle and/or its affiliates. +; +; OpenOffice.org - a multi-platform office productivity suite +; +; This file is part of OpenOffice.org. +; +; OpenOffice.org is free software: you can redistribute it and/or modify +; it under the terms of the GNU Lesser General Public License version 3 +; only, as published by the Free Software Foundation. +; +; OpenOffice.org 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 version 3 for more details +; (a copy is included in the LICENSE file that accompanied this code). +; +; You should have received a copy of the GNU Lesser General Public License +; version 3 along with OpenOffice.org. If not, see +; <http://www.openoffice.org/license.html> +; for a copy of the LGPLv3 License. +; +;************************************************************************* + +DllGetVersion@4 +CommandLineToArgvW@8 +CopyFileExA@24 +CopyFileExW@24 +CreateToolhelp32Snapshot@8 +DrawStateW@40 +EnumProcesses@12 +GetDiskFreeSpaceExA@16 +GetDiskFreeSpaceExW@16 +GetLogicalDriveStringsW@8 +GetLongPathNameA@12 +GetLongPathNameW@12 +GetModuleFileNameExA@16 +GetModuleFileNameExW@16 +GetProcessId@4 +GetUserDefaultUILanguage@0 +GetUserDomainA@8 +GetUserDomainW@8 +Module32First@8 +Module32FirstW@8 +Module32Next@8 +Module32NextW@8 +MoveFileExA@12 +MoveFileExW@12 +Process32First@8 +Process32FirstW@8 +Process32Next@8 +Process32NextW@8 +FindFirstVolumeA@8 +FindFirstVolumeW@8 +FindNextVolumeA@12 +FindNextVolumeW@12 +FindVolumeClose@4 +FindFirstVolumeMountPointA@12 +FindFirstVolumeMountPointW@12 +FindNextVolumeMountPointA@12 +FindNextVolumeMountPointW@12 +FindVolumeMountPointClose@4 +GetVolumeNameForVolumeMountPointA@12 +GetVolumeNameForVolumeMountPointW@12 +DeleteVolumeMountPointA@4 +DeleteVolumeMountPointW@4 +GetVolumePathNameA@12 +GetVolumePathNameW@12 +SetVolumeMountPointA@8 +SetVolumeMountPointW@8 +PathAddBackslashW@4 +PathCompactPathExW@16 +PathFileExistsW@4 +PathFindExtensionW@4 +PathFindFileNameW@4 +PathIsFileSpecW@4 +PathIsUNCW@4 +PathRemoveExtensionW@4 +PathRemoveFileSpecW@4 +PathSetDlgItemPathW@12 +PathStripToRootW@4 +SHCreateItemFromParsingName@16 +snprintf +snwprintf +vsnprintf +vsnwprintf + diff --git a/sal/systools/win32/uwinapi/win95sys.h b/sal/systools/win32/uwinapi/win95sys.h new file mode 100644 index 000000000000..4ca0c8e8fcff --- /dev/null +++ b/sal/systools/win32/uwinapi/win95sys.h @@ -0,0 +1,348 @@ +#pragma once + +//Kernel32 objects + +#define K32OBJ_SEMAPHORE 0x1 +#define K32OBJ_EVENT 0x2 +#define K32OBJ_MUTEX 0x3 +#define K32OBJ_CRITICAL_SECTION 0x4 +#define K32OBJ_PROCESS 0x5 +#define K32OBJ_THREAD 0x6 +#define K32OBJ_FILE 0x7 +#define K32OBJ_CHANGE 0x8 +#define K32OBJ_CONSOLE 0x9 +#define K32OBJ_SCREEN_BUFFER 0xA +#define K32OBJ_MEM_MAPPED_FILE 0xB +#define K32OBJ_SERIAL 0xC +#define K32OBJ_DEVICE_IOCTL 0xD +#define K32OBJ_PIPE 0xE +#define K32OBJ_MAILSLOT 0xF +#define K32OBJ_TOOLHELP_SNAPSHOT 0x10 +#define K32OBJ_SOCKET 0x11 + + +//Process Database flags + +#define fDebugSingle 0x00000001 +#define fCreateProcessEvent 0x00000002 +#define fExitProcessEvent 0x00000004 +#define fWin16Process 0x00000008 +#define fDosProcess 0x00000010 +#define fConsoleProcess 0x00000020 +#define fFileApisAreOem 0x00000040 +#define fNukeProcess 0x00000080 +#define fServiceProcess 0x00000100 +#define fLoginScriptHack 0x00000800 + + +//Thread Database flags + +#define fCreateThreadEvent 0x00000001 +#define fCancelExceptionAbort 0x00000002 +#define fOnTempStack 0x00000004 +#define fGrowableStack 0x00000008 +#define fDelaySingleStep 0x00000010 +#define fOpenExeAsImmovableFile 0x00000020 +#define fCreateSuspended 0x00000040 +#define fStackOverflow 0x00000080 +#define fNestedCleanAPCs 0x00000100 +#define fWasOemNowAnsi 0x00000200 +#define fOKToSetThreadOem 0x00000400 + +#ifdef _MSC_VER +#pragma warning(disable:4103) +#endif +#pragma pack(1) + + +//MODREF and IMTE structures + +typedef struct _MODREF { + struct _MODREF *pNextModRef; // 00h + DWORD un1; // 04h + DWORD un2; // 08h + DWORD un3; // 0Ch + WORD mteIndex; // 10h + WORD un4; // 12h + DWORD un5; // 14h + PVOID ppdb; // 18h Pointer to process database + DWORD un6; // 1Ch + DWORD un7; // 20h + DWORD un8; // 24h +} MODREF, *PMODREF; + +typedef struct _IMTE { + DWORD un1; // 00h + PIMAGE_NT_HEADERS pNTHdr; // 04h + DWORD un2; // 08h + PSTR pszFileName; // 0Ch + PSTR pszModName; // 10h + WORD cbFileName; // 14h + WORD cbModName; // 16h + DWORD un3; // 18h + DWORD cSections; // 1Ch + DWORD un5; // 20h + DWORD baseAddress; // 24h + WORD hModule16; // 28h + WORD cUsage; // 2Ah + DWORD un7; // 2Ch + PSTR pszFileName2; // 30h + WORD cbFileName2; // 34h + DWORD pszModName2; // 36h + WORD cbModName2; // 3Ah +} IMTE, *PIMTE; + + +//Process Database structure + +typedef struct _ENVIRONMENT_DATABASE { +PSTR pszEnvironment; // 00h Pointer to Environment +DWORD un1; // 04h +PSTR pszCmdLine; // 08h Pointer to command line +PSTR pszCurrDirectory; // 0Ch Pointer to current directory +LPSTARTUPINFOA pStartupInfo;// 10h Pointer to STARTUPINFOA struct +HANDLE hStdIn; // 14h Standard Input +HANDLE hStdOut; // 18h Standard Output +HANDLE hStdErr; // 1Ch Standard Error +DWORD un2; // 20h +DWORD InheritConsole; // 24h +DWORD BreakType; // 28h +DWORD BreakSem; // 2Ch +DWORD BreakEvent; // 30h +DWORD BreakThreadID; // 34h +DWORD BreakHandlers; // 38h +} ENVIRONMENT_DATABASE, *PENVIRONMENT_DATABASE; + +typedef struct _KERNEL_OBJECT { +DWORD Type; // 00h KERNEL32 object type (5) +DWORD cReference; // 04h Number of references to process +} KERNEL_OBJECT, *PKERNEL_OBJECT; + +typedef struct _HANDLE_TABLE_ENTRY { + DWORD flags; // Valid flags depend on what type of object this is + PKERNEL_OBJECT pObject; // Pointer to the object that the handle refers to +} HANDLE_TABLE_ENTRY, *PHANDLE_TABLE_ENTRY; + +typedef struct _HANDLE_TABLE { + DWORD cEntries; // Max number of handles in table + HANDLE_TABLE_ENTRY array[1]; // An array (number is given by cEntries) +} HANDLE_TABLE, *PHANDLE_TABLE; + + +typedef struct _PROCESS_DATABASE { +DWORD Type; // 00h KERNEL32 object type (5) +DWORD cReference; // 04h Number of references to process +DWORD un1; // 08h +DWORD someEvent; // 0Ch An event object (What's it used for???) +DWORD TerminationStatus; // 10h Returned by GetExitCodeProcess +DWORD un2; // 14h +DWORD DefaultHeap; // 18h Address of the process heap +DWORD MemoryContext; // 1Ch pointer to the process's context +DWORD flags; // 20h + // 0x00000001 - fDebugSingle + // 0x00000002 - fCreateProcessEvent + // 0x00000004 - fExitProcessEvent + // 0x00000008 - fWin16Process + // 0x00000010 - fDosProcess + // 0x00000020 - fConsoleProcess + // 0x00000040 - fFileApisAreOem + // 0x00000080 - fNukeProcess + // 0x00000100 - fServiceProcess + // 0x00000800 - fLoginScriptHack +DWORD pPSP; // 24h Linear address of PSP? +WORD PSPSelector; // 28h +WORD MTEIndex; // 2Ah +WORD cThreads; // 2Ch +WORD cNotTermThreads; // 2Eh +WORD un3; // 30h +WORD cRing0Threads; // 32h number of ring 0 threads +HANDLE HeapHandle; // 34h Heap to allocate handle tables out of + // This seems to always be the KERNEL32 heap +HTASK W16TDB; // 38h Win16 Task Database selector +DWORD MemMapFiles; // 3Ch memory mapped file list (?) +PENVIRONMENT_DATABASE pEDB; // 40h Pointer to Environment Database +PHANDLE_TABLE pHandleTable; // 44h Pointer to process handle table +struct _PROCESS_DATABASE *ParentPDB; // 48h Parent process database +PMODREF MODREFlist; // 4Ch Module reference list +DWORD ThreadList; // 50h Threads in this process +DWORD DebuggeeCB; // 54h Debuggee Context block? +DWORD LocalHeapFreeHead; // 58h Head of free list in process heap +DWORD InitialRing0ID; // 5Ch +CRITICAL_SECTION crst; // 60h +DWORD un4[3]; // 78h +DWORD pConsole; // 84h Pointer to console for process +DWORD tlsInUseBits1; // 88h // Represents TLS indices 0 - 31 +DWORD tlsInUseBits2; // 8Ch // Represents TLS indices 32 - 63 +DWORD ProcessDWORD; // 90h +struct _PROCESS_DATABASE *ProcessGroup; // 94h +DWORD pExeMODREF; // 98h pointer to EXE's MODREF +DWORD TopExcFilter; // 9Ch Top Exception Filter? +DWORD BasePriority; // A0h Base scheduling priority for process +DWORD HeapOwnList; // A4h Head of the list of process heaps +DWORD HeapHandleBlockList;// A8h Pointer to head of heap handle block list +DWORD pSomeHeapPtr; // ACh normally zero, but can a pointer to a + // moveable handle block in the heap +DWORD pConsoleProvider; // B0h Process that owns the console we're using? +WORD EnvironSelector; // B4h Selector containing process environment +WORD ErrorMode; // B6H SetErrorMode value (also thunks to Win16) +DWORD pevtLoadFinished; // B8h Pointer to event LoadFinished? +WORD UTState; // BCh +} PROCESS_DATABASE, *PPROCESS_DATABASE; + + +//TIB (Thread Information Block) structure + +typedef struct _SEH_record { + struct _SEH_record *pNext; + FARPROC pfnHandler; +} SEH_record, *PSEH_record; + +// This is semi-documented in the NTDDK.H file from the NT DDK +typedef struct _TIB { +PSEH_record pvExcept; // 00h Head of exception record list +PVOID pvStackUserTop; // 04h Top of user stack +PVOID pvStackUserBase; // 08h Base of user stack +WORD pvTDB; // 0Ch TDB +WORD pvThunksSS; // 0Eh SS selector used for thunking to 16 bits +DWORD SelmanList; // 10h +PVOID pvArbitrary; // 14h Available for application use +struct _tib *ptibSelf; // 18h Linear address of TIB structure +WORD TIBFlags; // 1Ch +WORD Win16MutexCount; // 1Eh +DWORD DebugContext; // 20h +DWORD pCurrentPriority; // 24h +DWORD pvQueue; // 28h Message Queue selector +PVOID *pvTLSArray; // 2Ch Thread Local Storage array +} TIB, *PTIB; + + +//TDBX structure + +typedef struct _TDBX { + DWORD ptdb; // 00h // PTHREAD_DATABASE + DWORD ppdb; // 04h // PPROCESDS_DATABASE + DWORD ContextHandle; // 08h + DWORD un1; // 0Ch + DWORD TimeOutHandle; // 10h + DWORD WakeParam; // 14h + DWORD BlockHandle; // 18h + DWORD BlockState; // 1Ch + DWORD SuspendCount; // 20h + DWORD SuspendHandle; // 24h + DWORD MustCompleteCount; // 28h + DWORD WaitExFlags; // 2Ch + // 0x00000001 - WAITEXBIT + // 0x00000002 - WAITACKBIT + // 0x00000004 - SUSPEND_APC_PENDING + // 0x00000008 - SUSPEND_TERMINATED + // 0x00000010 - BLOCKED_FOR_TERMINATION + // 0x00000020 - EMULATE_NPX + // 0x00000040 - WIN32_NPX + // 0x00000080 - EXTENDED_HANDLES + // 0x00000100 - FROZEN + // 0x00000200 - DONT_FREEZE + // 0x00000400 - DONT_UNFREEZE + // 0x00000800 - DONT_TRACE + // 0x00001000 - STOP_TRACING + // 0x00002000 - WAITING_FOR_CRST_SAFE + // 0x00004000 - CRST_SAFE + // 0x00040000 - BLOCK_TERMINATE_APC + DWORD SyncWaitCount; // 30h + DWORD QueuedSyncFuncs; // 34h + DWORD UserAPCList; // 38h + DWORD KernAPCList; // 3Ch + DWORD pPMPSPSelector; // 40h + DWORD BlockedOnID; // 44h + DWORD un2[7]; // 48h + DWORD TraceRefData; // 64h + DWORD TraceCallBack; // 68h + DWORD TraceEventHandle; // 6Ch + WORD TraceOutLastCS; // 70h + WORD K16TDB; // 72h + WORD K16PDB; // 74h + WORD DosPDBSeg; // 76h + WORD ExceptionCount; // 78h +} TDBX, *PTDBX; + + +//Thread Database structure + +typedef struct _THREAD_DATABASE { +DWORD Type; // 00h +DWORD cReference; // 04h +PPROCESS_DATABASE pProcess; // 08h +DWORD someEvent; // 0Ch An event object (What's it used for???) +DWORD pvExcept; // 10h This field through field 3CH is a TIB + // structure (see TIB.H) +DWORD TopOfStack; // 14h +DWORD StackLow; // 18h +WORD W16TDB; // 1Ch +WORD StackSelector16; // 1Eh Used when thunking down to 16 bits +DWORD SelmanList; // 20h +DWORD UserPointer; // 24h +PTIB pTIB; // 28h +WORD TIBFlags; // 2Ch TIBF_WIN32 = 1, TIBF_TRAP = 2 +WORD Win16MutexCount; // 2Eh +DWORD DebugContext; // 30h +PDWORD pCurrentPriority; // 34h +DWORD MessageQueue; // 38h +DWORD pTLSArray; // 3Ch +PPROCESS_DATABASE pProcess2;// 40h Another copy of the thread's process??? +DWORD Flags; // 44h + // 0x00000001 - fCreateThreadEvent + // 0x00000002 - fCancelExceptionAbort + // 0x00000004 - fOnTempStack + // 0x00000008 - fGrowableStack + // 0x00000010 - fDelaySingleStep + // 0x00000020 - fOpenExeAsImmovableFile + // 0x00000040 - fCreateSuspended + // 0x00000080 - fStackOverflow + // 0x00000100 - fNestedCleanAPCs + // 0x00000200 - fWasOemNowAnsi + // 0x00000400 - fOKToSetThreadOem +DWORD TerminationStatus; // 48h Returned by GetExitCodeThread +WORD TIBSelector; // 4Ch +WORD EmulatorSelector; // 4Eh +DWORD cHandles; // 50h +DWORD WaitNodeList; // 54h +DWORD un4; // 58h +DWORD Ring0Thread; // 5Ch +PTDBX pTDBX; // 60 +DWORD StackBase; // 64h +DWORD TerminationStack; // 68h +DWORD EmulatorData; // 6Ch +DWORD GetLastErrorCode; // 70h +DWORD DebuggerCB; // 74h +DWORD DebuggerThread; // 78h +PCONTEXT ThreadContext; // 7Ch // register context defined in WINNT.H +DWORD Except16List; // 80h +DWORD ThunkConnect; // 84h +DWORD NegStackBase; // 88h +DWORD CurrentSS; // 8Ch +DWORD SSTable; // 90h +DWORD ThunkSS16; // 94h +DWORD TLSArray[64]; // 98h +DWORD DeltaPriority; // 198h + +// The retail version breaks off somewhere around here. +// All the remaining fields are most likely only in the debug version + +DWORD un5[7]; // 19Ch +DWORD pCreateData16; // 1B8h +DWORD APISuspendCount; // 1BCh # of times SuspendThread has been called +DWORD un6; // 1C0h +DWORD WOWChain; // 1C4h +WORD wSSBig; // 1C8h +WORD un7; // 1CAh +DWORD lp16SwitchRec; // 1CCh +DWORD un8[6]; // 1D0h +DWORD pSomeCritSect1; // 1E8h +DWORD pWin16Mutex; // 1ECh +DWORD pWin32Mutex; // 1F0h +DWORD pSomeCritSect2; // 1F4h +DWORD un9; // 1F8h +DWORD ripString; // 1FCh +DWORD LastTlsSetValueEIP[64]; // 200h (parallel to TlsArray, contains EIP + // where TLS value was last set from) +} THREAD_DATABASE, *PTHREAD_DATABASE; + |