From 21836d5095b91e3106112f60417d766b4802bfa4 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Wed, 24 Oct 2007 15:21:17 +0200 Subject: [PATCH] push 50b650a476c6f0df362ce67f063848f086de44d9 --- .gitignore | 4 + Makefile.in | 2 + configure | 3 + configure.ac | 1 + dlls/Makefile.in | 1 + dlls/advapi32/security.c | 23 +- dlls/advapi32/tests/crypt_sha.c | 12 - dlls/advapi32/tests/security.c | 46 +- dlls/comctl32/listview.c | 2 +- dlls/comctl32/theming.c | 2 +- dlls/comdlg32/printdlg.c | 22 +- dlls/comdlg32/printdlg16.c | 2 +- dlls/crypt32/crypt32_private.h | 2 +- dlls/cryptnet/Makefile.in | 1 + dlls/cryptnet/cryptnet.spec | 4 +- dlls/cryptnet/cryptnet_main.c | 1013 ++++++++++++++++++++++++++++++++++++++- dlls/cryptnet/tests/cryptnet.c | 129 ++++- dlls/dplayx/dplay.c | 4 +- dlls/dsound/mixer.c | 2 +- dlls/gdi32/bidi.c | 4 +- dlls/gdi32/region.c | 4 +- dlls/gdi32/tests/font.c | 2 - dlls/mshtml/view.c | 1 + dlls/msi/action.c | 2 +- dlls/msi/alter.c | 10 +- dlls/msi/appsearch.c | 2 +- dlls/msi/files.c | 3 + dlls/msi/tests/install.c | 2 +- dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/sec.c | 18 +- dlls/ole32/filemoniker.c | 4 +- dlls/ole32/ole2.c | 2 +- dlls/oleaut32/tests/vartest.c | 4 +- dlls/oleaut32/typelib.c | 2 +- dlls/opengl32/make_opengl | 4 +- dlls/riched20/rtf.h | 2 +- dlls/riched32/tests/Makefile.in | 13 + dlls/riched32/tests/editor.c | 142 ++++++ dlls/urlmon/tests/misc.c | 37 +- dlls/urlmon/urlmon_main.c | 23 + dlls/usp10/tests/usp10.c | 2 +- dlls/winealsa.drv/dscapture.c | 1 + dlls/winealsa.drv/mixer.c | 1 + dlls/wined3d/device.c | 2 +- dlls/winedos/dosaspi.c | 2 +- dlls/winejack.drv/audio.c | 4 +- dlls/winex11.drv/dib.c | 20 +- dlls/winex11.drv/dib_convert.c | 12 +- dlls/winex11.drv/dib_dst_swap.c | 12 +- dlls/winex11.drv/dib_src_swap.c | 12 +- dlls/winex11.drv/mouse.c | 2 +- dlls/wininet/http.c | 9 +- dlls/wininet/urlcache.c | 227 ++++++--- include/winbase.h | 2 +- include/winnt.h | 7 +- include/winternl.h | 1 + programs/explorer/systray.c | 2 +- programs/taskmgr/applpage.c | 2 +- programs/taskmgr/graphctl.c | 4 +- programs/winedbg/stack.c | 4 +- programs/winetest/Makefile.in | 3 + programs/winetest/winetest.rc | 1 + tools/winapi/win32.api | 22 + tools/winedump/README | 3 +- 64 files changed, 1724 insertions(+), 191 deletions(-) create mode 100644 dlls/riched32/tests/Makefile.in create mode 100644 dlls/riched32/tests/editor.c diff --git a/.gitignore b/.gitignore index 1bde3846142..e64757cf4b7 100644 --- a/.gitignore +++ b/.gitignore @@ -380,6 +380,9 @@ dlls/riched20/tests/*.ok dlls/riched20/tests/riched20_crosstest.exe dlls/riched20/tests/testlist.c dlls/riched20/version.res +dlls/riched32/tests/*.ok +dlls/riched32/tests/riched32_crosstest.exe +dlls/riched32/tests/testlist.c dlls/riched32/version.res dlls/rpcrt4/librpcrt4.def dlls/rpcrt4/tests/*.ok @@ -732,6 +735,7 @@ programs/winetest/pdh_test.exe programs/winetest/psapi_test.exe programs/winetest/quartz_test.exe programs/winetest/riched20_test.exe +programs/winetest/riched32_test.exe programs/winetest/rpcrt4_test.exe programs/winetest/rsabase_test.exe programs/winetest/rsaenh_test.exe diff --git a/Makefile.in b/Makefile.in index 31bfb087a4c..1de6a53ee76 100644 --- a/Makefile.in +++ b/Makefile.in @@ -359,6 +359,7 @@ ALL_MAKEFILES = \ dlls/riched20/Makefile \ dlls/riched20/tests/Makefile \ dlls/riched32/Makefile \ + dlls/riched32/tests/Makefile \ dlls/rpcrt4/Makefile \ dlls/rpcrt4/tests/Makefile \ dlls/rsabase/Makefile \ @@ -733,6 +734,7 @@ dlls/resutils/Makefile: dlls/resutils/Makefile.in dlls/Makedll.rules dlls/riched20/Makefile: dlls/riched20/Makefile.in dlls/Makedll.rules dlls/riched20/tests/Makefile: dlls/riched20/tests/Makefile.in dlls/Maketest.rules dlls/riched32/Makefile: dlls/riched32/Makefile.in dlls/Makedll.rules +dlls/riched32/tests/Makefile: dlls/riched32/tests/Makefile.in dlls/Maketest.rules dlls/rpcrt4/Makefile: dlls/rpcrt4/Makefile.in dlls/Makedll.rules dlls/rpcrt4/tests/Makefile: dlls/rpcrt4/tests/Makefile.in dlls/Maketest.rules dlls/rsabase/Makefile: dlls/rsabase/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 5c6d64653f5..fbcedf2e1c1 100755 --- a/configure +++ b/configure @@ -20937,6 +20937,8 @@ ac_config_files="$ac_config_files dlls/riched20/tests/Makefile" ac_config_files="$ac_config_files dlls/riched32/Makefile" +ac_config_files="$ac_config_files dlls/riched32/tests/Makefile" + ac_config_files="$ac_config_files dlls/rpcrt4/Makefile" ac_config_files="$ac_config_files dlls/rpcrt4/tests/Makefile" @@ -22020,6 +22022,7 @@ do "dlls/riched20/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/riched20/Makefile" ;; "dlls/riched20/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/riched20/tests/Makefile" ;; "dlls/riched32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/riched32/Makefile" ;; + "dlls/riched32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/riched32/tests/Makefile" ;; "dlls/rpcrt4/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/rpcrt4/Makefile" ;; "dlls/rpcrt4/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/rpcrt4/tests/Makefile" ;; "dlls/rsabase/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/rsabase/Makefile" ;; diff --git a/configure.ac b/configure.ac index 44b4883cd3c..9bdabca1bca 100644 --- a/configure.ac +++ b/configure.ac @@ -1786,6 +1786,7 @@ AC_CONFIG_FILES([dlls/resutils/Makefile]) AC_CONFIG_FILES([dlls/riched20/Makefile]) AC_CONFIG_FILES([dlls/riched20/tests/Makefile]) AC_CONFIG_FILES([dlls/riched32/Makefile]) +AC_CONFIG_FILES([dlls/riched32/tests/Makefile]) AC_CONFIG_FILES([dlls/rpcrt4/Makefile]) AC_CONFIG_FILES([dlls/rpcrt4/tests/Makefile]) AC_CONFIG_FILES([dlls/rsabase/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 5be98ecf491..eaeab3e3e81 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -292,6 +292,7 @@ TESTSUBDIRS = \ psapi/tests \ quartz/tests \ riched20/tests \ + riched32/tests \ rpcrt4/tests \ rsabase/tests \ rsaenh/tests \ diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index 79f5a3a024b..82de97b2c17 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -580,7 +580,7 @@ AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewSta BOOL WINAPI AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, - PTOKEN_PRIVILEGES PreviousState, LPDWORD ReturnLength ) + PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength ) { NTSTATUS status; @@ -1363,6 +1363,17 @@ BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescri return set_ntstatus( RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision)); } +/****************************************************************************** + * SetSecurityDescriptorControl [ADVAPI32.@] + */ +BOOL WINAPI SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, + SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, + SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ) +{ + return set_ntstatus( RtlSetControlSecurityDescriptor( + pSecurityDescriptor, ControlBitsOfInterest, ControlBitsToSet ) ); +} + /* ############################## ###### ACL FUNCTIONS ###### ############################## @@ -3077,16 +3088,6 @@ BOOL WINAPI SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation, return TRUE; } -BOOL WINAPI SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, - SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, - SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ) -{ - FIXME("%p 0x%08x 0x%08x - stub\n", pSecurityDescriptor, ControlBitsOfInterest, - ControlBitsToSet); - - return TRUE; -} - BOOL WINAPI AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ) { return RtlAreAllAccessesGranted( GrantedAccess, DesiredAccess ); diff --git a/dlls/advapi32/tests/crypt_sha.c b/dlls/advapi32/tests/crypt_sha.c index e8cd5577976..cfdaf991d41 100644 --- a/dlls/advapi32/tests/crypt_sha.c +++ b/dlls/advapi32/tests/crypt_sha.c @@ -33,8 +33,6 @@ typedef struct { UCHAR Buffer[64]; } SHA_CTX, *PSHA_CTX; -#define ctxcmp(a,b) memcmp((char*)a, (char*)b, FIELD_OFFSET(SHA_CTX, Buffer)) - static void test_sha_ctx(void) { FARPROC pA_SHAInit, pA_SHAUpdate, pA_SHAFinal; @@ -45,9 +43,6 @@ static void test_sha_ctx(void) ULONG test_buffer_size = strlen(test_buffer); HMODULE hmod; SHA_CTX ctx; - SHA_CTX ctx_initialized = {{0, 0, 0, 0, 0}, {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0}, {0, 0}}; - SHA_CTX ctx_update1 = {{0, 0, 0, 0, 0}, {0xdbe5eba8, 0x6b4335ca, 0xf7c94abe, 0xc9f34e31, 0x311023f0}, {0, 0x67}}; - SHA_CTX ctx_update2 = {{0, 0, 0, 0, 0}, {0x5ecc818d, 0x52498169, 0xf6758559, 0xd035a164, 0x871dd125}, {0, 0xce}}; ULONG result[5]; ULONG result_correct[5] = {0xe014f93, 0xe09791ec, 0x6dcf96c8, 0x8e9385fc, 0x1611c1bb}; @@ -64,16 +59,9 @@ static void test_sha_ctx(void) RtlZeroMemory(&ctx, sizeof(ctx)); pA_SHAInit(&ctx); - ok(!ctxcmp(&ctx, &ctx_initialized), "invalid initialization\n"); - pA_SHAUpdate(&ctx, test_buffer, test_buffer_size); - ok(!ctxcmp(&ctx, &ctx_update1), "update doesn't work correctly\n"); - pA_SHAUpdate(&ctx, test_buffer, test_buffer_size); - ok(!ctxcmp(&ctx, &ctx_update2), "update doesn't work correctly\n"); - pA_SHAFinal(&ctx, result); - ok(!ctxcmp(&ctx, &ctx_initialized), "context hasn't been reinitialized\n"); ok(!memcmp(result, result_correct, sizeof(result)), "incorrect result\n"); } diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 9cf409e7844..3332d7b306e 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -1143,7 +1143,7 @@ static void test_CreateWellKnownSid() } cb = sizeof(sid_buffer); - ok(CreateWellKnownSid(i, value->without_domain ? NULL : domainsid, sid_buffer, &cb), "Couldn't create well known sid %d\n", i); + ok(pCreateWellKnownSid(i, value->without_domain ? NULL : domainsid, sid_buffer, &cb), "Couldn't create well known sid %d\n", i); expect_eq(GetSidLengthRequired(*GetSidSubAuthorityCount(sid_buffer)), cb, DWORD, "%d"); ok(IsValidSid(sid_buffer), "The sid is not valid\n"); ok(ConvertSidToStringSid(sid_buffer, &str), "Couldn't convert SID to string\n"); @@ -1155,7 +1155,7 @@ static void test_CreateWellKnownSid() { char buf2[SECURITY_MAX_SID_SIZE]; cb = sizeof(buf2); - ok(CreateWellKnownSid(i, domainsid, buf2, &cb), "Couldn't create well known sid %d with optional domain\n", i); + ok(pCreateWellKnownSid(i, domainsid, buf2, &cb), "Couldn't create well known sid %d with optional domain\n", i); expect_eq(GetSidLengthRequired(*GetSidSubAuthorityCount(sid_buffer)), cb, DWORD, "%d"); ok(memcmp(buf2, sid_buffer, cb) == 0, "SID create with domain is different than without (%d)\n", i); } @@ -2272,6 +2272,47 @@ static void test_PrivateObjectSecurity(void) #undef CHECK_RESULT_AND_FREE #undef CHECK_ONE_OF_AND_FREE +static void test_acls(void) +{ + char buffer[256]; + PACL pAcl = (PACL)buffer; + BOOL ret; + + SetLastError(0xdeadbeef); + ret = InitializeAcl(pAcl, sizeof(ACL) - 1, ACL_REVISION); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InitializeAcl with too small a buffer should have failed with ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = InitializeAcl(pAcl, 0xffffffff, ACL_REVISION); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "InitializeAcl with too large a buffer should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION1); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "InitializeAcl(ACL_REVISION1) should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError()); + + ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION2); + ok(ret, "InitializeAcl(ACL_REVISION2) failed with error %d\n", GetLastError()); + + ret = IsValidAcl(pAcl); + ok(ret, "IsValidAcl failed with error %d\n", GetLastError()); + + ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION3); + ok(ret, "InitializeAcl(ACL_REVISION3) failed with error %d\n", GetLastError()); + + ret = IsValidAcl(pAcl); + ok(ret, "IsValidAcl failed with error %d\n", GetLastError()); + + ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION4); + ok(ret, "InitializeAcl(ACL_REVISION4) failed with error %d\n", GetLastError()); + + ret = IsValidAcl(pAcl); + ok(ret, "IsValidAcl failed with error %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = InitializeAcl(pAcl, sizeof(buffer), -1); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "InitializeAcl(-1) failed with error %d\n", GetLastError()); +} + START_TEST(security) { init(); @@ -2299,4 +2340,5 @@ START_TEST(security) test_ConvertStringSecurityDescriptor(); test_ConvertSecurityDescriptorToString(); test_PrivateObjectSecurity(); + test_acls(); } diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 41f19b03603..53fb53b9978 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -6491,7 +6491,7 @@ static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT n * be scrolled only in line increments. "dy" will be rounded to the * nearest number of pixels that are a whole line. Ex: if line height * is 16 and an 8 is passed, the list will be scrolled by 16. If a 7 - * is passed the the scroll will be 0. (per MSDN 7/2002) + * is passed, then the scroll will be 0. (per MSDN 7/2002) * * For: (per experimentaion with native control and CSpy ListView) * LVS_ICON dy=1 = 1 pixel (vertical only) diff --git a/dlls/comctl32/theming.c b/dlls/comctl32/theming.c index e462f526b2c..5b5f6b304ee 100644 --- a/dlls/comctl32/theming.c +++ b/dlls/comctl32/theming.c @@ -68,7 +68,7 @@ static ATOM atSubclassProp; /* Generate a number of subclass window procs. * With a single proc alone, we can't really reliably find out the superclass, * so have one for each subclass. The subclass number is also stored in a prop - * since it's needed by THEMING_CallOriginalClass(). Then, the the subclass + * since it's needed by THEMING_CallOriginalClass(). Then, the subclass * proc and ref data are fetched and the proc called. */ #define MAKE_SUBCLASS_PROC(N) \ diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index 490a794609f..009af2a47ee 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -1987,7 +1987,7 @@ static BOOL PRINTDLG_CreateDCW(LPPRINTDLGW lppd) /*********************************************************************** * PrintDlgA (COMDLG32.@) * - * Displays the the PRINT dialog box, which enables the user to specify + * Displays the PRINT dialog box, which enables the user to specify * specific properties of the print job. * * PARAMS @@ -3359,7 +3359,7 @@ PageDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) /*********************************************************************** * PageSetupDlgA (COMDLG32.@) * - * Displays the the PAGE SETUP dialog box, which enables the user to specify + * Displays the PAGE SETUP dialog box, which enables the user to specify * specific properties of a printed page such as * size, source, orientation and the width of the page margins. * @@ -3383,6 +3383,11 @@ BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) { PageSetupDataA *pda; PRINTDLGA pdlg; + if (setupdlg == NULL) { + COMDLG32_SetCommDlgExtendedError(CDERR_INITIALIZATION); + return FALSE; + } + /* TRACE */ if(TRACE_ON(commdlg)) { char flagstr[1000] = ""; @@ -3399,11 +3404,8 @@ BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA setupdlg) { setupdlg->hDevNames, setupdlg->hInstance, setupdlg->Flags, flagstr); } + /* Checking setupdlg structure */ - if (setupdlg == NULL) { - COMDLG32_SetCommDlgExtendedError(CDERR_INITIALIZATION); - return FALSE; - } if(setupdlg->lStructSize != sizeof(PAGESETUPDLGA)) { COMDLG32_SetCommDlgExtendedError(CDERR_STRUCTSIZE); return FALSE; @@ -3488,6 +3490,12 @@ BOOL WINAPI PageSetupDlgW(LPPAGESETUPDLGW setupdlg) { PRINTDLGW pdlg; FIXME("Unicode implementation is not done yet\n"); + + if (setupdlg == NULL) { + COMDLG32_SetCommDlgExtendedError(CDERR_INITIALIZATION); + return FALSE; + } + if(TRACE_ON(commdlg)) { char flagstr[1000] = ""; const struct pd_flags *pflag = psd_flags; @@ -3576,7 +3584,7 @@ HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA lpPrintDlgExA) /*********************************************************************** * PrintDlgExW (COMDLG32.@) * - * Display the the PRINT dialog box, which enables the user to specify + * Displays the PRINT dialog box, which enables the user to specify * specific properties of the print job. The property sheet can also have * additional application-specific and driver-specific property pages. * diff --git a/dlls/comdlg32/printdlg16.c b/dlls/comdlg32/printdlg16.c index 65921f6281b..a4d22445eb2 100644 --- a/dlls/comdlg32/printdlg16.c +++ b/dlls/comdlg32/printdlg16.c @@ -327,7 +327,7 @@ static HGLOBAL16 PRINTDLG_GetDlgTemplate16(const PRINTDLG16 *lppd) /*********************************************************************** * PrintDlg (COMMDLG.20) * - * Displays the the PRINT dialog box, which enables the user to specify + * Displays the PRINT dialog box, which enables the user to specify * specific properties of the print job. * * RETURNS diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 8293e8276d8..c1009d6c96c 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -275,7 +275,7 @@ const void *CRYPT_ReadSerializedElement(const BYTE *pbElement, */ BOOL CRYPT_ReadSerializedStoreFromFile(HANDLE file, HCERTSTORE store); -/* Fixes up the the pointers in info, where info is assumed to be a +/* Fixes up the pointers in info, where info is assumed to be a * CRYPT_KEY_PROV_INFO, followed by its container name, provider name, and any * provider parameters, in a contiguous buffer, but where info's pointers are * assumed to be invalid. Upon return, info's pointers point to the diff --git a/dlls/cryptnet/Makefile.in b/dlls/cryptnet/Makefile.in index ed180f4b227..2506ea92f0a 100644 --- a/dlls/cryptnet/Makefile.in +++ b/dlls/cryptnet/Makefile.in @@ -5,6 +5,7 @@ VPATH = @srcdir@ MODULE = cryptnet.dll IMPORTLIB = libcryptnet.$(IMPLIBEXT) IMPORTS = crypt32 kernel32 +DELAYIMPORTS = wininet C_SRCS = \ cryptnet_main.c diff --git a/dlls/cryptnet/cryptnet.spec b/dlls/cryptnet/cryptnet.spec index bcf35e6f426..6fca711e262 100644 --- a/dlls/cryptnet/cryptnet.spec +++ b/dlls/cryptnet/cryptnet.spec @@ -7,8 +7,8 @@ @ stdcall CryptGetObjectUrl(ptr ptr long ptr ptr ptr ptr ptr) @ stub CryptGetTimeValidObject @ stub CryptInstallCancelRetrieval -@ stub CryptRetrieveObjectByUrlA -@ stub CryptRetrieveObjectByUrlW +@ stdcall CryptRetrieveObjectByUrlA(str str long long ptr ptr ptr ptr ptr) +@ stdcall CryptRetrieveObjectByUrlW(wstr str long long ptr ptr ptr ptr ptr) @ stub CryptUninstallCancelRetrieval @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer() diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c index 206ba24c349..603185df84b 100644 --- a/dlls/cryptnet/cryptnet_main.c +++ b/dlls/cryptnet/cryptnet_main.c @@ -24,7 +24,10 @@ #include "wine/debug.h" #include "winbase.h" #include "winnt.h" +#include "winnls.h" +#include "wininet.h" #define NONAMELESSUNION +#define CERT_REVOCATION_PARA_HAS_EXTRA_FIELDS #include "wincrypt.h" WINE_DEFAULT_DEBUG_CHANNEL(cryptnet); @@ -172,7 +175,10 @@ static BOOL WINAPI CRYPT_GetUrlFromCertificateCRLDistPoint(LPCSTR pszUrlOid, } } if (!pcbUrlArray) + { SetLastError(E_INVALIDARG); + ret = FALSE; + } else if (!pUrlArray) *pcbUrlArray = bytesNeeded; else if (*pcbUrlArray < bytesNeeded) @@ -291,10 +297,1015 @@ BOOL WINAPI CryptGetObjectUrl(LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, } /*********************************************************************** + * CryptRetrieveObjectByUrlA (CRYPTNET.@) + */ +BOOL WINAPI CryptRetrieveObjectByUrlA(LPCSTR pszURL, LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, + HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, + PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) +{ + BOOL ret = FALSE; + int len; + + TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_a(pszURL), + debugstr_a(pszObjectOid), dwRetrievalFlags, dwTimeout, ppvObject, + hAsyncRetrieve, pCredentials, pvVerify, pAuxInfo); + + if (!pszURL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + len = MultiByteToWideChar(CP_ACP, 0, pszURL, -1, NULL, 0); + if (len) + { + LPWSTR url = CryptMemAlloc(len * sizeof(WCHAR)); + + if (url) + { + MultiByteToWideChar(CP_ACP, 0, pszURL, -1, url, len); + ret = CryptRetrieveObjectByUrlW(url, pszObjectOid, + dwRetrievalFlags, dwTimeout, ppvObject, hAsyncRetrieve, + pCredentials, pvVerify, pAuxInfo); + CryptMemFree(url); + } + else + SetLastError(ERROR_OUTOFMEMORY); + } + return ret; +} + +static void WINAPI CRYPT_FreeBlob(LPCSTR pszObjectOid, + PCRYPT_BLOB_ARRAY pObject, void *pvFreeContext) +{ + DWORD i; + + for (i = 0; i < pObject->cBlob; i++) + CryptMemFree(pObject->rgBlob[i].pbData); + CryptMemFree(pObject->rgBlob); +} + +static BOOL CRYPT_GetObjectFromFile(HANDLE hFile, PCRYPT_BLOB_ARRAY pObject) +{ + BOOL ret; + LARGE_INTEGER size; + + if ((ret = GetFileSizeEx(hFile, &size))) + { + if (size.HighPart) + { + WARN("file too big\n"); + SetLastError(ERROR_INVALID_DATA); + ret = FALSE; + } + else + { + CRYPT_DATA_BLOB blob; + + blob.pbData = CryptMemAlloc(size.LowPart); + if (blob.pbData) + { + blob.cbData = size.LowPart; + ret = ReadFile(hFile, blob.pbData, size.LowPart, &blob.cbData, + NULL); + if (ret) + { + pObject->rgBlob = CryptMemAlloc(sizeof(CRYPT_DATA_BLOB)); + if (pObject->rgBlob) + { + pObject->cBlob = 1; + memcpy(pObject->rgBlob, &blob, sizeof(CRYPT_DATA_BLOB)); + } + else + { + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + if (!ret) + CryptMemFree(blob.pbData); + } + else + { + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + } + return ret; +} + +/* FIXME: should make wininet cache all downloads instead */ +/* FIXME: how do I know the cached object is up to date? */ +static BOOL CRYPT_GetObjectFromCache(LPCWSTR pszURL, PCRYPT_BLOB_ARRAY pObject, + PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) +{ + BOOL ret = FALSE; + INTERNET_CACHE_ENTRY_INFOW cacheInfo = { sizeof(cacheInfo), 0 }; + DWORD size = sizeof(cacheInfo); + + TRACE("(%s, %p, %p)\n", debugstr_w(pszURL), pObject, pAuxInfo); + + if (GetUrlCacheEntryInfoW(pszURL, &cacheInfo, &size) || + GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + FILETIME ft; + + GetSystemTimeAsFileTime(&ft); + if (CompareFileTime(&cacheInfo.ExpireTime, &ft) >= 0) + { + LPINTERNET_CACHE_ENTRY_INFOW pCacheInfo = CryptMemAlloc(size); + + if (pCacheInfo) + { + if (GetUrlCacheEntryInfoW(pszURL, pCacheInfo, &size)) + { + HANDLE hFile = CreateFileW(pCacheInfo->lpszLocalFileName, + GENERIC_READ, 0, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + + if (hFile != INVALID_HANDLE_VALUE) + { + if ((ret = CRYPT_GetObjectFromFile(hFile, pObject))) + { + if (pAuxInfo && pAuxInfo->cbSize >= + offsetof(CRYPT_RETRIEVE_AUX_INFO, + pLastSyncTime) + sizeof(PFILETIME) && + pAuxInfo->pLastSyncTime) + memcpy(pAuxInfo->pLastSyncTime, + &pCacheInfo->LastSyncTime, + sizeof(FILETIME)); + } + CloseHandle(hFile); + } + } + CryptMemFree(pCacheInfo); + } + else + SetLastError(ERROR_OUTOFMEMORY); + } + else + DeleteUrlCacheEntryW(pszURL); + } + TRACE("returning %d\n", ret); + return ret; +} + +static inline LPWSTR strndupW(LPWSTR string, int len) +{ + LPWSTR ret = NULL; + if (string && (ret = CryptMemAlloc((len + 1) * sizeof(WCHAR))) != NULL) + { + memcpy(ret, string, len * sizeof(WCHAR)); + ret[len] = 0; + } + return ret; +} + +/* Parses the URL, and sets components's lpszHostName and lpszUrlPath members + * to NULL-terminated copies of those portions of the URL (to be freed with + * CryptMemFree.) + */ +static BOOL CRYPT_CrackUrl(LPCWSTR pszURL, URL_COMPONENTSW *components) +{ + BOOL ret; + + TRACE("(%s, %p)\n", debugstr_w(pszURL), components); + + memset(components, 0, sizeof(*components)); + components->dwStructSize = sizeof(*components); + components->dwHostNameLength = 1; + components->dwUrlPathLength = 1; + ret = InternetCrackUrlW(pszURL, 0, ICU_DECODE, components); + if (ret) + { + LPWSTR hostname = strndupW(components->lpszHostName, + components->dwHostNameLength); + LPWSTR path = strndupW(components->lpszUrlPath, + components->dwUrlPathLength); + + components->lpszHostName = hostname; + components->lpszUrlPath = path; + switch (components->nScheme) + { + case INTERNET_SCHEME_FTP: + if (!components->nPort) + components->nPort = INTERNET_DEFAULT_FTP_PORT; + break; + case INTERNET_SCHEME_HTTP: + if (!components->nPort) + components->nPort = INTERNET_DEFAULT_HTTP_PORT; + break; + default: + ; /* do nothing */ + } + } + TRACE("returning %d\n", ret); + return ret; +} + +struct InetContext +{ + HANDLE event; + DWORD timeout; + DWORD error; +}; + +static struct InetContext *CRYPT_MakeInetContext(DWORD dwTimeout) +{ + struct InetContext *context = CryptMemAlloc(sizeof(struct InetContext)); + + if (context) + { + context->event = CreateEventW(NULL, FALSE, FALSE, NULL); + if (!context->event) + { + CryptMemFree(context); + context = NULL; + } + else + { + context->timeout = dwTimeout; + context->error = ERROR_SUCCESS; + } + } + return context; +} + +static BOOL CRYPT_DownloadObject(DWORD dwRetrievalFlags, HINTERNET hHttp, + struct InetContext *context, PCRYPT_BLOB_ARRAY pObject, + PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) +{ + CRYPT_DATA_BLOB object = { 0, NULL }; + DWORD bytesAvailable; + BOOL ret; + + do { + if ((ret = InternetQueryDataAvailable(hHttp, &bytesAvailable, 0, 0))) + { + if (bytesAvailable) + { + if (object.pbData) + object.pbData = CryptMemRealloc(object.pbData, + object.cbData + bytesAvailable); + else + object.pbData = CryptMemAlloc(bytesAvailable); + if (object.pbData) + { + INTERNET_BUFFERSA buffer = { sizeof(buffer), 0 }; + + buffer.dwBufferLength = bytesAvailable; + buffer.lpvBuffer = object.pbData + object.cbData; + if (!(ret = InternetReadFileExA(hHttp, &buffer, IRF_NO_WAIT, + (DWORD_PTR)context))) + { + if (GetLastError() == ERROR_IO_PENDING) + { + if (WaitForSingleObject(context->event, + context->timeout) == WAIT_TIMEOUT) + SetLastError(ERROR_TIMEOUT); + else if (context->error) + SetLastError(context->error); + else + ret = TRUE; + } + } + if (ret) + object.cbData += bytesAvailable; + } + else + { + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + } + else if (GetLastError() == ERROR_IO_PENDING) + { + if (WaitForSingleObject(context->event, context->timeout) == + WAIT_TIMEOUT) + SetLastError(ERROR_TIMEOUT); + else + ret = TRUE; + } + } while (ret && bytesAvailable); + if (ret) + { + pObject->rgBlob = CryptMemAlloc(sizeof(CRYPT_DATA_BLOB)); + if (!pObject->rgBlob) + { + CryptMemFree(object.pbData); + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + else + { + pObject->rgBlob[0].cbData = object.cbData; + pObject->rgBlob[0].pbData = object.pbData; + pObject->cBlob = 1; + } + } + TRACE("returning %d\n", ret); + return ret; +} + +static void CRYPT_CacheURL(LPCWSTR pszURL, PCRYPT_BLOB_ARRAY pObject, + DWORD dwRetrievalFlags) +{ + WCHAR cacheFileName[MAX_PATH]; + + /* FIXME: let wininet directly cache instead */ + if (CreateUrlCacheEntryW(pszURL, pObject->rgBlob[0].cbData, NULL, + cacheFileName, 0)) + { + HANDLE hCacheFile = CreateFileW(cacheFileName, GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + + if (hCacheFile != INVALID_HANDLE_VALUE) + { + DWORD bytesWritten, entryType; + FILETIME ft = { 0 }; + + if (!(dwRetrievalFlags & CRYPT_STICKY_CACHE_RETRIEVAL)) + entryType = NORMAL_CACHE_ENTRY; + else + entryType = STICKY_CACHE_ENTRY; + WriteFile(hCacheFile, pObject->rgBlob[0].pbData, + pObject->rgBlob[0].cbData, &bytesWritten, NULL); + CloseHandle(hCacheFile); + CommitUrlCacheEntryW(pszURL, cacheFileName, ft, ft, entryType, + NULL, 0, NULL, NULL); + } + } +} + +static void CALLBACK CRYPT_InetStatusCallback(HINTERNET hInt, + DWORD_PTR dwContext, DWORD status, void *statusInfo, DWORD statusInfoLen) +{ + struct InetContext *context = (struct InetContext *)dwContext; + LPINTERNET_ASYNC_RESULT result; + + switch (status) + { + case INTERNET_STATUS_REQUEST_COMPLETE: + result = (LPINTERNET_ASYNC_RESULT)statusInfo; + context->error = result->dwError; + SetEvent(context->event); + } +} + +static BOOL CRYPT_Connect(URL_COMPONENTSW *components, + struct InetContext *context, PCRYPT_CREDENTIALS pCredentials, + HINTERNET *phInt, HINTERNET *phHost) +{ + BOOL ret; + + TRACE("(%s:%d, %p, %p, %p, %p)\n", debugstr_w(components->lpszHostName), + components->nPort, context, pCredentials, phInt, phInt); + + *phHost = NULL; + *phInt = InternetOpenW(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, + context ? INTERNET_FLAG_ASYNC : 0); + if (*phInt) + { + DWORD service; + + if (context) + InternetSetStatusCallbackW(*phInt, CRYPT_InetStatusCallback); + switch (components->nScheme) + { + case INTERNET_SCHEME_FTP: + service = INTERNET_SERVICE_FTP; + break; + case INTERNET_SCHEME_HTTP: + service = INTERNET_SERVICE_HTTP; + break; + default: + service = 0; + } + /* FIXME: use pCredentials for username/password */ + *phHost = InternetConnectW(*phInt, components->lpszHostName, + components->nPort, NULL, NULL, service, 0, (DWORD_PTR)context); + if (!*phHost) + { + InternetCloseHandle(*phInt); + *phInt = NULL; + ret = FALSE; + } + else + ret = TRUE; + } + else + ret = FALSE; + TRACE("returning %d\n", ret); + return ret; +} + +static BOOL WINAPI FTP_RetrieveEncodedObjectW(LPCWSTR pszURL, + LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, + PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, + void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, + PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) +{ + FIXME("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL), + debugstr_a(pszObjectOid), dwRetrievalFlags, dwTimeout, pObject, + ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo); + + pObject->cBlob = 0; + pObject->rgBlob = NULL; + *ppfnFreeObject = CRYPT_FreeBlob; + *ppvFreeContext = NULL; + return FALSE; +} + +static const WCHAR x509cacert[] = { 'a','p','p','l','i','c','a','t','i','o','n', + '/','x','-','x','5','0','9','-','c','a','-','c','e','r','t',0 }; +static const WCHAR x509emailcert[] = { 'a','p','p','l','i','c','a','t','i','o', + 'n','/','x','-','x','5','0','9','-','e','m','a','i','l','-','c','e','r','t', + 0 }; +static const WCHAR x509servercert[] = { 'a','p','p','l','i','c','a','t','i','o', + 'n','/','x','-','x','5','0','9','-','s','e','r','v','e','r','-','c','e','r', + 't',0 }; +static const WCHAR x509usercert[] = { 'a','p','p','l','i','c','a','t','i','o', + 'n','/','x','-','x','5','0','9','-','u','s','e','r','-','c','e','r','t',0 }; +static const WCHAR pkcs7cert[] = { 'a','p','p','l','i','c','a','t','i','o','n', + '/','x','-','p','k','c','s','7','-','c','e','r','t','i','f','c','a','t','e', + 's',0 }; +static const WCHAR pkixCRL[] = { 'a','p','p','l','i','c','a','t','i','o','n', + '/','p','k','i','x','-','c','r','l',0 }; +static const WCHAR pkcs7CRL[] = { 'a','p','p','l','i','c','a','t','i','o','n', + '/','x','-','p','k','c','s','7','-','c','r','l',0 }; +static const WCHAR pkcs7sig[] = { 'a','p','p','l','i','c','a','t','i','o','n', + '/','x','-','p','k','c','s','7','-','s','i','g','n','a','t','u','r','e',0 }; +static const WCHAR pkcs7mime[] = { 'a','p','p','l','i','c','a','t','i','o','n', + '/','x','-','p','k','c','s','7','-','m','i','m','e',0 }; + +static BOOL WINAPI HTTP_RetrieveEncodedObjectW(LPCWSTR pszURL, + LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, + PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, + void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, + PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) +{ + BOOL ret = FALSE; + + TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL), + debugstr_a(pszObjectOid), dwRetrievalFlags, dwTimeout, pObject, + ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo); + + pObject->cBlob = 0; + pObject->rgBlob = NULL; + *ppfnFreeObject = CRYPT_FreeBlob; + *ppvFreeContext = NULL; + + if (!(dwRetrievalFlags & CRYPT_WIRE_ONLY_RETRIEVAL)) + ret = CRYPT_GetObjectFromCache(pszURL, pObject, pAuxInfo); + if (!ret && (!(dwRetrievalFlags & CRYPT_CACHE_ONLY_RETRIEVAL) || + (dwRetrievalFlags & CRYPT_WIRE_ONLY_RETRIEVAL))) + { + URL_COMPONENTSW components; + + if ((ret = CRYPT_CrackUrl(pszURL, &components))) + { + HINTERNET hInt, hHost; + struct InetContext *context = NULL; + + if (dwTimeout) + context = CRYPT_MakeInetContext(dwTimeout); + ret = CRYPT_Connect(&components, context, pCredentials, &hInt, + &hHost); + if (ret) + { + static LPCWSTR types[] = { x509cacert, x509emailcert, + x509servercert, x509usercert, pkcs7cert, pkixCRL, pkcs7CRL, + pkcs7sig, pkcs7mime, NULL }; + HINTERNET hHttp = HttpOpenRequestW(hHost, NULL, + components.lpszUrlPath, NULL, NULL, types, + INTERNET_FLAG_NO_COOKIES | INTERNET_FLAG_NO_UI, + (DWORD_PTR)context); + + if (hHttp) + { + ret = HttpSendRequestExW(hHttp, NULL, NULL, 0, + (DWORD_PTR)context); + if (!ret && GetLastError() == ERROR_IO_PENDING) + { + if (WaitForSingleObject(context->event, + context->timeout) == WAIT_TIMEOUT) + SetLastError(ERROR_TIMEOUT); + else + ret = TRUE; + } + ret = HttpEndRequestW(hHttp, NULL, 0, (DWORD_PTR)context); + if (!ret && GetLastError() == ERROR_IO_PENDING) + { + if (WaitForSingleObject(context->event, + context->timeout) == WAIT_TIMEOUT) + SetLastError(ERROR_TIMEOUT); + else + ret = TRUE; + } + if (ret) + ret = CRYPT_DownloadObject(dwRetrievalFlags, hHttp, + context, pObject, pAuxInfo); + if (ret && !(dwRetrievalFlags & CRYPT_DONT_CACHE_RESULT)) + CRYPT_CacheURL(pszURL, pObject, dwRetrievalFlags); + InternetCloseHandle(hHttp); + } + InternetCloseHandle(hHost); + InternetCloseHandle(hInt); + } + if (context) + { + CloseHandle(context->event); + CryptMemFree(context); + } + CryptMemFree(components.lpszUrlPath); + CryptMemFree(components.lpszHostName); + } + } + TRACE("returning %d\n", ret); + return ret; +} + +static BOOL WINAPI File_RetrieveEncodedObjectW(LPCWSTR pszURL, + LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, + PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, + void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, + PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) +{ + URL_COMPONENTSW components = { sizeof(components), 0 }; + BOOL ret; + + TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL), + debugstr_a(pszObjectOid), dwRetrievalFlags, dwTimeout, pObject, + ppfnFreeObject, ppvFreeContext, hAsyncRetrieve, pCredentials, pAuxInfo); + + pObject->cBlob = 0; + pObject->rgBlob = NULL; + *ppfnFreeObject = CRYPT_FreeBlob; + *ppvFreeContext = NULL; + + components.dwUrlPathLength = 1; + ret = InternetCrackUrlW(pszURL, 0, ICU_DECODE, &components); + if (ret) + { + LPWSTR path; + + /* 3 == lstrlenW(L"c:") + 1 */ + path = CryptMemAlloc((components.dwUrlPathLength + 3) * sizeof(WCHAR)); + if (path) + { + HANDLE hFile; + + /* Try to create the file directly - Wine handles / in pathnames */ + lstrcpynW(path, components.lpszUrlPath, + components.dwUrlPathLength + 1); + hFile = CreateFileW(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) + { + /* Try again on the current drive */ + GetCurrentDirectoryW(components.dwUrlPathLength, path); + if (path[1] == ':') + { + lstrcpynW(path + 2, components.lpszUrlPath, + components.dwUrlPathLength + 1); + hFile = CreateFileW(path, GENERIC_READ, 0, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + } + if (hFile == INVALID_HANDLE_VALUE) + { + /* Try again on the Windows drive */ + GetWindowsDirectoryW(path, components.dwUrlPathLength); + if (path[1] == ':') + { + lstrcpynW(path + 2, components.lpszUrlPath, + components.dwUrlPathLength + 1); + hFile = CreateFileW(path, GENERIC_READ, 0, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + } + } + } + if (hFile != INVALID_HANDLE_VALUE) + { + if ((ret = CRYPT_GetObjectFromFile(hFile, pObject))) + { + if (pAuxInfo && pAuxInfo->cbSize >= + offsetof(CRYPT_RETRIEVE_AUX_INFO, + pLastSyncTime) + sizeof(PFILETIME) && + pAuxInfo->pLastSyncTime) + GetFileTime(hFile, NULL, NULL, + pAuxInfo->pLastSyncTime); + } + CloseHandle(hFile); + } + else + ret = FALSE; + CryptMemFree(path); + } + } + return ret; +} + +typedef BOOL (WINAPI *SchemeDllRetrieveEncodedObjectW)(LPCWSTR pwszUrl, + LPCSTR pszObjectOid, DWORD dwRetrievalFlags, DWORD dwTimeout, + PCRYPT_BLOB_ARRAY pObject, PFN_FREE_ENCODED_OBJECT_FUNC *ppfnFreeObject, + void **ppvFreeContext, HCRYPTASYNC hAsyncRetrieve, + PCRYPT_CREDENTIALS pCredentials, PCRYPT_RETRIEVE_AUX_INFO pAuxInfo); + +static BOOL CRYPT_GetRetrieveFunction(LPCWSTR pszURL, + SchemeDllRetrieveEncodedObjectW *pFunc, HCRYPTOIDFUNCADDR *phFunc) +{ + URL_COMPONENTSW components = { sizeof(components), 0 }; + BOOL ret; + + TRACE("(%s, %p, %p)\n", debugstr_w(pszURL), pFunc, phFunc); + + *pFunc = NULL; + *phFunc = 0; + components.dwSchemeLength = 1; + ret = InternetCrackUrlW(pszURL, 0, ICU_DECODE, &components); + if (ret) + { + /* Microsoft always uses CryptInitOIDFunctionSet/ + * CryptGetOIDFunctionAddress, but there doesn't seem to be a pressing + * reason to do so for builtin schemes. + */ + switch (components.nScheme) + { + case INTERNET_SCHEME_FTP: + *pFunc = FTP_RetrieveEncodedObjectW; + break; + case INTERNET_SCHEME_HTTP: + *pFunc = HTTP_RetrieveEncodedObjectW; + break; + case INTERNET_SCHEME_FILE: + *pFunc = File_RetrieveEncodedObjectW; + break; + default: + { + int len = WideCharToMultiByte(CP_ACP, 0, components.lpszScheme, + components.dwSchemeLength, NULL, 0, NULL, NULL); + + if (len) + { + LPSTR scheme = CryptMemAlloc(len); + + if (scheme) + { + static HCRYPTOIDFUNCSET set = NULL; + + if (!set) + set = CryptInitOIDFunctionSet( + SCHEME_OID_RETRIEVE_ENCODED_OBJECTW_FUNC, 0); + WideCharToMultiByte(CP_ACP, 0, components.lpszScheme, + components.dwSchemeLength, scheme, len, NULL, NULL); + ret = CryptGetOIDFunctionAddress(set, X509_ASN_ENCODING, + scheme, 0, (void **)pFunc, phFunc); + CryptMemFree(scheme); + } + else + { + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + else + ret = FALSE; + } + } + } + TRACE("returning %d\n", ret); + return ret; +} + +static BOOL WINAPI CRYPT_CreateBlob(LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContext) +{ + DWORD size, i; + CRYPT_BLOB_ARRAY *context; + BOOL ret = FALSE; + + size = sizeof(CRYPT_BLOB_ARRAY) + pObject->cBlob * sizeof(CRYPT_DATA_BLOB); + for (i = 0; i < pObject->cBlob; i++) + size += pObject->rgBlob[i].cbData; + context = CryptMemAlloc(size); + if (context) + { + LPBYTE nextData; + + context->cBlob = 0; + context->rgBlob = + (CRYPT_DATA_BLOB *)((LPBYTE)context + sizeof(CRYPT_BLOB_ARRAY)); + nextData = + (LPBYTE)context->rgBlob + pObject->cBlob * sizeof(CRYPT_DATA_BLOB); + for (i = 0; i < pObject->cBlob; i++) + { + memcpy(nextData, pObject->rgBlob[i].pbData, + pObject->rgBlob[i].cbData); + context->rgBlob[i].pbData = nextData; + context->rgBlob[i].cbData = pObject->rgBlob[i].cbData; + nextData += pObject->rgBlob[i].cbData; + context->cBlob++; + } + *ppvContext = context; + ret = TRUE; + } + return ret; +} + +typedef BOOL (WINAPI *AddContextToStore)(HCERTSTORE hCertStore, + const void *pContext, DWORD dwAddDisposition, const void **ppStoreContext); + +static BOOL CRYPT_CreateContext(PCRYPT_BLOB_ARRAY pObject, + DWORD dwExpectedContentTypeFlags, AddContextToStore addFunc, void **ppvContext) +{ + BOOL ret = TRUE; + + if (!pObject->cBlob) + { + SetLastError(ERROR_INVALID_DATA); + *ppvContext = NULL; + ret = FALSE; + } + else if (pObject->cBlob == 1) + { + if (!CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &pObject->rgBlob[0], + dwExpectedContentTypeFlags, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, + NULL, NULL, NULL, NULL, (const void **)ppvContext)) + { + SetLastError(CRYPT_E_NO_MATCH); + ret = FALSE; + } + } + else + { + HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + + if (store) + { + DWORD i; + const void *context; + + for (i = 0; i < pObject->cBlob; i++) + { + if (CryptQueryObject(CERT_QUERY_OBJECT_BLOB, + &pObject->rgBlob[i], dwExpectedContentTypeFlags, + CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL, NULL, NULL, + NULL, &context)) + { + if (!addFunc(store, context, CERT_STORE_ADD_ALWAYS, NULL)) + ret = FALSE; + } + else + { + SetLastError(CRYPT_E_NO_MATCH); + ret = FALSE; + } + } + } + else + ret = FALSE; + *ppvContext = store; + } + return ret; +} + +static BOOL WINAPI CRYPT_CreateCert(LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContext) +{ + return CRYPT_CreateContext(pObject, CERT_QUERY_CONTENT_FLAG_CERT, + (AddContextToStore)CertAddCertificateContextToStore, ppvContext); +} + +static BOOL WINAPI CRYPT_CreateCRL(LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContext) +{ + return CRYPT_CreateContext(pObject, CERT_QUERY_CONTENT_FLAG_CRL, + (AddContextToStore)CertAddCRLContextToStore, ppvContext); +} + +static BOOL WINAPI CRYPT_CreateCTL(LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContext) +{ + return CRYPT_CreateContext(pObject, CERT_QUERY_CONTENT_FLAG_CTL, + (AddContextToStore)CertAddCTLContextToStore, ppvContext); +} + +static BOOL WINAPI CRYPT_CreatePKCS7(LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContext) +{ + BOOL ret; + + if (!pObject->cBlob) + { + SetLastError(ERROR_INVALID_DATA); + *ppvContext = NULL; + ret = FALSE; + } + else if (pObject->cBlob == 1) + ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, &pObject->rgBlob[0], + CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | + CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED, CERT_QUERY_FORMAT_FLAG_BINARY, + 0, NULL, NULL, NULL, (HCERTSTORE *)ppvContext, NULL, NULL); + else + { + FIXME("multiple messages unimplemented\n"); + ret = FALSE; + } + return ret; +} + +static BOOL WINAPI CRYPT_CreateAny(LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContext) +{ + BOOL ret; + + if (!pObject->cBlob) + { + SetLastError(ERROR_INVALID_DATA); + *ppvContext = NULL; + ret = FALSE; + } + else + { + HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + + if (store) + { + HCERTSTORE memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + + if (memStore) + { + CertAddStoreToCollection(store, memStore, + CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0); + CertCloseStore(memStore, 0); + } + else + { + CertCloseStore(store, 0); + store = NULL; + } + } + if (store) + { + DWORD i; + + ret = TRUE; + for (i = 0; i < pObject->cBlob; i++) + { + DWORD contentType, expectedContentTypes = + CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | + CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED | + CERT_QUERY_CONTENT_FLAG_CERT | + CERT_QUERY_CONTENT_FLAG_CRL | + CERT_QUERY_CONTENT_FLAG_CTL; + HCERTSTORE contextStore; + const void *context; + + if (CryptQueryObject(CERT_QUERY_OBJECT_BLOB, + &pObject->rgBlob[i], expectedContentTypes, + CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, &contentType, NULL, + &contextStore, NULL, &context)) + { + switch (contentType) + { + case CERT_QUERY_CONTENT_CERT: + if (!CertAddCertificateContextToStore(store, + (PCCERT_CONTEXT)context, CERT_STORE_ADD_ALWAYS, NULL)) + ret = FALSE; + break; + case CERT_QUERY_CONTENT_CRL: + if (!CertAddCRLContextToStore(store, + (PCCRL_CONTEXT)context, CERT_STORE_ADD_ALWAYS, NULL)) + ret = FALSE; + break; + case CERT_QUERY_CONTENT_CTL: + if (!CertAddCTLContextToStore(store, + (PCCTL_CONTEXT)context, CERT_STORE_ADD_ALWAYS, NULL)) + ret = FALSE; + break; + default: + CertAddStoreToCollection(store, contextStore, 0, 0); + } + } + else + ret = FALSE; + } + } + else + ret = FALSE; + *ppvContext = store; + } + return ret; +} + +typedef BOOL (WINAPI *ContextDllCreateObjectContext)(LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, PCRYPT_BLOB_ARRAY pObject, void **ppvContext); + +static BOOL CRYPT_GetCreateFunction(LPCSTR pszObjectOid, + ContextDllCreateObjectContext *pFunc, HCRYPTOIDFUNCADDR *phFunc) +{ + BOOL ret = TRUE; + + TRACE("(%s, %p, %p)\n", debugstr_a(pszObjectOid), pFunc, phFunc); + + *pFunc = NULL; + *phFunc = 0; + if (!HIWORD(pszObjectOid)) + { + switch (LOWORD(pszObjectOid)) + { + case 0: + *pFunc = CRYPT_CreateBlob; + break; + case LOWORD(CONTEXT_OID_CERTIFICATE): + *pFunc = CRYPT_CreateCert; + break; + case LOWORD(CONTEXT_OID_CRL): + *pFunc = CRYPT_CreateCRL; + break; + case LOWORD(CONTEXT_OID_CTL): + *pFunc = CRYPT_CreateCTL; + break; + case LOWORD(CONTEXT_OID_PKCS7): + *pFunc = CRYPT_CreatePKCS7; + break; + case LOWORD(CONTEXT_OID_CAPI2_ANY): + *pFunc = CRYPT_CreateAny; + break; + } + } + if (!*pFunc) + { + static HCRYPTOIDFUNCSET set = NULL; + + if (!set) + set = CryptInitOIDFunctionSet( + CONTEXT_OID_CREATE_OBJECT_CONTEXT_FUNC, 0); + ret = CryptGetOIDFunctionAddress(set, X509_ASN_ENCODING, pszObjectOid, + 0, (void **)pFunc, phFunc); + } + TRACE("returning %d\n", ret); + return ret; +} + +/*********************************************************************** + * CryptRetrieveObjectByUrlW (CRYPTNET.@) + */ +BOOL WINAPI CryptRetrieveObjectByUrlW(LPCWSTR pszURL, LPCSTR pszObjectOid, + DWORD dwRetrievalFlags, DWORD dwTimeout, LPVOID *ppvObject, + HCRYPTASYNC hAsyncRetrieve, PCRYPT_CREDENTIALS pCredentials, LPVOID pvVerify, + PCRYPT_RETRIEVE_AUX_INFO pAuxInfo) +{ + BOOL ret; + SchemeDllRetrieveEncodedObjectW retrieve; + ContextDllCreateObjectContext create; + HCRYPTOIDFUNCADDR hRetrieve = 0, hCreate = 0; + + TRACE("(%s, %s, %08x, %d, %p, %p, %p, %p, %p)\n", debugstr_w(pszURL), + debugstr_a(pszObjectOid), dwRetrievalFlags, dwTimeout, ppvObject, + hAsyncRetrieve, pCredentials, pvVerify, pAuxInfo); + + if (!pszURL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + ret = CRYPT_GetRetrieveFunction(pszURL, &retrieve, &hRetrieve); + if (ret) + ret = CRYPT_GetCreateFunction(pszObjectOid, &create, &hCreate); + if (ret) + { + CRYPT_BLOB_ARRAY object = { 0, NULL }; + PFN_FREE_ENCODED_OBJECT_FUNC freeObject; + void *freeContext; + + ret = retrieve(pszURL, pszObjectOid, dwRetrievalFlags, dwTimeout, + &object, &freeObject, &freeContext, hAsyncRetrieve, pCredentials, + pAuxInfo); + if (ret) + { + ret = create(pszObjectOid, dwRetrievalFlags, &object, ppvObject); + freeObject(pszObjectOid, &object, freeContext); + } + } + if (hCreate) + CryptFreeOIDFunctionAddress(hCreate, 0); + if (hRetrieve) + CryptFreeOIDFunctionAddress(hRetrieve, 0); + TRACE("returning %d\n", ret); + return ret; +} + +/*********************************************************************** * CertDllVerifyRevocation (CRYPTNET.@) */ BOOL WINAPI CertDllVerifyRevocation(DWORD dwEncodingType, DWORD dwRevType, - DWORD cContext, void *rgpvContext[], DWORD dwFlags, + DWORD cContext, PVOID rgpvContext[], DWORD dwFlags, PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus) { FIXME("(%08x, %d, %d, %p, %08x, %p, %p): stub\n", dwEncodingType, dwRevType, diff --git a/dlls/cryptnet/tests/cryptnet.c b/dlls/cryptnet/tests/cryptnet.c index 8862d16bf27..25edaa6963a 100644 --- a/dlls/cryptnet/tests/cryptnet.c +++ b/dlls/cryptnet/tests/cryptnet.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include +#include #define NONAMELESSUNION #include #include @@ -174,13 +175,11 @@ static void test_getObjectUrl(void) SetLastError(0xdeadbeef); ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, (void *)cert, 0, NULL, NULL, NULL, NULL, NULL); - todo_wine ok(!ret && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", GetLastError()); SetLastError(0xdeadbeef); ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, (void *)cert, 0, NULL, NULL, NULL, &infoSize, NULL); - todo_wine ok(!ret && GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", GetLastError()); /* Can get it without specifying the location: */ @@ -234,7 +233,133 @@ static void test_getObjectUrl(void) } } +static void make_tmp_file(LPSTR path) +{ + static char curr[MAX_PATH] = { 0 }; + char temp[MAX_PATH]; + DWORD dwNumberOfBytesWritten; + HANDLE hf; + + if (!*curr) + GetCurrentDirectoryA(MAX_PATH, curr); + GetTempFileNameA(curr, "net", 0, temp); + lstrcpyA(path, temp); + hf = CreateFileA(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + WriteFile(hf, certWithCRLDistPoint, sizeof(certWithCRLDistPoint), + &dwNumberOfBytesWritten, NULL); + CloseHandle(hf); +} + +static void test_retrieveObjectByUrl(void) +{ + BOOL ret; + char tmpfile[MAX_PATH * 2], *ptr, url[MAX_PATH + 8]; + CRYPT_BLOB_ARRAY *pBlobArray; + PCCERT_CONTEXT cert; + PCCRL_CONTEXT crl; + HCERTSTORE store; + CRYPT_RETRIEVE_AUX_INFO aux = { 0 }; + FILETIME ft = { 0 }; + + SetLastError(0xdeadbeef); + ret = CryptRetrieveObjectByUrlA(NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, + NULL); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError()); + + make_tmp_file(tmpfile); + ptr = strchr(tmpfile, ':'); + if (ptr) + ptr += 2; /* skip colon and first slash */ + else + ptr = tmpfile; + snprintf(url, sizeof(url), "file:///%s", ptr); + do { + ptr = strchr(url, '\\'); + if (ptr) + *ptr = '/'; + } while (ptr); + + pBlobArray = (CRYPT_BLOB_ARRAY *)0xdeadbeef; + ret = CryptRetrieveObjectByUrlA(url, NULL, 0, 0, (void **)&pBlobArray, + NULL, NULL, NULL, NULL); + ok(ret, "CryptRetrieveObjectByUrlA failed: %d\n", GetLastError()); + ok(pBlobArray && pBlobArray != (CRYPT_BLOB_ARRAY *)0xdeadbeef, + "Expected a valid pointer\n"); + if (pBlobArray && pBlobArray != (CRYPT_BLOB_ARRAY *)0xdeadbeef) + { + ok(pBlobArray->cBlob == 1, "Expected 1 blob, got %d\n", + pBlobArray->cBlob); + ok(pBlobArray->rgBlob[0].cbData == sizeof(certWithCRLDistPoint), + "Unexpected size %d\n", pBlobArray->rgBlob[0].cbData); + CryptMemFree(pBlobArray); + } + cert = (PCCERT_CONTEXT)0xdeadbeef; + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0, + (void **)&cert, NULL, NULL, NULL, NULL); + ok(cert && cert != (PCCERT_CONTEXT)0xdeadbeef, "Expected a cert\n"); + if (cert && cert != (PCCERT_CONTEXT)0xdeadbeef) + CertFreeCertificateContext(cert); + crl = (PCCRL_CONTEXT)0xdeadbeef; + SetLastError(0xdeadbeef); + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CRL, 0, 0, (void **)&crl, + NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NO_MATCH, + "Expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError()); + ok(crl == NULL, "Expected CRL to be NULL\n"); + if (crl && crl != (PCCRL_CONTEXT)0xdeadbeef) + CertFreeCRLContext(crl); + store = (HCERTSTORE)0xdeadbeef; + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CAPI2_ANY, 0, 0, + (void **)&store, NULL, NULL, NULL, NULL); + ok(ret, "CryptRetrieveObjectByUrlA failed: %d\n", GetLastError()); + if (store && store != (HCERTSTORE)0xdeadbeef) + { + DWORD certs = 0; + + cert = NULL; + do { + cert = CertEnumCertificatesInStore(store, cert); + if (cert) + certs++; + } while (cert); + ok(certs == 1, "Expected 1 cert, got %d\n", certs); + CertCloseStore(store, 0); + } + /* Are file URLs cached? */ + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, + CRYPT_CACHE_ONLY_RETRIEVAL, 0, (void **)&cert, NULL, NULL, NULL, NULL); + ok(ret, "CryptRetrieveObjectByUrlA failed: %08x\n", GetLastError()); + if (cert && cert != (PCCERT_CONTEXT)0xdeadbeef) + CertFreeCertificateContext(cert); + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0, + (void **)&cert, NULL, NULL, NULL, &aux); + ok(ret, "CryptRetrieveObjectByUrlA failed: %08x\n", GetLastError()); + if (cert && cert != (PCCERT_CONTEXT)0xdeadbeef) + CertFreeCertificateContext(cert); + aux.cbSize = sizeof(aux); + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0, + (void **)&cert, NULL, NULL, NULL, &aux); + ok(ret, "CryptRetrieveObjectByUrlA failed: %08x\n", GetLastError()); + aux.pLastSyncTime = &ft; + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, 0, 0, + (void **)&cert, NULL, NULL, NULL, &aux); + ok(ft.dwLowDateTime || ft.dwHighDateTime, + "Expected last sync time to be set\n"); + DeleteFileA(tmpfile); + /* Okay, after being deleted, are file URLs still cached? */ + SetLastError(0xdeadbeef); + ret = CryptRetrieveObjectByUrlA(url, CONTEXT_OID_CERTIFICATE, + CRYPT_CACHE_ONLY_RETRIEVAL, 0, (void **)&cert, NULL, NULL, NULL, NULL); + ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND || + GetLastError() == ERROR_PATH_NOT_FOUND), + "Expected ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, got %d\n", + GetLastError()); +} + START_TEST(cryptnet) { test_getObjectUrl(); + test_retrieveObjectByUrl(); } diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 27e17c2541e..f421fe7ae6c 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -5281,14 +5281,14 @@ static HRESULT DirectPlayEnumerateAW(LPDPENUMDPCALLBACKA lpEnumCallbackA, /* The enumeration will return FALSE if we are not to continue. * * Note: on my windows box, major / minor version is 6 / 0 for all service providers - * and have no relations to any of the two dwReserved1 and dwReserved2 keys. + * and have no relation to any of the two dwReserved1 and dwReserved2 keys. * I think that it simply means that they are in-line with DirectX 6.0 */ if (lpEnumCallbackA) { DWORD sizeOfDescription = 0; - /* Note that this the the A case of this function, so use the A variant to get the description string */ + /* Note that this is the A case of this function, so use the A variant to get the description string */ if (RegQueryValueExA(hkServiceProvider, "DescriptionA", NULL, NULL, NULL, &sizeOfDescription) != ERROR_SUCCESS) { diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c index daa4e975425..5802f11ff9e 100644 --- a/dlls/dsound/mixer.c +++ b/dlls/dsound/mixer.c @@ -639,7 +639,7 @@ static DWORD DSOUND_MixInBuffer(IDirectSoundBufferImpl *dsb, DWORD writepos, DWO */ static DWORD DSOUND_MixOne(IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen) { - /* The buffer's primary_mixpos may be before or after the the device + /* The buffer's primary_mixpos may be before or after the device * buffer's mixpos, but both must be ahead of writepos. */ DWORD primary_done; diff --git a/dlls/gdi32/bidi.c b/dlls/gdi32/bidi.c index 1853a847416..1b7b8569060 100644 --- a/dlls/gdi32/bidi.c +++ b/dlls/gdi32/bidi.c @@ -1087,7 +1087,7 @@ BOOL BIDI_Reorder( i = done = 0; while (done < uCount) { - unsigned j, lastgood; + unsigned j; classify(lpOutString + done, chartype, uCount - done); /* limit text to first block */ i = resolveParagraphs(chartype, uCount - done); @@ -1140,7 +1140,7 @@ BOOL BIDI_Reorder( if (lpOrder) { - unsigned k; + int k, lastgood; for (j = lastgood = 0; j < i; ++j) if (levels[j] != levels[lastgood]) { diff --git a/dlls/gdi32/region.c b/dlls/gdi32/region.c index 3627ccb2db4..0fe94cb9a15 100644 --- a/dlls/gdi32/region.c +++ b/dlls/gdi32/region.c @@ -894,7 +894,7 @@ HRGN WINAPI CreateRoundRectRgn( INT left, INT top, * * NOTES * This is a special case of CreateRoundRectRgn() where the width of the - * ellipse at each corner is equal to the width the the rectangle and + * ellipse at each corner is equal to the width the rectangle and * the same for the height. */ HRGN WINAPI CreateEllipticRgn( INT left, INT top, @@ -919,7 +919,7 @@ HRGN WINAPI CreateEllipticRgn( INT left, INT top, * * NOTES * This is a special case of CreateRoundRectRgn() where the width of the - * ellipse at each corner is equal to the width the the rectangle and + * ellipse at each corner is equal to the width the rectangle and * the same for the height. */ HRGN WINAPI CreateEllipticRgnIndirect( const RECT *rect ) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index d7e378d9906..33dd3f8b6a1 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -1571,8 +1571,6 @@ static void test_text_metrics(const LOGFONTA *lf) test_char = min(last_unicode_char, 255); ok(tmA.tmLastChar == test_char, "A: tmLastChar for %s %02x != %02x\n", font_name, tmA.tmLastChar, test_char); - ok(tmA.tmBreakChar == 0x20, "A: tmBreakChar for %s %02x != 0x20\n", - font_name, tmA.tmBreakChar); } SetLastError(0xdeadbeef); diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index e24fa77adac..e1f13dc4248 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -92,6 +92,7 @@ static void activate_gecko(NSContainer *This) nsIBaseWindow_SetVisibility(This->window, TRUE); nsIBaseWindow_SetEnabled(This->window, TRUE); + nsIWebBrowserFocus_Activate(This->focus); } void update_doc(HTMLDocument *This, DWORD flags) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 80caaac13ec..cff5368d3b9 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -4358,9 +4358,9 @@ static UINT ITERATE_InstallService(MSIRECORD *rec, LPVOID param) } key = MSI_RecordGetString(row, 6); - msiobj_release(&row->hdr); file = get_loaded_file(package, key); + msiobj_release(&row->hdr); if (!file) { ERR("Failed to load the service file\n"); diff --git a/dlls/msi/alter.c b/dlls/msi/alter.c index e0a1b91ffe7..b8d315e1a47 100644 --- a/dlls/msi/alter.c +++ b/dlls/msi/alter.c @@ -145,13 +145,18 @@ static UINT alter_add_column(MSIALTERVIEW *av) static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { MSIALTERVIEW *av = (MSIALTERVIEW*)view; + UINT ref; TRACE("%p %p\n", av, record); if (av->hold == 1) av->table->ops->add_ref(av->table); else if (av->hold == -1) - av->table->ops->release(av->table); + { + ref = av->table->ops->release(av->table); + if (ref == 0) + av->table = NULL; + } if (av->colinfo) return alter_add_column(av); @@ -202,7 +207,8 @@ static UINT ALTER_delete( struct tagMSIVIEW *view ) MSIALTERVIEW *av = (MSIALTERVIEW*)view; TRACE("%p\n", av ); - av->table->ops->delete( av->table ); + if (av->table) + av->table->ops->delete( av->table ); msi_free( av ); return ERROR_SUCCESS; diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c index 8db9cb9def6..573927539be 100644 --- a/dlls/msi/appsearch.c +++ b/dlls/msi/appsearch.c @@ -73,7 +73,7 @@ static void ACTION_VerStrToInteger(LPCWSTR verStr, PDWORD ms, PDWORD ls) *ls = x3 << 16 | x4; } -/* Fills in sig with the the values from the Signature table, where name is the +/* Fills in sig with the values from the Signature table, where name is the * signature to find. Upon return, sig->File will be NULL if the record is not * found, and not NULL if it is found. * Warning: clears all fields in sig! diff --git a/dlls/msi/files.c b/dlls/msi/files.c index f2561d41172..0c27a901629 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -313,6 +313,9 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) msi_free(mi->disk_prompt); msi_free(mi->cabinet); msi_free(mi->volume_label); + mi->disk_prompt = NULL; + mi->cabinet = NULL; + mi->volume_label = NULL; mi->disk_id++; mi->is_continuous = TRUE; diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index c00b8699e74..24fa343cabc 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -2736,7 +2736,7 @@ static void set_admin_property_stream(LPCSTR file) hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); - hr = IStream_Write(stm, data, sizeof(data) - 1, &count); + hr = IStream_Write(stm, data, sizeof(data), &count); ok(hr == S_OK, "Expected S_OK, got %d\n", hr); IStream_Release(stm); diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 30c6ab3b5eb..fc1a6c8070e 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -813,7 +813,7 @@ @ stdcall RtlSetAllBits(ptr) # @ stub RtlSetAttributesSecurityDescriptor @ stdcall RtlSetBits(ptr long long) -# @ stub RtlSetControlSecurityDescriptor +@ stdcall RtlSetControlSecurityDescriptor(ptr long long) @ stdcall RtlSetCriticalSectionSpinCount(ptr long) @ stdcall RtlSetCurrentDirectory_U(ptr) @ stdcall RtlSetCurrentEnvironment(wstr ptr) diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c index 89d23dff2e2..0a9fa5c500b 100644 --- a/dlls/ntdll/sec.c +++ b/dlls/ntdll/sec.c @@ -1030,6 +1030,19 @@ NTSTATUS WINAPI RtlGetControlSecurityDescriptor( return STATUS_SUCCESS; } +/****************************************************************************** + * RtlSetControlSecurityDescriptor (NTDLL.@) + */ +NTSTATUS WINAPI RtlSetControlSecurityDescriptor( + PSECURITY_DESCRIPTOR SecurityDescriptor, + SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, + SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet) +{ + FIXME("(%p 0x%08x 0x%08x): stub\n", SecurityDescriptor, ControlBitsOfInterest, + ControlBitsToSet); + return STATUS_SUCCESS; +} + /************************************************************************** * RtlAbsoluteToSelfRelativeSD [NTDLL.@] @@ -1066,7 +1079,7 @@ NTSTATUS WINAPI RtlCreateAcl(PACL acl,DWORD size,DWORD rev) { TRACE("%p 0x%08x 0x%08x\n", acl, size, rev); - if (rev!=ACL_REVISION) + if (rev < MIN_ACL_REVISION || rev > MAX_ACL_REVISION) return STATUS_INVALID_PARAMETER; if (sizeAclRevision != ACL_REVISION) + if (pAcl->AclRevision < MIN_ACL_REVISION || + pAcl->AclRevision > MAX_ACL_REVISION) ret = FALSE; else { diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c index 4ef7d593d45..cc8eae9ed90 100644 --- a/dlls/ole32/filemoniker.c +++ b/dlls/ole32/filemoniker.c @@ -315,7 +315,7 @@ FileMonikerImpl_Load(IMoniker* iface, IStream* pStm) * * This function saves data of this object. In the beginning I thought * that I have just to write the filePath string on Stream. But, when I - * tested this function with windows programs samples, I noticed that it + * tested this function with windows program samples, I noticed that it * was not the case. This implementation is based on XP SP2. Other versions * of Windows have minor variations. * @@ -328,7 +328,7 @@ FileMonikerImpl_Load(IMoniker* iface, IStream* pStm) * 6) If we're only writing the multibyte version, * write a zero DWORD and finish. * - * 7) DWORD: double-length of the the path string type W ("\0" not + * 7) DWORD: double-length of the path string type W ("\0" not * included) * 8) WORD constant: 0x3 * 9) filePath unicode string. diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index cc12912422d..f6c0d186eee 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -520,7 +520,7 @@ HRESULT WINAPI DoDragDrop ( msg.message = 0; /* - * Pump messages. All mouse input should go the the capture window. + * Pump messages. All mouse input should go to the capture window. */ while (!trackerInfo.trackingDone && GetMessageA(&msg, 0, 0, 0) ) { diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index b409dd493f2..fd95361b4e8 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -3142,7 +3142,7 @@ static void test_VarRound(void) VARROUND(DATE,1.451,1,DATE,1.5); VARROUND(DATE,-1.45,1,DATE,-1.4); - /* replace the decimal seperator */ + /* replace the decimal separator */ GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buff, sizeof(buff)/sizeof(char)); if (!buff[1]) { szNumMin[2] = buff[0]; @@ -7889,7 +7889,7 @@ static void test_VarImp(void) BOOL bFail = FALSE; SKIPTESTIMP(rightvt); - /* Native crashes using the the extra flag VT_BYREF + /* Native crashes when using the extra flag VT_BYREF * or with the following VT combinations */ if ((leftvt == VT_UI4 && rightvt == VT_BSTR) || diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 16e5a6f4dee..62fe5575ff0 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -3076,7 +3076,7 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, pointing at an alpha-numeric char. However if *pArg is 0xffff or 0xfffe then the param has no name, the former meaning that the next WORD is the type, the latter - meaning the the next WORD is an offset to the type. */ + meaning that the next WORD is an offset to the type. */ HaveOffs = FALSE; if(*pArg == 0xffff) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 276fe816371..f473cf71931 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -309,8 +309,8 @@ if ($version eq "1.0") { # # Open the registry files # -open(TYPES, "$registry_path/gl.tm") || die "Could not open 'gl.tm'. Please check your path the the registry files.\n"; -open(REGISTRY, "$registry_path/gl.spec") || die "Could not open 'gl.spec'. Please check your path the the registry files.\n"; +open(TYPES, "$registry_path/gl.tm") || die "Could not open 'gl.tm'. Please check your path in the registry files.\n"; +open(REGISTRY, "$registry_path/gl.spec") || die "Could not open 'gl.spec'. Please check your path in the registry files.\n"; # # First, create a mapping between the pseudo types used in the spec file diff --git a/dlls/riched20/rtf.h b/dlls/riched20/rtf.h index 30d40f0cf8c..7234b435f88 100644 --- a/dlls/riched20/rtf.h +++ b/dlls/riched20/rtf.h @@ -961,7 +961,7 @@ struct RTFFont /* - * Color values are -1 if the default color for the the color + * Color values are -1 if the default color for the color * number should be used. The default color is writer-dependent. */ diff --git a/dlls/riched32/tests/Makefile.in b/dlls/riched32/tests/Makefile.in new file mode 100644 index 00000000000..06de4daf295 --- /dev/null +++ b/dlls/riched32/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = riched32.dll +IMPORTS = ole32 user32 gdi32 kernel32 + +CTESTS = \ + editor.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c new file mode 100644 index 00000000000..6d0c04e016e --- /dev/null +++ b/dlls/riched32/tests/editor.c @@ -0,0 +1,142 @@ +/* +* Unit test suite for rich edit control 1.0 +* +* Copyright 2006 Google (Thomas Kho) +* Copyright 2007 Matt Finnicum +* Copyright 2007 Dmitry Timoshkov +* Copyright 2007 Alex VillacĂ­s Lasso +* +* 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static HMODULE hmoduleRichEdit; + +static HWND new_window(LPCTSTR lpClassName, DWORD dwStyle, HWND parent) { + HWND hwnd; + hwnd = CreateWindow(lpClassName, NULL, dwStyle|WS_POPUP|WS_HSCROLL|WS_VSCROLL + |WS_VISIBLE, 0, 0, 200, 60, parent, NULL, + hmoduleRichEdit, NULL); + ok(hwnd != NULL, "class: %s, error: %d\n", lpClassName, (int) GetLastError()); + return hwnd; +} + +static HWND new_richedit(HWND parent) { + return new_window(RICHEDIT_CLASS10A, ES_MULTILINE, parent); +} + +static void test_WM_SETTEXT() +{ + HWND hwndRichEdit = new_richedit(NULL); + const char * TestItem1 = "TestSomeText"; + const char * TestItem2 = "TestSomeText\r"; + const char * TestItem3 = "TestSomeText\rSomeMoreText\r"; + const char * TestItem4 = "TestSomeText\n\nTestSomeText"; + const char * TestItem5 = "TestSomeText\r\r\nTestSomeText"; + const char * TestItem6 = "TestSomeText\r\r\n\rTestSomeText"; + const char * TestItem7 = "TestSomeText\r\n\r\r\n\rTestSomeText"; + const char * TestItem8 = "TestSomeText\r\n"; + const char * TestItem9 = "TestSomeText\r\nSomeMoreText\r\n"; + const char * TestItem10 = "TestSomeText\r\n\r\nTestSomeText"; + const char * TestItem11 = "TestSomeText TestSomeText"; + const char * TestItem12 = "TestSomeText \r\nTestSomeText"; + const char * TestItem13 = "TestSomeText\r\n \r\nTestSomeText"; + char buf[1024] = {0}; + LRESULT result; + + /* This test attempts to show that WM_SETTEXT on a riched32 control does not + attempt to modify the text that is pasted into the control, and should + return it as is. In particular, \r\r\n is NOT converted, unlike riched20. + Currently, builtin riched32 mangles solitary \r or \n when not part of + a \r\n pair. + */ + +#define TEST_SETTEXT(a, b, is_todo) \ + result = SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) a); \ + ok (result == 1, "WM_SETTEXT returned %ld instead of 1\n", result); \ + result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buf); \ + ok (result == strlen(buf), \ + "WM_GETTEXT returned %ld instead of expected %u\n", \ + result, strlen(buf)); \ + result = strcmp(b, buf); \ + if (is_todo) todo_wine { \ + ok(result == 0, \ + "WM_SETTEXT round trip: strcmp = %ld\n", result); \ + } else { \ + ok(result == 0, \ + "WM_SETTEXT round trip: strcmp = %ld\n", result); \ + } + + TEST_SETTEXT(TestItem1, TestItem1, 0) + TEST_SETTEXT(TestItem2, TestItem2, 1) + TEST_SETTEXT(TestItem3, TestItem3, 1) + TEST_SETTEXT(TestItem4, TestItem4, 1) + TEST_SETTEXT(TestItem5, TestItem5, 1) + TEST_SETTEXT(TestItem6, TestItem6, 1) + TEST_SETTEXT(TestItem7, TestItem7, 1) + TEST_SETTEXT(TestItem8, TestItem8, 0) + TEST_SETTEXT(TestItem9, TestItem9, 0) + TEST_SETTEXT(TestItem10, TestItem10, 0) + TEST_SETTEXT(TestItem11, TestItem11, 0) + TEST_SETTEXT(TestItem12, TestItem12, 0) + TEST_SETTEXT(TestItem13, TestItem13, 0) + +#undef TEST_SETTEXT + DestroyWindow(hwndRichEdit); +} + +START_TEST( editor ) +{ + MSG msg; + time_t end; + + /* Must explicitly LoadLibrary(). The test has no references to functions in + * RICHED32.DLL, so the linker doesn't actually link to it. */ + hmoduleRichEdit = LoadLibrary("RICHED32.DLL"); + ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError()); + + test_WM_SETTEXT(); + + /* Set the environment variable WINETEST_RICHED32 to keep windows + * responsive and open for 30 seconds. This is useful for debugging. + * + * The message pump uses PeekMessage() to empty the queue and then sleeps for + * 50ms before retrying the queue. */ + end = time(NULL) + 30; + if (getenv( "WINETEST_RICHED32" )) { + while (time(NULL) < end) { + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } else { + Sleep(50); + } + } + } + + OleFlushClipboard(); + ok(FreeLibrary(hmoduleRichEdit) != 0, "error: %d\n", (int) GetLastError()); +} diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c index b6f642187cc..9f33f730168 100644 --- a/dlls/urlmon/tests/misc.c +++ b/dlls/urlmon/tests/misc.c @@ -62,6 +62,13 @@ DEFINE_EXPECT(QI_IInternetProtocolInfo); DEFINE_EXPECT(CreateInstance); DEFINE_EXPECT(unk_Release); +static const char *debugstr_w(LPCWSTR str) +{ + static char buf[1024]; + WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL); + return buf; +} + static void test_CreateFormatEnum(void) { IEnumFORMATETC *fenum = NULL, *fenum2 = NULL; @@ -345,6 +352,7 @@ static void test_CoInternetCompareUrl(void) static const WCHAR mimeTextHtml[] = {'t','e','x','t','/','h','t','m','l',0}; static const WCHAR mimeTextPlain[] = {'t','e','x','t','/','p','l','a','i','n',0}; +static const WCHAR mimeTextRichtext[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0}; static const WCHAR mimeAppOctetStream[] = {'a','p','p','l','i','c','a','t','i','o','n','/', 'o','c','t','e','t','-','s','t','r','e','a','m',0}; static const WCHAR mimeImagePjpeg[] = {'i','m','a','g','e','/','p','j','p','e','g',0}; @@ -354,6 +362,8 @@ static const WCHAR mimeImageXPng[] = {'i','m','a','g','e','/','x','-','p','n','g static const WCHAR mimeImageTiff[] = {'i','m','a','g','e','/','t','i','f','f',0}; static const WCHAR mimeVideoAvi[] = {'v','i','d','e','o','/','a','v','i',0}; static const WCHAR mimeVideoMpeg[] = {'v','i','d','e','o','/','m','p','e','g',0}; +static const WCHAR mimeAppPostscript[] = + {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0}; static const WCHAR mimeAppXCompressed[] = {'a','p','p','l','i','c','a','t','i','o','n','/', 'x','-','c','o','m','p','r','e','s','s','e','d',0}; static const WCHAR mimeAppXZip[] = {'a','p','p','l','i','c','a','t','i','o','n','/', @@ -364,6 +374,7 @@ static const WCHAR mimeAppJava[] = {'a','p','p','l','i','c','a','t','i','o','n', static const WCHAR mimeAppPdf[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0}; static const WCHAR mimeAppXMSDownload[] = {'a','p','p','l','i','c','a','t','i','o','n','/','x','-','m','s','d','o','w','n','l','o','a','d',0}; +static const WCHAR mimeAudioWav[] = {'a','u','d','i','o','/','w','a','v',0}; static const struct { LPCWSTR url; @@ -449,6 +460,17 @@ static BYTE data67[] = {0x25,0x50,0x44,0x46,'x','<','h','t','m','l','>'}; static BYTE data68[] = {'M','Z','x'}; static BYTE data69[] = {'M','Z'}; static BYTE data70[] = {'M','Z','<','h','t','m','l','>',0xff}; +static BYTE data71[] = {'{','\\','r','t','f',0}; +static BYTE data72[] = {'{','\\','r','t','f'}; +static BYTE data73[] = {' ','{','\\','r','t','f',' '}; +static BYTE data74[] = {'{','\\','r','t','f','<','h','t','m','l','>',' '}; +static BYTE data75[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E',0xff}; +static BYTE data76[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E'}; +static BYTE data77[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V',0xff,0xff}; +static BYTE data78[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'<','h','t','m','l','>',0xff}; +static BYTE data79[] = {'%','!',0xff}; +static BYTE data80[] = {'%','!'}; +static BYTE data81[] = {'%','!','P','S','<','h','t','m','l','>'}; static const struct { BYTE *data; @@ -524,7 +546,18 @@ static const struct { {data67, sizeof(data67), mimeTextHtml}, {data68, sizeof(data68), mimeAppXMSDownload}, {data69, sizeof(data69), mimeTextPlain}, - {data70, sizeof(data70), mimeTextHtml} + {data70, sizeof(data70), mimeTextHtml}, + {data71, sizeof(data71), mimeTextRichtext}, + {data72, sizeof(data72), mimeTextPlain}, + {data73, sizeof(data73), mimeTextPlain}, + {data74, sizeof(data74), mimeTextHtml}, + {data75, sizeof(data75), mimeAudioWav}, + {data76, sizeof(data76), mimeTextPlain}, + {data77, sizeof(data77), mimeTextPlain}, + {data78, sizeof(data78), mimeTextHtml}, + {data79, sizeof(data79), mimeAppPostscript}, + {data80, sizeof(data80), mimeTextPlain}, + {data81, sizeof(data81), mimeTextHtml} }; static void test_FindMimeFromData(void) @@ -564,7 +597,7 @@ static void test_FindMimeFromData(void) hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, NULL, 0, &mime, 0); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres); - ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime\n", i); + ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, debugstr_w(mime)); CoTaskMemFree(mime); hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, diff --git a/dlls/urlmon/urlmon_main.c b/dlls/urlmon/urlmon_main.c index a64d4947f6d..a8c2d5ae534 100644 --- a/dlls/urlmon/urlmon_main.c +++ b/dlls/urlmon/urlmon_main.c @@ -408,6 +408,10 @@ void WINAPI ReleaseBindInfo(BINDINFO* pbindinfo) pbindinfo->cbSize = size; } +static BOOL text_richtext_filter(const BYTE *b, DWORD size) +{ + return size > 5 && !memcmp(b, "{\\rtf", 5); +} static BOOL text_html_filter(const BYTE *b, DWORD size) { @@ -428,6 +432,13 @@ static BOOL text_html_filter(const BYTE *b, DWORD size) return FALSE; } +static BOOL audio_wav_filter(const BYTE *b, DWORD size) +{ + return size > 12 + && b[0] == 'R' && b[1] == 'I' && b[2] == 'F' && b[3] == 'F' + && b[8] == 'W' && b[9] == 'A' && b[10] == 'V' && b[11] == 'E'; +} + static BOOL image_gif_filter(const BYTE *b, DWORD size) { return size >= 6 @@ -476,6 +487,11 @@ static BOOL video_mpeg_filter(const BYTE *b, DWORD size) && (b[3] == 0xb3 || b[3] == 0xba); } +static BOOL application_postscript_filter(const BYTE *b, DWORD size) +{ + return size > 2 && b[0] == '%' && b[1] == '!'; +} + static BOOL application_pdf_filter(const BYTE *b, DWORD size) { return size > 4 && b[0] == 0x25 && b[1] == 0x50 && b[2] == 0x44 && b[3] == 0x46; @@ -559,6 +575,8 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, int i; static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0}; + static const WCHAR wszTextRichtext[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0}; + static const WCHAR wszAudioWav[] = {'a','u','d','i','o','/','w','a','v',0}; static const WCHAR wszImageGif[] = {'i','m','a','g','e','/','g','i','f',0}; static const WCHAR wszImagePjpeg[] = {'i','m','a','g','e','/','p','j','p','e','g',0}; static const WCHAR wszImageTiff[] = {'i','m','a','g','e','/','t','i','f','f',0}; @@ -566,6 +584,8 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, static const WCHAR wszImageBmp[] = {'i','m','a','g','e','/','b','m','p',0}; static const WCHAR wszVideoAvi[] = {'v','i','d','e','o','/','a','v','i',0}; static const WCHAR wszVideoMpeg[] = {'v','i','d','e','o','/','m','p','e','g',0}; + static const WCHAR wszAppPostscript[] = + {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0}; static const WCHAR wszAppPdf[] = {'a','p','p','l','i','c','a','t','i','o','n','/', 'p','d','f',0}; static const WCHAR wszAppXZip[] = {'a','p','p','l','i','c','a','t','i','o','n','/', @@ -585,6 +605,8 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, BOOL (*filter)(const BYTE *,DWORD); } mime_filters[] = { {wszTextHtml, text_html_filter}, + {wszTextRichtext, text_richtext_filter}, + {wszAudioWav, audio_wav_filter}, {wszImageGif, image_gif_filter}, {wszImagePjpeg, image_pjpeg_filter}, {wszImageTiff, image_tiff_filter}, @@ -592,6 +614,7 @@ HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, {wszImageBmp, image_bmp_filter}, {wszVideoAvi, video_avi_filter}, {wszVideoMpeg, video_mpeg_filter}, + {wszAppPostscript, application_postscript_filter}, {wszAppPdf, application_pdf_filter}, {wszAppXZip, application_xzip_filter}, {wszAppXGzip, application_xgzip_filter}, diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index 54d826f2da8..ca2f5b60532 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -791,7 +791,7 @@ static void test_ScriptStringXtoCP_CPtoX(HDC hdc) iTrailing, X); /* - * Cleanup the the SSA for the next round of tests + * Cleanup the SSA for the next round of tests */ hr = ScriptStringFree(&ssa); ok(hr == S_OK, "ScriptStringFree should return S_OK not %08x\n", hr); diff --git a/dlls/winealsa.drv/dscapture.c b/dlls/winealsa.drv/dscapture.c index 3e6984ab76a..168fc91c01f 100644 --- a/dlls/winealsa.drv/dscapture.c +++ b/dlls/winealsa.drv/dscapture.c @@ -534,6 +534,7 @@ static ULONG WINAPI IDsCaptureDriverBufferImpl_Release(PIDSCDRIVERBUFFER iface) TRACE("mmap buffer %p destroyed\n", This->mmap_buffer); This->drv->capture_buffer = NULL; + LeaveCriticalSection(&This->pcm_crst); This->pcm_crst.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->pcm_crst); diff --git a/dlls/winealsa.drv/mixer.c b/dlls/winealsa.drv/mixer.c index f1b2e127a53..daa45a1f85e 100644 --- a/dlls/winealsa.drv/mixer.c +++ b/dlls/winealsa.drv/mixer.c @@ -573,6 +573,7 @@ static void ALSA_MixerExit(void) EnterCriticalSection(&elem_crst); TerminateThread(thread, 1); refcnt = 0; + LeaveCriticalSection(&elem_crst); } TRACE("Cleaning up\n"); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index cb491c7492a..6358c80913e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4361,7 +4361,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD } /** NOTE: MSDN says that setTexture increases the reference count, - * and the the application must set the texture back to null (or have a leaky application), + * and that the application must set the texture back to null (or have a leaky application), * This means we should pass the refcount up to the parent *******************************/ if (NULL != This->updateStateBlock->textures[Stage]) { diff --git a/dlls/winedos/dosaspi.c b/dlls/winedos/dosaspi.c index 019cf075d44..28089a3d287 100644 --- a/dlls/winedos/dosaspi.c +++ b/dlls/winedos/dosaspi.c @@ -90,7 +90,7 @@ DOSASPI_PostProc( SRB_ExecSCSICmd *lpPRB ) ctx.Eip = OFFSETOF(lpSRB16->cmd.SRB_PostProc); /* DPMI_CallRMProc will push the pointer to the stack * it is given (in this case &ptrSRB) with length - * 2*sizeof(WORD), that is, it copies the the contents + * 2*sizeof(WORD), that is, it copies the contents * of ptrSRB onto the stack, and decs sp by 2*sizeof(WORD). * After doing that, it pushes the return address * onto the stack (so we don't need to worry about that) diff --git a/dlls/winejack.drv/audio.c b/dlls/winejack.drv/audio.c index c266dd6244e..00daf80cb13 100644 --- a/dlls/winejack.drv/audio.c +++ b/dlls/winejack.drv/audio.c @@ -489,7 +489,7 @@ int JACK_callback_wwo (nframes_t nframes, void *arg) /****************************************************************** * JACK_bufsize_wwo * - * Called whenever the jack server changes the the max number + * Called whenever the jack server changes the max number * of frames passed to JACK_callback */ int JACK_bufsize_wwo (nframes_t nframes, void *arg) @@ -537,7 +537,7 @@ int JACK_bufsize_wwo (nframes_t nframes, void *arg) /****************************************************************** * JACK_bufsize_wwi * - * Called whenever the jack server changes the the max number + * Called whenever the jack server changes the max number * of frames passed to JACK_callback */ int JACK_bufsize_wwi (nframes_t nframes, void *arg) diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c index e24bd96546e..5d4ac459a94 100644 --- a/dlls/winex11.drv/dib.c +++ b/dlls/winex11.drv/dib.c @@ -614,7 +614,7 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits, dstval=0; for (x=0; x> 10) & 0x001f001f); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 10) & 0x7c00) | /* h */ @@ -143,7 +143,7 @@ static void convert_555_to_565_asis(int width, int height, ( srcval & 0x001f001f); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 1) & 0xffc0) | /* h, g */ @@ -176,7 +176,7 @@ static void convert_555_to_565_reverse(int width, int height, ((srcval << 11) & 0xf800f800); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 10) & 0x001f) | /* h */ @@ -380,7 +380,7 @@ static void convert_565_reverse(int width, int height, ((srcval >> 11) & 0x001f001f); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 11) & 0xf800) | /* h */ @@ -411,7 +411,7 @@ static void convert_565_to_555_asis(int width, int height, ( srcval & 0x001f001f); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 1) & 0x7fe0) | /* h, g */ @@ -442,7 +442,7 @@ static void convert_565_to_555_reverse(int width, int height, ((srcval << 10) & 0x7c007c00); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 11) & 0x001f) | /* h */ diff --git a/dlls/winex11.drv/dib_dst_swap.c b/dlls/winex11.drv/dib_dst_swap.c index 9a66bf427fa..66b77e6e339 100644 --- a/dlls/winex11.drv/dib_dst_swap.c +++ b/dlls/winex11.drv/dib_dst_swap.c @@ -94,7 +94,7 @@ static void convert_555_reverse_dst_byteswap(int width, int height, ((srcval << 2) & 0x007c007c); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x1f00) | /* h */ @@ -128,7 +128,7 @@ static void convert_555_to_565_asis_dst_byteswap(int width, int height, ((srcval << 8) & 0x1f001f00); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 7) & 0x00ff) | /* h, g - 3 bits */ @@ -163,7 +163,7 @@ static void convert_555_to_565_reverse_dst_byteswap(int width, int height, ((srcval << 3) & 0x00f800f8); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x1f00) | /* h */ @@ -441,7 +441,7 @@ static void convert_565_reverse_dst_byteswap(int width, int height, ((srcval << 3) & 0x00f800f8); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 3) & 0x1f00) | /* h */ @@ -474,7 +474,7 @@ static void convert_565_to_555_asis_dst_byteswap(int width, int height, ((srcval >> 9) & 0x007f007f); /* h, g - 2 bits */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 7) & 0xe000) | /* g - 3 bits*/ @@ -507,7 +507,7 @@ static void convert_565_to_555_reverse_dst_byteswap(int width, int height, ((srcval >> 9) & 0x00030003); /* g - 2 bits */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 7) & 0xe000) | /* g - 3 bits */ diff --git a/dlls/winex11.drv/dib_src_swap.c b/dlls/winex11.drv/dib_src_swap.c index d6e3458d5cf..65deed77213 100644 --- a/dlls/winex11.drv/dib_src_swap.c +++ b/dlls/winex11.drv/dib_src_swap.c @@ -96,7 +96,7 @@ static void convert_555_reverse_src_byteswap(int width, int height, ((srcval << 2) & 0x7c007c00); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x001f) | /* h */ @@ -130,7 +130,7 @@ static void convert_555_to_565_asis_src_byteswap(int width, int height, ((srcval >> 8) & 0x001f001f); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 9) & 0xfe00) | /* h, g - 2bits*/ @@ -165,7 +165,7 @@ static void convert_555_to_565_reverse_src_byteswap(int width, int height, ((srcval << 3) & 0xf800f800); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 2) & 0x001f) | /* h */ @@ -381,7 +381,7 @@ static void convert_565_reverse_src_byteswap(int width, int height, ((srcval >> 3) & 0x001f001f); /* h */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 3) & 0xf800) | /* l */ @@ -414,7 +414,7 @@ static void convert_565_to_555_asis_src_byteswap(int width, int height, ((srcval >> 8) & 0x001f001f); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval << 7) & 0x7f80) | /* h, g - 3 bits */ @@ -447,7 +447,7 @@ static void convert_565_to_555_reverse_src_byteswap(int width, int height, ((srcval << 2) & 0x7c007c00); /* l */ } if (width&1) { - /* And the the odd pixel */ + /* And then the odd pixel */ WORD srcval; srcval=*((const WORD*)srcpixel); *((WORD*)dstpixel)=((srcval >> 3) & 0x001f) | /* h */ diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 15c9f42c56d..1d080fc77d7 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -438,7 +438,7 @@ static XcursorImage *create_cursor_image( cursor_frame_t *frame ) * background color. * * Since we can't support inverting colors, we map the grayscale value of - * the "xor" data to the alpha channel, and xor the the color with either + * the "xor" data to the alpha channel, and xor the color with either * black or white. */ for (y = 0; y < ymax; ++y) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 70239f798e4..f496733c419 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2182,9 +2182,12 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, } else { - ret = HTTP_HttpSendRequestW(lpwhr, lpBuffersIn->lpcszHeader, lpBuffersIn->dwHeadersLength, - lpBuffersIn->lpvBuffer, lpBuffersIn->dwBufferLength, - lpBuffersIn->dwBufferTotal, FALSE); + if (lpBuffersIn) + ret = HTTP_HttpSendRequestW(lpwhr, lpBuffersIn->lpcszHeader, lpBuffersIn->dwHeadersLength, + lpBuffersIn->lpvBuffer, lpBuffersIn->dwBufferLength, + lpBuffersIn->dwBufferTotal, FALSE); + else + ret = HTTP_HttpSendRequestW(lpwhr, NULL, 0, NULL, 0, 0, FALSE); } WININET_Release(&lpwhr->hdr); diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c index 9887994e547..852ac87faa4 100644 --- a/dlls/wininet/urlcache.c +++ b/dlls/wininet/urlcache.c @@ -1002,7 +1002,7 @@ static BOOL URLCache_CopyEntry( * URLCache_SetEntryInfo (Internal) * * Helper for SetUrlCacheEntryInfo{A,W}. Sets fields in URL entry - * according the the flags set by dwFieldControl. + * according to the flags set by dwFieldControl. * * RETURNS * TRUE if the buffer was big enough @@ -1163,42 +1163,8 @@ static BOOL URLCache_FindHash(LPCURLCACHE_HEADER pHeader, LPCSTR lpszUrl, struct return FALSE; } -/*********************************************************************** - * URLCache_FindEntryInHash (Internal) - * - * Searches all the hash tables in the index for the given URL and - * returns the entry, if it was found, in ppEntry - * - * RETURNS - * TRUE if the entry was found - * FALSE if the entry could not be found - * - */ -static BOOL URLCache_FindEntryInHash(LPCURLCACHE_HEADER pHeader, LPCSTR lpszUrl, CACHEFILE_ENTRY ** ppEntry) -{ - struct _HASH_ENTRY * pHashEntry; - if (URLCache_FindHash(pHeader, lpszUrl, &pHashEntry)) - { - *ppEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); - return TRUE; - } - return FALSE; -} - -/*********************************************************************** - * URLCache_FindEntryInHashW (Internal) - * - * Searches all the hash tables in the index for the given URL and - * returns the entry, if it was found, in ppEntry - * - * RETURNS - * TRUE if the entry was found - * FALSE if the entry could not be found - * - */ -static BOOL URLCache_FindEntryInHashW(LPCURLCACHE_HEADER pHeader, LPCWSTR lpszUrl, CACHEFILE_ENTRY ** ppEntry) +static BOOL URLCache_FindHashW(LPCURLCACHE_HEADER pHeader, LPCWSTR lpszUrl, struct _HASH_ENTRY ** ppHashEntry) { - struct _HASH_ENTRY * pHashEntry; LPSTR urlA; int url_len; BOOL ret; @@ -1211,8 +1177,7 @@ static BOOL URLCache_FindEntryInHashW(LPCURLCACHE_HEADER pHeader, LPCWSTR lpszUr return FALSE; } WideCharToMultiByte(CP_ACP, 0, lpszUrl, -1, urlA, url_len, NULL, NULL); - if ((ret = URLCache_FindHash(pHeader, urlA, &pHashEntry))) - *ppEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); + ret = URLCache_FindHash(pHeader, urlA, ppHashEntry); HeapFree(GetProcessHeap(), 0, urlA); return ret; } @@ -1228,15 +1193,10 @@ static BOOL URLCache_FindEntryInHashW(LPCURLCACHE_HEADER pHeader, LPCWSTR lpszUr * FALSE if the entry could not be found * */ -static BOOL URLCache_HashEntrySetUse(LPCURLCACHE_HEADER pHeader, LPCSTR lpszUrl, DWORD dwUseCount) +static BOOL URLCache_HashEntrySetUse(struct _HASH_ENTRY * pHashEntry, DWORD dwUseCount) { - struct _HASH_ENTRY * pHashEntry; - if (URLCache_FindHash(pHeader, lpszUrl, &pHashEntry)) - { - pHashEntry->dwHashKey = dwUseCount | (DWORD)(pHashEntry->dwHashKey / HASHTABLE_NUM_ENTRIES) * HASHTABLE_NUM_ENTRIES; - return TRUE; - } - return FALSE; + pHashEntry->dwHashKey = dwUseCount | (DWORD)(pHashEntry->dwHashKey / HASHTABLE_NUM_ENTRIES) * HASHTABLE_NUM_ENTRIES; + return TRUE; } /*********************************************************************** @@ -1250,16 +1210,11 @@ static BOOL URLCache_HashEntrySetUse(LPCURLCACHE_HEADER pHeader, LPCSTR lpszUrl, * FALSE if the entry could not be found * */ -static BOOL URLCache_DeleteEntryFromHash(LPCURLCACHE_HEADER pHeader, LPCSTR lpszUrl) +static BOOL URLCache_DeleteEntryFromHash(struct _HASH_ENTRY * pHashEntry) { - struct _HASH_ENTRY * pHashEntry; - if (URLCache_FindHash(pHeader, lpszUrl, &pHashEntry)) - { - pHashEntry->dwHashKey = HASHTABLE_FREE; - pHashEntry->dwOffsetEntry = HASHTABLE_FREE; - return TRUE; - } - return FALSE; + pHashEntry->dwHashKey = HASHTABLE_FREE; + pHashEntry->dwOffsetEntry = HASHTABLE_FREE; + return TRUE; } /*********************************************************************** @@ -1398,6 +1353,7 @@ BOOL WINAPI GetUrlCacheEntryInfoA( ) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; @@ -1413,7 +1369,7 @@ BOOL WINAPI GetUrlCacheEntryInfoA( if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHash(pHeader, lpszUrlName, &pEntry)) + if (!URLCache_FindHash(pHeader, lpszUrlName, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); WARN("entry %s not found!\n", debugstr_a(lpszUrlName)); @@ -1421,6 +1377,7 @@ BOOL WINAPI GetUrlCacheEntryInfoA( return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -1461,6 +1418,7 @@ BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPDWORD lpdwCacheEntryInfoBufferSize) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; @@ -1476,7 +1434,7 @@ BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHashW(pHeader, lpszUrl, &pEntry)) + if (!URLCache_FindHashW(pHeader, lpszUrl, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); WARN("entry %s not found!\n", debugstr_w(lpszUrl)); @@ -1484,6 +1442,7 @@ BOOL WINAPI GetUrlCacheEntryInfoW(LPCWSTR lpszUrl, return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -1558,6 +1517,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA( DWORD dwFieldControl) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URLCACHECONTAINER * pContainer; @@ -1572,7 +1532,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA( if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHash(pHeader, lpszUrlName, &pEntry)) + if (!URLCache_FindHash(pHeader, lpszUrlName, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); WARN("entry %s not found!\n", debugstr_a(lpszUrlName)); @@ -1580,6 +1540,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA( return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -1604,6 +1565,7 @@ BOOL WINAPI SetUrlCacheEntryInfoA( BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW lpCacheEntryInfo, DWORD dwFieldControl) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URLCACHECONTAINER * pContainer; @@ -1618,7 +1580,7 @@ BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHashW(pHeader, lpszUrl, &pEntry)) + if (!URLCache_FindHashW(pHeader, lpszUrl, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); WARN("entry %s not found!\n", debugstr_w(lpszUrl)); @@ -1626,6 +1588,7 @@ BOOL WINAPI SetUrlCacheEntryInfoW(LPCWSTR lpszUrl, LPINTERNET_CACHE_ENTRY_INFOW return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -1656,6 +1619,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( ) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; @@ -1675,7 +1639,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHash(pHeader, lpszUrlName, &pEntry)) + if (!URLCache_FindHash(pHeader, lpszUrlName, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); TRACE("entry %s not found!\n", lpszUrlName); @@ -1683,6 +1647,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -1697,7 +1662,7 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( pUrlEntry->dwHitRate++; pUrlEntry->dwUseCount++; - URLCache_HashEntrySetUse(pHeader, lpszUrlName, pUrlEntry->dwUseCount); + URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); if (!URLCache_CopyEntry(pContainer, pHeader, lpCacheEntryInfo, lpdwCacheEntryInfoBufferSize, pUrlEntry, FALSE)) { @@ -1722,13 +1687,68 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW( IN DWORD dwReserved ) { + LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; + CACHEFILE_ENTRY * pEntry; + URL_CACHEFILE_ENTRY * pUrlEntry; + URLCACHECONTAINER * pContainer; + TRACE("(%s, %p, %p, 0x%08x)\n", debugstr_w(lpszUrlName), lpCacheEntryInfo, lpdwCacheEntryInfoBufferSize, dwReserved); - return FALSE; + if (!URLCacheContainers_FindContainerW(lpszUrlName, &pContainer)) + return FALSE; + + if (!URLCacheContainer_OpenIndex(pContainer)) + return FALSE; + + if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) + return FALSE; + + if (!URLCache_FindHashW(pHeader, lpszUrlName, &pHashEntry)) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + TRACE("entry %s not found!\n", debugstr_w(lpszUrlName)); + SetLastError(ERROR_FILE_NOT_FOUND); + return FALSE; + } + + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); + if (pEntry->dwSignature != URL_SIGNATURE) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPSTR)&pEntry->dwSignature, sizeof(DWORD))); + SetLastError(ERROR_FILE_NOT_FOUND); + return FALSE; + } + + pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; + TRACE("Found URL: %s\n", (LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl); + TRACE("Header info: %s\n", (LPBYTE)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo); + + pUrlEntry->dwHitRate++; + pUrlEntry->dwUseCount++; + URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); + + if (!URLCache_CopyEntry( + pContainer, + pHeader, + (LPINTERNET_CACHE_ENTRY_INFOA)lpCacheEntryInfo, + lpdwCacheEntryInfoBufferSize, + pUrlEntry, + TRUE /* UNICODE */)) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + return FALSE; + } + TRACE("Local File Name: %s\n", debugstr_w(lpCacheEntryInfo->lpszLocalFileName)); + + URLCacheContainer_UnlockIndex(pContainer, pHeader); + + return TRUE; } /*********************************************************************** @@ -1741,6 +1761,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA( ) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; @@ -1763,7 +1784,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA( if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHash(pHeader, lpszUrlName, &pEntry)) + if (!URLCache_FindHash(pHeader, lpszUrlName, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); TRACE("entry %s not found!\n", lpszUrlName); @@ -1771,6 +1792,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA( return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -1787,7 +1809,7 @@ BOOL WINAPI UnlockUrlCacheEntryFileA( return FALSE; } pUrlEntry->dwUseCount--; - URLCache_HashEntrySetUse(pHeader, lpszUrlName, pUrlEntry->dwUseCount); + URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -1800,7 +1822,59 @@ BOOL WINAPI UnlockUrlCacheEntryFileA( */ BOOL WINAPI UnlockUrlCacheEntryFileW( LPCWSTR lpszUrlName, DWORD dwReserved ) { - FIXME("(%s, 0x%08x)\n", debugstr_w(lpszUrlName), dwReserved); + LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; + CACHEFILE_ENTRY * pEntry; + URL_CACHEFILE_ENTRY * pUrlEntry; + URLCACHECONTAINER * pContainer; + + TRACE("(%s, 0x%08x)\n", debugstr_w(lpszUrlName), dwReserved); + + if (dwReserved) + { + ERR("dwReserved != 0\n"); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (!URLCacheContainers_FindContainerW(lpszUrlName, &pContainer)) + return FALSE; + + if (!URLCacheContainer_OpenIndex(pContainer)) + return FALSE; + + if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) + return FALSE; + + if (!URLCache_FindHashW(pHeader, lpszUrlName, &pHashEntry)) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + TRACE("entry %s not found!\n", debugstr_w(lpszUrlName)); + SetLastError(ERROR_FILE_NOT_FOUND); + return FALSE; + } + + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); + if (pEntry->dwSignature != URL_SIGNATURE) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPSTR)&pEntry->dwSignature, sizeof(DWORD))); + SetLastError(ERROR_FILE_NOT_FOUND); + return FALSE; + } + + pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; + + if (pUrlEntry->dwUseCount == 0) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + return FALSE; + } + pUrlEntry->dwUseCount--; + URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); + + URLCacheContainer_UnlockIndex(pContainer, pHeader); + return TRUE; } @@ -2021,6 +2095,7 @@ static BOOL WINAPI CommitUrlCacheEntryInternal( { URLCACHECONTAINER * pContainer; LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URL_CACHEFILE_ENTRY * pUrlEntry; DWORD dwBytesNeeded = DWORD_ALIGN(sizeof(*pUrlEntry)); @@ -2079,7 +2154,7 @@ static BOOL WINAPI CommitUrlCacheEntryInternal( WideCharToMultiByte(CP_ACP, 0, lpszUrlName, -1, achUrl, -1, NULL, NULL); - if (URLCache_FindEntryInHash(pHeader, achUrl, &pEntry)) + if (URLCache_FindHash(pHeader, achUrl, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); FIXME("entry already in cache - don't know what to do!\n"); @@ -2492,6 +2567,7 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName) { URLCACHECONTAINER * pContainer; LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; TRACE("(%s)\n", debugstr_a(lpszUrlName)); @@ -2505,7 +2581,7 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName) if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHash(pHeader, lpszUrlName, &pEntry)) + if (!URLCache_FindHash(pHeader, lpszUrlName, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); TRACE("entry %s not found!\n", lpszUrlName); @@ -2513,9 +2589,10 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName) return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); URLCache_DeleteEntry(pHeader, pEntry); - URLCache_DeleteEntryFromHash(pHeader, lpszUrlName); + URLCache_DeleteEntryFromHash(pHashEntry); URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -2530,6 +2607,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName) { URLCACHECONTAINER * pContainer; LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; LPSTR urlA; int url_len; @@ -2561,7 +2639,7 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName) return FALSE; } - if (!URLCache_FindEntryInHash(pHeader, urlA, &pEntry)) + if (!URLCache_FindHash(pHeader, urlA, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); TRACE("entry %s not found!\n", debugstr_a(urlA)); @@ -2570,9 +2648,10 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName) return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); URLCache_DeleteEntry(pHeader, pEntry); - URLCache_DeleteEntryFromHash(pHeader, urlA); + URLCache_DeleteEntryFromHash(pHashEntry); URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -2931,6 +3010,7 @@ DWORD WINAPI DeleteIE3Cache(HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int n BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLastModified ) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; @@ -2946,7 +3026,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHash(pHeader, url, &pEntry)) + if (!URLCache_FindHash(pHeader, url, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); TRACE("entry %s not found!\n", url); @@ -2954,6 +3034,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -2982,6 +3063,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLastModified ) { LPURLCACHE_HEADER pHeader; + struct _HASH_ENTRY * pHashEntry; CACHEFILE_ENTRY * pEntry; URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; @@ -2997,7 +3079,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) return FALSE; - if (!URLCache_FindEntryInHashW(pHeader, url, &pEntry)) + if (!URLCache_FindHashW(pHeader, url, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); TRACE("entry %s not found!\n", debugstr_w(url)); @@ -3005,6 +3087,7 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa return FALSE; } + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); diff --git a/include/winbase.h b/include/winbase.h index 2734ecbd7ac..7ca6e84830e 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1253,7 +1253,7 @@ BOOL WINAPI AccessCheckAndAuditAlarmA(LPCSTR,LPVOID,LPSTR,LPSTR,PSECURITY BOOL WINAPI AccessCheckAndAuditAlarmW(LPCWSTR,LPVOID,LPWSTR,LPWSTR,PSECURITY_DESCRIPTOR,DWORD,PGENERIC_MAPPING,BOOL,LPDWORD,LPBOOL,LPBOOL); #define AccessCheckAndAuditAlarm WINELIB_NAME_AW(AccessCheckAndAuditAlarm) BOOL WINAPI AccessCheckByType(PSECURITY_DESCRIPTOR,PSID,HANDLE,DWORD,POBJECT_TYPE_LIST,DWORD,PGENERIC_MAPPING,PPRIVILEGE_SET,LPDWORD,LPDWORD,LPBOOL); -BOOL WINAPI AdjustTokenPrivileges(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,LPDWORD); +BOOL WINAPI AdjustTokenPrivileges(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD); BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *); BOOL WINAPI AllocateLocallyUniqueId(PLUID); BOOL WINAPI AreAllAccessesGranted(DWORD,DWORD); diff --git a/include/winnt.h b/include/winnt.h index aecc2afefa7..cd810879684 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -3400,6 +3400,8 @@ typedef struct _SID { #define MIN_ACL_REVISION ACL_REVISION2 #define MAX_ACL_REVISION ACL_REVISION4 +#define ACL_REVISION 2 + typedef struct _ACL { BYTE AclRevision; BYTE Sbz1; @@ -3893,11 +3895,6 @@ typedef struct _TOKEN_STATISTICS { * ACLs of NT */ -#define ACL_REVISION 2 - -#define ACL_REVISION1 1 -#define ACL_REVISION2 2 - /* ACEs, directly starting after an ACL */ typedef struct _ACE_HEADER { BYTE AceType; diff --git a/include/winternl.h b/include/winternl.h index df3a48962e7..7ed801a4ced 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2221,6 +2221,7 @@ NTSTATUS WINAPI RtlSelfRelativeToAbsoluteSD(PSECURITY_DESCRIPTOR,PSECURITY_DESC void WINAPI RtlSetAllBits(PRTL_BITMAP); void WINAPI RtlSetBits(PRTL_BITMAP,ULONG,ULONG); ULONG WINAPI RtlSetCriticalSectionSpinCount(RTL_CRITICAL_SECTION*,ULONG); +NTSTATUS WINAPI RtlSetControlSecurityDescriptor(PSECURITY_DESCRIPTOR,SECURITY_DESCRIPTOR_CONTROL,SECURITY_DESCRIPTOR_CONTROL); NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING*); void WINAPI RtlSetCurrentEnvironment(PWSTR, PWSTR*); NTSTATUS WINAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN); diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 1814bcee278..ca8a34bfd3c 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -402,7 +402,7 @@ static BOOL is_systray_hidden(void) return ret; } -/* this function creates the the listener window */ +/* this function creates the listener window */ void initialize_systray(void) { WNDCLASSEX class; diff --git a/programs/taskmgr/applpage.c b/programs/taskmgr/applpage.c index 77928bd3b5b..038657eb86a 100644 --- a/programs/taskmgr/applpage.c +++ b/programs/taskmgr/applpage.c @@ -70,7 +70,7 @@ static void ApplicationPageUpdate(void) EnableWindow(hApplicationPageSwitchToButton, FALSE); } - /* If we are on the applications tab the the windows menu will */ + /* If we are on the applications tab, then the windows menu will */ /* be present on the menu bar so enable & disable the menu items */ if (TabCtrl_GetCurSel(hTabWnd) == 0) { diff --git a/programs/taskmgr/graphctl.c b/programs/taskmgr/graphctl.c index e255487039d..a914595f9a5 100644 --- a/programs/taskmgr/graphctl.c +++ b/programs/taskmgr/graphctl.c @@ -323,8 +323,8 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this) (m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, _tcslen(m_strYUnitsString)); SelectObject(m_dcGrid, oldFont); #endif - /* at this point we are done filling the the grid bitmap, */ - /* no more drawing to this bitmap is needed until the setting are changed */ + /* at this point we are done filling the grid bitmap, */ + /* no more drawing to this bitmap is needed until the settings are changed */ /* if we don't have one yet, set up a memory dc for the plot */ if (this->m_dcPlot == NULL) diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index 86f682f2e2b..a416c8bb40e 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -161,7 +161,7 @@ static BOOL CALLBACK stack_read_mem(HANDLE hProc, DWORD64 addr, /****************************************************************** * stack_fetch_frames * - * Do a backtrace on the the current thread + * Do a backtrace on the current thread */ unsigned stack_fetch_frames(void) { @@ -275,7 +275,7 @@ static void stack_print_addr_and_args(int nf) /****************************************************************** * backtrace * - * Do a backtrace on the the current thread + * Do a backtrace on the current thread */ static void backtrace(void) { diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index b1342e0a55e..56197e4c160 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -68,6 +68,7 @@ TESTBINS = \ psapi_test.exe \ quartz_test.exe \ riched20_test.exe \ + riched32_test.exe \ rpcrt4_test.exe \ rsabase_test.exe \ rsaenh_test.exe \ @@ -187,6 +188,8 @@ quartz_test.exe: $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT) cp $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT) $@ && $(STRIP) $@ riched20_test.exe: $(DLLDIR)/riched20/tests/riched20_test.exe$(DLLEXT) cp $(DLLDIR)/riched20/tests/riched20_test.exe$(DLLEXT) $@ && $(STRIP) $@ +riched32_test.exe: $(DLLDIR)/riched32/tests/riched32_test.exe$(DLLEXT) + cp $(DLLDIR)/riched32/tests/riched32_test.exe$(DLLEXT) $@ && $(STRIP) $@ rpcrt4_test.exe: $(DLLDIR)/rpcrt4/tests/rpcrt4_test.exe$(DLLEXT) cp $(DLLDIR)/rpcrt4/tests/rpcrt4_test.exe$(DLLEXT) $@ && $(STRIP) $@ rsabase_test.exe: $(DLLDIR)/rsabase/tests/rsabase_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index 9b8a8ebfc0b..b34931a78ae 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -126,6 +126,7 @@ pdh_test.exe TESTRES "pdh_test.exe" psapi_test.exe TESTRES "psapi_test.exe" quartz_test.exe TESTRES "quartz_test.exe" riched20_test.exe TESTRES "riched20_test.exe" +riched32_test.exe TESTRES "riched32_test.exe" rpcrt4_test.exe TESTRES "rpcrt4_test.exe" rsabase_test.exe TESTRES "rsabase_test.exe" rsaenh_test.exe TESTRES "rsaenh_test.exe" diff --git a/tools/winapi/win32.api b/tools/winapi/win32.api index 6864f2eeb58..c3c33a6d82f 100644 --- a/tools/winapi/win32.api +++ b/tools/winapi/win32.api @@ -147,6 +147,7 @@ PSID * PSID_IDENTIFIER_AUTHORITY PSID_NAME_USE PTOKEN_GROUPS +PTOKEN_PRIVILEGES PTRACE_GUID_REGISTRATION PTRACEHANDLE PTRUSTED_DOMAIN_AUTH_INFORMATION @@ -797,6 +798,27 @@ void LPCWSTR LPWSTR +%%cryptnet.dll + +%long + +BOOL +DWORD + +%ptr + +DWORD * +LPVOID +PCERT_REVOCATION_PARA +PCERT_REVOCATION_STATUS +PCRYPT_URL_ARRAY +PCRYPT_URL_INFO +PVOID[] + +%str + +LPCSTR + %%ctl3d32.dll %long diff --git a/tools/winedump/README b/tools/winedump/README index 28ec230ff8b..b1ef087d75f 100644 --- a/tools/winedump/README +++ b/tools/winedump/README @@ -52,7 +52,8 @@ dump other information from PE files; See the section 'Dumping' below. Usage ----- Winedump is a command line tool. For the list of options and the basic usage -see the the winedump(1) man page. +see the winedump(1) man page. + Spec mode: Generating stub DLLs ------------------------------- -- 2.11.4.GIT