From 8a7c2897c4d30ec373e8aa4717f207f71c53c414 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Tue, 7 Apr 2009 17:24:14 +0200 Subject: [PATCH] push 502c994fb3b2157cb8d5bfd04fb7e4ce7daec2a1 --- dlls/comctl32/tab.c | 24 +++- dlls/dbghelp/stabs.c | 11 +- dlls/gdi32/tests/metafile.c | 83 ++++++++---- dlls/kernel32/tests/actctx.c | 28 ++-- dlls/msi/tests/source.c | 21 ++- dlls/msvcrt/scanf.h | 4 +- dlls/oleaut32/tests/usrmarshal.c | 4 +- dlls/oleaut32/usrmarshal.c | 22 +-- dlls/psapi/psapi_main.c | 7 +- dlls/psapi/tests/psapi_main.c | 70 +++++++--- dlls/rpcrt4/Makefile.in | 1 + dlls/rpcrt4/rpc_transport.c | 279 +++++++++++++++++++------------------- dlls/rpcrt4/tests/server.c | 10 ++ dlls/secur32/secur32.c | 97 ++++++++++++- dlls/secur32/tests/secur32.c | 86 ++++++++++++ dlls/shell32/tests/shlfolder.c | 9 +- dlls/urlmon/Makefile.in | 1 + dlls/urlmon/mimefilter.c | 263 +++++++++++++++++++++++++++++++++++ dlls/urlmon/tests/protocol.c | 100 ++++++++++++-- dlls/urlmon/umon.c | 4 - dlls/urlmon/urlmon_main.c | 5 +- dlls/urlmon/urlmon_main.h | 1 + dlls/wined3d/arb_program_shader.c | 10 +- dlls/wined3d/baseshader.c | 3 + dlls/wined3d/glsl_shader.c | 61 +++++---- dlls/wined3d/wined3d_private.h | 21 ++- include/Makefile.in | 1 + include/winsock2.h | 23 +--- include/ws2def.h | 71 ++++++++++ include/ws2ipdef.h | 4 - programs/winecfg/Fr.rc | 4 +- programs/wordpad/print.c | 6 +- programs/wordpad/wordpad.c | 2 +- 33 files changed, 1012 insertions(+), 324 deletions(-) create mode 100644 dlls/urlmon/mimefilter.c create mode 100644 include/ws2def.h diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index a7e925f3d9b..4eebd15409b 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -1480,11 +1480,12 @@ TAB_EraseTabInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect { if (lStyle & TCS_FLATBUTTONS) { - FillRect(hdc, drawRect, hbr); + InflateRect(&rTemp, 2, 2); + FillRect(hdc, &rTemp, hbr); if (iItem == infoPtr->iHotTracked) { - DrawEdge(hdc, drawRect, EDGE_RAISED, BF_SOFT|BF_TOPLEFT); - DrawEdge(hdc, drawRect, EDGE_RAISED, BF_FLAT|BF_BOTTOMRIGHT); + DrawEdge(hdc, &rTemp, EDGE_RAISED, BF_SOFT|BF_TOPLEFT); + DrawEdge(hdc, &rTemp, EDGE_RAISED, BF_FLAT|BF_BOTTOMRIGHT); } } else @@ -1569,7 +1570,22 @@ TAB_DrawItemInterior(const TAB_INFO *infoPtr, HDC hdc, INT iItem, RECT *drawRect drawRect->left += 4; drawRect->top += 4; drawRect->right -= 4; - drawRect->bottom -= 1; + + if (lStyle & TCS_VERTICAL) + { + if (!(lStyle & TCS_BOTTOM)) drawRect->right += 1; + drawRect->bottom -= 4; + } + else + { + if (lStyle & TCS_BOTTOM) + { + drawRect->top -= 2; + drawRect->bottom -= 4; + } + else + drawRect->bottom -= 1; + } } else { diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index b2df46a28df..f6199f3cea8 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -1131,6 +1131,7 @@ struct pending_line int source_idx; int line_num; unsigned long offset; + unsigned long load_offset; }; struct pending_object @@ -1177,13 +1178,15 @@ static inline void pending_add_var(struct pending_list* pending, const char* nam } static inline void pending_add_line(struct pending_list* pending, int source_idx, - int line_num, unsigned long offset) + int line_num, unsigned long offset, + unsigned long load_offset) { pending_make_room(pending); pending->objs[pending->num].tag = PENDING_LINE; pending->objs[pending->num].u.line.source_idx = source_idx; pending->objs[pending->num].u.line.line_num = line_num; pending->objs[pending->num].u.line.offset = offset; + pending->objs[pending->num].u.line.load_offset = load_offset; pending->num++; } @@ -1203,7 +1206,7 @@ static void pending_flush(struct pending_list* pending, struct module* module, break; case PENDING_LINE: if (module->type == DMT_MACHO) - pending->objs[i].u.line.offset -= func->address; + pending->objs[i].u.line.offset -= func->address - pending->objs[i].u.line.load_offset; symt_add_func_line(module, func, pending->objs[i].u.line.source_idx, pending->objs[i].u.line.line_num, pending->objs[i].u.line.offset); break; @@ -1489,12 +1492,12 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset, { unsigned long offset = stab_ptr->n_value; if (module->type == DMT_MACHO) - offset -= curr_func->address; + offset -= curr_func->address - load_offset; symt_add_func_line(module, curr_func, source_idx, stab_ptr->n_desc, offset); } else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc, - stab_ptr->n_value); + stab_ptr->n_value, load_offset); break; case N_FUN: /* diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index b6c0864dfc4..63c2cc4b024 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -449,7 +449,7 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, } case EMR_EOF: ok(save_state == 0, "EOF save_state %d\n", save_state); - ok(select_no == 2, "Too many/few selects %i\n",select_no); + ok(select_no == 3, "Too many/few selects %i\n",select_no); break; } @@ -484,7 +484,7 @@ static void test_SaveDC(void) int ret; POINT pt; SIZE size; - HFONT hFont,hFontOld,hFontCheck; + HFONT hFont,hFont2,hFontOld,hFontCheck; static const RECT rc = { 0, 0, 150, 150 }; /* Win9x doesn't play EMFs on invisible windows */ @@ -512,9 +512,9 @@ static void test_SaveDC(void) SetPixelV(hdcMetafile, 50, 50, 0); ret = GetViewportOrgEx(hdcMetafile, &pt); - ok(pt.x == 0,"Extecting ViewportOrg x of 0, got %i\n",pt.x); + ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - ok(size.cx == 120,"Extecting ViewportExt cx of 120, got %i\n",size.cx); + ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %i\n",size.cx); ret = SaveDC(hdcMetafile); ok(ret == 1, "ret = %d\n", ret); @@ -527,9 +527,9 @@ static void test_SaveDC(void) SetPixelV(hdcMetafile, 50, 50, 0); ret = GetViewportOrgEx(hdcMetafile, &pt); - ok(pt.x == 10,"Extecting ViewportOrg x of 10, got %i\n",pt.x); + ok(pt.x == 10,"Expecting ViewportOrg x of 10, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - ok(size.cx == 200,"Extecting ViewportExt cx of 200, got %i\n",size.cx); + ok(size.cx == 200,"Expecting ViewportExt cx of 200, got %i\n",size.cx); ret = SaveDC(hdcMetafile); ok(ret == 2, "ret = %d\n", ret); @@ -537,14 +537,16 @@ static void test_SaveDC(void) SetViewportOrgEx(hdcMetafile, 20, 20, NULL); SetWindowExtEx(hdcMetafile, 120, 120, NULL ); SetViewportExtEx(hdcMetafile, 300, 300, NULL ); + SetPolyFillMode( hdcMetafile, ALTERNATE ); + SetBkColor( hdcMetafile, 0 ); /* Force Win9x to update DC state */ SetPixelV(hdcMetafile, 50, 50, 0); ret = GetViewportOrgEx(hdcMetafile, &pt); - ok(pt.x == 20,"Extecting ViewportOrg x of 20, got %i\n",pt.x); + ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - ok(size.cx == 300,"Extecting ViewportExt cx of 300, got %i\n",size.cx); + ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %i\n",size.cx); ret = SaveDC(hdcMetafile); ok(ret == 3, "ret = %d\n", ret); @@ -553,33 +555,40 @@ static void test_SaveDC(void) SetWindowExtEx(hdcMetafile, 200, 200, NULL ); SetViewportExtEx(hdcMetafile, 400, 400, NULL ); + SetPolyFillMode( hdcMetafile, WINDING ); + SetBkColor( hdcMetafile, 0x123456 ); + ok( GetPolyFillMode( hdcMetafile ) == WINDING, "PolyFillMode not restored\n" ); + ok( GetBkColor( hdcMetafile ) == 0x123456, "Background color not restored\n" ); + /* Force Win9x to update DC state */ SetPixelV(hdcMetafile, 50, 50, 0); ret = GetViewportOrgEx(hdcMetafile, &pt); - ok(pt.x == 30,"Extecting ViewportOrg x of 30, got %i\n",pt.x); + ok(pt.x == 30,"Expecting ViewportOrg x of 30, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - ok(size.cx == 400,"Extecting ViewportExt cx of 400, got %i\n",size.cx); + ok(size.cx == 400,"Expecting ViewportExt cx of 400, got %i\n",size.cx); ret = RestoreDC(hdcMetafile, -1); ok(ret, "ret = %d\n", ret); ret = GetViewportOrgEx(hdcMetafile, &pt); - todo_wine ok(pt.x == 20,"Extecting ViewportOrg x of 20, got %i\n",pt.x); + todo_wine ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - todo_wine ok(size.cx == 300,"Extecting ViewportExt cx of 300, got %i\n",size.cx); + todo_wine ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %i\n",size.cx); + todo_wine ok( GetPolyFillMode( hdcMetafile ) == ALTERNATE, "PolyFillMode not restored\n" ); + todo_wine ok( GetBkColor( hdcMetafile ) == 0, "Background color not restored\n" ); ret = SaveDC(hdcMetafile); ok(ret == 3, "ret = %d\n", ret); ret = GetViewportOrgEx(hdcMetafile, &pt); - todo_wine ok(pt.x == 20,"Extecting ViewportOrg x of 20, got %i\n",pt.x); + todo_wine ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - todo_wine ok(size.cx == 300,"Extecting ViewportExt cx of 300, got %i\n",size.cx); + todo_wine ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %i\n",size.cx); ret = RestoreDC(hdcMetafile, 1); ok(ret, "ret = %d\n", ret); ret = GetViewportOrgEx(hdcMetafile, &pt); - todo_wine ok(pt.x == 0,"Extecting ViewportOrg x of 0, got %i\n",pt.x); + todo_wine ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - todo_wine ok(size.cx == 120,"Extecting ViewportExt cx of 120, got %i\n",size.cx); + todo_wine ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %i\n",size.cx); SetWindowOrgEx(hdcMetafile, -4, -4, NULL); SetViewportOrgEx(hdcMetafile, 40, 40, NULL); @@ -590,16 +599,16 @@ static void test_SaveDC(void) SetPixelV(hdcMetafile, 50, 50, 0); ret = GetViewportOrgEx(hdcMetafile, &pt); - ok(pt.x == 40,"Extecting ViewportOrg x of 40, got %i\n",pt.x); + ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - ok(size.cx == 50,"Extecting ViewportExt cx of 50, got %i\n",size.cx); + ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %i\n",size.cx); ret = SaveDC(hdcMetafile); ok(ret == 1, "ret = %d\n", ret); ret = GetViewportOrgEx(hdcMetafile, &pt); - ok(pt.x == 40,"Extecting ViewportOrg x of 40, got %i\n",pt.x); + ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - ok(size.cx == 50,"Extecting ViewportExt cx of 50, got %i\n",size.cx); + ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %i\n",size.cx); ret = SaveDC(hdcMetafile); ok(ret == 2, "ret = %d\n", ret); @@ -614,18 +623,25 @@ static void test_SaveDC(void) ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError()); hFontOld = SelectObject(hdcMetafile, hFont); + + hFont2 = CreateFontIndirectA(&orig_lf); + ok(hFont2 != 0, "CreateFontIndirectA error %d\n", GetLastError()); + hFontCheck = SelectObject(hdcMetafile, hFont2); + ok(hFontCheck == hFont, "Font not selected\n"); + /* Force Win9x to update DC state */ SetPixelV(hdcMetafile, 50, 50, 0); ret = RestoreDC(hdcMetafile, 1); ok(ret, "ret = %d\n", ret); ret = GetViewportOrgEx(hdcMetafile, &pt); - ok(pt.x == 40,"Extecting ViewportOrg x of 40, got %i\n",pt.x); + ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %i\n",pt.x); ret = GetViewportExtEx(hdcMetafile, &size); - ok(size.cx == 50,"Extecting ViewportExt cx of 50, got %i\n",size.cx); + ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %i\n",size.cx); hFontCheck = SelectObject(hdcMetafile, hFontOld); - todo_wine ok(hFontOld == hFontCheck && hFontCheck != hFont, "Font not reverted with DC Restore\n"); + todo_wine ok(hFontOld == hFontCheck && hFontCheck != hFont && hFontCheck != hFont2, + "Font not reverted with DC Restore\n"); hMetafile = CloseEnhMetaFile(hdcMetafile); ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError()); @@ -635,6 +651,8 @@ static void test_SaveDC(void) ret = DeleteObject(hFont); ok( ret, "DeleteObject error %d\n", GetLastError()); + ret = DeleteObject(hFont2); + ok( ret, "DeleteObject error %d\n", GetLastError()); ret = DeleteEnhMetaFile(hMetafile); ok( ret, "DeleteEnhMetaFile error %d\n", GetLastError()); ret = ReleaseDC(hwnd, hdcDisplay); @@ -649,7 +667,7 @@ static void test_mf_SaveDC(void) int ret; POINT pt; SIZE size; - HFONT hFont,hFontOld,hFontCheck; + HFONT hFont,hFont2,hFontOld,hFontCheck; hdcMetafile = CreateMetaFileA(NULL); ok(hdcMetafile != 0, "CreateMetaFileA error %d\n", GetLastError()); @@ -693,6 +711,8 @@ static void test_mf_SaveDC(void) /* Force Win9x to update DC state */ SetPixelV(hdcMetafile, 50, 50, 0); + SetPolyFillMode( hdcMetafile, ALTERNATE ); + SetBkColor( hdcMetafile, 0 ); ret = SaveDC(hdcMetafile); todo_wine ok(ret == 1, "ret = %d\n", ret); @@ -702,6 +722,11 @@ static void test_mf_SaveDC(void) SetWindowExtEx(hdcMetafile, 200, 200, NULL ); SetViewportExtEx(hdcMetafile, 400, 400, NULL ); + SetPolyFillMode( hdcMetafile, WINDING ); + SetBkColor( hdcMetafile, 0x123456 ); + todo_wine ok( !GetPolyFillMode( hdcMetafile ), "GetPolyFillMode succeeded\n" ); + todo_wine ok( GetBkColor( hdcMetafile ) == CLR_INVALID, "GetBkColor succeeded\n" ); + /* Force Win9x to update DC state */ SetPixelV(hdcMetafile, 50, 50, 0); @@ -739,13 +764,19 @@ static void test_mf_SaveDC(void) ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError()); hFontOld = SelectObject(hdcMetafile, hFont); + + hFont2 = CreateFontIndirectA(&orig_lf); + ok(hFont2 != 0, "CreateFontIndirectA error %d\n", GetLastError()); + hFontCheck = SelectObject(hdcMetafile, hFont2); + ok(hFontCheck == hFont, "Font not selected\n"); + /* Force Win9x to update DC state */ SetPixelV(hdcMetafile, 50, 50, 0); ret = RestoreDC(hdcMetafile, 1); hFontCheck = SelectObject(hdcMetafile, hFontOld); - ok(hFontOld != hFontCheck && hFontCheck == hFont, "Font incorrectly reverted with DC Restore\n"); + ok(hFontOld != hFontCheck && hFontCheck == hFont2, "Font incorrectly reverted with DC Restore\n"); hMetafile = CloseMetaFile(hdcMetafile); ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError()); @@ -754,6 +785,8 @@ static void test_mf_SaveDC(void) ok( ret, "DeleteMetaFile error %d\n", GetLastError()); ret = DeleteObject(hFont); ok( ret, "DeleteObject error %d\n", GetLastError()); + ret = DeleteObject(hFont2); + ok( ret, "DeleteObject error %d\n", GetLastError()); } diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index 5573c6af1a0..d8f48de7472 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -43,6 +43,14 @@ static const char* strw(LPCWSTR x) return buffer; } +#ifdef __i386__ +#define ARCH "x86" +#elif defined __x86_64__ +#define ARCH "amd64" +#else +#define ARCH "none" +#endif + static const char manifest1[] = "" "" @@ -54,7 +62,7 @@ static const char manifest2[] = "" "" "" -"" +"" "" "" "" @@ -76,7 +84,7 @@ static const char manifest4[] = "" "" "" + "version=\"6.0.1.0\" processorArchitecture=\"" ARCH "\" publicKeyToken=\"6595b64144ccf1df\">" "" "" "" @@ -84,19 +92,19 @@ static const char manifest4[] = static const char testdep_manifest1[] = "" -"" +"" ""; static const char testdep_manifest2[] = "" -"" +"" "" "" ""; static const char testdep_manifest3[] = " " -"" +"" "" "" "wndClass" @@ -138,7 +146,7 @@ static const char wrong_manifest6[] = static const char wrong_manifest7[] = "" -"" +"" "" ""; @@ -150,7 +158,7 @@ static const char wrong_manifest8[] = static const char wrong_depmanifest1[] = "" -"" +"" ""; static const WCHAR testlib_dll[] = @@ -386,21 +394,21 @@ static const info_in_assembly manifest4_info = { static const info_in_assembly depmanifest1_info = { 0x10, depmanifest_path, - "testdep,processorArchitecture=\"x86\"," + "testdep,processorArchitecture=\"" ARCH "\"," "type=\"win32\",version=\"6.5.4.3\"", TRUE }; static const info_in_assembly depmanifest2_info = { 0x10, depmanifest_path, - "testdep,processorArchitecture=\"x86\"," + "testdep,processorArchitecture=\"" ARCH "\"," "type=\"win32\",version=\"6.5.4.3\"", TRUE }; static const info_in_assembly depmanifest3_info = { 0x10, depmanifest_path, - "testdep,processorArchitecture=\"x86\",type=\"win32\",version=\"6.5.4.3\"", + "testdep,processorArchitecture=\"" ARCH "\",type=\"win32\",version=\"6.5.4.3\"", TRUE }; diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index 192f01070cb..2e9e3ff3e5d 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -27,10 +27,12 @@ #include #include #include +#include #include "wine/test.h" static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); +static BOOLEAN (WINAPI *pGetUserNameExA)(EXTENDED_NAME_FORMAT, LPSTR, PULONG); static UINT (WINAPI *pMsiSourceListAddMediaDiskA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPCSTR, LPCSTR); static UINT (WINAPI *pMsiSourceListAddSourceExA) @@ -51,6 +53,7 @@ static void init_functionpointers(void) { HMODULE hmsi = GetModuleHandleA("msi.dll"); HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); + HMODULE hsecur32 = LoadLibraryA("secur32.dll"); #define GET_PROC(dll, func) \ p ## func = (void *)GetProcAddress(dll, #func); \ @@ -67,6 +70,8 @@ static void init_functionpointers(void) GET_PROC(hadvapi32, ConvertSidToStringSidA) + GET_PROC(hsecur32, GetUserNameExA) + #undef GET_PROC } @@ -3139,12 +3144,16 @@ static void test_MsiSourceListAddSource(void) /* MACHINENAME\username */ size = MAX_PATH; - GetComputerNameA(username, &size); - lstrcatA(username, "\\"); - ptr = username + lstrlenA(username); - size = MAX_PATH; - GetUserNameA(ptr, &size); - + if (pGetUserNameExA != NULL) + pGetUserNameExA(NameSamCompatible, username, &size); + else + { + GetComputerNameA(username, &size); + lstrcatA(username, "\\"); + ptr = username + lstrlenA(username); + size = MAX_PATH - (ptr - username); + GetUserNameA(ptr, &size); + } trace("username: %s\n", username); /* GetLastError is not set by the function */ diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h index 6ea9ab1ca81..3eb705b2376 100644 --- a/dlls/msvcrt/scanf.h +++ b/dlls/msvcrt/scanf.h @@ -151,6 +151,8 @@ _FUNCTION_ { switch(*format) { case 'p': case 'P': /* pointer. */ + if (sizeof(void *) == sizeof(LONGLONG)) I64_prefix = 1; + /* fall through */ case 'x': case 'X': /* hexadecimal integer. */ base = 16; @@ -224,7 +226,7 @@ _FUNCTION_ { if (!suppress) { #define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur if (I64_prefix) _SET_NUMBER_(LONGLONG); - else if (l_prefix) _SET_NUMBER_(long int); + else if (l_prefix) _SET_NUMBER_(LONG); else if (h_prefix) _SET_NUMBER_(short int); else _SET_NUMBER_(int); } diff --git a/dlls/oleaut32/tests/usrmarshal.c b/dlls/oleaut32/tests/usrmarshal.c index cb6f45d2a60..38827b1dcd9 100644 --- a/dlls/oleaut32/tests/usrmarshal.c +++ b/dlls/oleaut32/tests/usrmarshal.c @@ -146,8 +146,8 @@ static void check_safearray(void *buffer, LPSAFEARRAY lpsa) wiresa += sizeof(DWORD); ok(*(DWORD *)wiresa == cell_count, "wiresa + 0x1c should be %u instead of %u\n", cell_count, *(DWORD *)wiresa); wiresa += sizeof(DWORD); - ok(*(DWORD_PTR *)wiresa == (DWORD_PTR)lpsa->pvData, "wiresa + 0x20 should be lpsa->pvData instead of 0x%08lx\n", *(DWORD_PTR *)wiresa); - wiresa += sizeof(DWORD_PTR); + ok(*(DWORD *)wiresa, "wiresa + 0x20 should be non-zero instead of 0x%08x\n", *(DWORD *)wiresa); + wiresa += sizeof(DWORD); if(sftype == SF_HAVEIID) { GUID guid; diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c index 14c655c71b0..1e20c3cd322 100644 --- a/dlls/oleaut32/usrmarshal.c +++ b/dlls/oleaut32/usrmarshal.c @@ -755,7 +755,7 @@ ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY TRACE("("); dump_user_flags(pFlags); TRACE(", %d, %p\n", StartingSize, *ppsa); ALIGN_LENGTH(size, 3); - size += sizeof(ULONG_PTR); + size += sizeof(ULONG); if (*ppsa) { SAFEARRAY *psa = *ppsa; @@ -770,7 +770,7 @@ ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY size += sizeof(ULONG); size += sizeof(ULONG); - size += sizeof(ULONG_PTR); + size += sizeof(ULONG); if (sftype == SF_HAVEIID) size += sizeof(IID); @@ -843,8 +843,8 @@ unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buf TRACE("("); dump_user_flags(pFlags); TRACE(", %p, &%p\n", Buffer, *ppsa); ALIGN_POINTER(Buffer, 3); - *(ULONG_PTR *)Buffer = *ppsa ? TRUE : FALSE; - Buffer += sizeof(ULONG_PTR); + *(ULONG *)Buffer = *ppsa ? 0x1 : 0x0; + Buffer += sizeof(ULONG); if (*ppsa) { VARTYPE vt; @@ -874,8 +874,8 @@ unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buf *(ULONG *)Buffer = ulCellCount; Buffer += sizeof(ULONG); - *(ULONG_PTR *)Buffer = (ULONG_PTR)psa->pvData; - Buffer += sizeof(ULONG_PTR); + *(ULONG *)Buffer = psa->pvData ? 0x2 : 0x0; + Buffer += sizeof(ULONG); if (sftype == SF_HAVEIID) { SafeArrayGetIID(psa, &guid); @@ -958,7 +958,7 @@ unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buf unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer, LPSAFEARRAY *ppsa) { - ULONG_PTR ptr; + ULONG ptr; wireSAFEARRAY wiresa; ULONG cDims; HRESULT hr; @@ -971,8 +971,8 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B TRACE("("); dump_user_flags(pFlags); TRACE(", %p, %p\n", Buffer, ppsa); ALIGN_POINTER(Buffer, 3); - ptr = *(ULONG_PTR *)Buffer; - Buffer += sizeof(ULONG_PTR); + ptr = *(ULONG *)Buffer; + Buffer += sizeof(ULONG); if (!ptr) { @@ -1001,8 +1001,8 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B cell_count = *(ULONG *)Buffer; Buffer += sizeof(ULONG); - ptr = *(ULONG_PTR *)Buffer; - Buffer += sizeof(ULONG_PTR); + ptr = *(ULONG *)Buffer; + Buffer += sizeof(ULONG); if (sftype == SF_HAVEIID) { memcpy(&guid, Buffer, sizeof(guid)); diff --git a/dlls/psapi/psapi_main.c b/dlls/psapi/psapi_main.c index 72484dc5a0e..61ba8dea891 100644 --- a/dlls/psapi/psapi_main.c +++ b/dlls/psapi/psapi_main.c @@ -507,8 +507,11 @@ DWORD WINAPI GetProcessImageFileNameA( HANDLE process, LPSTR file, DWORD size ) */ DWORD WINAPI GetProcessImageFileNameW( HANDLE process, LPWSTR file, DWORD size ) { - FIXME("(%p, %p, %d) stub\n", process, file, size ); - return 0; + BOOL success = QueryFullProcessImageNameW(process, PROCESS_NAME_NATIVE, file, &size); + if (success) + return size; + else + return 0; } /*********************************************************************** diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c index 4cee7c62405..6ef5b04c189 100644 --- a/dlls/psapi/tests/psapi_main.c +++ b/dlls/psapi/tests/psapi_main.c @@ -21,10 +21,17 @@ #include #include -#include "wine/test.h" #include "windows.h" +#include "wine/test.h" #include "psapi.h" +#define expect_eq_d(expected, actual) \ + do { \ + int value = (actual); \ + ok((expected) == value, "Expected " #actual " to be %d (" #expected ") is %d\n", \ + (expected), value); \ + } while (0) + #define PSAPI_GET_PROC(func) \ p ## func = (void*)GetProcAddress(hpsapi, #func); \ if(!p ## func) { \ @@ -63,6 +70,7 @@ static DWORD (WINAPI *pGetModuleFileNameExA)(HANDLE, HMODULE, LPSTR, DWORD); static BOOL (WINAPI *pGetModuleInformation)(HANDLE, HMODULE, LPMODULEINFO, DWORD); static DWORD (WINAPI *pGetMappedFileNameA)(HANDLE, LPVOID, LPSTR, DWORD); static DWORD (WINAPI *pGetProcessImageFileNameA)(HANDLE, LPSTR, DWORD); +static DWORD (WINAPI *pGetProcessImageFileNameW)(HANDLE, LPWSTR, DWORD); static BOOL (WINAPI *pGetProcessMemoryInfo)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD); static BOOL (WINAPI *pGetWsChanges)(HANDLE, PPSAPI_WS_WATCH_INFORMATION, DWORD); static BOOL (WINAPI *pInitializeProcessForWsWatch)(HANDLE); @@ -84,6 +92,8 @@ static BOOL InitFunctionPtrs(HMODULE hpsapi) /* GetProcessImageFileName is not exported on NT4 */ pGetProcessImageFileNameA = (void *)GetProcAddress(hpsapi, "GetProcessImageFileNameA"); + pGetProcessImageFileNameW = + (void *)GetProcAddress(hpsapi, "GetProcessImageFileNameW"); return TRUE; } @@ -166,6 +176,7 @@ static void test_GetProcessImageFileName(void) { HMODULE hMod = GetModuleHandle(NULL); char szImgPath[MAX_PATH], szMapPath[MAX_PATH]; + WCHAR szImgPathW[MAX_PATH]; DWORD ret; if(pGetProcessImageFileNameA == NULL) @@ -175,26 +186,49 @@ static void test_GetProcessImageFileName(void) SetLastError(0xdeadbeef); if(!pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath))) { - if(GetLastError() == ERROR_INVALID_FUNCTION) + if(GetLastError() == ERROR_INVALID_FUNCTION) { win_skip("GetProcessImageFileName not implemented\n"); - else if(GetLastError() == 0xdeadbeef) - ok(0, "failed without error code\n"); + return; + } + + if(GetLastError() == 0xdeadbeef) + todo_wine ok(0, "failed without error code\n"); else - ok(0, "failed with %d\n", GetLastError()); + todo_wine ok(0, "failed with %d\n", GetLastError()); + } - return; + todo_wine w32_err(pGetProcessImageFileNameA(NULL, szImgPath, sizeof(szImgPath)), ERROR_INVALID_HANDLE); + todo_wine w32_err(pGetProcessImageFileNameA(hpSR, szImgPath, sizeof(szImgPath)), ERROR_ACCESS_DENIED); + todo_wine w32_err(pGetProcessImageFileNameA(hpQI, szImgPath, 0), ERROR_INSUFFICIENT_BUFFER); + todo_wine + if(w32_suc(ret = pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath))) && + w32_suc(pGetMappedFileNameA(hpQV, hMod, szMapPath, sizeof(szMapPath)))) { + /* Windows returns 2*strlen-1 */ + ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret); + ok(!strcmp(szImgPath, szMapPath), + "szImgPath=\"%s\" szMapPath=\"%s\"\n", szImgPath, szMapPath); } - - w32_err(pGetProcessImageFileNameA(NULL, szImgPath, sizeof(szImgPath)), ERROR_INVALID_HANDLE); - w32_err(pGetProcessImageFileNameA(hpSR, szImgPath, sizeof(szImgPath)), ERROR_ACCESS_DENIED); - w32_err(pGetProcessImageFileNameA(hpQI, szImgPath, 0), ERROR_INSUFFICIENT_BUFFER); - if(!w32_suc(ret = pGetProcessImageFileNameA(hpQI, szImgPath, sizeof(szImgPath))) || - !w32_suc(pGetMappedFileNameA(hpQV, hMod, szMapPath, sizeof(szMapPath)))) - return; - /* Windows returns 2*strlen-1 */ - ok(ret >= strlen(szImgPath), "szImgPath=\"%s\" ret=%d\n", szImgPath, ret); - ok(!strcmp(szImgPath, szMapPath), - "szImgPath=\"%s\" szMapPath=\"%s\"\n", szImgPath, szMapPath); + + w32_err(pGetProcessImageFileNameW(NULL, szImgPathW, sizeof(szImgPathW)), ERROR_INVALID_HANDLE); + /* no information about correct buffer size returned: */ + w32_err(pGetProcessImageFileNameW(hpQI, szImgPathW, 0), ERROR_INSUFFICIENT_BUFFER); + w32_err(pGetProcessImageFileNameW(hpQI, NULL, 0), ERROR_INSUFFICIENT_BUFFER); + + /* correct call */ + memset(szImgPathW, 0xff, sizeof(szImgPathW)); + ret = pGetProcessImageFileNameW(hpQI, szImgPathW, sizeof(szImgPathW)/sizeof(WCHAR)); + ok(ret > 0, "GetProcessImageFileNameW should have succeeded.\n"); + ok(szImgPathW[0] == '\\', "GetProcessImageFileNameW should have returned an NT path.\n"); + expect_eq_d(lstrlenW(szImgPathW), ret); + + /* boundary values of 'size' */ + w32_err(pGetProcessImageFileNameW(hpQI, szImgPathW, ret), ERROR_INSUFFICIENT_BUFFER); + + memset(szImgPathW, 0xff, sizeof(szImgPathW)); + ret = pGetProcessImageFileNameW(hpQI, szImgPathW, ret + 1); + ok(ret > 0, "GetProcessImageFileNameW should have succeeded.\n"); + ok(szImgPathW[0] == '\\', "GetProcessImageFileNameW should have returned an NT path.\n"); + expect_eq_d(lstrlenW(szImgPathW), ret); } static void test_GetModuleFileNameEx(void) @@ -309,7 +343,7 @@ START_TEST(psapi_main) test_GetModuleInformation(); test_GetProcessMemoryInfo(); todo_wine test_GetMappedFileName(); - todo_wine test_GetProcessImageFileName(); + test_GetProcessImageFileName(); test_GetModuleFileNameEx(); test_GetModuleBaseName(); test_ws_functions(); diff --git a/dlls/rpcrt4/Makefile.in b/dlls/rpcrt4/Makefile.in index 3e47345636d..fda374c9435 100644 --- a/dlls/rpcrt4/Makefile.in +++ b/dlls/rpcrt4/Makefile.in @@ -7,6 +7,7 @@ MODULE = rpcrt4.dll IMPORTLIB = rpcrt4 IMPORTS = uuid advapi32 kernel32 ntdll DELAYIMPORTS = wininet secur32 user32 +EXTRALIBS = @SOCKETLIBS@ C_SRCS = \ cproxy.c \ diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index 8f159e47280..9c8796172f3 100644 --- a/dlls/rpcrt4/rpc_transport.c +++ b/dlls/rpcrt4/rpc_transport.c @@ -762,6 +762,143 @@ static RPC_STATUS rpcrt4_ncalrpc_parse_top_of_tower(const unsigned char *tower_d /**** ncacn_ip_tcp support ****/ +static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned char *tower_data, + const char *networkaddr, + unsigned char tcp_protid, + const char *endpoint) +{ + twr_tcp_floor_t *tcp_floor; + twr_ipv4_floor_t *ipv4_floor; + struct addrinfo *ai; + struct addrinfo hints; + int ret; + size_t size = sizeof(*tcp_floor) + sizeof(*ipv4_floor); + + TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint); + + if (!tower_data) + return size; + + tcp_floor = (twr_tcp_floor_t *)tower_data; + tower_data += sizeof(*tcp_floor); + + ipv4_floor = (twr_ipv4_floor_t *)tower_data; + + tcp_floor->count_lhs = sizeof(tcp_floor->protid); + tcp_floor->protid = tcp_protid; + tcp_floor->count_rhs = sizeof(tcp_floor->port); + + ipv4_floor->count_lhs = sizeof(ipv4_floor->protid); + ipv4_floor->protid = EPM_PROTOCOL_IP; + ipv4_floor->count_rhs = sizeof(ipv4_floor->ipv4addr); + + hints.ai_flags = AI_NUMERICHOST; + /* FIXME: only support IPv4 at the moment. how is IPv6 represented by the EPM? */ + hints.ai_family = PF_INET; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + hints.ai_addrlen = 0; + hints.ai_addr = NULL; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + + ret = getaddrinfo(networkaddr, endpoint, &hints, &ai); + if (ret) + { + ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai); + if (ret) + { + ERR("getaddrinfo failed: %s\n", gai_strerror(ret)); + return 0; + } + } + + if (ai->ai_family == PF_INET) + { + const struct sockaddr_in *sin = (const struct sockaddr_in *)ai->ai_addr; + tcp_floor->port = sin->sin_port; + ipv4_floor->ipv4addr = sin->sin_addr.s_addr; + } + else + { + ERR("unexpected protocol family %d\n", ai->ai_family); + return 0; + } + + freeaddrinfo(ai); + + return size; +} + +static RPC_STATUS rpcrt4_ip_tcp_parse_top_of_tower(const unsigned char *tower_data, + size_t tower_size, + char **networkaddr, + unsigned char tcp_protid, + char **endpoint) +{ + const twr_tcp_floor_t *tcp_floor = (const twr_tcp_floor_t *)tower_data; + const twr_ipv4_floor_t *ipv4_floor; + struct in_addr in_addr; + + TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint); + + if (tower_size < sizeof(*tcp_floor)) + return EPT_S_NOT_REGISTERED; + + tower_data += sizeof(*tcp_floor); + tower_size -= sizeof(*tcp_floor); + + if (tower_size < sizeof(*ipv4_floor)) + return EPT_S_NOT_REGISTERED; + + ipv4_floor = (const twr_ipv4_floor_t *)tower_data; + + if ((tcp_floor->count_lhs != sizeof(tcp_floor->protid)) || + (tcp_floor->protid != tcp_protid) || + (tcp_floor->count_rhs != sizeof(tcp_floor->port)) || + (ipv4_floor->count_lhs != sizeof(ipv4_floor->protid)) || + (ipv4_floor->protid != EPM_PROTOCOL_IP) || + (ipv4_floor->count_rhs != sizeof(ipv4_floor->ipv4addr))) + return EPT_S_NOT_REGISTERED; + + if (endpoint) + { + *endpoint = I_RpcAllocate(6 /* sizeof("65535") + 1 */); + if (!*endpoint) + return RPC_S_OUT_OF_RESOURCES; + sprintf(*endpoint, "%u", ntohs(tcp_floor->port)); + } + + if (networkaddr) + { + *networkaddr = I_RpcAllocate(INET_ADDRSTRLEN); + if (!*networkaddr) + { + if (endpoint) + { + I_RpcFree(*endpoint); + *endpoint = NULL; + } + return RPC_S_OUT_OF_RESOURCES; + } + in_addr.s_addr = ipv4_floor->ipv4addr; + if (!inet_ntop(AF_INET, &in_addr, *networkaddr, INET_ADDRSTRLEN)) + { + ERR("inet_ntop: %s\n", strerror(errno)); + I_RpcFree(*networkaddr); + *networkaddr = NULL; + if (endpoint) + { + I_RpcFree(*endpoint); + *endpoint = NULL; + } + return EPT_S_NOT_REGISTERED; + } + } + + return RPC_S_OK; +} + #ifdef HAVE_SOCKETPAIR typedef struct _RpcConnection_tcp @@ -1167,74 +1304,6 @@ static int rpcrt4_conn_tcp_wait_for_incoming_data(RpcConnection *Connection) return 0; } -static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned char *tower_data, - const char *networkaddr, - unsigned char tcp_protid, - const char *endpoint) -{ - twr_tcp_floor_t *tcp_floor; - twr_ipv4_floor_t *ipv4_floor; - struct addrinfo *ai; - struct addrinfo hints; - int ret; - size_t size = sizeof(*tcp_floor) + sizeof(*ipv4_floor); - - TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint); - - if (!tower_data) - return size; - - tcp_floor = (twr_tcp_floor_t *)tower_data; - tower_data += sizeof(*tcp_floor); - - ipv4_floor = (twr_ipv4_floor_t *)tower_data; - - tcp_floor->count_lhs = sizeof(tcp_floor->protid); - tcp_floor->protid = tcp_protid; - tcp_floor->count_rhs = sizeof(tcp_floor->port); - - ipv4_floor->count_lhs = sizeof(ipv4_floor->protid); - ipv4_floor->protid = EPM_PROTOCOL_IP; - ipv4_floor->count_rhs = sizeof(ipv4_floor->ipv4addr); - - hints.ai_flags = AI_NUMERICHOST; - /* FIXME: only support IPv4 at the moment. how is IPv6 represented by the EPM? */ - hints.ai_family = PF_INET; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - hints.ai_addrlen = 0; - hints.ai_addr = NULL; - hints.ai_canonname = NULL; - hints.ai_next = NULL; - - ret = getaddrinfo(networkaddr, endpoint, &hints, &ai); - if (ret) - { - ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai); - if (ret) - { - ERR("getaddrinfo failed: %s\n", gai_strerror(ret)); - return 0; - } - } - - if (ai->ai_family == PF_INET) - { - const struct sockaddr_in *sin = (const struct sockaddr_in *)ai->ai_addr; - tcp_floor->port = sin->sin_port; - ipv4_floor->ipv4addr = sin->sin_addr.s_addr; - } - else - { - ERR("unexpected protocol family %d\n", ai->ai_family); - return 0; - } - - freeaddrinfo(ai); - - return size; -} - static size_t rpcrt4_ncacn_ip_tcp_get_top_of_tower(unsigned char *tower_data, const char *networkaddr, const char *endpoint) @@ -1243,75 +1312,6 @@ static size_t rpcrt4_ncacn_ip_tcp_get_top_of_tower(unsigned char *tower_data, EPM_PROTOCOL_TCP, endpoint); } -static RPC_STATUS rpcrt4_ip_tcp_parse_top_of_tower(const unsigned char *tower_data, - size_t tower_size, - char **networkaddr, - unsigned char tcp_protid, - char **endpoint) -{ - const twr_tcp_floor_t *tcp_floor = (const twr_tcp_floor_t *)tower_data; - const twr_ipv4_floor_t *ipv4_floor; - struct in_addr in_addr; - - TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint); - - if (tower_size < sizeof(*tcp_floor)) - return EPT_S_NOT_REGISTERED; - - tower_data += sizeof(*tcp_floor); - tower_size -= sizeof(*tcp_floor); - - if (tower_size < sizeof(*ipv4_floor)) - return EPT_S_NOT_REGISTERED; - - ipv4_floor = (const twr_ipv4_floor_t *)tower_data; - - if ((tcp_floor->count_lhs != sizeof(tcp_floor->protid)) || - (tcp_floor->protid != tcp_protid) || - (tcp_floor->count_rhs != sizeof(tcp_floor->port)) || - (ipv4_floor->count_lhs != sizeof(ipv4_floor->protid)) || - (ipv4_floor->protid != EPM_PROTOCOL_IP) || - (ipv4_floor->count_rhs != sizeof(ipv4_floor->ipv4addr))) - return EPT_S_NOT_REGISTERED; - - if (endpoint) - { - *endpoint = I_RpcAllocate(6 /* sizeof("65535") + 1 */); - if (!*endpoint) - return RPC_S_OUT_OF_RESOURCES; - sprintf(*endpoint, "%u", ntohs(tcp_floor->port)); - } - - if (networkaddr) - { - *networkaddr = I_RpcAllocate(INET_ADDRSTRLEN); - if (!*networkaddr) - { - if (endpoint) - { - I_RpcFree(*endpoint); - *endpoint = NULL; - } - return RPC_S_OUT_OF_RESOURCES; - } - in_addr.s_addr = ipv4_floor->ipv4addr; - if (!inet_ntop(AF_INET, &in_addr, *networkaddr, INET_ADDRSTRLEN)) - { - ERR("inet_ntop: %s\n", strerror(errno)); - I_RpcFree(*networkaddr); - *networkaddr = NULL; - if (endpoint) - { - I_RpcFree(*endpoint); - *endpoint = NULL; - } - return EPT_S_NOT_REGISTERED; - } - } - - return RPC_S_OK; -} - typedef struct _RpcServerProtseq_sock { RpcServerProtseq common; @@ -1461,6 +1461,8 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_parse_top_of_tower(const unsigned char *to endpoint); } +#endif /* HAVE_SOCKETPAIR */ + /**** ncacn_http support ****/ /* 60 seconds is the period native uses */ @@ -2399,7 +2401,6 @@ static RPC_STATUS rpcrt4_ncacn_http_parse_top_of_tower(const unsigned char *towe networkaddr, EPM_PROTOCOL_HTTP, endpoint); } -#endif /* HAVE_SOCKETPAIR */ static const struct connection_ops conn_protseq_list[] = { { "ncacn_np", @@ -2445,6 +2446,7 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_ncacn_ip_tcp_parse_top_of_tower, NULL, }, +#endif { "ncacn_http", { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP }, rpcrt4_ncacn_http_alloc, @@ -2459,7 +2461,6 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_ncacn_http_parse_top_of_tower, rpcrt4_ncacn_http_receive_fragment, }, -#endif }; diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index efa64eb5150..18cfa5942aa 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -591,6 +591,12 @@ s_context_handle_test(void) binding = I_RpcGetCurrentCallHandle(); ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n"); + if (!pNDRSContextMarshall2 || !pNDRSContextUnmarshall2) + { + win_skip("NDRSContextMarshall2 or NDRSContextUnmarshall2 not exported from rpcrt4.dll\n"); + return; + } + h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0); ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n"); @@ -614,6 +620,9 @@ s_context_handle_test(void) ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n"); ok(h->userContext == (void *)0xdeadbeef, "userContext of interface didn't unmarshal properly: %p\n", h->userContext); + /* raises ERROR_INVALID_HANDLE exception on Vista upwards */ + if (0) + { /* marshal a context handle with an interface specified */ h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0); ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n"); @@ -627,6 +636,7 @@ s_context_handle_test(void) h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0); ok(h != NULL, "NDRSContextUnmarshall2 returned NULL\n"); ok(h->userContext == (void *)0xcafebabe, "userContext of interface didn't unmarshal properly: %p\n", h->userContext); + } /* test same interface data, but different pointer */ /* raises ERROR_INVALID_HANDLE exception */ diff --git a/dlls/secur32/secur32.c b/dlls/secur32/secur32.c index 2e25b153542..73db3954f9c 100644 --- a/dlls/secur32/secur32.c +++ b/dlls/secur32/secur32.c @@ -32,6 +32,7 @@ #include "secext.h" #include "ntsecapi.h" #include "thunks.h" +#include "lmcons.h" #include "wine/list.h" #include "wine/debug.h" @@ -1055,15 +1056,103 @@ BOOLEAN WINAPI GetComputerObjectNameW( BOOLEAN WINAPI GetUserNameExA( EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize) { - FIXME("%d %p %p\n", NameFormat, lpNameBuffer, nSize); - return FALSE; + BOOLEAN rc; + LPWSTR bufferW = NULL; + ULONG sizeW = *nSize; + TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); + if (lpNameBuffer) { + bufferW = HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR)); + if (bufferW == NULL) { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + } + rc = GetUserNameExW(NameFormat, bufferW, &sizeW); + if (rc) { + ULONG len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL); + if (len <= *nSize) + { + WideCharToMultiByte(CP_ACP, 0, bufferW, -1, lpNameBuffer, *nSize, NULL, NULL); + *nSize = len - 1; + } + else + { + *nSize = len; + rc = FALSE; + SetLastError(ERROR_MORE_DATA); + } + } + else + *nSize = sizeW; + HeapFree(GetProcessHeap(), 0, bufferW); + return rc; } BOOLEAN WINAPI GetUserNameExW( EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize) { - FIXME("%d %p %p\n", NameFormat, lpNameBuffer, nSize); - return FALSE; + BOOLEAN status; + WCHAR samname[UNLEN + 1 + MAX_COMPUTERNAME_LENGTH + 1]; + LPWSTR out; + DWORD len; + TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize); + + if (NameFormat == NameUnknown) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + switch (NameFormat) + { + case NameSamCompatible: + { + /* This assumes the current user is always a local account */ + len = MAX_COMPUTERNAME_LENGTH + 1; + if (GetComputerNameW(samname, &len)) + { + out = samname + lstrlenW(samname); + *out++ = '\\'; + len = UNLEN + 1; + if (GetUserNameW(out, &len)) + { + status = (lstrlenW(samname) < *nSize); + if (status) + { + lstrcpyW(lpNameBuffer, samname); + *nSize = lstrlenW(samname); + } + else + { + SetLastError(ERROR_MORE_DATA); + *nSize = lstrlenW(samname) + 1; + } + } + else + status = FALSE; + } + else + status = FALSE; + } + break; + case NameFullyQualifiedDN: + case NameDisplay: + case NameUniqueId: + case NameCanonical: + case NameUserPrincipal: + case NameCanonicalEx: + case NameServicePrincipal: + case NameDnsDomain: + FIXME("NameFormat %d not implemented\n", NameFormat); + SetLastError(ERROR_CANT_ACCESS_DOMAIN_INFO); + status = FALSE; + break; + default: + SetLastError(ERROR_INVALID_PARAMETER); + status = FALSE; + } + + return status; } BOOLEAN WINAPI TranslateNameA( diff --git a/dlls/secur32/tests/secur32.c b/dlls/secur32/tests/secur32.c index 27e07fbd0b2..6a4ae056bdd 100644 --- a/dlls/secur32/tests/secur32.c +++ b/dlls/secur32/tests/secur32.c @@ -32,6 +32,8 @@ static HMODULE secdll; static BOOLEAN (WINAPI * pGetComputerObjectNameA)(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG lpnSize); static BOOLEAN (WINAPI * pGetComputerObjectNameW)(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG lpnSize); +static BOOLEAN (WINAPI * pGetUserNameExA)(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG lpnSize); +static BOOLEAN (WINAPI * pGetUserNameExW)(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG lpnSize); static PSecurityFunctionTableA (SEC_ENTRY * pInitSecurityInterfaceA)(void); static PSecurityFunctionTableW (SEC_ENTRY * pInitSecurityInterfaceW)(void); @@ -94,6 +96,82 @@ static void testGetComputerObjectNameW(void) } } +static void testGetUserNameExA(void) +{ + char name[256]; + ULONG size; + BOOLEAN rc; + int i; + + for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { + size = sizeof(name); + ZeroMemory(name, sizeof(name)); + rc = pGetUserNameExA(formats[i], name, &size); + ok(rc || ((formats[i] == NameUnknown) && + (GetLastError() == ERROR_INVALID_PARAMETER)) || + (GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) || + (GetLastError() == ERROR_NO_SUCH_DOMAIN) || + (GetLastError() == ERROR_NO_SUCH_USER) || + (GetLastError() == ERROR_NONE_MAPPED) || + (GetLastError() == ERROR_ACCESS_DENIED), + "GetUserNameExA(%d) failed: %d\n", + formats[i], GetLastError()); + } + + size = 0; + rc = pGetUserNameExA(NameSamCompatible, NULL, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); + ok(size != 0, "Expected size to be set to required size\n"); + size = 0; + rc = pGetUserNameExA(NameSamCompatible, name, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); + ok(size != 0, "Expected size to be set to required size\n"); + size = 1; + name[0] = 0xff; + rc = pGetUserNameExA(NameSamCompatible, name, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); + ok(1 < size, "Expected size to be set to required size\n"); + ok(name[0] == (char) 0xff, "Expected unchanged buffer\n"); +} + +static void testGetUserNameExW(void) +{ + WCHAR nameW[256]; + ULONG size; + BOOLEAN rc; + int i; + + for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { + size = sizeof(nameW); + ZeroMemory(nameW, sizeof(nameW)); + rc = pGetUserNameExW(formats[i], nameW, &size); + ok(rc || ((formats[i] == NameUnknown) && + (GetLastError() == ERROR_INVALID_PARAMETER)) || + (GetLastError() == ERROR_CANT_ACCESS_DOMAIN_INFO) || + (GetLastError() == ERROR_NO_SUCH_DOMAIN) || + (GetLastError() == ERROR_NO_SUCH_USER) || + (GetLastError() == ERROR_NONE_MAPPED) || + (GetLastError() == ERROR_ACCESS_DENIED), + "GetUserNameExW(%d) failed: %d\n", + formats[i], GetLastError()); + } + + size = 0; + rc = pGetUserNameExW(NameSamCompatible, NULL, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); + ok(size != 0, "Expected size to be set to required size\n"); + size = 0; + rc = pGetUserNameExW(NameSamCompatible, nameW, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); + ok(size != 0, "Expected size to be set to required size\n"); + size = 1; + nameW[0] = 0xff; + rc = pGetUserNameExW(NameSamCompatible, nameW, &size); + ok(! rc && GetLastError() == ERROR_MORE_DATA, "Expected fail with ERROR_MORE_DATA, got %d with %u\n", rc, GetLastError()); + ok(1 < size, "Expected size to be set to required size\n"); + ok(nameW[0] == (WCHAR) 0xff, "Expected unchanged buffer\n"); +} + static void test_InitSecurityInterface(void) { PSecurityFunctionTableA sftA; @@ -137,6 +215,8 @@ START_TEST(secur32) { pGetComputerObjectNameA = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameA"); pGetComputerObjectNameW = (PVOID)GetProcAddress(secdll, "GetComputerObjectNameW"); + pGetUserNameExA = (PVOID)GetProcAddress(secdll, "GetUserNameExA"); + pGetUserNameExW = (PVOID)GetProcAddress(secdll, "GetUserNameExW"); pInitSecurityInterfaceA = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceA"); pInitSecurityInterfaceW = (PVOID)GetProcAddress(secdll, "InitSecurityInterfaceW"); @@ -146,6 +226,12 @@ START_TEST(secur32) if (pGetComputerObjectNameW) testGetComputerObjectNameW(); + if (pGetUserNameExA) + testGetUserNameExA(); + + if (pGetUserNameExW) + testGetUserNameExW(); + test_InitSecurityInterface(); FreeLibrary(secdll); diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 8c5f1dcf5dc..5492b8410ae 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -717,7 +717,7 @@ static void test_GetAttributesOf(void) SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER, /* Win95, WinNT when queried directly */ - SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | + SFGAO_CANLINK | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER }; WCHAR wszMyComputer[] = { @@ -769,10 +769,6 @@ static void test_GetAttributesOf(void) /* Windows sets the SFGAO_CANLINK flag, when MyComputer is queried via the Desktop * folder object. It doesn't do this, if MyComputer is queried directly (see below). - * SFGAO_CANLINK is the same as DROPEFFECT_LINK, which MSDN says means: "Drag source - * should create a link to the original data". You can't create links on MyComputer on - * Windows, so this flag shouldn't be set. Seems like a bug in Windows. As long as nobody - * depends on this bug, we probably shouldn't imitate it. */ dwFlags = 0xffffffff; hr = IShellFolder_GetAttributesOf(psfDesktop, 1, (LPCITEMIDLIST*)&pidlMyComputer, &dwFlags); @@ -780,9 +776,10 @@ static void test_GetAttributesOf(void) for (i = 0, foundFlagsMatch = FALSE; !foundFlagsMatch && i < sizeof(myComputerFlags) / sizeof(myComputerFlags[0]); i++) { - if (myComputerFlags[i] == (dwFlags & ~(DWORD)SFGAO_CANLINK)) + if ((myComputerFlags[i] | SFGAO_CANLINK) == dwFlags) foundFlagsMatch = TRUE; } + todo_wine ok (foundFlagsMatch, "Wrong MyComputer attributes: %08x\n", dwFlags); hr = IShellFolder_BindToObject(psfDesktop, pidlMyComputer, NULL, &IID_IShellFolder, (LPVOID*)&psfMyComputer); diff --git a/dlls/urlmon/Makefile.in b/dlls/urlmon/Makefile.in index 825eab256c6..bd6a2567f06 100644 --- a/dlls/urlmon/Makefile.in +++ b/dlls/urlmon/Makefile.in @@ -17,6 +17,7 @@ C_SRCS = \ gopher.c \ http.c \ internet.c \ + mimefilter.c \ mk.c \ protocol.c \ regsvr.c \ diff --git a/dlls/urlmon/mimefilter.c b/dlls/urlmon/mimefilter.c new file mode 100644 index 00000000000..ee6f50f238f --- /dev/null +++ b/dlls/urlmon/mimefilter.c @@ -0,0 +1,263 @@ +/* + * Copyright 2009 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "urlmon_main.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(urlmon); + +typedef struct { + const IInternetProtocolVtbl *lpIInternetProtocolVtbl; + const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; + + LONG ref; +} MimeFilter; + +#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolVtbl) +#define PROTOCOLSINK(x) ((IInternetProtocolSink*) &(x)->lpIInternetProtocolSinkVtbl) + +#define PROTOCOL_THIS(iface) DEFINE_THIS(MimeFilter, IInternetProtocol, iface) + +static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + + *ppv = NULL; + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { + TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { + TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); + *ppv = PROTOCOL(This); + }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { + TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); + *ppv = PROTOCOLSINK(This); + } + + if(*ppv) { + IInternetProtocol_AddRef(iface); + return S_OK; + } + + WARN("not supported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + LONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ref=%d\n", This, ref); + return ref; +} + +static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + heap_free(This); + + URLMON_UnlockModule(); + } + + return ref; +} + +static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, + IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, + DWORD grfPI, HANDLE_PTR dwReserved) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, + pOIBindInfo, grfPI, dwReserved); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%p)\n", This, pProtocolData); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, + DWORD dwOptions) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%08x)\n", This, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_Suspend(IInternetProtocol *iface) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv, + ULONG cb, ULONG *pcbRead) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, + DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)->(%08x)\n", This, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterProtocol_UnlockRequest(IInternetProtocol *iface) +{ + MimeFilter *This = PROTOCOL_THIS(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +#undef PROTOCOL_THIS + +static const IInternetProtocolVtbl MimeFilterProtocolVtbl = { + MimeFilterProtocol_QueryInterface, + MimeFilterProtocol_AddRef, + MimeFilterProtocol_Release, + MimeFilterProtocol_Start, + MimeFilterProtocol_Continue, + MimeFilterProtocol_Abort, + MimeFilterProtocol_Terminate, + MimeFilterProtocol_Suspend, + MimeFilterProtocol_Resume, + MimeFilterProtocol_Read, + MimeFilterProtocol_Seek, + MimeFilterProtocol_LockRequest, + MimeFilterProtocol_UnlockRequest +}; + +#define PROTSINK_THIS(iface) DEFINE_THIS(MimeFilter, IInternetProtocolSink, iface) + +static HRESULT WINAPI MimeFilterSink_QueryInterface(IInternetProtocolSink *iface, + REFIID riid, void **ppv) +{ + MimeFilter *This = PROTSINK_THIS(iface); + return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); +} + +static ULONG WINAPI MimeFilterSink_AddRef(IInternetProtocolSink *iface) +{ + MimeFilter *This = PROTSINK_THIS(iface); + return IInternetProtocol_AddRef(PROTOCOL(This)); +} + +static ULONG WINAPI MimeFilterSink_Release(IInternetProtocolSink *iface) +{ + MimeFilter *This = PROTSINK_THIS(iface); + return IInternetProtocol_Release(PROTOCOL(This)); +} + +static HRESULT WINAPI MimeFilterSink_Switch(IInternetProtocolSink *iface, + PROTOCOLDATA *pProtocolData) +{ + MimeFilter *This = PROTSINK_THIS(iface); + FIXME("(%p)->(%p)\n", This, pProtocolData); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterSink_ReportProgress(IInternetProtocolSink *iface, + ULONG ulStatusCode, LPCWSTR szStatusText) +{ + MimeFilter *This = PROTSINK_THIS(iface); + FIXME("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterSink_ReportData(IInternetProtocolSink *iface, + DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) +{ + MimeFilter *This = PROTSINK_THIS(iface); + FIXME("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeFilterSink_ReportResult(IInternetProtocolSink *iface, + HRESULT hrResult, DWORD dwError, LPCWSTR szResult) +{ + MimeFilter *This = PROTSINK_THIS(iface); + FIXME("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); + return E_NOTIMPL; +} + +#undef PROTSINK_THIS + +static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { + MimeFilterSink_QueryInterface, + MimeFilterSink_AddRef, + MimeFilterSink_Release, + MimeFilterSink_Switch, + MimeFilterSink_ReportProgress, + MimeFilterSink_ReportData, + MimeFilterSink_ReportResult +}; + +HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) +{ + MimeFilter *ret; + + TRACE("(%p %p)\n", pUnkOuter, ppobj); + + URLMON_LockModule(); + + ret = heap_alloc_zero(sizeof(MimeFilter)); + + ret->lpIInternetProtocolVtbl = &MimeFilterProtocolVtbl; + ret->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; + ret->ref = 1; + + *ppobj = PROTOCOL(ret); + return S_OK; +} diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index cc9d41a3479..ea19c778eaa 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -84,6 +84,7 @@ DEFINE_EXPECT(GetBindString_USER_AGENT); DEFINE_EXPECT(GetBindString_POST_COOKIE); DEFINE_EXPECT(QueryService_HttpNegotiate); DEFINE_EXPECT(QueryService_InternetProtocol); +DEFINE_EXPECT(QueryService_HttpSecurity); DEFINE_EXPECT(BeginningTransaction); DEFINE_EXPECT(GetRootSecurityId); DEFINE_EXPECT(OnResponse); @@ -123,6 +124,7 @@ static HANDLE event_complete, event_complete2; static BOOL binding_test; static PROTOCOLDATA protocoldata, *pdata; static DWORD prot_read; +static BOOL security_problem = FALSE; static enum { FILE_TEST, @@ -182,6 +184,60 @@ static int strcmp_wa(LPCWSTR strw, const char *stra) return lstrcmpW(strw, buf); } +static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(&IID_IUnknown, riid) + || IsEqualGUID(&IID_IHttpSecurity, riid)) { + *ppv = iface; + return S_OK; + } + + ok(0, "unexpected call\n"); + return E_NOINTERFACE; +} + +static ULONG WINAPI HttpSecurity_AddRef(IHttpSecurity *iface) +{ + return 2; +} + +static ULONG WINAPI HttpSecurity_Release(IHttpSecurity *iface) +{ + return 1; +} + +static HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity* iface, REFGUID rguidReason, HWND *phwnd) +{ + trace("HttpSecurity_GetWindow\n"); + + return S_FALSE; +} + +static HRESULT WINAPI HttpSecurity_OnSecurityProblem(IHttpSecurity *iface, DWORD dwProblem) +{ + trace("Security problem: %u\n", dwProblem); + ok(dwProblem == ERROR_INTERNET_SEC_CERT_REV_FAILED, "Expected ERROR_INTERNET_SEC_CERT_REV_FAILED got %u\n", dwProblem); + + /* Only retry once */ + if (security_problem) + return E_ABORT; + + security_problem = TRUE; + SET_EXPECT(BeginningTransaction); + + return RPC_E_RETRY; +} + +static IHttpSecurityVtbl HttpSecurityVtbl = { + HttpSecurity_QueryInterface, + HttpSecurity_AddRef, + HttpSecurity_Release, + HttpSecurity_GetWindow, + HttpSecurity_OnSecurityProblem +}; + +static IHttpSecurity http_security = { &HttpSecurityVtbl }; + static HRESULT WINAPI HttpNegotiate_QueryInterface(IHttpNegotiate2 *iface, REFIID riid, void **ppv) { if(IsEqualGUID(&IID_IUnknown, riid) @@ -320,6 +376,12 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFG return E_NOINTERFACE; } + if(IsEqualGUID(&IID_IHttpSecurity, guidService)) { + ok(IsEqualGUID(&IID_IHttpSecurity, riid), "unexpected riid\n"); + CHECK_EXPECT(QueryService_HttpSecurity); + return IHttpSecurity_QueryInterface(&http_security, riid, ppv); + } + ok(0, "unexpected service %s\n", debugstr_guid(guidService)); return E_FAIL; } @@ -380,7 +442,7 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL } if(tested_protocol == FTP_TEST) todo_wine CHECK_CALLED(ReportProgress_SENDINGREQUEST); - else + else if (tested_protocol != HTTPS_TEST) CHECK_CALLED(ReportProgress_SENDINGREQUEST); if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) { SET_EXPECT(OnResponse); @@ -397,18 +459,26 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL ok(hres == S_OK, "Continue failed: %08x\n", hres); if(tested_protocol == FTP_TEST) CLEAR_CALLED(ReportData); - else + else if (! security_problem) CHECK_CALLED(ReportData); if (!state) { - state = 1; - if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) { - CHECK_CALLED(OnResponse); - if(tested_protocol == HTTPS_TEST) - CHECK_CALLED(ReportProgress_ACCEPTRANGES); - CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE); - if(bindf & BINDF_NEEDFILE) - CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE); + if (! security_problem) + { + state = 1; + if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) { + CHECK_CALLED(OnResponse); + if(tested_protocol == HTTPS_TEST) + CHECK_CALLED(ReportProgress_ACCEPTRANGES); + CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE); + if(bindf & BINDF_NEEDFILE) + CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE); + } + } + else + { + security_problem = FALSE; + SET_EXPECT(ReportProgress_CONNECTING); } } @@ -466,11 +536,11 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, } break; case BINDSTATUS_FINDINGRESOURCE: - CHECK_EXPECT(ReportProgress_FINDINGRESOURCE); + CHECK_EXPECT2(ReportProgress_FINDINGRESOURCE); ok(szStatusText != NULL, "szStatusText == NULL\n"); break; case BINDSTATUS_CONNECTING: - CHECK_EXPECT(ReportProgress_CONNECTING); + CHECK_EXPECT2(ReportProgress_CONNECTING); ok(szStatusText != NULL, "szStatusText == NULL\n"); break; case BINDSTATUS_SENDINGREQUEST: @@ -1672,6 +1742,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_https, BOOL is_first) SET_EXPECT(ReportProgress_PROXYDETECTING); if(! is_https) SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE); + else + SET_EXPECT(QueryService_HttpSecurity); if(!(bindf & BINDF_FROMURLMON)) { SET_EXPECT(OnResponse); SET_EXPECT(ReportProgress_RAWMIMETYPE); @@ -1695,6 +1767,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_https, BOOL is_first) CHECK_CALLED(Switch); else CHECK_CALLED(ReportData); + if (is_https) + CLEAR_CALLED(QueryService_HttpSecurity); while(1) { if(bindf & BINDF_FROMURLMON) @@ -1721,6 +1795,8 @@ static void test_http_protocol_url(LPCWSTR url, BOOL is_https, BOOL is_first) } ok(hres == S_FALSE, "Read failed: %08x\n", hres); CHECK_CALLED(ReportResult); + if (is_https) + CLEAR_CALLED(ReportProgress_SENDINGREQUEST); test_protocol_terminate(async_protocol); ref = IInternetProtocol_Release(async_protocol); diff --git a/dlls/urlmon/umon.c b/dlls/urlmon/umon.c index fe60c754716..e6e20b9d11c 100644 --- a/dlls/urlmon/umon.c +++ b/dlls/urlmon/umon.c @@ -20,13 +20,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include - #include "urlmon_main.h" #include "winreg.h" -#include "winternl.h" -#include "wininet.h" #include "shlwapi.h" #include "wine/debug.h" diff --git a/dlls/urlmon/urlmon_main.c b/dlls/urlmon/urlmon_main.c index ad1b07bd6f4..8561937643a 100644 --- a/dlls/urlmon/urlmon_main.c +++ b/dlls/urlmon/urlmon_main.c @@ -187,6 +187,8 @@ static const ClassFactory ZoneManagerCF = { &ClassFactoryVtbl, ZoneMgrImpl_Construct}; static const ClassFactory StdURLMonikerCF = { &ClassFactoryVtbl, StdURLMoniker_Construct}; +static const ClassFactory MimeFilterCF = + { &ClassFactoryVtbl, MimeFilter_Construct}; struct object_creation_info { @@ -212,7 +214,8 @@ static const struct object_creation_info object_creation[] = { &CLSID_MkProtocol, CLASSFACTORY(&MkProtocolCF), wszMk }, { &CLSID_InternetSecurityManager, CLASSFACTORY(&SecurityManagerCF), NULL }, { &CLSID_InternetZoneManager, CLASSFACTORY(&ZoneManagerCF), NULL }, - { &CLSID_StdURLMoniker, CLASSFACTORY(&StdURLMonikerCF), NULL } + { &CLSID_StdURLMoniker, CLASSFACTORY(&StdURLMonikerCF), NULL }, + { &CLSID_DeCompMimeFilter, CLASSFACTORY(&MimeFilterCF), NULL } }; static void init_session(BOOL init) diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h index 0d9a9669136..1ee2eec313e 100644 --- a/dlls/urlmon/urlmon_main.h +++ b/dlls/urlmon/urlmon_main.h @@ -45,6 +45,7 @@ extern HRESULT HttpSProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); extern HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); extern HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); extern HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); +extern HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); /********************************************************************** * Dll lifetime tracking declaration for urlmon.dll diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 794f1e32353..5d3bd76df68 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -688,7 +688,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD if (shader_is_pshader_version(ins->reg_maps->shader_version)) { IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)ins->shader; - gen_color_correction(buffer, dst_str, ins->dst[0].token & WINED3DSP_WRITEMASK_ALL, + gen_color_correction(buffer, dst_str, ins->dst[0].write_mask, "one", "coefmul.x", ps->cur_args->color_fixup[sampler_idx]); } } @@ -1019,7 +1019,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) if ((WINED3DSHADER_VERSION_MAJOR(ins->reg_maps->shader_version) == 1 && !shader_is_pshader_version(ins->reg_maps->shader_version) - && shader_get_regtype(ins->dst[0].token) == WINED3DSPR_ADDR) + && ins->dst[0].register_type == WINED3DSPR_ADDR) || ins->handler_idx == WINED3DSIH_MOVA) { SHADER_BUFFER *buffer = ins->buffer; @@ -1584,10 +1584,10 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) break; } + tmp_dst = ins->dst[0]; for (i = 0; i < nComponents; i++) { - tmp_dst.register_idx = ins->dst[0].register_idx; - tmp_dst.modifiers = ins->dst[0].modifiers; - tmp_dst.token = ((ins->dst[0].token) & ~WINED3DSP_WRITEMASK_ALL) | (WINED3DSP_WRITEMASK_0 << i); + tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i; + tmp_dst.token = (tmp_dst.token & ~WINED3DSP_WRITEMASK_ALL) | tmp_dst.write_mask; tmp_ins.src[1] = ins->src[1]+i; shader_hw_map2gl(&tmp_ins); } diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index ed6c069456e..57f65a46638 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -850,7 +850,10 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer, { dst_param.addr_token = 0; pToken += shader_get_param(pToken, shader_version, &dst_param.token, &dst_param.addr_token); + dst_param.register_type = ((dst_param.token & WINED3DSP_REGTYPE_MASK) >> WINED3DSP_REGTYPE_SHIFT) + | ((dst_param.token & WINED3DSP_REGTYPE_MASK2) >> WINED3DSP_REGTYPE_SHIFT2); dst_param.register_idx = dst_param.token & WINED3DSP_REGNUM_MASK; + dst_param.write_mask = dst_param.token & WINED3DSP_WRITEMASK_ALL; dst_param.modifiers = dst_param.token & WINED3DSP_DSTMOD_MASK; } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index e18224dea5d..94ce5f22c17 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1184,7 +1184,8 @@ static DWORD shader_glsl_get_write_mask(const DWORD param, char *write_mask) { char *ptr = write_mask; DWORD mask = param & WINED3DSP_WRITEMASK_ALL; - if (shader_is_scalar(param)) { + if (shader_is_scalar(shader_get_regtype(param), param & WINED3DSP_REGNUM_MASK)) + { mask = WINED3DSP_WRITEMASK_0; } else { *ptr++ = '.'; @@ -1218,7 +1219,8 @@ static void shader_glsl_get_swizzle(const DWORD param, BOOL fixup, DWORD mask, c const char *swizzle_chars = fixup ? "zyxw" : "xyzw"; char *ptr = swizzle_str; - if (!shader_is_scalar(param)) { + if (!shader_is_scalar(shader_get_regtype(param), param & WINED3DSP_REGNUM_MASK)) + { *ptr++ = '.'; /* swizzle bits fields: wwzzyyxx */ if (mask & WINED3DSP_WRITEMASK_0) *ptr++ = swizzle_chars[swizzle & 0x03]; @@ -1435,18 +1437,18 @@ static void shader_glsl_append_fixup_arg(char *arguments, const char *reg_name, static void shader_glsl_color_correction(const struct wined3d_shader_instruction *ins, struct color_fixup_desc fixup) { + struct wined3d_shader_dst_param dst; unsigned int mask_size, remaining; glsl_dst_param_t dst_param; char arguments[256]; DWORD mask; - BOOL dummy; mask = 0; if (fixup.x_sign_fixup || fixup.x_source != CHANNEL_SOURCE_X) mask |= WINED3DSP_WRITEMASK_0; if (fixup.y_sign_fixup || fixup.y_source != CHANNEL_SOURCE_Y) mask |= WINED3DSP_WRITEMASK_1; if (fixup.z_sign_fixup || fixup.z_source != CHANNEL_SOURCE_Z) mask |= WINED3DSP_WRITEMASK_2; if (fixup.w_sign_fixup || fixup.w_source != CHANNEL_SOURCE_W) mask |= WINED3DSP_WRITEMASK_3; - mask &= ins->dst[0].token; + mask &= ins->dst[0].write_mask; if (!mask) return; /* Nothing to do */ @@ -1459,11 +1461,10 @@ static void shader_glsl_color_correction(const struct wined3d_shader_instruction mask_size = shader_glsl_get_write_mask_size(mask); - dst_param.mask_str[0] = '\0'; - shader_glsl_get_write_mask(mask, dst_param.mask_str); - - dst_param.reg_name[0] = '\0'; - shader_glsl_get_register_name(ins->dst[0].token, ins->dst[0].addr_token, dst_param.reg_name, &dummy, ins); + dst = ins->dst[0]; + dst.write_mask = mask; + dst.token = (dst.token & ~WINED3DSP_WRITEMASK_ALL) | dst.write_mask; + shader_glsl_add_dst_param(ins, &dst, &dst_param); arguments[0] = '\0'; remaining = mask_size; @@ -1509,7 +1510,7 @@ static void PRINTF_ATTR(6, 7) shader_glsl_gen_sample_code(const struct wined3d_s BOOL rect_fixup = FALSE; va_list args; - shader_glsl_get_swizzle(swizzle, FALSE, ins->dst[0].token, dst_swizzle); + shader_glsl_get_swizzle(swizzle, FALSE, ins->dst[0].write_mask, dst_swizzle); if (shader_is_pshader_version(ins->reg_maps->shader_version)) { @@ -1599,7 +1600,7 @@ static void shader_glsl_mov(const struct wined3d_shader_instruction *ins) * shader versions WINED3DSIO_MOVA is used for this. */ if ((WINED3DSHADER_VERSION_MAJOR(ins->reg_maps->shader_version) == 1 && !shader_is_pshader_version(ins->reg_maps->shader_version) - && shader_get_regtype(ins->dst[0].token) == WINED3DSPR_ADDR)) + && ins->dst[0].register_type == WINED3DSPR_ADDR)) { /* This is a simple floor() */ unsigned int mask_size = shader_glsl_get_write_mask_size(write_mask); @@ -1900,7 +1901,7 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) char mask_char[6]; BOOL temp_destination = FALSE; - if (shader_is_scalar(ins->src[0])) + if (shader_is_scalar(shader_get_regtype(ins->src[0]), ins->src[0] & WINED3DSP_REGNUM_MASK)) { write_mask = shader_glsl_append_dst(ins->buffer, ins); @@ -1918,7 +1919,9 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) DWORD src1regtype = shader_get_regtype(ins->src[1]); DWORD src2regtype = shader_get_regtype(ins->src[2]); DWORD dstreg = ins->dst[0].register_idx; - DWORD dstregtype = shader_get_regtype(ins->dst[0].token); + DWORD dstregtype = ins->dst[0].register_type; + DWORD dst_mask = ins->dst[0].write_mask; + struct wined3d_shader_dst_param dst = ins->dst[0]; /* Cycle through all source0 channels */ for (i=0; i<4; i++) { @@ -1932,22 +1935,22 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) } } + dst.write_mask = dst_mask & write_mask; + dst.token = (dst.token & ~WINED3DSP_WRITEMASK_ALL) | dst.write_mask; + /* Splitting the cmp instruction up in multiple lines imposes a problem: * The first lines may overwrite source parameters of the following lines. * Deal with that by using a temporary destination register if needed */ - if((src0reg == dstreg && src0regtype == dstregtype) || - (src1reg == dstreg && src1regtype == dstregtype) || - (src2reg == dstreg && src2regtype == dstregtype)) { - - write_mask = shader_glsl_get_write_mask(ins->dst[0].token & (~WINED3DSP_WRITEMASK_ALL | write_mask), - mask_char); + if ((src0reg == dstreg && src0regtype == dstregtype) + || (src1reg == dstreg && src1regtype == dstregtype) + || (src2reg == dstreg && src2regtype == dstregtype)) + { + write_mask = shader_glsl_get_write_mask(dst.token, mask_char); if (!write_mask) continue; shader_addline(ins->buffer, "tmp0%s = (", mask_char); temp_destination = TRUE; } else { - struct wined3d_shader_dst_param dst = ins->dst[0]; - dst.token &= ~WINED3DSP_WRITEMASK_ALL | write_mask; write_mask = shader_glsl_append_dst_ext(ins->buffer, ins, &dst); if (!write_mask) continue; } @@ -1974,11 +1977,13 @@ static void shader_glsl_cmp(const struct wined3d_shader_instruction *ins) * the compare is done per component of src0. */ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins) { + struct wined3d_shader_dst_param dst; glsl_src_param_t src0_param; glsl_src_param_t src1_param; glsl_src_param_t src2_param; DWORD write_mask, cmp_channel = 0; unsigned int i, j; + DWORD dst_mask; if (ins->reg_maps->shader_version < WINED3DPS_VERSION(1, 4)) { @@ -1998,8 +2003,9 @@ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins) return; } /* Cycle through all source0 channels */ + dst_mask = ins->dst[0].write_mask; + dst = ins->dst[0]; for (i=0; i<4; i++) { - struct wined3d_shader_dst_param dst; write_mask = 0; /* Find the destination channels which use the current source0 channel */ for (j=0; j<4; j++) { @@ -2009,8 +2015,9 @@ static void shader_glsl_cnd(const struct wined3d_shader_instruction *ins) cmp_channel = WINED3DSP_WRITEMASK_0 << j; } } - dst = ins->dst[0]; - dst.token &= ~WINED3DSP_WRITEMASK_ALL | write_mask; + + dst.write_mask = dst_mask & write_mask; + dst.token = (dst.token & ~WINED3DSP_WRITEMASK_ALL) | dst.write_mask; write_mask = shader_glsl_append_dst_ext(ins->buffer, ins, &dst); if (!write_mask) continue; @@ -2087,11 +2094,11 @@ static void shader_glsl_mnxn(const struct wined3d_shader_instruction *ins) break; } + tmp_dst = ins->dst[0]; for (i = 0; i < nComponents; ++i) { - tmp_dst.register_idx = ins->dst[0].register_idx; - tmp_dst.modifiers = ins->dst[0].modifiers; - tmp_dst.token = ((ins->dst[0].token) & ~WINED3DSP_WRITEMASK_ALL) | (WINED3DSP_WRITEMASK_0 << i); + tmp_dst.write_mask = WINED3DSP_WRITEMASK_0 << i; + tmp_dst.token = (tmp_dst.token & ~WINED3DSP_WRITEMASK_ALL) | tmp_dst.write_mask; tmp_ins.src[1] = ins->src[1] + i; shader_glsl_dot(&tmp_ins); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index ff03d3d788e..6593908ead4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -452,7 +452,9 @@ typedef struct SHADER_OPCODE struct wined3d_shader_dst_param { + WINED3DSHADER_PARAM_REGISTER_TYPE register_type; UINT register_idx; + DWORD write_mask; DWORD modifiers; DWORD token; DWORD addr_token; @@ -2385,16 +2387,13 @@ static inline BOOL shader_is_comment(DWORD token) { return WINED3DSIO_COMMENT == (token & WINED3DSI_OPCODE_MASK); } -static inline BOOL shader_is_scalar(DWORD param) { - DWORD reg_type = shader_get_regtype(param); - DWORD reg_num; - - switch (reg_type) { +static inline BOOL shader_is_scalar(WINED3DSHADER_PARAM_REGISTER_TYPE register_type, UINT register_idx) +{ + switch (register_type) + { case WINED3DSPR_RASTOUT: - if ((param & WINED3DSP_REGNUM_MASK) != 0) { - /* oFog & oPts */ - return TRUE; - } + /* oFog & oPts */ + if (register_idx != 0) return TRUE; /* oPos */ return FALSE; @@ -2405,8 +2404,8 @@ static inline BOOL shader_is_scalar(DWORD param) { return TRUE; case WINED3DSPR_MISCTYPE: - reg_num = param & WINED3DSP_REGNUM_MASK; - switch(reg_num) { + switch(register_idx) + { case 0: /* vPos */ return FALSE; case 1: /* vFace */ diff --git a/include/Makefile.in b/include/Makefile.in index 6c1878aede1..795e55ce611 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -473,6 +473,7 @@ SRCDIR_INCLUDES = \ wmistr.h \ wnaspi32.h \ wownt32.h \ + ws2def.h \ ws2ipdef.h \ ws2spi.h \ ws2tcpip.h \ diff --git a/include/winsock2.h b/include/winsock2.h index b73fde3734a..d54e8a894a0 100644 --- a/include/winsock2.h +++ b/include/winsock2.h @@ -47,6 +47,7 @@ #include #undef __WINE_WINSOCK2__ +#include #ifdef __cplusplus extern "C" { @@ -421,28 +422,6 @@ typedef struct _BLOB { } BLOB, *LPBLOB; #endif -#ifndef __CSADDR_DEFINED__ -#define __CSADDR_DEFINED__ - -typedef struct _SOCKET_ADDRESS { - LPSOCKADDR lpSockaddr; - INT iSockaddrLength; -} SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS; - -typedef struct _CSADDR_INFO { - SOCKET_ADDRESS LocalAddr; - SOCKET_ADDRESS RemoteAddr; - INT iSocketType; - INT iProtocol; -} CSADDR_INFO, *PCSADDR_INFO, *LPCSADDR_INFO; -#endif - -/*socket address list */ -typedef struct _SOCKET_ADDRESS_LIST { - INT iAddressCount; - SOCKET_ADDRESS Address[1]; -} SOCKET_ADDRESS_LIST, *LPSOCKET_ADDRESS_LIST; - /* addressfamily protocol pairs */ typedef struct _AFPROTOCOLS { INT iAddressFamily; diff --git a/include/ws2def.h b/include/ws2def.h new file mode 100644 index 00000000000..f2f72232be9 --- /dev/null +++ b/include/ws2def.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009 Robert Shearman + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef _WS2DEF_ +#define _WS2DEF_ + +/* FIXME: #include */ + +#ifdef USE_WS_PREFIX +#define WS(x) WS_##x +#else +#define WS(x) x +#endif + +#ifndef __CSADDR_DEFINED__ +#define __CSADDR_DEFINED__ + +typedef struct _SOCKET_ADDRESS { + LPSOCKADDR lpSockaddr; + INT iSockaddrLength; +} SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS; + +typedef struct _CSADDR_INFO { + SOCKET_ADDRESS LocalAddr; + SOCKET_ADDRESS RemoteAddr; + INT iSocketType; + INT iProtocol; +} CSADDR_INFO, *PCSADDR_INFO, *LPCSADDR_INFO; +#endif + +#ifdef USE_WS_PREFIX +#define WS__SS_MAXSIZE 128 +#define WS__SS_ALIGNSIZE (sizeof(__int64)) +#define WS__SS_PAD1SIZE (WS__SS_ALIGNSIZE - sizeof(short)) +#define WS__SS_PAD2SIZE (WS__SS_MAXSIZE - 2 * WS__SS_ALIGNSIZE) +#else +#define _SS_MAXSIZE 128 +#define _SS_ALIGNSIZE (sizeof(__int64)) +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(short)) +#define _SS_PAD2SIZE (_SS_MAXSIZE - 2 * _SS_ALIGNSIZE) +#endif + +typedef struct WS(sockaddr_storage) { + short ss_family; + char __ss_pad1[WS(_SS_PAD1SIZE)]; + __int64 __ss_align; + char __ss_pad2[WS(_SS_PAD2SIZE)]; +} SOCKADDR_STORAGE, *PSOCKADDR_STORAGE, *LPSOCKADDR_STORAGE; + +/*socket address list */ +typedef struct _SOCKET_ADDRESS_LIST { + INT iAddressCount; + SOCKET_ADDRESS Address[1]; +} SOCKET_ADDRESS_LIST, *LPSOCKET_ADDRESS_LIST; + +#endif /* _WS2DEF_ */ diff --git a/include/ws2ipdef.h b/include/ws2ipdef.h index 1fcfd27823b..c9c09709f58 100644 --- a/include/ws2ipdef.h +++ b/include/ws2ipdef.h @@ -261,8 +261,4 @@ struct WS(ip_msfilter) { #define WS_INET6_ADDRSTRLEN 65 #endif /* USE_WS_PREFIX */ -#ifdef __cplusplus -} -#endif - #endif /* __WS2IPDEF__ */ diff --git a/programs/winecfg/Fr.rc b/programs/winecfg/Fr.rc index 818c50ffa00..d72bafc3232 100644 --- a/programs/winecfg/Fr.rc +++ b/programs/winecfg/Fr.rc @@ -67,7 +67,7 @@ FONT 8, "MS Shell Dlg" BEGIN GROUPBOX " Paramètres des fenêtres ",IDC_STATIC,8,4,244,92 CONTROL "Permettre aux applications DirectX d'empêcher la souris de quitter leur fenêtre",IDC_DX_MOUSE_GRAB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP | BS_MULTILINE,15,20,230,16 - CONTROL "Allow the window manager to &decorate the windows",IDC_ENABLE_DECORATED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,40,230,8 + CONTROL "Permettre au gestionnaire de &fenêtres de &décorer les fenêtres",IDC_ENABLE_DECORATED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,40,230,8 CONTROL "Permettre au gestionnaire de &fenêtres de contrôler les fenêtres",IDC_ENABLE_MANAGED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,52,230,8 CONTROL "Émuler un bureau virtuel",IDC_ENABLE_DESKTOP,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,15,64,230,8 @@ -188,7 +188,7 @@ BEGIN COMBOBOX IDC_THEME_COLORCOMBO,15,48,112,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Taille :",IDC_THEME_SIZETEXT,135,40,110,8 COMBOBOX IDC_THEME_SIZECOMBO,135,48,110,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Item :",IDC_STATIC,15,64,112,8 + LTEXT "Elément :",IDC_STATIC,15,64,112,8 COMBOBOX IDC_SYSPARAM_COMBO,15,74,112,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT LTEXT "Couleur :",IDC_SYSPARAM_COLOR_TEXT,135,64,25,8,WS_DISABLED PUSHBUTTON "",IDC_SYSPARAM_COLOR,135,74,25,13,WS_DISABLED | BS_OWNERDRAW diff --git a/programs/wordpad/print.c b/programs/wordpad/print.c index 2aa642fc3d6..a62f955ff61 100644 --- a/programs/wordpad/print.c +++ b/programs/wordpad/print.c @@ -489,7 +489,7 @@ BOOL preview_isactive(void) return preview.page != 0; } -static void add_ruler_units(HDC hdcRuler, RECT* drawRect, BOOL NewMetrics, long EditLeftmost) +static void add_ruler_units(HDC hdcRuler, RECT* drawRect, BOOL NewMetrics, LONG EditLeftmost) { static HDC hdc; @@ -564,7 +564,7 @@ static void add_ruler_units(HDC hdcRuler, RECT* drawRect, BOOL NewMetrics, long BitBlt(hdcRuler, 0, 0, drawRect->right, drawRect->bottom, hdc, 0, 0, SRCAND); } -static void paint_ruler(HWND hWnd, long EditLeftmost, BOOL NewMetrics) +static void paint_ruler(HWND hWnd, LONG EditLeftmost, BOOL NewMetrics) { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); @@ -603,7 +603,7 @@ static void paint_ruler(HWND hWnd, long EditLeftmost, BOOL NewMetrics) LRESULT CALLBACK ruler_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static WNDPROC pPrevRulerProc; - static long EditLeftmost; + static LONG EditLeftmost; static BOOL NewMetrics; switch(msg) diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index c74d140c7ff..a8a7fb074b0 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -2233,7 +2233,7 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) case ID_EDIT_READONLY: { - long nStyle = GetWindowLong(hwndEditor, GWL_STYLE); + LONG nStyle = GetWindowLong(hwndEditor, GWL_STYLE); if (nStyle & ES_READONLY) SendMessageW(hwndEditor, EM_SETREADONLY, 0, 0); else -- 2.11.4.GIT