From 093a0db906d7ac2a0460bdc53a9012727f842f18 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Sun, 15 Mar 2009 11:22:15 +0000 Subject: [PATCH] - Add mssign32, msisip, query, updspapi, wintab32 from Wine svn path=/trunk/; revision=40031 --- reactos/baseaddress.rbuild | 4 + reactos/boot/bootdata/packages/reactos.dff | 6 + reactos/dll/win32/msisip/main.c | 250 ++++ reactos/dll/win32/msisip/msisip.rbuild | 13 + reactos/dll/win32/msisip/msisip.spec | 8 + reactos/dll/win32/mssign32/mssign32.rbuild | 11 + reactos/dll/win32/mssign32/mssign32.spec | 30 + reactos/dll/win32/mssign32/mssign32_main.c | 42 + reactos/dll/win32/mssip32/main.c | 46 + reactos/dll/win32/mssip32/mssip32.rbuild | 11 + reactos/dll/win32/mssip32/mssip32.spec | 9 + reactos/dll/win32/query/query.rbuild | 12 + reactos/dll/win32/query/query.spec | 46 + reactos/dll/win32/query/query_main.c | 101 ++ reactos/dll/win32/updspapi/main.c | 37 + reactos/dll/win32/updspapi/updspapi.rbuild | 11 + reactos/dll/win32/updspapi/updspapi.spec | 78 ++ reactos/dll/win32/win32.rbuild | 18 + reactos/dll/win32/wintab32/context.c | 1085 ++++++++++++++++++ reactos/dll/win32/wintab32/manager.c | 291 +++++ reactos/dll/win32/wintab32/wintab.h | 788 +++++++++++++ reactos/dll/win32/wintab32/wintab.spec | 42 + reactos/dll/win32/wintab32/wintab16.c | 540 +++++++++ reactos/dll/win32/wintab32/wintab32.c | 148 +++ reactos/dll/win32/wintab32/wintab32.rbuild | 13 + reactos/dll/win32/wintab32/wintab32.spec | 44 + reactos/dll/win32/wintab32/wintab_internal.h | 162 +++ reactos/include/psdk/cierror.h | 44 + reactos/media/doc/README.WINE | 6 + 29 files changed, 3896 insertions(+) create mode 100644 reactos/dll/win32/msisip/main.c create mode 100644 reactos/dll/win32/msisip/msisip.rbuild create mode 100644 reactos/dll/win32/msisip/msisip.spec create mode 100644 reactos/dll/win32/mssign32/mssign32.rbuild create mode 100644 reactos/dll/win32/mssign32/mssign32.spec create mode 100644 reactos/dll/win32/mssign32/mssign32_main.c create mode 100644 reactos/dll/win32/mssip32/main.c create mode 100644 reactos/dll/win32/mssip32/mssip32.rbuild create mode 100644 reactos/dll/win32/mssip32/mssip32.spec create mode 100644 reactos/dll/win32/query/query.rbuild create mode 100644 reactos/dll/win32/query/query.spec create mode 100644 reactos/dll/win32/query/query_main.c create mode 100644 reactos/dll/win32/updspapi/main.c create mode 100644 reactos/dll/win32/updspapi/updspapi.rbuild create mode 100644 reactos/dll/win32/updspapi/updspapi.spec create mode 100644 reactos/dll/win32/wintab32/context.c create mode 100644 reactos/dll/win32/wintab32/manager.c create mode 100644 reactos/dll/win32/wintab32/wintab.h create mode 100644 reactos/dll/win32/wintab32/wintab.spec create mode 100644 reactos/dll/win32/wintab32/wintab16.c create mode 100644 reactos/dll/win32/wintab32/wintab32.c create mode 100644 reactos/dll/win32/wintab32/wintab32.rbuild create mode 100644 reactos/dll/win32/wintab32/wintab32.spec create mode 100644 reactos/dll/win32/wintab32/wintab_internal.h create mode 100644 reactos/include/psdk/cierror.h diff --git a/reactos/baseaddress.rbuild b/reactos/baseaddress.rbuild index ca9b987e67d..725150512e4 100644 --- a/reactos/baseaddress.rbuild +++ b/reactos/baseaddress.rbuild @@ -42,6 +42,8 @@ + + @@ -118,6 +120,7 @@ + @@ -232,6 +235,7 @@ + diff --git a/reactos/boot/bootdata/packages/reactos.dff b/reactos/boot/bootdata/packages/reactos.dff index a3504535d5d..ea3d3c5dcf1 100644 --- a/reactos/boot/bootdata/packages/reactos.dff +++ b/reactos/boot/bootdata/packages/reactos.dff @@ -319,7 +319,10 @@ dll\win32\mshtml.tlb\mshtml.tlb 1 dll\win32\msi\msi.dll 1 dll\win32\msimg32\msimg32.dll 1 dll\win32\msimtf\msimtf.dll 1 +dll\win32\msisip\msisip.dll 1 dll\win32\msrle32\msrle32.dll 1 +dll\win32\mssign32\mssign32.dll 1 +dll\win32\mssip32\mssip32.dll 1 dll\win32\mstask\mstask.dll 1 dll\win32\msvcrt\msvcrt.dll 1 dll\win32\msvcrt20\msvcrt20.dll 1 @@ -356,6 +359,7 @@ dll\win32\psapi\psapi.dll 1 dll\win32\pstorec\pstorec.dll 1 dll\win32\qmgr\qmgr.dll 1 dll\win32\qmgrprxy\qmgrprxy.dll 1 +dll\win32\query\query.dll 1 dll\win32\rasapi32\rasapi32.dll 1 dll\win32\rasdlg\rasdlg.dll 1 dll\win32\rasman\rasman.dll 1 @@ -396,6 +400,7 @@ dll\win32\uext2\uext2.dll 1 dll\win32\ufat\ufat.dll 1 dll\win32\ufatx\ufatx.dll 1 optional dll\win32\untfs\untfs.dll 1 +dll\win32\updspapi\updspapi.dll 1 dll\win32\url\url.dll 1 dll\win32\urlmon\urlmon.dll 1 dll\win32\user32\user32.dll 1 @@ -410,6 +415,7 @@ dll\win32\wininet\wininet.dll 1 dll\win32\winmm\winmm.dll 1 dll\win32\winspool\winspool.drv 1 dll\win32\winsta\winsta.dll 1 +dll\win32\wintab32\wintab32.dll 1 dll\win32\wlanapi\wlanapi.dll 1 dll\win32\wintrust\wintrust.dll 1 dll\win32\wldap32\wldap32.dll 1 diff --git a/reactos/dll/win32/msisip/main.c b/reactos/dll/win32/msisip/main.c new file mode 100644 index 00000000000..cea0398e91b --- /dev/null +++ b/reactos/dll/win32/msisip/main.c @@ -0,0 +1,250 @@ +/* + * Copyright 2008 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include +#include "windef.h" +#include "winbase.h" +#include "wincrypt.h" +#include "mssip.h" +#define COBJMACROS +#include "objbase.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msisip); + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + case DLL_PROCESS_DETACH: + break; + default: + break; + } + + return TRUE; +} + +static GUID mySubject = { 0x000c10f1, 0x0000, 0x0000, + { 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 }}; + +/*********************************************************************** + * DllRegisterServer (MSISIP.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + static WCHAR msisip[] = { 'M','S','I','S','I','P','.','D','L','L',0 }; + static WCHAR getSignedDataMsg[] = { 'M','s','i','S','I','P','G','e','t', + 'S','i','g','n','e','d','D','a','t','a','M','s','g',0 }; + static WCHAR putSignedDataMsg[] = { 'M','s','i','S','I','P','P','u','t', + 'S','i','g','n','e','d','D','a','t','a','M','s','g',0 }; + static WCHAR createIndirectData[] = { 'M','s','i','S','I','P', + 'C','r','e','a','t','e','I','n','d','i','r','e','c','t','D','a','t','a', + 0 }; + static WCHAR verifyIndirectData[] = { 'M','s','i','S','I','P', + 'V','e','r','i','f','y','I','n','d','i','r','e','c','t','D','a','t','a', + 0 }; + static WCHAR removeSignedDataMsg[] = { 'M','s','i','S','I','P','R','e','m', + 'o','v','e','S','i','g','n','e','d','D','a','t','a','M','s','g', 0 }; + static WCHAR isMyTypeOfFile[] = { 'M','s','i','S','I','P', + 'I','s','M','y','T','y','p','e','O','f','F','i','l','e',0 }; + + SIP_ADD_NEWPROVIDER prov; + + memset(&prov, 0, sizeof(prov)); + prov.cbStruct = sizeof(prov); + prov.pwszDLLFileName = msisip; + prov.pgSubject = &mySubject; + prov.pwszGetFuncName = getSignedDataMsg; + prov.pwszPutFuncName = putSignedDataMsg; + prov.pwszCreateFuncName = createIndirectData; + prov.pwszVerifyFuncName = verifyIndirectData; + prov.pwszRemoveFuncName = removeSignedDataMsg; + prov.pwszIsFunctionNameFmt2 = isMyTypeOfFile; + return CryptSIPAddProvider(&prov) ? S_OK : S_FALSE; +} + +/*********************************************************************** + * DllUnregisterServer (MSISIP.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + CryptSIPRemoveProvider(&mySubject); + return S_OK; +} + +/*********************************************************************** + * MsiSIPGetSignedDataMsg (MSISIP.@) + */ +BOOL WINAPI MsiSIPGetSignedDataMsg(SIP_SUBJECTINFO *pSubjectInfo, + DWORD *pdwEncodingType, DWORD dwIndex, DWORD *pcbSignedDataMsg, + BYTE *pbSignedDataMsg) +{ + static const WCHAR digitalSig[] = { 5,'D','i','g','i','t','a','l', + 'S','i','g','n','a','t','u','r','e',0 }; + BOOL ret = FALSE; + IStorage *stg = NULL; + HRESULT r; + IStream *stm = NULL; + BYTE hdr[2], len[sizeof(DWORD)]; + DWORD count, lenBytes, dataBytes; + + TRACE("(%p %p %d %p %p)\n", pSubjectInfo, pdwEncodingType, dwIndex, + pcbSignedDataMsg, pbSignedDataMsg); + + r = StgOpenStorage(pSubjectInfo->pwsFileName, NULL, + STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg); + if (FAILED(r)) + { + TRACE("couldn't open %s\n", debugstr_w(pSubjectInfo->pwsFileName)); + goto end; + } + + r = IStorage_OpenStream(stg, digitalSig, 0, + STGM_READ|STGM_SHARE_EXCLUSIVE, 0, &stm); + if (FAILED(r)) + { + TRACE("couldn't find digital signature stream\n"); + goto freestorage; + } + + r = IStream_Read(stm, hdr, sizeof(hdr), &count); + if (FAILED(r) || count != sizeof(hdr)) + goto freestream; + if (hdr[0] != 0x30) + { + WARN("unexpected data in digital sig: 0x%02x%02x\n", hdr[0], hdr[1]); + goto freestream; + } + + /* Read the asn.1 length from the stream. Only supports definite-length + * values, which DER-encoded signatures should be. + */ + if (hdr[1] == 0x80) + { + WARN("indefinite-length encoding not supported!\n"); + goto freestream; + } + else if (hdr[1] & 0x80) + { + DWORD temp; + LPBYTE ptr; + + lenBytes = hdr[1] & 0x7f; + if (lenBytes > sizeof(DWORD)) + { + WARN("asn.1 length too long (%d)\n", lenBytes); + goto freestream; + } + r = IStream_Read(stm, len, lenBytes, &count); + if (FAILED(r) || count != lenBytes) + goto freestream; + dataBytes = 0; + temp = lenBytes; + ptr = len; + while (temp--) + { + dataBytes <<= 8; + dataBytes |= *ptr++; + } + } + else + { + lenBytes = 0; + dataBytes = hdr[1]; + } + + if (!pbSignedDataMsg) + { + *pcbSignedDataMsg = 2 + lenBytes + dataBytes; + ret = TRUE; + } + else if (*pcbSignedDataMsg < 2 + lenBytes + dataBytes) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + *pcbSignedDataMsg = 2 + lenBytes + dataBytes; + } + else + { + LPBYTE ptr = pbSignedDataMsg; + + memcpy(ptr, hdr, sizeof(hdr)); + ptr += sizeof(hdr); + if (lenBytes) + { + memcpy(ptr, len, lenBytes); + ptr += lenBytes; + } + r = IStream_Read(stm, ptr, dataBytes, &count); + if (SUCCEEDED(r) && count == dataBytes) + { + *pdwEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING; + *pcbSignedDataMsg = 2 + lenBytes + dataBytes; + ret = TRUE; + } + } + +freestream: + IStream_Release(stm); +freestorage: + IStorage_Release(stg); +end: + + TRACE("returning %d\n", ret); + return ret; +} + +/*********************************************************************** + * MsiSIPIsMyTypeOfFile (MSISIP.@) + */ +BOOL WINAPI MsiSIPIsMyTypeOfFile(WCHAR *name, GUID *subject) +{ + static const WCHAR msi[] = { '.','m','s','i',0 }; + static const WCHAR msp[] = { '.','m','s','p',0 }; + BOOL ret = FALSE; + + TRACE("(%s, %p)\n", debugstr_w(name), subject); + + if (lstrlenW(name) < lstrlenW(msi)) + return FALSE; + else if (lstrcmpiW(name + lstrlenW(name) - lstrlenW(msi), msi) && + lstrcmpiW(name + lstrlenW(name) - lstrlenW(msp), msp)) + return FALSE; + else + { + IStorage *stg = NULL; + HRESULT r = StgOpenStorage(name, NULL, + STGM_DIRECT|STGM_READ|STGM_SHARE_DENY_WRITE, NULL, 0, &stg); + + if (SUCCEEDED(r)) + { + IStorage_Release(stg); + *subject = mySubject; + ret = TRUE; + } + } + return ret; +} diff --git a/reactos/dll/win32/msisip/msisip.rbuild b/reactos/dll/win32/msisip/msisip.rbuild new file mode 100644 index 00000000000..ecfc133b908 --- /dev/null +++ b/reactos/dll/win32/msisip/msisip.rbuild @@ -0,0 +1,13 @@ + + + + . + include/reactos/wine + + main.c + wine + crypt32 + ole32 + kernel32 + ntdll + diff --git a/reactos/dll/win32/msisip/msisip.spec b/reactos/dll/win32/msisip/msisip.spec new file mode 100644 index 00000000000..cfe829249cb --- /dev/null +++ b/reactos/dll/win32/msisip/msisip.spec @@ -0,0 +1,8 @@ +5 stdcall MsiSIPIsMyTypeOfFile(wstr ptr) +6 stdcall MsiSIPGetSignedDataMsg(ptr ptr long ptr ptr) +7 stub MsiSIPPutSignedDataMsg +8 stub MsiSIPRemoveSignedDataMsg +9 stub MsiSIPCreateIndirectData +10 stub MsiSIPVerifyIndirectData +11 stdcall DllRegisterServer() +12 stdcall DllUnregisterServer() diff --git a/reactos/dll/win32/mssign32/mssign32.rbuild b/reactos/dll/win32/mssign32/mssign32.rbuild new file mode 100644 index 00000000000..be7cca8a244 --- /dev/null +++ b/reactos/dll/win32/mssign32/mssign32.rbuild @@ -0,0 +1,11 @@ + + + + . + include/reactos/wine + + mssign32_main.c + wine + kernel32 + ntdll + diff --git a/reactos/dll/win32/mssign32/mssign32.spec b/reactos/dll/win32/mssign32/mssign32.spec new file mode 100644 index 00000000000..95b42e4eb6b --- /dev/null +++ b/reactos/dll/win32/mssign32/mssign32.spec @@ -0,0 +1,30 @@ +@ stub DllRegisterServer +@ stub DllUnregisterServer +@ stub FreeCryptProvFromCert +@ stub GetCryptProvFromCert +@ stub PvkFreeCryptProv +@ stub PvkGetCryptProv +@ stub PvkPrivateKeyAcquireContext +@ stub PvkPrivateKeyAcquireContextA +@ stub PvkPrivateKeyAcquireContextFromMemory +@ stub PvkPrivateKeyAcquireContextFromMemoryA +@ stub PvkPrivateKeyLoad +@ stub PvkPrivateKeyLoadA +@ stub PvkPrivateKeyLoadFromMemory +@ stub PvkPrivateKeyLoadFromMemoryA +@ stub PvkPrivateKeyReleaseContext +@ stub PvkPrivateKeyReleaseContextA +@ stub PvkPrivateKeySave +@ stub PvkPrivateKeySaveA +@ stub PvkPrivateKeySaveToMemory +@ stub PvkPrivateKeySaveToMemoryA +@ stub SignError +@ stub SignerAddTimeStampResponse +@ stub SignerAddTimeStampResponseEx +@ stub SignerCreateTimeStampRequest +@ stub SignerFreeSignerContext +@ stub SignerSign +@ stub SignerSignEx +@ stub SignerTimeStamp +@ stub SignerTimeStampEx +@ stub SpcGetCertFromKey diff --git a/reactos/dll/win32/mssign32/mssign32_main.c b/reactos/dll/win32/mssign32/mssign32_main.c new file mode 100644 index 00000000000..6b403bdc98c --- /dev/null +++ b/reactos/dll/win32/mssign32/mssign32_main.c @@ -0,0 +1,42 @@ +/* + * MSSIGN32 implementation + * + * Copyright 2009 Austin English + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" + + +BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv ) +{ + switch(reason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls( hinst ); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} diff --git a/reactos/dll/win32/mssip32/main.c b/reactos/dll/win32/mssip32/main.c new file mode 100644 index 00000000000..91ec17f9303 --- /dev/null +++ b/reactos/dll/win32/mssip32/main.c @@ -0,0 +1,46 @@ +/* + * Copyright 2008 Maarten Lankhorst + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mssip32); + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + case DLL_PROCESS_DETACH: + break; + default: + break; + } + return TRUE; +} diff --git a/reactos/dll/win32/mssip32/mssip32.rbuild b/reactos/dll/win32/mssip32/mssip32.rbuild new file mode 100644 index 00000000000..7796618c12e --- /dev/null +++ b/reactos/dll/win32/mssip32/mssip32.rbuild @@ -0,0 +1,11 @@ + + + + . + include/reactos/wine + + main.c + wine + kernel32 + ntdll + diff --git a/reactos/dll/win32/mssip32/mssip32.spec b/reactos/dll/win32/mssip32/mssip32.spec new file mode 100644 index 00000000000..0c09bfbdbe2 --- /dev/null +++ b/reactos/dll/win32/mssip32/mssip32.spec @@ -0,0 +1,9 @@ +@ stub CryptSIPGetInfo +@ stub CryptSIPGetRegWorkingFlags +@ stub CryptSIPCreateIndirectData +@ stub CryptSIPGetSignedDataMsg +@ stub CryptSIPPutSignedDataMsg +@ stub CryptSIPRemoveSignedDataMsg +@ stub CryptSIPVerifyIndirectData +@ stub DllRegisterServer +@ stub DllUnregisterServer diff --git a/reactos/dll/win32/query/query.rbuild b/reactos/dll/win32/query/query.rbuild new file mode 100644 index 00000000000..c84ca002a4c --- /dev/null +++ b/reactos/dll/win32/query/query.rbuild @@ -0,0 +1,12 @@ + + + + . + include/reactos/wine + + query_main.c + wine + uuid + kernel32 + ntdll + diff --git a/reactos/dll/win32/query/query.spec b/reactos/dll/win32/query/query.spec new file mode 100644 index 00000000000..612ea2d1337 --- /dev/null +++ b/reactos/dll/win32/query/query.spec @@ -0,0 +1,46 @@ +@ stub _AbortMerges@16 +@ stub BeginCacheTransaction +@ stub BindIFilterFromStorage +@ stub BindIFilterFromStream +@ stub CIBuildQueryNode +@ stub CIBuildQueryTree +@ stub CICreateCommand +@ stub CIGetGlobalPropertyList +@ stub CIMakeICommand +@ stub CIRestrictionToFullTree +@ stdcall CIState(wstr wstr ptr) +@ stub CITextToFullTree +@ stub CITextToFullTreeEx +@ stub CITextToSelectTree +@ stub CITextToSelectTreeEx +@ stub CiSvcMain +@ stub CollectCIISAPIPerformanceData +@ stub CollectCIPerformanceData +@ stub CollectFILTERPerformanceData +@ stub CreateSecurityStore +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +# @ stdcall -private DllUnregisterServer() +@ stub DoneCIISAPIPerformanceData +@ stub DoneCIPerformanceData +@ stub DoneFILTERPerformanceData +@ stub EndCacheTransaction +@ stub _ForceMasterMerge@16 +@ stub FsCiShutdown +@ stub InitializeCIISAPIPerformanceData +@ stub InitializeCIPerformanceData +@ stub InitializeFILTERPerformanceData +@ stub _LoadBHIFilter@16 +@ stub LoadBinaryFilter +@ stub LoadIFilter +@ stub LoadTextFilter +@ stub LocateCatalogs +@ stdcall LocateCatalogsA(str long ptr ptr ptr ptr) +@ stdcall LocateCatalogsW(wstr long ptr ptr ptr ptr) +@ stub SetCatalogState +@ stub SetupCache +@ stub SetupCacheEx +@ stub _StartFWCiSvcWork@12 +@ stub _StopFWCiSvcWork@16 +@ stub SvcEntry_CiSvc diff --git a/reactos/dll/win32/query/query_main.c b/reactos/dll/win32/query/query_main.c new file mode 100644 index 00000000000..cdf0966b052 --- /dev/null +++ b/reactos/dll/win32/query/query_main.c @@ -0,0 +1,101 @@ +/* + * Query Implementation + * + * Copyright 2006 Mike McCormack + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "ole2.h" +#include "ntquery.h" +#include "cierror.h" +#include "initguid.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(query); + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) +{ + switch(fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hInstDLL); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +/*********************************************************************** + * DllGetClassObject (QUERY.@) + */ +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) +{ + FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllCanUnloadNow(void) +{ + FIXME("\n"); + return S_FALSE; +} + +HRESULT WINAPI DllRegisterServer(void) +{ + FIXME("\n"); + return S_OK; +} + +HRESULT WINAPI CIState( WCHAR const *pwcsCat, WCHAR const *pwcsMachine, CI_STATE *pCiState) +{ + FIXME("%s %s %p\n", debugstr_w(pwcsCat), debugstr_w(pwcsMachine), pCiState); + return CI_E_NOT_RUNNING; +} + +HRESULT WINAPI LocateCatalogsA(CHAR const *pwszScope, ULONG iBm, + CHAR *pwszMachine, ULONG *pcMachine, + CHAR *pwszCat, ULONG *pcCat) +{ + + FIXME("%s %u %p %p %p %p\n", debugstr_a(pwszScope), + iBm, pwszMachine, pcMachine, pwszCat, pcCat); + return CI_E_NOT_RUNNING; +} + +HRESULT WINAPI LocateCatalogsW(WCHAR const *pwszScope, ULONG iBm, + WCHAR *pwszMachine, ULONG *pcMachine, + WCHAR *pwszCat, ULONG *pcCat) +{ + + FIXME("%s %u %p %p %p %p\n", debugstr_w(pwszScope), + iBm, pwszMachine, pcMachine, pwszCat, pcCat); + return CI_E_NOT_RUNNING; +} diff --git a/reactos/dll/win32/updspapi/main.c b/reactos/dll/win32/updspapi/main.c new file mode 100644 index 00000000000..73af32fe983 --- /dev/null +++ b/reactos/dll/win32/updspapi/main.c @@ -0,0 +1,37 @@ +/* + * Copyright 2009 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "setupapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(updspapi); + +DWORD WINAPI UpdSpSetDynamicStringA(HINF hinf, LPSTR str1, LPSTR str2) +{ + FIXME("%p %s %s\n", hinf, debugstr_a(str1), debugstr_a(str2)); + return 1; +} diff --git a/reactos/dll/win32/updspapi/updspapi.rbuild b/reactos/dll/win32/updspapi/updspapi.rbuild new file mode 100644 index 00000000000..13597569a03 --- /dev/null +++ b/reactos/dll/win32/updspapi/updspapi.rbuild @@ -0,0 +1,11 @@ + + + . + include/reactos/wine + + main.c + wine + setupapi + kernel32 + ntdll + diff --git a/reactos/dll/win32/updspapi/updspapi.spec b/reactos/dll/win32/updspapi/updspapi.spec new file mode 100644 index 00000000000..dc6b25f0471 --- /dev/null +++ b/reactos/dll/win32/updspapi/updspapi.spec @@ -0,0 +1,78 @@ +@ stdcall UpdSpCloseFileQueue(ptr) setupapi.SetupCloseFileQueue +@ stdcall UpdSpCloseInfFile(long) setupapi.SetupCloseInfFile +@ stdcall UpdSpCommitFileQueueA(long long ptr ptr) setupapi.SetupCommitFileQueueA +@ stdcall UpdSpCommitFileQueueW(long long ptr ptr) setupapi.SetupCommitFileQueueW +@ stdcall UpdSpCopyErrorA(long str str str str str long long str long ptr) setupapi.SetupCopyErrorA +@ stdcall UpdSpCopyErrorW(long wstr wstr wstr wstr wstr long long wstr long ptr) setupapi.SetupCopyErrorW +@ stdcall UpdSpDecompressOrCopyFileA(str str ptr) setupapi.SetupDecompressOrCopyFileA +@ stdcall UpdSpDecompressOrCopyFileW(wstr wstr ptr) setupapi.SetupDecompressOrCopyFileW +@ stdcall UpdSpDefaultQueueCallbackA(ptr long long long) setupapi.SetupDefaultQueueCallbackA +@ stdcall UpdSpDefaultQueueCallbackW(ptr long long long) setupapi.SetupDefaultQueueCallbackW +@ stdcall UpdSpDeleteErrorA(long str str long long) setupapi.SetupDeleteErrorA +@ stdcall UpdSpDeleteErrorW(long wstr wstr long long) setupapi.SetupDeleteErrorW +@ stdcall UpdSpEnumInfSectionsA(long long ptr long ptr) setupapi.SetupEnumInfSectionsA +@ stdcall UpdSpEnumInfSectionsW(long long ptr long ptr) setupapi.SetupEnumInfSectionsW +@ stdcall UpdSpFindFirstLineA(long str str ptr) setupapi.SetupFindFirstLineA +@ stdcall UpdSpFindFirstLineW(long wstr wstr ptr) setupapi.SetupFindFirstLineW +@ stdcall UpdSpFindNextLine(ptr ptr) setupapi.SetupFindNextLine +@ stdcall UpdSpFindNextMatchLineA(ptr str ptr) setupapi.SetupFindNextMatchLineA +@ stdcall UpdSpFindNextMatchLineW(ptr wstr ptr) setupapi.SetupFindNextMatchLineW +@ stdcall UpdSpGetBinaryField(ptr long ptr long ptr) setupapi.SetupGetBinaryField +@ stdcall UpdSpGetFieldCount(ptr) setupapi.SetupGetFieldCount +@ stdcall UpdSpGetIntField(ptr long ptr) setupapi.SetupGetIntField +@ stdcall UpdSpGetLineByIndexA(long str long ptr) setupapi.SetupGetLineByIndexA +@ stdcall UpdSpGetLineByIndexW(long wstr long ptr) setupapi.SetupGetLineByIndexW +@ stdcall UpdSpGetLineCountA(long str) setupapi.SetupGetLineCountA +@ stdcall UpdSpGetLineCountW(long wstr) setupapi.SetupGetLineCountW +@ stdcall UpdSpGetLineTextA(ptr long str str ptr long ptr) setupapi.SetupGetLineTextA +@ stdcall UpdSpGetLineTextW(ptr long wstr wstr ptr long ptr) setupapi.SetupGetLineTextW +@ stdcall UpdSpGetMultiSzFieldA(ptr long ptr long ptr) setupapi.SetupGetMultiSzFieldA +@ stdcall UpdSpGetMultiSzFieldW(ptr long ptr long ptr) setupapi.SetupGetMultiSzFieldW +@ stdcall UpdSpGetSourceFileLocationA(ptr ptr str ptr ptr long ptr) setupapi.SetupGetSourceFileLocationA +@ stdcall UpdSpGetSourceFileLocationW(ptr ptr wstr ptr ptr long ptr) setupapi.SetupGetSourceFileLocationW +@ stdcall UpdSpGetSourceInfoA(ptr long long ptr long ptr) setupapi.SetupGetSourceInfoA +@ stdcall UpdSpGetSourceInfoW(ptr long long ptr long ptr) setupapi.SetupGetSourceInfoW +@ stdcall UpdSpGetStringFieldA(ptr long ptr long ptr) setupapi.SetupGetStringFieldA +@ stdcall UpdSpGetStringFieldW(ptr long ptr long ptr) setupapi.SetupGetStringFieldW +@ stdcall UpdSpGetTargetPathA(ptr ptr str ptr long ptr) setupapi.SetupGetTargetPathA +@ stdcall UpdSpGetTargetPathW(ptr ptr wstr ptr long ptr) setupapi.SetupGetTargetPathW +@ stdcall UpdSpInitDefaultQueueCallback(long) setupapi.SetupInitDefaultQueueCallback +@ stdcall UpdSpInitDefaultQueueCallbackEx(long long long long ptr) setupapi.SetupInitDefaultQueueCallbackEx +@ stdcall UpdSpInstallFilesFromInfSectionA(long long long str str long) setupapi.SetupInstallFilesFromInfSectionA +@ stdcall UpdSpInstallFilesFromInfSectionW(long long long wstr wstr long) setupapi.SetupInstallFilesFromInfSectionW +@ stdcall UpdSpInstallFromInfSectionA(long long str long long str long ptr ptr long ptr) setupapi.SetupInstallFromInfSectionA +@ stdcall UpdSpInstallFromInfSectionW(long long wstr long long wstr long ptr ptr long ptr) setupapi.SetupInstallFromInfSectionW +@ stdcall UpdSpIterateCabinetA(str long ptr ptr) setupapi.SetupIterateCabinetA +@ stdcall UpdSpIterateCabinetW(wstr long ptr ptr) setupapi.SetupIterateCabinetW +@ stdcall UpdSpOpenAppendInfFileA(str long ptr) setupapi.SetupOpenAppendInfFileA +@ stdcall UpdSpOpenAppendInfFileW(wstr long ptr) setupapi.SetupOpenAppendInfFileW +@ stdcall UpdSpOpenFileQueue() setupapi.SetupOpenFileQueue +@ stdcall UpdSpOpenInfFileA(str str long ptr) setupapi.SetupOpenInfFileA +@ stdcall UpdSpOpenInfFileW(wstr wstr long ptr) setupapi.SetupOpenInfFileW +@ stdcall UpdSpPromptForDiskA(ptr str str str str str long ptr long ptr) setupapi.SetupPromptForDiskA +@ stdcall UpdSpPromptForDiskW(ptr wstr wstr wstr wstr wstr long ptr long ptr) setupapi.SetupPromptForDiskW +@ stdcall UpdSpQueueCopyA(long str str str str str str str long) setupapi.SetupQueueCopyA +@ stdcall UpdSpQueueCopySectionA(long str long long str long) setupapi.SetupQueueCopySectionA +@ stdcall UpdSpQueueCopySectionW(long wstr long long wstr long) setupapi.SetupQueueCopySectionW +@ stdcall UpdSpQueueCopyW(long wstr wstr wstr wstr wstr wstr wstr long) setupapi.SetupQueueCopyW +@ stdcall UpdSpQueueDeleteA(long str str) setupapi.SetupQueueDeleteA +@ stdcall UpdSpQueueDeleteSectionA(long long long str) setupapi.SetupQueueDeleteSectionA +@ stdcall UpdSpQueueDeleteSectionW(long long long wstr) setupapi.SetupQueueDeleteSectionW +@ stdcall UpdSpQueueDeleteW(long wstr wstr) setupapi.SetupQueueDeleteW +@ stdcall UpdSpScanFileQueueA(long long long ptr ptr ptr) setupapi.SetupScanFileQueueA +@ stdcall UpdSpScanFileQueueW(long long long ptr ptr ptr) setupapi.SetupScanFileQueueW +@ stdcall UpdSpSetDirectoryIdA(long long str) setupapi.SetupSetDirectoryIdA +@ stdcall UpdSpSetDirectoryIdW(long long wstr) setupapi.SetupSetDirectoryIdW +@ stdcall UpdSpSetDynamicStringA(ptr str str) +@ stub UpdSpSetDynamicStringExA +@ stub UpdSpSetDynamicStringExW +@ stub UpdSpSetDynamicStringW +@ stdcall UpdSpStringTableAddString(ptr wstr long) setupapi.StringTableAddString +@ stdcall UpdSpStringTableAddStringEx(ptr wstr long ptr long) setupapi.StringTableAddStringEx +@ stdcall UpdSpStringTableDestroy(ptr) setupapi.StringTableDestroy +@ stub UpdSpStringTableEnum +@ stdcall UpdSpStringTableInitialize() setupapi.StringTableInitialize +@ stdcall UpdSpStringTableInitializeEx(long long) setupapi.StringTableInitializeEx +@ stdcall UpdSpStringTableLookUpString(ptr wstr long) setupapi.StringTableLookUpString +@ stdcall UpdSpStringTableLookUpStringEx(ptr wstr long ptr long) setupapi.StringTableLookUpStringEx +@ stdcall UpdSpTermDefaultQueueCallback(ptr) setupapi.SetupTermDefaultQueueCallback diff --git a/reactos/dll/win32/win32.rbuild b/reactos/dll/win32/win32.rbuild index bbeaec32642..78d236ed614 100644 --- a/reactos/dll/win32/win32.rbuild +++ b/reactos/dll/win32/win32.rbuild @@ -256,9 +256,18 @@ + + + + + + + + + @@ -367,6 +376,9 @@ + + + @@ -490,6 +502,9 @@ + + + @@ -535,6 +550,9 @@ + + + diff --git a/reactos/dll/win32/wintab32/context.c b/reactos/dll/win32/wintab32/context.c new file mode 100644 index 00000000000..6b52c081a15 --- /dev/null +++ b/reactos/dll/win32/wintab32/context.c @@ -0,0 +1,1085 @@ +/* + * Tablet Context + * + * Copyright 2002 Patrik Stridvall + * Copyright 2003 CodeWeavers, Aric Stewart + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include +#include +#include + +#include "windef.h" +#include "winerror.h" +#include "winbase.h" +#include "winuser.h" +#include "winnls.h" + +#include "wintab.h" +#include "wintab_internal.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wintab32); + +/* + * Documentation found at + * http://www.csl.sony.co.jp/projects/ar/restricted/wintabl.html + */ + +static BOOL gLoaded; +static LPOPENCONTEXT gOpenContexts; +static HCTX gTopContext = (HCTX)0xc00; + +static void LOGCONTEXTAtoW(const LOGCONTEXTA *in, LOGCONTEXTW *out) +{ + MultiByteToWideChar(CP_ACP, 0, in->lcName, -1, out->lcName, LCNAMELEN); + out->lcName[LCNAMELEN - 1] = 0; + /* we use the fact that the fields after lcName are the same in LOGCONTEXTA and W */ + memcpy(&out->lcOptions, &in->lcOptions, sizeof(LOGCONTEXTA) - FIELD_OFFSET(LOGCONTEXTA, lcOptions)); +} + +static void LOGCONTEXTWtoA(const LOGCONTEXTW *in, LOGCONTEXTA *out) +{ + WideCharToMultiByte(CP_ACP, 0, in->lcName, LCNAMELEN, out->lcName, LCNAMELEN, NULL, NULL); + out->lcName[LCNAMELEN - 1] = 0; + /* we use the fact that the fields after lcName are the same in LOGCONTEXTA and W */ + memcpy(&out->lcOptions, &in->lcOptions, sizeof(LOGCONTEXTW) - FIELD_OFFSET(LOGCONTEXTW, lcOptions)); +} + +static BOOL is_logcontext_category(UINT wCategory) +{ + return wCategory == WTI_DEFSYSCTX || wCategory == WTI_DEFCONTEXT || wCategory == WTI_DDCTXS; +} + +static BOOL is_string_field(UINT wCategory, UINT nIndex) +{ + if (wCategory == WTI_INTERFACE && nIndex == IFC_WINTABID) + return TRUE; + if (is_logcontext_category(wCategory) && nIndex == CTX_NAME) + return TRUE; + if ((wCategory >= WTI_CURSORS && wCategory <= WTI_CURSORS + 9) && + (nIndex == CSR_NAME || nIndex == CSR_BTNNAMES)) + return TRUE; + if (wCategory == WTI_DEVICES && (nIndex == DVC_NAME || nIndex == DVC_PNPID)) + return TRUE; + return FALSE; +} + +static const char* DUMPBITS(int x) +{ + char buf[200]; + buf[0] = 0; + if (x&PK_CONTEXT) strcat(buf,"PK_CONTEXT "); + if (x&PK_STATUS) strcat(buf, "PK_STATUS "); + if (x&PK_TIME) strcat(buf, "PK_TIME "); + if (x&PK_CHANGED) strcat(buf, "PK_CHANGED "); + if (x&PK_SERIAL_NUMBER) strcat(buf, "PK_SERIAL_NUMBER "); + if (x&PK_CURSOR) strcat(buf, "PK_CURSOR "); + if (x&PK_BUTTONS) strcat(buf, "PK_BUTTONS "); + if (x&PK_X) strcat(buf, "PK_X "); + if (x&PK_Y) strcat(buf, "PK_Y "); + if (x&PK_Z) strcat(buf, "PK_Z "); + if (x&PK_NORMAL_PRESSURE) strcat(buf, "PK_NORMAL_PRESSURE "); + if (x&PK_TANGENT_PRESSURE) strcat(buf, "PK_TANGENT_PRESSURE "); + if (x&PK_ORIENTATION) strcat(buf, "PK_ORIENTATION "); + if (x&PK_ROTATION) strcat(buf, "PK_ROTATION "); + return wine_dbg_sprintf("{%s}",buf); +} + +static inline void DUMPPACKET(WTPACKET packet) +{ + TRACE("pkContext: %p pkStatus: 0x%x pkTime : 0x%x pkChanged: 0x%x pkSerialNumber: 0x%x pkCursor : %i pkButtons: %x pkX: %i pkY: %i pkZ: %i pkNormalPressure: %i pkTangentPressure: %i pkOrientation: (%i,%i,%i) pkRotation: (%i,%i,%i)\n", + packet.pkContext, packet.pkStatus, packet.pkTime, packet.pkChanged, packet.pkSerialNumber, + packet.pkCursor, packet.pkButtons, packet.pkX, packet.pkY, packet.pkZ, + packet.pkNormalPressure, packet.pkTangentPressure, + packet.pkOrientation.orAzimuth, packet.pkOrientation.orAltitude, packet.pkOrientation.orTwist, + packet.pkRotation.roPitch, packet.pkRotation.roRoll, packet.pkRotation.roYaw); +} + +static inline void DUMPCONTEXT(LOGCONTEXTW lc) +{ + TRACE("Name: %s, Options: %x, Status: %x, Locks: %x, MsgBase: %x, " + "Device: %x, PktRate: %x, " + "%x%s, %x%s, %x%s, " + "BtnDnMask: %x, BtnUpMask: %x, " + "InOrgX: %i, InOrgY: %i, InOrgZ: %i, " + "InExtX: %i, InExtY: %i, InExtZ: %i, " + "OutOrgX: %i, OutOrgY: %i, OutOrgZ: %i, " + "OutExtX: %i, OutExtY: %i, OutExtZ: %i, " + "SensX: %i, SensY: %i, SensZ: %i, " + "SysMode: %i, " + "SysOrgX: %i, SysOrgY: %i, " + "SysExtX: %i, SysExtY: %i, " + "SysSensX: %i, SysSensY: %i\n", + wine_dbgstr_w(lc.lcName), lc.lcOptions, lc.lcStatus, lc.lcLocks, lc.lcMsgBase, + lc.lcDevice, lc.lcPktRate, lc.lcPktData, DUMPBITS(lc.lcPktData), + lc.lcPktMode, DUMPBITS(lc.lcPktMode), lc.lcMoveMask, + DUMPBITS(lc.lcMoveMask), lc.lcBtnDnMask, lc.lcBtnUpMask, + lc.lcInOrgX, lc.lcInOrgY, lc.lcInOrgZ, lc.lcInExtX, lc.lcInExtY, + lc.lcInExtZ, lc.lcOutOrgX, lc.lcOutOrgY, lc.lcOutOrgZ, lc.lcOutExtX, + lc.lcOutExtY, lc.lcOutExtZ, lc.lcSensX, lc.lcSensY, lc.lcSensZ, lc.lcSysMode, + lc.lcSysOrgX, lc.lcSysOrgY, lc.lcSysExtX, lc.lcSysExtY, lc.lcSysSensX, + lc.lcSysSensY); +} + + +/* Find an open context given the handle */ +static LPOPENCONTEXT TABLET_FindOpenContext(HCTX hCtx) +{ + LPOPENCONTEXT ptr = gOpenContexts; + while (ptr) + { + if (ptr->handle == hCtx) return ptr; + ptr = ptr->next; + } + return NULL; +} + +static void LoadTablet(void) +{ + TRACE("Initializing the tablet to hwnd %p\n",hwndDefault); + gLoaded= TRUE; + pLoadTabletInfo(hwndDefault); +} + +int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam, + LPARAM lParam, BOOL send_always) +{ + if ((send_always) || (newcontext->context.lcOptions & CXO_MESSAGES)) + { + TRACE("Posting message %x to %p\n",msg, newcontext->hwndOwner); + return PostMessageA(newcontext->hwndOwner, msg, wParam, lParam); + } + return 0; +} + +static inline DWORD ScaleForContext(DWORD In, LONG InOrg, LONG InExt, LONG OutOrg, LONG OutExt) +{ + if (((InExt > 0 )&&(OutExt > 0)) || ((InExt<0) && (OutExt < 0))) + return ((In - InOrg) * abs(OutExt) / abs(InExt)) + OutOrg; + else + return ((abs(InExt) - (In - InOrg))*abs(OutExt) / abs(InExt)) + OutOrg; +} + +LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd) +{ + LPOPENCONTEXT ptr=NULL; + + EnterCriticalSection(&csTablet); + + ptr = gOpenContexts; + while (ptr) + { + TRACE("Trying Queue %p (%p %p)\n", ptr->handle, hwnd, ptr->hwndOwner); + + if (ptr->hwndOwner == hwnd) + { + int tgt; + if (!ptr->enabled) + { + ptr = ptr->next; + continue; + } + + tgt = ptr->PacketsQueued; + + packet->pkContext = ptr->handle; + + /* translate packet data to the context */ + + /* Scale as per documentation */ + packet->pkY = ScaleForContext(packet->pkY, ptr->context.lcInOrgY, + ptr->context.lcInExtY, ptr->context.lcOutOrgY, + ptr->context.lcOutExtY); + + packet->pkX = ScaleForContext(packet->pkX, ptr->context.lcInOrgX, + ptr->context.lcInExtX, ptr->context.lcOutOrgX, + ptr->context.lcOutExtX); + + /* flip the Y axis */ + if (ptr->context.lcOutExtY > 0) + packet->pkY = ptr->context.lcOutExtY - packet->pkY; + else if (ptr->context.lcOutExtY < 0) + packet->pkY = abs(ptr->context.lcOutExtY + packet->pkY); + + DUMPPACKET(*packet); + + if (tgt == ptr->QueueSize) + { + TRACE("Queue Overflow %p\n",ptr->handle); + ptr->PacketQueue[tgt-1].pkStatus |= TPS_QUEUE_ERR; + } + else + { + TRACE("Placed in queue %p index %i\n",ptr->handle,tgt); + ptr->PacketQueue[tgt] = *packet; + ptr->PacketsQueued++; + + if (ptr->ActiveCursor != packet->pkCursor) + { + ptr->ActiveCursor = packet->pkCursor; + if (ptr->context.lcOptions & CXO_CSRMESSAGES) + TABLET_PostTabletMessage(ptr, _WT_CSRCHANGE(ptr->context.lcMsgBase), + (WPARAM)packet->pkSerialNumber, (LPARAM)ptr->handle, + FALSE); + } + } + break; + } + ptr = ptr->next; + } + LeaveCriticalSection(&csTablet); + TRACE("Done (%p)\n",ptr); + return ptr; +} + +/* + * Flushes all packets from the queue. + */ +static inline void TABLET_FlushQueue(LPOPENCONTEXT context) +{ + context->PacketsQueued = 0; +} + +static inline int CopyTabletData(LPVOID target, LPVOID src, INT size) +{ + memcpy(target,src,size); + return(size); +} + +static INT TABLET_FindPacket(LPOPENCONTEXT context, UINT wSerial, + LPWTPACKET *pkt) +{ + int loop; + int index = -1; + for (loop = 0; loop < context->PacketsQueued; loop++) + if (context->PacketQueue[loop].pkSerialNumber == wSerial) + { + index = loop; + *pkt = &context->PacketQueue[loop]; + break; + } + + TRACE("%i .. %i\n",context->PacketsQueued,index); + + return index; +} + + +static LPVOID TABLET_CopyPacketData(LPOPENCONTEXT context, LPVOID lpPkt, + LPWTPACKET wtp) +{ + LPBYTE ptr; + + ptr = lpPkt; + TRACE("Packet Bits %s\n",DUMPBITS(context->context.lcPktData)); + + if (context->context.lcPktData & PK_CONTEXT) + ptr+=CopyTabletData(ptr,&wtp->pkContext,sizeof(HCTX)); + if (context->context.lcPktData & PK_STATUS) + ptr+=CopyTabletData(ptr,&wtp->pkStatus,sizeof(UINT)); + if (context->context.lcPktData & PK_TIME) + ptr+=CopyTabletData(ptr,&wtp->pkTime,sizeof(LONG)); + if (context->context.lcPktData & PK_CHANGED) + ptr+=CopyTabletData(ptr,&wtp->pkChanged,sizeof(WTPKT)); + if (context->context.lcPktData & PK_SERIAL_NUMBER) + ptr+=CopyTabletData(ptr,&wtp->pkChanged,sizeof(UINT)); + if (context->context.lcPktData & PK_CURSOR) + ptr+=CopyTabletData(ptr,&wtp->pkCursor,sizeof(UINT)); + if (context->context.lcPktData & PK_BUTTONS) + ptr+=CopyTabletData(ptr,&wtp->pkButtons,sizeof(DWORD)); + if (context->context.lcPktData & PK_X) + ptr+=CopyTabletData(ptr,&wtp->pkX,sizeof(DWORD)); + if (context->context.lcPktData & PK_Y) + ptr+=CopyTabletData(ptr,&wtp->pkY,sizeof(DWORD)); + if (context->context.lcPktData & PK_Z) + ptr+=CopyTabletData(ptr,&wtp->pkZ,sizeof(DWORD)); + if (context->context.lcPktData & PK_NORMAL_PRESSURE) + ptr+=CopyTabletData(ptr,&wtp->pkNormalPressure,sizeof(UINT)); + if (context->context.lcPktData & PK_TANGENT_PRESSURE) + ptr+=CopyTabletData(ptr,&wtp->pkTangentPressure,sizeof(UINT)); + if (context->context.lcPktData & PK_ORIENTATION) + ptr+=CopyTabletData(ptr,&wtp->pkOrientation,sizeof(ORIENTATION)); + if (context->context.lcPktData & PK_ROTATION) + ptr+=CopyTabletData(ptr,&wtp->pkRotation,sizeof(ROTATION)); + + /*TRACE("Copied %i bytes\n",(INT)ptr - (INT)lpPkt); */ + return ptr; +} + +static VOID TABLET_BlankPacketData(LPOPENCONTEXT context, LPVOID lpPkt, INT n) +{ + int rc = 0; + + if (context->context.lcPktData & PK_CONTEXT) + rc +=sizeof(HCTX); + if (context->context.lcPktData & PK_STATUS) + rc +=sizeof(UINT); + if (context->context.lcPktData & PK_TIME) + rc += sizeof(LONG); + if (context->context.lcPktData & PK_CHANGED) + rc += sizeof(WTPKT); + if (context->context.lcPktData & PK_SERIAL_NUMBER) + rc += sizeof(UINT); + if (context->context.lcPktData & PK_CURSOR) + rc += sizeof(UINT); + if (context->context.lcPktData & PK_BUTTONS) + rc += sizeof(DWORD); + if (context->context.lcPktData & PK_X) + rc += sizeof(DWORD); + if (context->context.lcPktData & PK_Y) + rc += sizeof(DWORD); + if (context->context.lcPktData & PK_Z) + rc += sizeof(DWORD); + if (context->context.lcPktData & PK_NORMAL_PRESSURE) + rc += sizeof(UINT); + if (context->context.lcPktData & PK_TANGENT_PRESSURE) + rc += sizeof(UINT); + if (context->context.lcPktData & PK_ORIENTATION) + rc += sizeof(ORIENTATION); + if (context->context.lcPktData & PK_ROTATION) + rc += sizeof(ROTATION); + + rc *= n; + memset(lpPkt,0,rc); +} + + +static UINT WTInfoT(UINT wCategory, UINT nIndex, LPVOID lpOutput, BOOL bUnicode) +{ + UINT result; + + TRACE("(%d, %d, %p, %d)\n", wCategory, nIndex, lpOutput, bUnicode); + if (gLoaded == FALSE) + LoadTablet(); + + /* + * Handle system extents here, as we can use user32.dll code to set them. + */ + if(wCategory == WTI_DEFSYSCTX) + { + switch(nIndex) + { + case CTX_SYSEXTX: + if(lpOutput != NULL) + *(LONG*)lpOutput = GetSystemMetrics(SM_CXSCREEN); + return sizeof(LONG); + case CTX_SYSEXTY: + if(lpOutput != NULL) + *(LONG*)lpOutput = GetSystemMetrics(SM_CYSCREEN); + return sizeof(LONG); + /* No action, delegate to X11Drv */ + } + } + + if (is_logcontext_category(wCategory) && nIndex == 0) + { + if (lpOutput) + { + LOGCONTEXTW buf; + pWTInfoW(wCategory, nIndex, &buf); + + /* Handle system extents here, as we can use user32.dll code to set them */ + if(wCategory == WTI_DEFSYSCTX && nIndex == 0) + { + buf.lcSysExtX = GetSystemMetrics(SM_CXSCREEN); + buf.lcSysExtY = GetSystemMetrics(SM_CYSCREEN); + } + + if (bUnicode) + memcpy(lpOutput, &buf, sizeof(buf)); + else + LOGCONTEXTWtoA(&buf, lpOutput); + } + + result = bUnicode ? sizeof(LOGCONTEXTW) : sizeof(LOGCONTEXTA); + } + else if (is_string_field(wCategory, nIndex) && !bUnicode) + { + int size = pWTInfoW(wCategory, nIndex, NULL); + WCHAR *buf = HeapAlloc(GetProcessHeap(), 0, size); + pWTInfoW(wCategory, nIndex, buf); + result = WideCharToMultiByte(CP_ACP, 0, buf, size/sizeof(WCHAR), lpOutput, lpOutput ? 2*size : 0, NULL, NULL); + HeapFree(GetProcessHeap(), 0, buf); + } + else + result = pWTInfoW(wCategory, nIndex, lpOutput); + + TRACE("returns %d\n", result); + return result; +} + +/*********************************************************************** + * WTInfoA (WINTAB32.20) + */ +UINT WINAPI WTInfoA(UINT wCategory, UINT nIndex, LPVOID lpOutput) +{ + return WTInfoT(wCategory, nIndex, lpOutput, FALSE); +} + + +/*********************************************************************** + * WTInfoW (WINTAB32.1020) + */ +UINT WINAPI WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) +{ + return WTInfoT(wCategory, nIndex, lpOutput, TRUE); +} + +/*********************************************************************** + * WTOpenW (WINTAB32.2021) + */ +HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable) +{ + LPOPENCONTEXT newcontext; + + TRACE("hWnd=%p, lpLogCtx=%p, fEnable=%u\n", hWnd, lpLogCtx, fEnable); + DUMPCONTEXT(*lpLogCtx); + + newcontext = HeapAlloc(GetProcessHeap(), 0 , sizeof(OPENCONTEXT)); + newcontext->context = *lpLogCtx; + newcontext->hwndOwner = hWnd; + newcontext->ActiveCursor = -1; + newcontext->QueueSize = 10; + newcontext->PacketsQueued = 0; + newcontext->PacketQueue=HeapAlloc(GetProcessHeap(),0,sizeof(WTPACKET)*10); + + EnterCriticalSection(&csTablet); + newcontext->handle = gTopContext++; + newcontext->next = gOpenContexts; + gOpenContexts = newcontext; + LeaveCriticalSection(&csTablet); + + pAttachEventQueueToTablet(hWnd); + + TABLET_PostTabletMessage(newcontext, _WT_CTXOPEN(newcontext->context.lcMsgBase), (WPARAM)newcontext->handle, + newcontext->context.lcStatus, TRUE); + + if (fEnable) + { + newcontext->enabled = TRUE; + /* TODO: Add to top of overlap order */ + newcontext->context.lcStatus = CXS_ONTOP; + } + else + { + newcontext->enabled = FALSE; + newcontext->context.lcStatus = CXS_DISABLED; + } + + TABLET_PostTabletMessage(newcontext, _WT_CTXOVERLAP(newcontext->context.lcMsgBase), + (WPARAM)newcontext->handle, + newcontext->context.lcStatus, TRUE); + + return newcontext->handle; +} + +/*********************************************************************** + * WTOpenA (WINTAB32.21) + */ +HCTX WINAPI WTOpenA(HWND hWnd, LPLOGCONTEXTA lpLogCtx, BOOL fEnable) +{ + LOGCONTEXTW logCtxW; + + LOGCONTEXTAtoW(lpLogCtx, &logCtxW); + return WTOpenW(hWnd, &logCtxW, fEnable); +} + +/*********************************************************************** + * WTClose (WINTAB32.22) + */ +BOOL WINAPI WTClose(HCTX hCtx) +{ + LPOPENCONTEXT context,ptr; + + TRACE("(%p)\n", hCtx); + + EnterCriticalSection(&csTablet); + + ptr = context = gOpenContexts; + + while (context && (context->handle != hCtx)) + { + ptr = context; + context = context->next; + } + if (!context) + { + LeaveCriticalSection(&csTablet); + return TRUE; + } + + if (context == gOpenContexts) + gOpenContexts = context->next; + else + ptr->next = context->next; + + LeaveCriticalSection(&csTablet); + + TABLET_PostTabletMessage(context, _WT_CTXCLOSE(context->context.lcMsgBase), (WPARAM)context->handle, + context->context.lcStatus,TRUE); + + HeapFree(GetProcessHeap(),0,context->PacketQueue); + HeapFree(GetProcessHeap(),0,context); + + return TRUE; +} + +/*********************************************************************** + * WTPacketsGet (WINTAB32.23) + */ +int WINAPI WTPacketsGet(HCTX hCtx, int cMaxPkts, LPVOID lpPkts) +{ + int limit; + LPOPENCONTEXT context; + LPVOID ptr = lpPkts; + + TRACE("(%p, %d, %p)\n", hCtx, cMaxPkts, lpPkts); + + if (!hCtx) + return 0; + + EnterCriticalSection(&csTablet); + + context = TABLET_FindOpenContext(hCtx); + + if (lpPkts != NULL) + TABLET_BlankPacketData(context,lpPkts,cMaxPkts); + + if (context->PacketsQueued == 0) + { + LeaveCriticalSection(&csTablet); + return 0; + } + + limit = min(cMaxPkts,context->PacketsQueued); + + if(ptr != NULL) + { + int i = 0; + for(i = 0; i < limit; i++) + ptr=TABLET_CopyPacketData(context ,ptr, &context->PacketQueue[i]); + } + + + if (limit < context->PacketsQueued) + { + memmove(context->PacketQueue, &context->PacketQueue[limit], + (context->PacketsQueued - (limit))*sizeof(WTPACKET)); + } + context->PacketsQueued -= limit; + LeaveCriticalSection(&csTablet); + + TRACE("Copied %i packets\n",limit); + + return limit; +} + +/*********************************************************************** + * WTPacket (WINTAB32.24) + */ +BOOL WINAPI WTPacket(HCTX hCtx, UINT wSerial, LPVOID lpPkt) +{ + int rc = 0; + LPOPENCONTEXT context; + LPWTPACKET wtp = NULL; + + TRACE("(%p, %d, %p)\n", hCtx, wSerial, lpPkt); + + if (!hCtx) + return 0; + + EnterCriticalSection(&csTablet); + + context = TABLET_FindOpenContext(hCtx); + + rc = TABLET_FindPacket(context ,wSerial, &wtp); + + if (rc >= 0) + { + if (lpPkt) + TABLET_CopyPacketData(context ,lpPkt, wtp); + + if ((rc+1) < context->QueueSize) + { + memmove(context->PacketQueue, &context->PacketQueue[rc+1], + (context->PacketsQueued - (rc+1))*sizeof(WTPACKET)); + } + context->PacketsQueued -= (rc+1); + } + LeaveCriticalSection(&csTablet); + + TRACE("Returning %i\n",rc+1); + return rc+1; +} + +/*********************************************************************** + * WTEnable (WINTAB32.40) + */ +BOOL WINAPI WTEnable(HCTX hCtx, BOOL fEnable) +{ + LPOPENCONTEXT context; + + TRACE("hCtx=%p, fEnable=%u\n", hCtx, fEnable); + + if (!hCtx) return FALSE; + + EnterCriticalSection(&csTablet); + context = TABLET_FindOpenContext(hCtx); + /* if we want to enable and it is not enabled then */ + if(fEnable && !context->enabled) + { + context->enabled = TRUE; + /* TODO: Add to top of overlap order */ + context->context.lcStatus = CXS_ONTOP; + TABLET_PostTabletMessage(context, + _WT_CTXOVERLAP(context->context.lcMsgBase), + (WPARAM)context->handle, + context->context.lcStatus, TRUE); + } + /* if we want to disable and it is not disabled then */ + else if (!fEnable && context->enabled) + { + context->enabled = FALSE; + /* TODO: Remove from overlap order?? needs a test */ + context->context.lcStatus = CXS_DISABLED; + TABLET_FlushQueue(context); + TABLET_PostTabletMessage(context, + _WT_CTXOVERLAP(context->context.lcMsgBase), + (WPARAM)context->handle, + context->context.lcStatus, TRUE); + } + LeaveCriticalSection(&csTablet); + + return TRUE; +} + +/*********************************************************************** + * WTOverlap (WINTAB32.41) + * + * Move context to top or bottom of overlap order + */ +BOOL WINAPI WTOverlap(HCTX hCtx, BOOL fToTop) +{ + LPOPENCONTEXT context; + + TRACE("hCtx=%p, fToTop=%u\n", hCtx, fToTop); + + if (!hCtx) return FALSE; + + EnterCriticalSection(&csTablet); + context = TABLET_FindOpenContext(hCtx); + if (!context) + { + LeaveCriticalSection(&csTablet); + return FALSE; + } + + /* if we want to send to top and it's not already there */ + if (fToTop && context->context.lcStatus != CXS_ONTOP) + { + /* TODO: Move context to top of overlap order */ + FIXME("Not moving context to top of overlap order\n"); + context->context.lcStatus = CXS_ONTOP; + TABLET_PostTabletMessage(context, + _WT_CTXOVERLAP(context->context.lcMsgBase), + (WPARAM)context->handle, + context->context.lcStatus, TRUE); + } + else if (!fToTop) + { + /* TODO: Move context to bottom of overlap order */ + FIXME("Not moving context to bottom of overlap order\n"); + context->context.lcStatus = CXS_OBSCURED; + TABLET_PostTabletMessage(context, + _WT_CTXOVERLAP(context->context.lcMsgBase), + (WPARAM)context->handle, + context->context.lcStatus, TRUE); + } + LeaveCriticalSection(&csTablet); + + return TRUE; +} + +/*********************************************************************** + * WTConfig (WINTAB32.61) + */ +BOOL WINAPI WTConfig(HCTX hCtx, HWND hWnd) +{ + FIXME("(%p, %p): stub\n", hCtx, hWnd); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTGetA (WINTAB32.61) + */ +BOOL WINAPI WTGetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx) +{ + LPOPENCONTEXT context; + + TRACE("(%p, %p)\n", hCtx, lpLogCtx); + + if (!hCtx) return 0; + + EnterCriticalSection(&csTablet); + context = TABLET_FindOpenContext(hCtx); + LOGCONTEXTWtoA(&context->context, lpLogCtx); + LeaveCriticalSection(&csTablet); + + return TRUE; +} + +/*********************************************************************** + * WTGetW (WINTAB32.1061) + */ +BOOL WINAPI WTGetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx) +{ + LPOPENCONTEXT context; + + TRACE("(%p, %p)\n", hCtx, lpLogCtx); + + if (!hCtx) return 0; + + EnterCriticalSection(&csTablet); + context = TABLET_FindOpenContext(hCtx); + memmove(lpLogCtx,&context->context,sizeof(LOGCONTEXTW)); + LeaveCriticalSection(&csTablet); + + return TRUE; +} + +/*********************************************************************** + * WTSetA (WINTAB32.62) + */ +BOOL WINAPI WTSetA(HCTX hCtx, LPLOGCONTEXTA lpLogCtx) +{ + LPOPENCONTEXT context; + + TRACE("hCtx=%p, lpLogCtx=%p\n", hCtx, lpLogCtx); + + if (!hCtx || !lpLogCtx) return FALSE; + + /* TODO: if cur process not owner of hCtx only modify + * attribs not locked by owner */ + + EnterCriticalSection(&csTablet); + context = TABLET_FindOpenContext(hCtx); + if (!context) + { + LeaveCriticalSection(&csTablet); + return FALSE; + } + + LOGCONTEXTAtoW(lpLogCtx, &context->context); + LeaveCriticalSection(&csTablet); + + return TRUE; +} + +/*********************************************************************** + * WTSetW (WINTAB32.1062) + */ +BOOL WINAPI WTSetW(HCTX hCtx, LPLOGCONTEXTW lpLogCtx) +{ + LPOPENCONTEXT context; + + TRACE("hCtx=%p, lpLogCtx=%p\n", hCtx, lpLogCtx); + + if (!hCtx || !lpLogCtx) return FALSE; + + /* TODO: if cur process not hCtx owner only modify + * attribs not locked by owner */ + + EnterCriticalSection(&csTablet); + context = TABLET_FindOpenContext(hCtx); + if (!context) + { + LeaveCriticalSection(&csTablet); + return FALSE; + } + + memmove(&context->context, lpLogCtx, sizeof(LOGCONTEXTW)); + LeaveCriticalSection(&csTablet); + + return TRUE; +} + +/*********************************************************************** + * WTExtGet (WINTAB32.63) + */ +BOOL WINAPI WTExtGet(HCTX hCtx, UINT wExt, LPVOID lpData) +{ + FIXME("(%p, %u, %p): stub\n", hCtx, wExt, lpData); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTExtSet (WINTAB32.64) + */ +BOOL WINAPI WTExtSet(HCTX hCtx, UINT wExt, LPVOID lpData) +{ + FIXME("(%p, %u, %p): stub\n", hCtx, wExt, lpData); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTSave (WINTAB32.65) + */ +BOOL WINAPI WTSave(HCTX hCtx, LPVOID lpSaveInfo) +{ + FIXME("(%p, %p): stub\n", hCtx, lpSaveInfo); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTRestore (WINTAB32.66) + */ +HCTX WINAPI WTRestore(HWND hWnd, LPVOID lpSaveInfo, BOOL fEnable) +{ + FIXME("(%p, %p, %u): stub\n", hWnd, lpSaveInfo, fEnable); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return 0; +} + +/*********************************************************************** + * WTPacketsPeek (WINTAB32.80) + */ +int WINAPI WTPacketsPeek(HCTX hCtx, int cMaxPkts, LPVOID lpPkts) +{ + int limit; + LPOPENCONTEXT context; + LPVOID ptr = lpPkts; + + TRACE("(%p, %d, %p)\n", hCtx, cMaxPkts, lpPkts); + + if (!hCtx || !lpPkts) return 0; + + EnterCriticalSection(&csTablet); + + context = TABLET_FindOpenContext(hCtx); + + if (context->PacketsQueued == 0) + { + LeaveCriticalSection(&csTablet); + return 0; + } + + for (limit = 0; limit < cMaxPkts && limit < context->PacketsQueued; limit++) + ptr = TABLET_CopyPacketData(context ,ptr, &context->PacketQueue[limit]); + + LeaveCriticalSection(&csTablet); + TRACE("Copied %i packets\n",limit); + return limit; +} + +/*********************************************************************** + * WTDataGet (WINTAB32.81) + */ +int WINAPI WTDataGet(HCTX hCtx, UINT wBegin, UINT wEnd, + int cMaxPkts, LPVOID lpPkts, LPINT lpNPkts) +{ + LPOPENCONTEXT context; + LPVOID ptr = lpPkts; + INT bgn = 0; + INT end = 0; + INT num = 0; + + TRACE("(%p, %u, %u, %d, %p, %p)\n", + hCtx, wBegin, wEnd, cMaxPkts, lpPkts, lpNPkts); + + if (!hCtx) return 0; + + EnterCriticalSection(&csTablet); + + context = TABLET_FindOpenContext(hCtx); + + if (context->PacketsQueued == 0) + { + LeaveCriticalSection(&csTablet); + return 0; + } + + while (bgn < context->PacketsQueued && + context->PacketQueue[bgn].pkSerialNumber != wBegin) + bgn++; + + end = bgn; + while (end < context->PacketsQueued && + context->PacketQueue[end].pkSerialNumber != wEnd) + end++; + + if ((bgn == end) && (end == context->PacketsQueued)) + { + LeaveCriticalSection(&csTablet); + return 0; + } + + for (num = bgn; num <= end; num++) + ptr = TABLET_CopyPacketData(context ,ptr, &context->PacketQueue[num]); + + /* remove read packets */ + if ((end+1) < context->PacketsQueued) + memmove( &context->PacketQueue[bgn], &context->PacketQueue[end+1], + (context->PacketsQueued - (end+1)) * sizeof (WTPACKET)); + + context->PacketsQueued -= ((end-bgn)+1); + *lpNPkts = ((end-bgn)+1); + + LeaveCriticalSection(&csTablet); + TRACE("Copied %i packets\n",*lpNPkts); + return (end - bgn)+1; +} + +/*********************************************************************** + * WTDataPeek (WINTAB32.82) + */ +int WINAPI WTDataPeek(HCTX hCtx, UINT wBegin, UINT wEnd, + int cMaxPkts, LPVOID lpPkts, LPINT lpNPkts) +{ + LPOPENCONTEXT context; + LPVOID ptr = lpPkts; + INT bgn = 0; + INT end = 0; + INT num = 0; + + TRACE("(%p, %u, %u, %d, %p, %p)\n", + hCtx, wBegin, wEnd, cMaxPkts, lpPkts, lpNPkts); + + if (!hCtx || !lpPkts) return 0; + + EnterCriticalSection(&csTablet); + + context = TABLET_FindOpenContext(hCtx); + + if (context->PacketsQueued == 0) + { + LeaveCriticalSection(&csTablet); + return 0; + } + + while (bgn < context->PacketsQueued && + context->PacketQueue[bgn].pkSerialNumber != wBegin) + bgn++; + + end = bgn; + while (end < context->PacketsQueued && + context->PacketQueue[end].pkSerialNumber != wEnd) + end++; + + if (bgn == context->PacketsQueued || end == context->PacketsQueued) + { + TRACE("%i %i %i\n", bgn, end, context->PacketsQueued); + LeaveCriticalSection(&csTablet); + return 0; + } + + for (num = bgn; num <= end; num++) + ptr = TABLET_CopyPacketData(context ,ptr, &context->PacketQueue[num]); + + *lpNPkts = ((end-bgn)+1); + LeaveCriticalSection(&csTablet); + + TRACE("Copied %i packets\n",*lpNPkts); + return (end - bgn)+1; +} + +/*********************************************************************** + * WTQueuePacketsEx (WINTAB32.200) + */ +BOOL WINAPI WTQueuePacketsEx(HCTX hCtx, UINT *lpOld, UINT *lpNew) +{ + LPOPENCONTEXT context; + + TRACE("(%p, %p, %p)\n", hCtx, lpOld, lpNew); + + if (!hCtx) return 0; + + EnterCriticalSection(&csTablet); + + context = TABLET_FindOpenContext(hCtx); + + if (context->PacketsQueued) + { + *lpOld = context->PacketQueue[0].pkSerialNumber; + *lpNew = context->PacketQueue[context->PacketsQueued-1].pkSerialNumber; + } + else + { + TRACE("No packets\n"); + LeaveCriticalSection(&csTablet); + return FALSE; + } + LeaveCriticalSection(&csTablet); + + return TRUE; +} + +/*********************************************************************** + * WTQueueSizeGet (WINTAB32.84) + */ +int WINAPI WTQueueSizeGet(HCTX hCtx) +{ + LPOPENCONTEXT context; + TRACE("(%p)\n", hCtx); + + if (!hCtx) return 0; + + EnterCriticalSection(&csTablet); + context = TABLET_FindOpenContext(hCtx); + LeaveCriticalSection(&csTablet); + return context->QueueSize; +} + +/*********************************************************************** + * WTQueueSizeSet (WINTAB32.85) + */ +BOOL WINAPI WTQueueSizeSet(HCTX hCtx, int nPkts) +{ + LPOPENCONTEXT context; + + TRACE("(%p, %d)\n", hCtx, nPkts); + + if (!hCtx) return 0; + + EnterCriticalSection(&csTablet); + + context = TABLET_FindOpenContext(hCtx); + + context->PacketQueue = HeapReAlloc(GetProcessHeap(), 0, + context->PacketQueue, sizeof(WTPACKET)*nPkts); + + context->QueueSize = nPkts; + LeaveCriticalSection(&csTablet); + + return nPkts; +} diff --git a/reactos/dll/win32/wintab32/manager.c b/reactos/dll/win32/wintab32/manager.c new file mode 100644 index 00000000000..f225d076891 --- /dev/null +++ b/reactos/dll/win32/wintab32/manager.c @@ -0,0 +1,291 @@ +/* + * Tablet Manager + * + * Copyright 2002 Patrik Stridvall + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" + +#include "wintab.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wintab32); + +/*********************************************************************** + * WTMgrOpen (WINTAB32.100) + */ +HMGR WINAPI WTMgrOpen(HWND hWnd, UINT wMsgBase) +{ + FIXME("(%p, %u): stub\n", hWnd, wMsgBase); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return NULL; +} + +/*********************************************************************** + * WTMgrClose (WINTAB32.101) + */ +BOOL WINAPI WTMgrClose(HMGR hMgr) +{ + FIXME("(%p): stub\n", hMgr); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrContextEnum (WINTAB32.120) + */ +BOOL WINAPI WTMgrContextEnum(HMGR hMgr, WTENUMPROC lpEnumFunc, LPARAM lParam) +{ + FIXME("(%p, %p, %ld): stub\n", hMgr, lpEnumFunc, lParam); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrContextOwner (WINTAB32.121) + */ +HWND WINAPI WTMgrContextOwner(HMGR hMgr, HCTX hCtx) +{ + FIXME("(%p, %p): stub\n", hMgr, hCtx); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return NULL; +} + +/*********************************************************************** + * WTMgrDefContext (WINTAB32.122) + */ +HCTX WINAPI WTMgrDefContext(HMGR hMgr, BOOL fSystem) +{ + FIXME("(%p, %u): stub\n", hMgr, fSystem); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return NULL; +} + +/*********************************************************************** + * WTMgrDefContextEx (WINTAB32.206) + * + * 1.1 + */ +HCTX WINAPI WTMgrDefContextEx(HMGR hMgr, UINT wDevice, BOOL fSystem) +{ + FIXME("(%p, %hu, %hu): stub\n", hMgr, wDevice, fSystem); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return NULL; +} + +/*********************************************************************** + * WTMgrDeviceConfig (WINTAB32.140) + */ +UINT WINAPI WTMgrDeviceConfig(HMGR hMgr, UINT wDevice, HWND hWnd) +{ + FIXME("(%p, %u, %p): stub\n", hMgr, wDevice, hWnd); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return 0; +} + +/*********************************************************************** + * WTMgrConfigReplaceExA (WINTAB32.202) + */ +BOOL WINAPI WTMgrConfigReplaceExA(HMGR hMgr, BOOL fInstall, + LPSTR lpszModule, LPSTR lpszCfgProc) +{ + FIXME("(%p, %u, %s, %s): stub\n", hMgr, fInstall, + debugstr_a(lpszModule), debugstr_a(lpszCfgProc)); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrConfigReplaceExW (WINTAB32.1202) + */ +BOOL WINAPI WTMgrConfigReplaceExW(HMGR hMgr, BOOL fInstall, + LPWSTR lpszModule, LPSTR lpszCfgProc) +{ + FIXME("(%p, %u, %s, %s): stub\n", hMgr, fInstall, + debugstr_w(lpszModule), debugstr_a(lpszCfgProc)); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrPacketHookExA (WINTAB32.203) + */ +HWTHOOK WINAPI WTMgrPacketHookExA(HMGR hMgr, int nType, + LPSTR lpszModule, LPSTR lpszHookProc) +{ + FIXME("(%p, %d, %s, %s): stub\n", hMgr, nType, + debugstr_a(lpszModule), debugstr_a(lpszHookProc)); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return NULL; +} + +/*********************************************************************** + * WTMgrPacketHookExW (WINTAB32.1203) + */ +HWTHOOK WINAPI WTMgrPacketHookExW(HMGR hMgr, int nType, + LPWSTR lpszModule, LPSTR lpszHookProc) +{ + FIXME("(%p, %d, %s, %s): stub\n", hMgr, nType, + debugstr_w(lpszModule), debugstr_a(lpszHookProc)); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return NULL; +} + +/*********************************************************************** + * WTMgrPacketUnhook (WINTAB32.204) + */ +BOOL WINAPI WTMgrPacketUnhook(HWTHOOK hHook) +{ + FIXME("(%p): stub\n", hHook); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrPacketHookNext (WINTAB32.205) + */ +LRESULT WINAPI WTMgrPacketHookNext(HWTHOOK hHook, int nCode, + WPARAM wParam, LPARAM lParam) +{ + FIXME("(%p, %d, %lu, %lu): stub\n", hHook, nCode, wParam, lParam); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return 0; +} + + +/*********************************************************************** + * WTMgrExt (WINTAB32.180) + */ +BOOL WINAPI WTMgrExt(HMGR hMgr, UINT wExt, LPVOID lpData) +{ + FIXME("(%p, %u, %p): stub\n", hMgr, wExt, lpData); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrEnable (WINTAB32.181) + */ +BOOL WINAPI WTMgrCsrEnable(HMGR hMgr, UINT wCursor, BOOL fEnable) +{ + FIXME("(%p, %u, %u): stub\n", hMgr, wCursor, fEnable); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrButtonMap (WINTAB32.182) + */ +BOOL WINAPI WTMgrCsrButtonMap(HMGR hMgr, UINT wCursor, + LPBYTE lpLogBtns, LPBYTE lpSysBtns) +{ + FIXME("(%p, %u, %p, %p): stub\n", hMgr, wCursor, lpLogBtns, lpSysBtns); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrPressureBtnMarks (WINTAB32.183) + * + * OBSOLETE IN WIN32! (But only according to documentation) + */ +BOOL WINAPI WTMgrCsrPressureBtnMarks(HMGR hMgr, UINT wCsr, + DWORD dwNMarks, DWORD dwTMarks) +{ + FIXME("(%p, %u, %u, %u): stub\n", hMgr, wCsr, dwNMarks, dwTMarks); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrPressureBtnMarksEx (WINTAB32.201) + */ +BOOL WINAPI WTMgrCsrPressureBtnMarksEx(HMGR hMgr, UINT wCsr, + UINT *lpNMarks, UINT *lpTMarks) +{ + FIXME("(%p, %u, %p, %p): stub\n", hMgr, wCsr, lpNMarks, lpTMarks); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrPressureResponse (WINTAB32.184) + */ +BOOL WINAPI WTMgrCsrPressureResponse(HMGR hMgr, UINT wCsr, + UINT *lpNResp, UINT *lpTResp) +{ + FIXME("(%p, %u, %p, %p): stub\n", hMgr, wCsr, lpNResp, lpTResp); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrExt (WINTAB32.185) + */ +BOOL WINAPI WTMgrCsrExt(HMGR hMgr, UINT wCsr, UINT wExt, LPVOID lpData) +{ + FIXME("(%p, %u, %u, %p): stub\n", hMgr, wCsr, wExt, lpData); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + + return FALSE; +} diff --git a/reactos/dll/win32/wintab32/wintab.h b/reactos/dll/win32/wintab32/wintab.h new file mode 100644 index 00000000000..d10371b0217 --- /dev/null +++ b/reactos/dll/win32/wintab32/wintab.h @@ -0,0 +1,788 @@ +/* + * Copyright (C) 1991-1998 by LCS/Telegraphics + * Copyright (C) 2002 Patrik Stridvall + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WINTAB_H +#define __WINE_WINTAB_H + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ + +/*********************************************************************** + * Messages + */ +#ifndef NOWTMESSAGES + +#define WT_DEFBASE 0x7FF0 +#define WT_MAXOFFSET 0xF + +#define _WT_PACKET(b) ((b)+0) +#define _WT_CTXOPEN(b) ((b)+1) +#define _WT_CTXCLOSE(b) ((b)+2) +#define _WT_CTXUPDATE(b) ((b)+3) +#define _WT_CTXOVERLAP(b) ((b)+4) +#define _WT_PROXIMITY(b) ((b)+5) +#define _WT_INFOCHANGE(b) ((b)+6) +#define _WT_CSRCHANGE(b) ((b)+7) /* 1.1 */ +#define _WT_MAX(b) ((b)+WT_MAXOFFSET) + +#define WT_PACKET _WT_PACKET(WT_DEFBASE) +#define WT_CTXOPEN _WT_CTXOPEN(WT_DEFBASE) +#define WT_CTXCLOSE _WT_CTXCLOSE(WT_DEFBASE) +#define WT_CTXUPDATE _WT_CTXUPDATE(WT_DEFBASE) +#define WT_CTXOVERLAP _WT_CTXOVERLAP(WT_DEFBASE) +#define WT_PROXIMITY _WT_PROXIMITY(WT_DEFBASE) +#define WT_INFOCHANGE _WT_INFOCHANGE(WT_DEFBASE) +#define WT_CSRCHANGE _WT_CSRCHANGE(WT_DEFBASE) /* 1.1 */ +#define WT_MAX _WT_MAX(WT_DEFBASE) + +#endif + +/*********************************************************************** + * COMMON DATA DEFS + */ + +DECLARE_HANDLE(HMGR); /* manager handle */ +DECLARE_HANDLE(HCTX); /* context handle */ +DECLARE_HANDLE(HWTHOOK); /* hook handle */ + +typedef DWORD WTPKT; /* packet mask */ + +#ifndef NOWTPKT + +/* WTPKT bits */ +#define PK_CONTEXT 0x0001 /* reporting context */ +#define PK_STATUS 0x0002 /* status bits */ +#define PK_TIME 0x0004 /* time stamp */ +#define PK_CHANGED 0x0008 /* change bit vector */ +#define PK_SERIAL_NUMBER 0x0010 /* packet serial number */ +#define PK_CURSOR 0x0020 /* reporting cursor */ +#define PK_BUTTONS 0x0040 /* button information */ +#define PK_X 0x0080 /* x axis */ +#define PK_Y 0x0100 /* y axis */ +#define PK_Z 0x0200 /* z axis */ +#define PK_NORMAL_PRESSURE 0x0400 /* normal or tip pressure */ +#define PK_TANGENT_PRESSURE 0x0800 /* tangential or barrel pressure */ +#define PK_ORIENTATION 0x1000 /* orientation info: tilts */ +#define PK_ROTATION 0x2000 /* rotation info; 1.1 */ + +#endif + +typedef DWORD FIX32; /* fixed-point arithmetic type */ + +#ifndef NOFIX32 + +#define INT(x) HIWORD(x) +#define FRAC(x) LOWORD(x) + +#define CASTFIX32(x) ((FIX32)((x)*65536L)) + +#define ROUND(x) (INT(x) + (FRAC(x) > (WORD)0x8000)) + +#define FIX_MUL(c, a, b) \ + (c = (((DWORD)FRAC(a) * FRAC(b)) >> 16) + \ + (DWORD)INT(a) * FRAC(b) + \ + (DWORD)INT(b) * FRAC(a) + \ + ((DWORD)INT(a) * INT(b) << 16)) + +#ifdef _WINDLL +# define FIX_DIV_SC static +#else +# define FIX_DIV_SC +# endif + +#define FIX_DIV(c, a, b) \ + { \ + FIX_DIV_SC DWORD temp, rem, btemp; \ + \ + /* fraction done bytewise */ \ + temp = ((a / b) << 16); \ + rem = a % b; \ + btemp = b; \ + if (INT(btemp) < 256) { \ + rem <<= 8; \ + } else { \ + btemp >>= 8; \ + } \ + temp += ((rem / btemp) << 8); \ + rem %= btemp; \ + rem <<= 8; \ + temp += rem / btemp; \ + c = temp; \ + } + +#endif + +/*********************************************************************** + * INFO DATA DEFS + */ + +#ifndef NOWTINFO + +#ifndef NOWTAXIS + +typedef struct tagAXIS { + LONG axMin; + LONG axMax; + UINT axUnits; + FIX32 axResolution; +} AXIS, *PAXIS, *NPAXIS, *LPAXIS; + +/* unit specifiers */ +#define TU_NONE 0 +#define TU_INCHES 1 +#define TU_CENTIMETERS 2 +#define TU_CIRCLE 3 + +#endif + +#ifndef NOWTSYSBUTTONS + +/* system button assignment values */ +#define SBN_NONE 0x00 +#define SBN_LCLICK 0x01 +#define SBN_LDBLCLICK 0x02 +#define SBN_LDRAG 0x03 +#define SBN_RCLICK 0x04 +#define SBN_RDBLCLICK 0x05 +#define SBN_RDRAG 0x06 +#define SBN_MCLICK 0x07 +#define SBN_MDBLCLICK 0x08 +#define SBN_MDRAG 0x09 + +/* for Pen Windows */ +#define SBN_PTCLICK 0x10 +#define SBN_PTDBLCLICK 0x20 +#define SBN_PTDRAG 0x30 +#define SBN_PNCLICK 0x40 +#define SBN_PNDBLCLICK 0x50 +#define SBN_PNDRAG 0x60 +#define SBN_P1CLICK 0x70 +#define SBN_P1DBLCLICK 0x80 +#define SBN_P1DRAG 0x90 +#define SBN_P2CLICK 0xA0 +#define SBN_P2DBLCLICK 0xB0 +#define SBN_P2DRAG 0xC0 +#define SBN_P3CLICK 0xD0 +#define SBN_P3DBLCLICK 0xE0 +#define SBN_P3DRAG 0xF0 + +#endif + +#ifndef NOWTCAPABILITIES + +/* hardware capabilities */ +#define HWC_INTEGRATED 0x0001 +#define HWC_TOUCH 0x0002 +#define HWC_HARDPROX 0x0004 +#define HWC_PHYSID_CURSORS 0x0008 /* 1.1 */ +#endif + +#ifndef NOWTIFC + +#ifndef NOWTCURSORS + +/* cursor capabilities */ +#define CRC_MULTIMODE 0x0001 /* 1.1 */ +#define CRC_AGGREGATE 0x0002 /* 1.1 */ +#define CRC_INVERT 0x0004 /* 1.1 */ + +#endif + +/* info categories */ +#define WTI_INTERFACE 1 +#define IFC_WINTABID 1 +#define IFC_SPECVERSION 2 +#define IFC_IMPLVERSION 3 +#define IFC_NDEVICES 4 +#define IFC_NCURSORS 5 +#define IFC_NCONTEXTS 6 +#define IFC_CTXOPTIONS 7 +#define IFC_CTXSAVESIZE 8 +#define IFC_NEXTENSIONS 9 +#define IFC_NMANAGERS 10 +#define IFC_MAX 10 + +#endif + +#ifndef NOWTSTATUS + +#define WTI_STATUS 2 +#define STA_CONTEXTS 1 +#define STA_SYSCTXS 2 +#define STA_PKTRATE 3 +#define STA_PKTDATA 4 +#define STA_MANAGERS 5 +#define STA_SYSTEM 6 +#define STA_BUTTONUSE 7 +#define STA_SYSBTNUSE 8 +#define STA_MAX 8 + +#endif + +#ifndef NOWTDEFCONTEXT + +#define WTI_DEFCONTEXT 3 +#define WTI_DEFSYSCTX 4 +#define WTI_DDCTXS 400 /* 1.1 */ +#define WTI_DSCTXS 500 /* 1.1 */ +#define CTX_NAME 1 +#define CTX_OPTIONS 2 +#define CTX_STATUS 3 +#define CTX_LOCKS 4 +#define CTX_MSGBASE 5 +#define CTX_DEVICE 6 +#define CTX_PKTRATE 7 +#define CTX_PKTDATA 8 +#define CTX_PKTMODE 9 +#define CTX_MOVEMASK 10 +#define CTX_BTNDNMASK 11 +#define CTX_BTNUPMASK 12 +#define CTX_INORGX 13 +#define CTX_INORGY 14 +#define CTX_INORGZ 15 +#define CTX_INEXTX 16 +#define CTX_INEXTY 17 +#define CTX_INEXTZ 18 +#define CTX_OUTORGX 19 +#define CTX_OUTORGY 20 +#define CTX_OUTORGZ 21 +#define CTX_OUTEXTX 22 +#define CTX_OUTEXTY 23 +#define CTX_OUTEXTZ 24 +#define CTX_SENSX 25 +#define CTX_SENSY 26 +#define CTX_SENSZ 27 +#define CTX_SYSMODE 28 +#define CTX_SYSORGX 29 +#define CTX_SYSORGY 30 +#define CTX_SYSEXTX 31 +#define CTX_SYSEXTY 32 +#define CTX_SYSSENSX 33 +#define CTX_SYSSENSY 34 +#define CTX_MAX 34 + +#endif + +#ifndef NOWTDEVICES + +#define WTI_DEVICES 100 +#define DVC_NAME 1 +#define DVC_HARDWARE 2 +#define DVC_NCSRTYPES 3 +#define DVC_FIRSTCSR 4 +#define DVC_PKTRATE 5 +#define DVC_PKTDATA 6 +#define DVC_PKTMODE 7 +#define DVC_CSRDATA 8 +#define DVC_XMARGIN 9 +#define DVC_YMARGIN 10 +#define DVC_ZMARGIN 11 +#define DVC_X 12 +#define DVC_Y 13 +#define DVC_Z 14 +#define DVC_NPRESSURE 15 +#define DVC_TPRESSURE 16 +#define DVC_ORIENTATION 17 +#define DVC_ROTATION 18 /* 1.1 */ +#define DVC_PNPID 19 /* 1.1 */ +#define DVC_MAX 19 + +#endif + +#ifndef NOWTCURSORS + +#define WTI_CURSORS 200 +#define CSR_NAME 1 +#define CSR_ACTIVE 2 +#define CSR_PKTDATA 3 +#define CSR_BUTTONS 4 +#define CSR_BUTTONBITS 5 +#define CSR_BTNNAMES 6 +#define CSR_BUTTONMAP 7 +#define CSR_SYSBTNMAP 8 +#define CSR_NPBUTTON 9 +#define CSR_NPBTNMARKS 10 +#define CSR_NPRESPONSE 11 +#define CSR_TPBUTTON 12 +#define CSR_TPBTNMARKS 13 +#define CSR_TPRESPONSE 14 +#define CSR_PHYSID 15 /* 1.1 */ +#define CSR_MODE 16 /* 1.1 */ +#define CSR_MINPKTDATA 17 /* 1.1 */ +#define CSR_MINBUTTONS 18 /* 1.1 */ +#define CSR_CAPABILITIES 19 /* 1.1 */ +/* from http://www.wacomeng.com/devsupport/ibmpc/wacomwindevfaq.html */ +#define CSR_TYPE 20 +#define CSR_MAX 20 + +#endif + +#ifndef NOWTEXTENSIONS + +#define WTI_EXTENSIONS 300 +#define EXT_NAME 1 +#define EXT_TAG 2 +#define EXT_MASK 3 +#define EXT_SIZE 4 +#define EXT_AXES 5 +#define EXT_DEFAULT 6 +#define EXT_DEFCONTEXT 7 +#define EXT_DEFSYSCTX 8 +#define EXT_CURSORS 9 +#define EXT_MAX 109 /* Allow 100 cursors */ + +#endif + +#endif + +/*********************************************************************** + * CONTEXT DATA DEFS + */ + +#define LCNAMELEN 40 +#define LC_NAMELEN 40 + +typedef struct tagLOGCONTEXTA { + char lcName[LCNAMELEN]; + UINT lcOptions; + UINT lcStatus; + UINT lcLocks; + UINT lcMsgBase; + UINT lcDevice; + UINT lcPktRate; + WTPKT lcPktData; + WTPKT lcPktMode; + WTPKT lcMoveMask; + DWORD lcBtnDnMask; + DWORD lcBtnUpMask; + LONG lcInOrgX; + LONG lcInOrgY; + LONG lcInOrgZ; + LONG lcInExtX; + LONG lcInExtY; + LONG lcInExtZ; + LONG lcOutOrgX; + LONG lcOutOrgY; + LONG lcOutOrgZ; + LONG lcOutExtX; + LONG lcOutExtY; + LONG lcOutExtZ; + FIX32 lcSensX; + FIX32 lcSensY; + FIX32 lcSensZ; + BOOL lcSysMode; + int lcSysOrgX; + int lcSysOrgY; + int lcSysExtX; + int lcSysExtY; + FIX32 lcSysSensX; + FIX32 lcSysSensY; +} LOGCONTEXTA, *PLOGCONTEXTA, *NPLOGCONTEXTA, *LPLOGCONTEXTA; + +typedef struct tagLOGCONTEXTW { + WCHAR lcName[LCNAMELEN]; + UINT lcOptions; + UINT lcStatus; + UINT lcLocks; + UINT lcMsgBase; + UINT lcDevice; + UINT lcPktRate; + WTPKT lcPktData; + WTPKT lcPktMode; + WTPKT lcMoveMask; + DWORD lcBtnDnMask; + DWORD lcBtnUpMask; + LONG lcInOrgX; + LONG lcInOrgY; + LONG lcInOrgZ; + LONG lcInExtX; + LONG lcInExtY; + LONG lcInExtZ; + LONG lcOutOrgX; + LONG lcOutOrgY; + LONG lcOutOrgZ; + LONG lcOutExtX; + LONG lcOutExtY; + LONG lcOutExtZ; + FIX32 lcSensX; + FIX32 lcSensY; + FIX32 lcSensZ; + BOOL lcSysMode; + int lcSysOrgX; + int lcSysOrgY; + int lcSysExtX; + int lcSysExtY; + FIX32 lcSysSensX; + FIX32 lcSysSensY; +} LOGCONTEXTW, *PLOGCONTEXTW, *NPLOGCONTEXTW, *LPLOGCONTEXTW; + +DECL_WINELIB_TYPE_AW(LOGCONTEXT) +DECL_WINELIB_TYPE_AW(PLOGCONTEXT) +DECL_WINELIB_TYPE_AW(NPLOGCONTEXT) +DECL_WINELIB_TYPE_AW(LPLOGCONTEXT) + +/* context option values */ +#define CXO_SYSTEM 0x0001 +#define CXO_PEN 0x0002 +#define CXO_MESSAGES 0x0004 +#define CXO_MARGIN 0x8000 +#define CXO_MGNINSIDE 0x4000 +#define CXO_CSRMESSAGES 0x0008 /* 1.1 */ + +/* context status values */ +#define CXS_DISABLED 0x0001 +#define CXS_OBSCURED 0x0002 +#define CXS_ONTOP 0x0004 + +/* context lock values */ +#define CXL_INSIZE 0x0001 +#define CXL_INASPECT 0x0002 +#define CXL_SENSITIVITY 0x0004 +#define CXL_MARGIN 0x0008 +#define CXL_SYSOUT 0x0010 + +/*********************************************************************** + * EVENT DATA DEFS + */ + +/* For packet structure definition, see pktdef.h */ + +/* packet status values */ +#define TPS_PROXIMITY 0x0001 +#define TPS_QUEUE_ERR 0x0002 +#define TPS_MARGIN 0x0004 +#define TPS_GRAB 0x0008 +#define TPS_INVERT 0x0010 /* 1.1 */ + +typedef struct tagORIENTATION { + int orAzimuth; + int orAltitude; + int orTwist; +} ORIENTATION, *PORIENTATION, *NPORIENTATION, *LPORIENTATION; + +typedef struct tagROTATION { /* 1.1 */ + int roPitch; + int roRoll; + int roYaw; +} ROTATION, *PROTATION, *NPROTATION, *LPROTATION; + +/* grandfather in obsolete member names. */ +#define rotPitch roPitch +#define rotRoll roRoll +#define rotYaw roYaw + +/* relative buttons */ +#define TBN_NONE 0 +#define TBN_UP 1 +#define TBN_DOWN 2 + +/*********************************************************************** + * DEVICE CONFIG CONSTANTS + */ + +#ifndef NOWTDEVCFG + +#define WTDC_NONE 0 +#define WTDC_CANCEL 1 +#define WTDC_OK 2 +#define WTDC_RESTART 3 + +#endif + +/*********************************************************************** + * HOOK CONSTANTS + */ + +#ifndef NOWTHOOKS + +#define WTH_PLAYBACK 1 +#define WTH_RECORD 2 + +#define WTHC_GETLPLPFN (-3) +#define WTHC_LPLPFNNEXT (-2) +#define WTHC_LPFNNEXT (-1) +#define WTHC_ACTION 0 +#define WTHC_GETNEXT 1 +#define WTHC_SKIP 2 + +#endif + +/*********************************************************************** + * PREFERENCE FUNCTION CONSTANTS + */ + +#ifndef NOWTPREF + +#define WTP_LPDEFAULT ((LPVOID)-1L) +#define WTP_DWDEFAULT ((DWORD)-1L) + +#endif + +/*********************************************************************** + * EXTENSION TAGS AND CONSTANTS + */ + +#ifndef NOWTEXTENSIONS + +/* constants for use with pktdef.h */ +#define PKEXT_ABSOLUTE 1 +#define PKEXT_RELATIVE 2 + +/* Extension tags. */ +#define WTX_OBT 0 /* Out of bounds tracking */ +#define WTX_FKEYS 1 /* Function keys */ +#define WTX_TILT 2 /* Raw Cartesian tilt; 1.1 */ +#define WTX_CSRMASK 3 /* select input by cursor type; 1.1 */ +#define WTX_XBTNMASK 4 /* Extended button mask; 1.1 */ + +typedef struct tagXBTNMASK { + BYTE xBtnDnMask[32]; + BYTE xBtnUpMask[32]; +} XBTNMASK; + +typedef struct tagTILT { /* 1.1 */ + int tiltX; + int tiltY; +} TILT; + +#endif + +/*********************************************************************** + * Functions + */ + +#ifndef NOWTCALLBACKS + +#ifndef NOWTMANAGERFXNS + +/* callback function types */ +typedef BOOL (WINAPI * WTENUMPROC)(HCTX, LPARAM); /* changed CALLBACK->WINAPI, 1.1 */ +typedef BOOL (WINAPI * WTCONFIGPROC)(HCTX, HWND); +typedef LRESULT (WINAPI * WTHOOKPROC)(int, WPARAM, LPARAM); +typedef WTHOOKPROC *LPWTHOOKPROC; + +#endif + +#endif + +#ifndef NOWTFUNCTIONS + +#ifndef NOWTBASICFXNS +/* BASIC FUNCTIONS */ + +#define ORD_WTInfoA 20 +#define ORD_WTInfoW 1020 +#define ORD_WTInfo WINELIB_NAME_AW(ORD_WTInfo) +#define ORD_WTOpenA 21 +#define ORD_WTOpenW 1021 +#define ORD_WTOpen WINELIB_NAME_AW(ORD_WTOpen) +#define ORD_WTClose 22 +#define ORD_WTPacketsGet 23 +#define ORD_WTPacket 24 + +UINT WINAPI WTInfoA(UINT, UINT, LPVOID); +UINT WINAPI WTInfoW(UINT, UINT, LPVOID); +#define WTInfo WINELIB_NAME_AW(WTInfo) +HCTX WINAPI WTOpenA(HWND, LPLOGCONTEXTA, BOOL); +HCTX WINAPI WTOpenW(HWND, LPLOGCONTEXTW, BOOL); +#define WTOpen WINELIB_NAME_AW(WTOpen) +BOOL WINAPI WTClose(HCTX); +int WINAPI WTPacketsGet(HCTX, int, LPVOID); +BOOL WINAPI WTPacket(HCTX, UINT, LPVOID); + +#endif + +#ifndef NOWTVISIBILITYFXNS +/* VISIBILITY FUNCTIONS */ + +#define ORD_WTEnable 40 +#define ORD_WTOverlap 41 + +BOOL WINAPI WTEnable(HCTX, BOOL); +BOOL WINAPI WTOverlap(HCTX, BOOL); + +#endif + +#ifndef NOWTCTXEDITFXNS +/* CONTEXT EDITING FUNCTIONS */ + +#define ORD_WTConfig 60 +#define ORD_WTGetA 61 +#define ORD_WTGetW 1061 +#define ORD_WTGet WINELIB_NAME_AW(ORD_WTGet) +#define ORD_WTSetA 62 +#define ORD_WTSetW 1062 +#define ORD_WTSet WINELIB_NAME_AW(ORD_WTSet) +#define ORD_WTExtGet 63 +#define ORD_WTExtSet 64 +#define ORD_WTSave 65 +#define ORD_WTRestore 66 + +BOOL WINAPI WTConfig(HCTX, HWND); +BOOL WINAPI WTGetA(HCTX, LPLOGCONTEXTA); +BOOL WINAPI WTGetW(HCTX, LPLOGCONTEXTW); +#define WTGet WINELIB_NAME_AW(WTGet) +BOOL WINAPI WTSetA(HCTX, LPLOGCONTEXTA); +BOOL WINAPI WTSetW(HCTX, LPLOGCONTEXTW); +#define WTSet WINELIB_NAME_AW(WTSet) +BOOL WINAPI WTExtGet(HCTX, UINT, LPVOID); +BOOL WINAPI WTExtSet(HCTX, UINT, LPVOID); +BOOL WINAPI WTSave(HCTX, LPVOID); +HCTX WINAPI WTRestore(HWND, LPVOID, BOOL); + +#endif + +#ifndef NOWTQUEUEFXNS +/* ADVANCED PACKET AND QUEUE FUNCTIONS */ + +#define ORD_WTPacketsPeek 80 +#define ORD_WTDataGet 81 +#define ORD_WTDataPeek 82 +#define ORD_WTQueueSizeGet 84 +#define ORD_WTQueueSizeSet 85 + +int WINAPI WTPacketsPeek(HCTX, int, LPVOID); +int WINAPI WTDataGet(HCTX, UINT, UINT, int, LPVOID, LPINT); +int WINAPI WTDataPeek(HCTX, UINT, UINT, int, LPVOID, LPINT); +int WINAPI WTQueueSizeGet(HCTX); +BOOL WINAPI WTQueueSizeSet(HCTX, int); + +#endif + +#ifndef NOWTHMGRFXNS +/* MANAGER HANDLE FUNCTIONS */ + +#define ORD_WTMgrOpen 100 +#define ORD_WTMgrClose 101 + +HMGR WINAPI WTMgrOpen(HWND, UINT); +BOOL WINAPI WTMgrClose(HMGR); + +#endif + +#ifndef NOWTMGRCTXFXNS +/* MANAGER CONTEXT FUNCTIONS */ + +#define ORD_WTMgrContextEnum 120 +#define ORD_WTMgrContextOwner 121 +#define ORD_WTMgrDefContext 122 +#define ORD_WTMgrDefContextEx 206 + +BOOL WINAPI WTMgrContextEnum(HMGR, WTENUMPROC, LPARAM); +HWND WINAPI WTMgrContextOwner(HMGR, HCTX); +HCTX WINAPI WTMgrDefContext(HMGR, BOOL); +HCTX WINAPI WTMgrDefContextEx(HMGR, UINT, BOOL); /* 1.1 */ + +#endif + +#ifndef NOWTMGRCONFIGFXNS +/* MANAGER CONFIG BOX FUNCTIONS */ + +#define ORD_WTMgrDeviceConfig 140 + +UINT WINAPI WTMgrDeviceConfig(HMGR, UINT, HWND); + +#endif + +#ifndef NOWTMGRHOOKFXNS +/* MANAGER PACKET HOOK FUNCTIONS */ + +/* OBSOLETE IN WIN32! */ + +#endif + +#ifndef NOWTMGRPREFFXNS +/* MANAGER PREFERENCE DATA FUNCTIONS */ + +#define ORD_WTMgrExt 180 +#define ORD_WTMgrCsrEnable 181 +#define ORD_WTMgrCsrButtonMap 182 +#define ORD_WTMgrCsrPressureBtnMarks 183 +#define ORD_WTMgrCsrPressureResponse 184 +#define ORD_WTMgrCsrExt 185 + +BOOL WINAPI WTMgrExt(HMGR, UINT, LPVOID); +BOOL WINAPI WTMgrCsrEnable(HMGR, UINT, BOOL); +BOOL WINAPI WTMgrCsrButtonMap(HMGR, UINT, LPBYTE, LPBYTE); +BOOL WINAPI WTMgrCsrPressureBtnMarks(HMGR, UINT, DWORD, DWORD); +BOOL WINAPI WTMgrCsrPressureResponse(HMGR, UINT, UINT *, UINT *); +BOOL WINAPI WTMgrCsrExt(HMGR, UINT, UINT, LPVOID); + +#endif + +/*********************************************************************** + * Win32 replacements for non-portable functions. + */ + +#ifndef NOWTQUEUEFXNS +/* ADVANCED PACKET AND QUEUE FUNCTIONS */ + +#define ORD_WTQueuePacketsEx 200 + +BOOL WINAPI WTQueuePacketsEx(HCTX, UINT *, UINT *); + +#endif + +#ifndef NOWTMGRCONFIGFXNS +/* MANAGER CONFIG BOX FUNCTIONS */ + +#define ORD_WTMgrConfigReplaceExA 202 +#define ORD_WTMgrConfigReplaceExW 1202 +#define ORD_WTMgrConfigReplaceEx WINELIB_NAME_AW(ORD_WTMgrConfigReplaceEx) + +BOOL WINAPI WTMgrConfigReplaceExA(HMGR, BOOL, LPSTR, LPSTR); +BOOL WINAPI WTMgrConfigReplaceExW(HMGR, BOOL, LPWSTR, LPSTR); +#define WTMgrConfigReplaceEx WINELIB_NAME_AW(WTMgrConfigReplaceEx) + +#endif + +#ifndef NOWTMGRHOOKFXNS +/* MANAGER PACKET HOOK FUNCTIONS */ + +#define ORD_WTMgrPacketHookExA 203 +#define ORD_WTMgrPacketHookExW 1203 +#define ORD_WTMgrPacketHookEx WINELIB_NAME_AW(ORD_WTMgrPacketHookEx) +#define ORD_WTMgrPacketUnhook 204 +#define ORD_WTMgrPacketHookNext 205 + +HWTHOOK WINAPI WTMgrPacketHookExA(HMGR, int, LPSTR, LPSTR); +HWTHOOK WINAPI WTMgrPacketHookExW(HMGR, int, LPWSTR, LPSTR); +#define WTMgrPacketHookEx WINELIB_NAME_AW(WTMgrPacketHookEx) +BOOL WINAPI WTMgrPacketUnhook(HWTHOOK); +LRESULT WINAPI WTMgrPacketHookNext(HWTHOOK, int, WPARAM, LPARAM); + +#endif + +#ifndef NOWTMGRPREFFXNS +/* MANAGER PREFERENCE DATA FUNCTIONS */ + +#define ORD_WTMgrCsrPressureBtnMarksEx 201 + +BOOL WINAPI WTMgrCsrPressureBtnMarksEx(HMGR, UINT, UINT *, UINT *); + +#endif + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + +#endif /* defined(__WINE_WINTAB_H */ diff --git a/reactos/dll/win32/wintab32/wintab.spec b/reactos/dll/win32/wintab32/wintab.spec new file mode 100644 index 00000000000..38cd4908ccb --- /dev/null +++ b/reactos/dll/win32/wintab32/wintab.spec @@ -0,0 +1,42 @@ +20 pascal -ret16 WTInfo(word word ptr) WTInfo16 +21 pascal -ret16 WTOpen(word ptr word) WTOpen16 +22 pascal -ret16 WTClose(word) WTClose16 +23 pascal -ret16 WTPacketsGet(word s_word ptr) WTPacketsGet16 +24 pascal -ret16 WTPacket(word word ptr) WTPacket16 +40 pascal -ret16 WTEnable(word word) WTEnable16 +41 pascal -ret16 WTOverlap(word word) WTOverlap16 +60 pascal -ret16 WTConfig(word word) WTConfig16 +61 pascal -ret16 WTGet(word ptr) WTGet16 +62 pascal -ret16 WTSet(word ptr) WTSet16 +63 pascal -ret16 WTExtGet(word word ptr) WTExtGet16 +64 pascal -ret16 WTExtSet(word word ptr) WTExtSet16 +65 pascal -ret16 WTSave(word ptr) WTSave16 +66 pascal -ret16 WTRestore(word ptr word) WTRestore16 +80 pascal -ret16 WTPacketsPeek(word s_word ptr) WTPacketsPeek16 +81 pascal -ret16 WTDataGet(word word word s_word ptr ptr) WTDataGet16 +82 pascal -ret16 WTDataPeek(word word word s_word ptr ptr) WTDataPeek16 +83 pascal WTQueuePackets(word) WTQueuePackets16 +84 pascal -ret16 WTQueueSizeGet(word) WTQueueSizeGet16 +85 pascal -ret16 WTQueueSizeSet(word s_word) WTQueueSizeSet16 +100 pascal -ret16 WTMgrOpen(word word) WTMgrOpen16 +101 pascal -ret16 WTMgrClose(word) WTMgrClose16 +120 pascal -ret16 WTMgrContextEnum(word ptr long) WTMgrContextEnum16 +121 pascal -ret16 WTMgrContextOwner(word word) WTMgrContextOwner16 +122 pascal -ret16 WTMgrDefContext(word word) WTMgrDefContext16 +140 pascal -ret16 WTMgrDeviceConfig(word word word) WTMgrDeviceConfig16 +141 pascal -ret16 WTMgrConfigReplace(word word ptr) WTMgrConfigReplace16 +160 pascal WTMgrPacketHook(word word s_word ptr) WTMgrPacketHook16 +161 pascal WTMgrPacketHookDefProc(s_word word long ptr) WTMgrPacketHookDefProc16 +180 pascal -ret16 WTMgrExt(word word ptr) WTMgrExt16 +181 pascal -ret16 WTMgrCsrEnable(word word word) WTMgrCsrEnable16 +182 pascal -ret16 WTMgrCsrButtonMap(word word ptr ptr) WTMgrCsrButtonMap16 +183 pascal -ret16 WTMgrCsrPressureBtnMarks(word word long long) WTMgrCsrPressureBtnMarks16 +184 pascal -ret16 WTMgrCsrPressureResponse(word word ptr ptr) WTMgrCsrPressureResponse16 +185 pascal -ret16 WTMgrCsrExt(word word word ptr) WTMgrCsrExt16 +200 pascal -ret16 WTQueuePacketsEx(word ptr ptr) WTQueuePacketsEx16 +201 pascal -ret16 WTMgrCsrPressureBtnMarksEx(word word ptr ptr) WTMgrCsrPressureBtnMarksEx16 +202 pascal -ret16 WTMgrConfigReplaceEx(word word str str) WTMgrConfigReplaceEx16 +203 pascal -ret16 WTMgrPacketHookEx(word s_word str str) WTMgrPacketHookEx16 +204 pascal -ret16 WTMgrPacketUnhook(word) WTMgrPacketUnhook16 +205 pascal -ret16 WTMgrPacketHookNext(word s_word word long) WTMgrPacketHookNext16 +206 pascal -ret16 WTMgrDefContextEx(word word word) WTMgrDefContextEx16 diff --git a/reactos/dll/win32/wintab32/wintab16.c b/reactos/dll/win32/wintab32/wintab16.c new file mode 100644 index 00000000000..fc359776612 --- /dev/null +++ b/reactos/dll/win32/wintab32/wintab16.c @@ -0,0 +1,540 @@ +/* + * Tablet Win16 + * + * Copyright 2002 Patrik Stridvall + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include + +#include "windef.h" +#include "winbase.h" + +#include "wintab.h" + +#include "wine/windef16.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wintab); + +/**********************************************************************/ + +#define DECLARE_HANDLE16(a) \ + typedef HANDLE16 a##16; \ + typedef a##16 *P##a##16; \ + typedef a##16 *NP##a##16; \ + typedef a##16 *LP##a##16 + +DECLARE_HANDLE16(HMGR); /* manager handle */ +DECLARE_HANDLE16(HCTX); /* context handle */ +DECLARE_HANDLE16(HWTHOOK); /* hook handle */ + +/**********************************************************************/ + +typedef struct tagLOGCONTEXT16 { + char lcName[LCNAMELEN]; + UINT16 lcOptions; + UINT16 lcStatus; + UINT16 lcLocks; + UINT16 lcMsgBase; + UINT16 lcDevice; + UINT16 lcPktRate; + WTPKT lcPktData; + WTPKT lcPktMode; + WTPKT lcMoveMask; + DWORD lcBtnDnMask; + DWORD lcBtnUpMask; + LONG lcInOrgX; + LONG lcInOrgY; + LONG lcInOrgZ; + LONG lcInExtX; + LONG lcInExtY; + LONG lcInExtZ; + LONG lcOutOrgX; + LONG lcOutOrgY; + LONG lcOutOrgZ; + LONG lcOutExtX; + LONG lcOutExtY; + LONG lcOutExtZ; + FIX32 lcSensX; + FIX32 lcSensY; + FIX32 lcSensZ; + BOOL16 lcSysMode; + INT16 lcSysOrgX; + INT16 lcSysOrgY; + INT16 lcSysExtX; + INT16 lcSysExtY; + FIX32 lcSysSensX; + FIX32 lcSysSensY; +} LOGCONTEXT16, *PLOGCONTEXT16, *NPLOGCONTEXT16, *LPLOGCONTEXT16; + +/**********************************************************************/ + +typedef BOOL16 (WINAPI * WTENUMPROC16)(HCTX16, LPARAM); /* changed CALLBACK->WINAPI, 1.1 */ +typedef BOOL16 (WINAPI * WTCONFIGPROC16)(HCTX16, HWND16); +typedef LRESULT (WINAPI * WTHOOKPROC16)(INT16, WPARAM16, LPARAM); +typedef WTHOOKPROC16 *LPWTHOOKPROC16; + +/*********************************************************************** + * WTInfo (WINTAB.20) + */ +UINT16 WINAPI WTInfo16(UINT16 wCategory, UINT16 nIndex, LPVOID lpOutput) +{ + FIXME("(%hu, %hu, %p): stub\n", wCategory, nIndex, lpOutput); + + return 0; +} + +/*********************************************************************** + * WTOpen (WINTAB.21) + */ +HCTX16 WINAPI WTOpen16(HWND16 hWnd, LPLOGCONTEXT16 lpLogCtx, BOOL16 fEnable) +{ + FIXME("(0x%04hx, %p, %hu): stub\n", hWnd, lpLogCtx, fEnable); + + return 0; +} + +/*********************************************************************** + * WTClose (WINTAB.22) + */ +BOOL16 WINAPI WTClose16(HCTX16 hCtx) +{ + FIXME("(0x%04hx): stub\n", hCtx); + + return TRUE; +} + +/*********************************************************************** + * WTPacketsGet (WINTAB.23) + */ +INT16 WINAPI WTPacketsGet16(HCTX16 hCtx, INT16 cMaxPkts, LPVOID lpPkts) +{ + FIXME("(0x%04hx, %hd, %p): stub\n", hCtx, cMaxPkts, lpPkts); + + return 0; +} + +/*********************************************************************** + * WTPacket (WINTAB.24) + */ +BOOL16 WINAPI WTPacket16(HCTX16 hCtx, UINT16 wSerial, LPVOID lpPkt) +{ + FIXME("(0x%04hx, %hd, %p): stub\n", hCtx, wSerial, lpPkt); + + return FALSE; +} + +/*********************************************************************** + * WTEnable (WINTAB.40) + */ +BOOL16 WINAPI WTEnable16(HCTX16 hCtx, BOOL16 fEnable) +{ + FIXME("(0x%04hx, %hu): stub\n", hCtx, fEnable); + + return FALSE; +} + +/*********************************************************************** + * WTOverlap (WINTAB.41) + */ +BOOL16 WINAPI WTOverlap16(HCTX16 hCtx, BOOL16 fToTop) +{ + FIXME("(0x%04hx, %hu): stub\n", hCtx, fToTop); + + return FALSE; +} + +/*********************************************************************** + * WTConfig (WINTAB.60) + */ +BOOL16 WINAPI WTConfig16(HCTX16 hCtx, HWND16 hWnd) +{ + FIXME("(0x%04hx, 0x%04hx): stub\n", hCtx, hWnd); + + return FALSE; +} + +/*********************************************************************** + * WTGet (WINTAB.61) + */ +BOOL16 WINAPI WTGet16(HCTX16 hCtx, LPLOGCONTEXT16 lpLogCtx) +{ + FIXME("(0x%04hx, %p): stub\n", hCtx, lpLogCtx); + + return FALSE; +} + +/*********************************************************************** + * WTSet (WINTAB.62) + */ +BOOL16 WINAPI WTSet16(HCTX16 hCtx, LPLOGCONTEXT16 lpLogCtx) +{ + FIXME("(0x%04hx, %p): stub\n", hCtx, lpLogCtx); + + return FALSE; +} + +/*********************************************************************** + * WTExtGet (WINTAB.63) + */ +BOOL16 WINAPI WTExtGet16(HCTX16 hCtx, UINT16 wExt, LPVOID lpData) +{ + FIXME("(0x%04hx, %hu, %p): stub\n", hCtx, wExt, lpData); + + return FALSE; +} + +/*********************************************************************** + * WTExtSet (WINTAB.64) + */ +BOOL16 WINAPI WTExtSet16(HCTX16 hCtx, UINT16 wExt, LPVOID lpData) +{ + FIXME("(0x%04hx, %hu, %p): stub\n", hCtx, wExt, lpData); + + return FALSE; +} + +/*********************************************************************** + * WTSave (WINTAB.65) + */ +BOOL16 WINAPI WTSave16(HCTX16 hCtx, LPVOID lpSaveInfo) +{ + FIXME("(0x%04hx, %p): stub\n", hCtx, lpSaveInfo); + + return FALSE; +} + +/*********************************************************************** + * WTRestore (WINTAB.66) + */ +HCTX16 WINAPI WTRestore16(HWND16 hWnd, LPVOID lpSaveInfo, BOOL16 fEnable) +{ + FIXME("(0x%04hx, %p, %hu): stub\n", hWnd, lpSaveInfo, fEnable); + + return 0; +} + +/*********************************************************************** + * WTPacketsPeek (WINTAB.80) + */ +INT16 WINAPI WTPacketsPeek16(HCTX16 hCtx, INT16 cMaxPkts, LPVOID lpPkts) +{ + FIXME("(0x%04hx, %hd, %p): stub\n", hCtx, cMaxPkts, lpPkts); + + return 0; +} + +/*********************************************************************** + * WTDataGet (WINTAB.81) + */ +INT16 WINAPI WTDataGet16(HCTX16 hCtx, UINT16 wBegin, UINT16 wEnd, + INT16 cMaxPkts, LPVOID lpPkts, LPINT16 lpNPkts) +{ + FIXME("(0x%04hx, %hu, %hu, %hd, %p, %p): stub\n", + hCtx, wBegin, wEnd, cMaxPkts, lpPkts, lpNPkts); + + return 0; +} + +/*********************************************************************** + * WTDataPeek (WINTAB.82) + */ +INT16 WINAPI WTDataPeek16(HCTX16 hCtx, UINT16 wBegin, UINT16 wEnd, + INT16 cMaxPkts, LPVOID lpPkts, LPINT16 lpNPkts) +{ + FIXME("(0x%04hx, %hu, %hu, %hd, %p, %p): stub\n", + hCtx, wBegin, wEnd, cMaxPkts, lpPkts, lpNPkts); + + return 0; +} + +/*********************************************************************** + * WTQueuePackets (WINTAB.83) + * + * OBSOLETE IN WIN32! + */ +DWORD WINAPI WTQueuePackets16(HCTX16 hCtx) +{ + FIXME("(0x%04hx): stub\n", hCtx); + + return 0; +} + +/*********************************************************************** + * WTQueuePacketsEx (WINTAB.200) + */ +BOOL16 WINAPI WTQueuePacketsEx16(HCTX16 hCtx, UINT16 *lpOld, UINT16 *lpNew) +{ + FIXME("(0x%04hx, %p, %p): stub\n", hCtx, lpOld, lpNew); + + return TRUE; +} + +/*********************************************************************** + * WTQueueSizeGet (WINTAB.84) + */ +INT16 WINAPI WTQueueSizeGet16(HCTX16 hCtx) +{ + FIXME("(0x%04hx): stub\n", hCtx); + + return 0; +} + +/*********************************************************************** + * WTQueueSizeSet (WINTAB.85) + */ +BOOL16 WINAPI WTQueueSizeSet16(HCTX16 hCtx, INT16 nPkts) +{ + FIXME("(0x%04hx, %hd): stub\n", hCtx, nPkts); + + return FALSE; +} + +/*********************************************************************** + * WTMgrOpen (WINTAB.100) + */ +HMGR16 WINAPI WTMgrOpen16(HWND16 hWnd, UINT16 wMsgBase) +{ + FIXME("(0x%04hx, %hu): stub\n", hWnd, wMsgBase); + + return 0; +} + +/*********************************************************************** + * WTMgrClose (WINTAB.101) + */ +BOOL16 WINAPI WTMgrClose16(HMGR16 hMgr) +{ + FIXME("(0x%04hx): stub\n", hMgr); + + return FALSE; +} + +/*********************************************************************** + * WTMgrContextEnum (WINTAB.120) + */ +BOOL16 WINAPI WTMgrContextEnum16(HMGR16 hMgr, WTENUMPROC16 lpEnumFunc, LPARAM lParam) +{ + FIXME("(0x%04hx, %p, %ld): stub\n", hMgr, lpEnumFunc, lParam); + + return FALSE; +} + +/*********************************************************************** + * WTMgrContextOwner (WINTAB.121) + */ +HWND16 WINAPI WTMgrContextOwner16(HMGR16 hMgr, HCTX16 hCtx) +{ + FIXME("(0x%04hx, 0x%04hx): stub\n", hMgr, hCtx); + + return 0; +} + +/*********************************************************************** + * WTMgrDefContext (WINTAB.122) + */ +HCTX16 WINAPI WTMgrDefContext16(HMGR16 hMgr, BOOL16 fSystem) +{ + FIXME("(0x%04hx, %hu): stub\n", hMgr, fSystem); + + return 0; +} + +/*********************************************************************** + * WTMgrDefContextEx (WINTAB.206) + * + * 1.1 + */ +HCTX16 WINAPI WTMgrDefContextEx16(HMGR16 hMgr, UINT16 wDevice, BOOL16 fSystem) +{ + FIXME("(0x%04hx, %hu, %hu): stub\n", hMgr, wDevice, fSystem); + + return 0; +} + +/*********************************************************************** + * WTMgrDeviceConfig (WINTAB.140) + */ +UINT16 WINAPI WTMgrDeviceConfig16(HMGR16 hMgr, UINT16 wDevice, HWND16 hWnd) +{ + FIXME("(0x%04hx, %hu, 0x%04hx): stub\n", hMgr, wDevice, hWnd); + + return 0; +} + +/*********************************************************************** + * WTMgrConfigReplace (WINTAB.141) + * + * OBSOLETE IN WIN32! + */ +BOOL16 WINAPI WTMgrConfigReplace16(HMGR16 hMgr, BOOL16 fInstall, + WTCONFIGPROC16 lpConfigProc) +{ + FIXME("(0x%04hx, %hu, %p): stub\n", hMgr, fInstall, lpConfigProc); + + return FALSE; +} + +/*********************************************************************** + * WTMgrConfigReplaceEx (WINTAB.202) + */ +BOOL16 WINAPI WTMgrConfigReplaceEx16(HMGR16 hMgr, BOOL16 fInstall, + LPSTR lpszModule, LPSTR lpszCfgProc) +{ + FIXME("(0x%04hx, %hu, %s, %s): stub\n", hMgr, fInstall, + debugstr_a(lpszModule), debugstr_a(lpszCfgProc)); + + return FALSE; +} + +/*********************************************************************** + * WTMgrPacketHook (WINTAB.160) + * + * OBSOLETE IN WIN32! + */ +WTHOOKPROC16 WINAPI WTMgrPacketHook16(HMGR16 hMgr, BOOL16 fInstall, + INT16 nType, WTHOOKPROC16 lpFunc) +{ + FIXME("(0x%04hx, %hu, %hd, %p): stub\n", hMgr, fInstall, nType, lpFunc); + + return 0; +} + +/*********************************************************************** + * WTMgrPacketHookEx (WINTAB.203) + */ +HWTHOOK16 WINAPI WTMgrPacketHookEx16(HMGR16 hMgr, INT16 nType, + LPSTR lpszModule, LPSTR lpszHookProc) +{ + FIXME("(0x%04hx, %hd, %s, %s): stub\n", hMgr, nType, + debugstr_a(lpszModule), debugstr_a(lpszHookProc)); + + return 0; +} + +/*********************************************************************** + * WTMgrPacketUnhook (WINTAB.204) + */ +BOOL16 WINAPI WTMgrPacketUnhook16(HWTHOOK16 hHook) +{ + FIXME("(0x%04hx): stub\n", hHook); + + return FALSE; +} + +/*********************************************************************** + * WTMgrPacketHookDefProc (WINTAB.161) + * + * OBSOLETE IN WIN32! + */ +LRESULT WINAPI WTMgrPacketHookDefProc16(INT16 nCode, WPARAM16 wParam, + LPARAM lParam, LPWTHOOKPROC16 lplpFunc) +{ + FIXME("(%hd, %hu, %lu, %p): stub\n", nCode, wParam, lParam, lplpFunc); + + return 0; +} + +/*********************************************************************** + * WTMgrPacketHookNext (WINTAB.205) + */ +LRESULT WINAPI WTMgrPacketHookNext16(HWTHOOK16 hHook, INT16 nCode, + WPARAM16 wParam, LPARAM lParam) +{ + FIXME("(0x%04hx, %hd, %hu, %lu): stub\n", hHook, nCode, wParam, lParam); + + return 0; +} + + +/*********************************************************************** + * WTMgrExt (WINTAB.180) + */ +BOOL16 WINAPI WTMgrExt16(HMGR16 hMgr, UINT16 wExt, LPVOID lpData) +{ + FIXME("(0x%04hx, %hu, %p): stub\n", hMgr, wExt, lpData); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrEnable (WINTAB.181) + */ +BOOL16 WINAPI WTMgrCsrEnable16(HMGR16 hMgr, UINT16 wCursor, BOOL16 fEnable) +{ + FIXME("(0x%04hx, %hu, %hu): stub\n", hMgr, wCursor, fEnable); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrButtonMap (WINTAB.182) + */ +BOOL16 WINAPI WTMgrCsrButtonMap16(HMGR16 hMgr, UINT16 wCursor, + LPBYTE lpLogBtns, LPBYTE lpSysBtns) +{ + FIXME("(0x%04hx, %hu, %p, %p): stub\n", hMgr, wCursor, lpLogBtns, lpSysBtns); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrPressureBtnMarks (WINTAB.183) + * + * OBSOLETE IN WIN32! (But only according to documentation) + */ +BOOL16 WINAPI WTMgrCsrPressureBtnMarks16(HMGR16 hMgr, UINT16 wCsr, + DWORD dwNMarks, DWORD dwTMarks) +{ + FIXME("(0x%04hx, %hu, %u, %u): stub\n", hMgr, wCsr, dwNMarks, dwTMarks); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrPressureBtnMarksEx (WINTAB.201) + */ +BOOL16 WINAPI WTMgrCsrPressureBtnMarksEx16(HMGR16 hMgr, UINT16 wCsr, + UINT16 *lpNMarks, UINT16 *lpTMarks) +{ + FIXME("(0x%04hx, %hu, %p, %p): stub\n", hMgr, wCsr, lpNMarks, lpTMarks); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrPressureResponse (WINTAB.184) + */ +BOOL16 WINAPI WTMgrCsrPressureResponse16(HMGR16 hMgr, UINT16 wCsr, + UINT16 *lpNResp, UINT16 *lpTResp) +{ + FIXME("(0x%04hx, %hu, %p, %p): stub\n", hMgr, wCsr, lpNResp, lpTResp); + + return FALSE; +} + +/*********************************************************************** + * WTMgrCsrExt (WINTAB.185) + */ +BOOL16 WINAPI WTMgrCsrExt16(HMGR16 hMgr, UINT16 wCsr, UINT16 wExt, LPVOID lpData) +{ + FIXME("(0x%04hx, %hu, %hu, %p): stub\n", hMgr, wCsr, wExt, lpData); + + return FALSE; +} diff --git a/reactos/dll/win32/wintab32/wintab32.c b/reactos/dll/win32/wintab32/wintab32.c new file mode 100644 index 00000000000..b52b429d949 --- /dev/null +++ b/reactos/dll/win32/wintab32/wintab32.c @@ -0,0 +1,148 @@ +/* + * WinTab32 library + * + * Copyright 2003 CodeWeavers, Aric Stewart + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" +#include "wintab.h" +#include "wintab_internal.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wintab32); + +HWND hwndDefault = NULL; +static const WCHAR + WC_TABLETCLASSNAME[] = {'W','i','n','e','T','a','b','l','e','t','C','l','a','s','s',0}; +CRITICAL_SECTION csTablet; + +int (CDECL *pLoadTabletInfo)(HWND hwnddefault) = NULL; +int (CDECL *pGetCurrentPacket)(LPWTPACKET packet) = NULL; +int (CDECL *pAttachEventQueueToTablet)(HWND hOwner) = NULL; +UINT (CDECL *pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput) = NULL; + +static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, + LPARAM lParam); + +static VOID TABLET_Register(void) +{ + WNDCLASSW wndClass; + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); + wndClass.style = CS_GLOBALCLASS; + wndClass.lpfnWndProc = TABLET_WindowProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = 0; + wndClass.hCursor = NULL; + wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW +1); + wndClass.lpszClassName = WC_TABLETCLASSNAME; + RegisterClassW(&wndClass); +} + +static VOID TABLET_Unregister(void) +{ + UnregisterClassW(WC_TABLETCLASSNAME, NULL); +} + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpReserved) +{ + static const WCHAR name[] = {'T','a','b','l','e','t',0}; + HMODULE hx11drv; + + TRACE("%p, %x, %p\n",hInstDLL,fdwReason,lpReserved); + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + TRACE("Initialization\n"); + DisableThreadLibraryCalls(hInstDLL); + InitializeCriticalSection(&csTablet); + csTablet.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": csTablet"); + hx11drv = GetModuleHandleA("winex11.drv"); + if (hx11drv) + { + pLoadTabletInfo = (void *)GetProcAddress(hx11drv, "LoadTabletInfo"); + pAttachEventQueueToTablet = (void *)GetProcAddress(hx11drv, "AttachEventQueueToTablet"); + pGetCurrentPacket = (void *)GetProcAddress(hx11drv, "GetCurrentPacket"); + pWTInfoW = (void *)GetProcAddress(hx11drv, "WTInfoW"); + TABLET_Register(); + hwndDefault = CreateWindowW(WC_TABLETCLASSNAME, name, + WS_POPUPWINDOW,0,0,0,0,0,0,hInstDLL,0); + } + else + return FALSE; + break; + case DLL_PROCESS_DETACH: + TRACE("Detaching\n"); + if (hwndDefault) + { + DestroyWindow(hwndDefault); + hwndDefault = 0; + } + TABLET_Unregister(); + csTablet.DebugInfo->Spare[0] = 0; + DeleteCriticalSection(&csTablet); + break; + } + return TRUE; +} + + +/* + * The window proc for the default TABLET window + */ +static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, + LPARAM lParam) +{ + TRACE("Incoming Message 0x%x (0x%08x, 0x%08x)\n", uMsg, (UINT)wParam, + (UINT)lParam); + + switch(uMsg) + { + case WM_NCCREATE: + return TRUE; + + case WT_PACKET: + { + WTPACKET packet; + LPOPENCONTEXT handler; + pGetCurrentPacket(&packet); + handler = AddPacketToContextQueue(&packet,(HWND)lParam); + if (handler && handler->context.lcOptions & CXO_MESSAGES) + TABLET_PostTabletMessage(handler, _WT_PACKET(handler->context.lcMsgBase), + (WPARAM)packet.pkSerialNumber, + (LPARAM)handler->handle, FALSE); + break; + } + case WT_PROXIMITY: + { + WTPACKET packet; + LPOPENCONTEXT handler; + pGetCurrentPacket(&packet); + handler = AddPacketToContextQueue(&packet,(HWND)wParam); + if (handler) + TABLET_PostTabletMessage(handler, WT_PROXIMITY, + (WPARAM)handler->handle, lParam, TRUE); + break; + } + } + return 0; +} diff --git a/reactos/dll/win32/wintab32/wintab32.rbuild b/reactos/dll/win32/wintab32/wintab32.rbuild new file mode 100644 index 00000000000..10da535839b --- /dev/null +++ b/reactos/dll/win32/wintab32/wintab32.rbuild @@ -0,0 +1,13 @@ + + + . + include/reactos/wine + + context.c + manager.c + wintab32.c + wine + user32 + kernel32 + ntdll + diff --git a/reactos/dll/win32/wintab32/wintab32.spec b/reactos/dll/win32/wintab32/wintab32.spec new file mode 100644 index 00000000000..03312e7787d --- /dev/null +++ b/reactos/dll/win32/wintab32/wintab32.spec @@ -0,0 +1,44 @@ +20 stdcall WTInfoA(long long ptr) +21 stdcall WTOpenA(long ptr long) +22 stdcall WTClose(long) +23 stdcall WTPacketsGet(long long ptr) +24 stdcall WTPacket(long long ptr) +40 stdcall WTEnable(long long) +41 stdcall WTOverlap(long long) +60 stdcall WTConfig(long long) +61 stdcall WTGetA(long ptr) +62 stdcall WTSetA(long ptr) +63 stdcall WTExtGet(long long ptr) +64 stdcall WTExtSet(long long ptr) +65 stdcall WTSave(long ptr) +66 stdcall WTRestore(long ptr long) +80 stdcall WTPacketsPeek(long long ptr) +81 stdcall WTDataGet(long long long long ptr ptr) +82 stdcall WTDataPeek(long long long long ptr ptr) +84 stdcall WTQueueSizeGet(long) +85 stdcall WTQueueSizeSet(long long) +100 stdcall WTMgrOpen(long long) +101 stdcall WTMgrClose(long) +120 stdcall WTMgrContextEnum(long ptr long) +121 stdcall WTMgrContextOwner(long long) +122 stdcall WTMgrDefContext(long long) +140 stdcall WTMgrDeviceConfig(long long long) +180 stdcall WTMgrExt(long long ptr) +181 stdcall WTMgrCsrEnable(long long long) +182 stdcall WTMgrCsrButtonMap(long long ptr ptr) +183 stdcall WTMgrCsrPressureBtnMarks(long long long long) +184 stdcall WTMgrCsrPressureResponse(long long ptr ptr) +185 stdcall WTMgrCsrExt(long long long ptr) +200 stdcall WTQueuePacketsEx(long ptr ptr) +201 stdcall WTMgrCsrPressureBtnMarksEx(long long ptr ptr) +202 stdcall WTMgrConfigReplaceExA(long long str str) +203 stdcall WTMgrPacketHookExA(long long str str) +204 stdcall WTMgrPacketUnhook(long) +205 stdcall WTMgrPacketHookNext(long long long long) +206 stdcall WTMgrDefContextEx(long long long) +1020 stdcall WTInfoW(long long ptr) +1021 stdcall WTOpenW(long ptr long) +1061 stdcall WTGetW(long ptr) +1062 stdcall WTSetW(long ptr) +1202 stdcall WTMgrConfigReplaceExW(long long wstr str) +1203 stdcall WTMgrPacketHookExW(long long wstr str) diff --git a/reactos/dll/win32/wintab32/wintab_internal.h b/reactos/dll/win32/wintab32/wintab_internal.h new file mode 100644 index 00000000000..b0a2e8fd58f --- /dev/null +++ b/reactos/dll/win32/wintab32/wintab_internal.h @@ -0,0 +1,162 @@ +/* + * Tablet header + * + * Copyright 2003 CodeWeavers (Aric Stewart) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WINTAB_INTERNAL_H +#define __WINE_WINTAB_INTERNAL_H + +typedef struct tagWTI_INTERFACE_INFO { + CHAR WINTABID[1024]; + /* a copy of the null-terminated tablet hardware identification string + * in the user buffer. This string should include make, model, and + * revision information in user-readable format. + */ + WORD SPECVERSION; + /* the specification version number. The high-order byte contains the + * major version number; the low-order byte contains the minor version + * number. + */ + WORD IMPLVERSION; + /* the implementation version number. The high-order byte contains the + * major version number; the low-order byte contains the minor version + * number. + */ + UINT NDEVICES; + /* the number of devices supported. */ + UINT NCURSORS; + /* the total number of cursor types supported. */ + UINT NCONTEXTS; + /* the number of contexts supported. */ + UINT CTXOPTIONS; + /* flags indicating which context options are supported */ + UINT CTXSAVESIZE; + /* the size of the save information returned from WTSave.*/ + UINT NEXTENSIONS; + /* the number of extension data items supported.*/ + UINT NMANAGERS; + /* the number of manager handles supported.*/ + }WTI_INTERFACE_INFO, *LPWTI_INTERFACE_INFO; + +typedef struct tagWTI_STATUS_INFO{ + UINT CONTEXTS; + /* the number of contexts currently open.*/ + UINT SYSCTXS; + /* the number of system contexts currently open.*/ + UINT PKTRATE; + /* the maximum packet report rate currently being received by any + * context, in Hertz. + */ + WTPKT PKTDATA; + /* a mask indicating which packet data items are requested by at + * least one context. + */ + UINT MANAGERS; + /* the number of manager handles currently open.*/ + BOOL SYSTEM; + /* a non-zero value if system pointing is available to the whole + * screen; zero otherwise. + */ + DWORD BUTTONUSE; + /* a button mask indicating the logical buttons whose events are + * requested by at least one context. + */ + DWORD SYSBTNUSE; + /* a button mask indicating which logical buttons are assigned a system + * button function by the current cursor's system button map. + */ +} WTI_STATUS_INFO, *LPWTI_STATUS_INFO; + +typedef struct tagWTI_EXTENSIONS_INFO +{ + CHAR NAME[256]; + /* a unique, null-terminated string describing the extension.*/ + UINT TAG; + /* a unique identifier for the extension. */ + WTPKT MASK; + /* a mask that can be bitwise OR'ed with WTPKT-type variables to select + * the extension. + */ + UINT SIZE[2]; + /* an array of two UINTs specifying the extension's size within a packet + * (in bytes). The first is for absolute mode; the second is for + * relative mode. + */ + AXIS *AXES; + /* an array of axis descriptions, as needed for the extension. */ + BYTE *DEFAULT; + /* the current global default data, as needed for the extension. This + * data is modified via the WTMgrExt function. + */ + BYTE *DEFCONTEXT; + BYTE *DEFSYSCTX; + /* the current default context-specific data, as needed for the + * extension. The indices identify the digitizing- and system-context + * defaults, respectively. + */ + BYTE *CURSORS; + /* Is the first of one or more consecutive indices, one per cursor type. + * Each returns the current default cursor-specific data, as need for + * the extension. This data is modified via the WTMgrCsrExt function. + */ +} WTI_EXTENSIONS_INFO, *LPWTI_EXTENSIONS_INFO; + +typedef struct tagWTPACKET { + HCTX pkContext; + UINT pkStatus; + LONG pkTime; + WTPKT pkChanged; + UINT pkSerialNumber; + UINT pkCursor; + DWORD pkButtons; + DWORD pkX; + DWORD pkY; + DWORD pkZ; + UINT pkNormalPressure; + UINT pkTangentPressure; + ORIENTATION pkOrientation; + ROTATION pkRotation; /* 1.1 */ +} WTPACKET, *LPWTPACKET; + +typedef struct tagOPENCONTEXT +{ + HCTX handle; + LOGCONTEXTW context; + HWND hwndOwner; + BOOL enabled; + INT ActiveCursor; + INT QueueSize; + INT PacketsQueued; + LPWTPACKET PacketQueue; + struct tagOPENCONTEXT *next; +} OPENCONTEXT, *LPOPENCONTEXT; + +int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam, + LPARAM lParam, BOOL send_always); +LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd); + +/* X11drv functions */ +extern int (CDECL *pLoadTabletInfo)(HWND hwnddefault); +extern int (CDECL *pGetCurrentPacket)(LPWTPACKET packet); +extern int (CDECL *pAttachEventQueueToTablet)(HWND hOwner); +extern UINT (CDECL *pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput); + +extern HWND hwndDefault; +extern CRITICAL_SECTION csTablet; + +#endif /* __WINE_WINTAB_INTERNAL_H */ diff --git a/reactos/include/psdk/cierror.h b/reactos/include/psdk/cierror.h new file mode 100644 index 00000000000..049985beb11 --- /dev/null +++ b/reactos/include/psdk/cierror.h @@ -0,0 +1,44 @@ +/* + * Copyright 2006 Mike McCormack + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_CIERROR_H__ +#define __WINE_CIERROR_H__ + +#define CI_E_ALREADY_INITIALIZED 0x8004180a +#define CI_E_NOT_INITIALIZED 0x8004180b +#define CI_E_BUFFERTOOSMALL 0x8004180c +#define CI_E_PROPERTY_NOT_CACHED 0x8004180d +#define CI_E_INVALID_STATE 0x8004180f +#define CI_E_FILTERING_DISABLED 0x80041810 +#define CI_E_DISK_FULL 0x80041811 +#define CI_E_SHUTDOWN 0x80041812 +#define CI_E_WORKID_NOTVALID 0x80041813 +#define CI_E_NOT_FOUND 0x80041815 +#define CI_E_USE_DEFAULT_PID 0x80041816 +#define CI_E_DUPLICATE_NOTIFICATION 0x80041817 +#define CI_E_UPDATES_DISABLED 0x80041818 +#define CI_E_INVALID_FLAGS_COMBINATION 0x80041819 +#define CI_E_OUTOFSEQ_INCREMENT_DATA 0x8004181a +#define CI_E_SHARING_VIOLATION 0x8004181b +#define CI_E_LOGON_FAILURE 0x8004181c +#define CI_E_NO_CATALOG 0x8004181d +#define CI_E_STRANGE_PAGEORSECTOR_SIZE 0x8004181e +#define CI_E_TIMEOUT 0x8004181f +#define CI_E_NOT_RUNNING 0x80041820 + +#endif diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 9d81e3a564a..e424e4c2349 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -89,7 +89,10 @@ reactos/dll/win32/mshtml # Autosync reactos/dll/win32/msimg32 # Autosync reactos/dll/win32/msi # Autosync reactos/dll/win32/msimtf # Autosync +reactos/dll/win32/msisip # Autosync reactos/dll/win32/msrle32 # Autosync +reactos/dll/win32/mssign32 # Autosync +reactos/dll/win32/mssip32 # Autosync reactos/dll/win32/mstask # Autosync reactos/dll/win32/msvcrt20 # Autosync reactos/dll/win32/msvfw32 # Autosync @@ -114,6 +117,7 @@ reactos/dll/win32/pdh # Autosync reactos/dll/win32/powrprof # Forked at Wine-1.0rc5 reactos/dll/win32/printui # Autosync reactos/dll/win32/pstorec # Autosync +reactos/dll/win32/query # Autosync reactos/dll/win32/rasapi32 # Autosync reactos/dll/win32/riched20 # Autosync reactos/dll/win32/riched32 # Autosync @@ -133,6 +137,7 @@ reactos/dll/win32/sti # Autosync reactos/dll/win32/sxs # Autosync reactos/dll/win32/tapi32 # Autosync reactos/dll/win32/twain_32 # Out of sync +reactos/dll/win32/updspapi # Autosync reactos/dll/win32/url # Autosync reactos/dll/win32/urlmon # Autosync reactos/dll/win32/usp10 # Autosync @@ -143,6 +148,7 @@ reactos/dll/win32/winhttp # Autosync reactos/dll/win32/winmm # Forked at Wine-20050628 reactos/dll/win32/winmm/midimap # Forked at Wine-20050628 reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 +reactos/dll/win32/wintab32 # Autosync reactos/dll/win32/wintrust # Out of sync reactos/dll/win32/wldap32 # Autosync reactos/dll/win32/wmi # Autosync