ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2007
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
707 discussions
Start a n
N
ew thread
[winesync] 27919: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 14:11:12 2007 New Revision: 27919 URL:
http://svn.reactos.org/svn/reactos?rev=27919&view=rev
Log: Autosyncing with Wine HEAD Added: trunk/reactos/dll/win32/urlmon/bindprot.c (with props) trunk/reactos/dll/win32/urlmon/mk.c (with props) Modified: trunk/reactos/dll/win32/urlmon/binding.c trunk/reactos/dll/win32/urlmon/file.c trunk/reactos/dll/win32/urlmon/format.c trunk/reactos/dll/win32/urlmon/ftp.c trunk/reactos/dll/win32/urlmon/http.c trunk/reactos/dll/win32/urlmon/internet.c trunk/reactos/dll/win32/urlmon/regsvr.c trunk/reactos/dll/win32/urlmon/rsrc.rc trunk/reactos/dll/win32/urlmon/sec_mgr.c trunk/reactos/dll/win32/urlmon/session.c trunk/reactos/dll/win32/urlmon/umon.c trunk/reactos/dll/win32/urlmon/umstream.c trunk/reactos/dll/win32/urlmon/urlmon.rbuild trunk/reactos/dll/win32/urlmon/urlmon.spec trunk/reactos/dll/win32/urlmon/urlmon_main.c trunk/reactos/dll/win32/urlmon/urlmon_main.h trunk/reactos/dll/win32/urlmon/version.rc [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/urlmon/binding.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/binding.c…
Added: trunk/reactos/dll/win32/urlmon/bindprot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/bindprot.…
Modified: trunk/reactos/dll/win32/urlmon/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/file.c?re…
Modified: trunk/reactos/dll/win32/urlmon/format.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/format.c?…
Modified: trunk/reactos/dll/win32/urlmon/ftp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/ftp.c?rev…
Modified: trunk/reactos/dll/win32/urlmon/http.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/http.c?re…
Modified: trunk/reactos/dll/win32/urlmon/internet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/internet.…
Added: trunk/reactos/dll/win32/urlmon/mk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/mk.c?rev=…
Modified: trunk/reactos/dll/win32/urlmon/regsvr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/regsvr.c?…
Modified: trunk/reactos/dll/win32/urlmon/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/rsrc.rc?r…
Modified: trunk/reactos/dll/win32/urlmon/sec_mgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/sec_mgr.c…
Modified: trunk/reactos/dll/win32/urlmon/session.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/session.c…
Modified: trunk/reactos/dll/win32/urlmon/umon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/umon.c?re…
Modified: trunk/reactos/dll/win32/urlmon/umstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/umstream.…
Modified: trunk/reactos/dll/win32/urlmon/urlmon.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon.rb…
Modified: trunk/reactos/dll/win32/urlmon/urlmon.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon.sp…
Modified: trunk/reactos/dll/win32/urlmon/urlmon_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon_ma…
Modified: trunk/reactos/dll/win32/urlmon/urlmon_main.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon_ma…
Modified: trunk/reactos/dll/win32/urlmon/version.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/version.r…
17 years, 3 months
1
0
0
0
[winesync] 27918: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 14:07:14 2007 New Revision: 27918 URL:
http://svn.reactos.org/svn/reactos?rev=27918&view=rev
Log: Autosyncing with Wine HEAD Removed: trunk/reactos/dll/win32/shfolder/shfolder_main.c Modified: trunk/reactos/dll/win32/shfolder/shfolder.rbuild Modified: trunk/reactos/dll/win32/shfolder/shfolder.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shfolder/shfolde…
============================================================================== --- trunk/reactos/dll/win32/shfolder/shfolder.rbuild (original) +++ trunk/reactos/dll/win32/shfolder/shfolder.rbuild Fri Jul 27 14:07:14 2007 @@ -12,7 +12,6 @@ <library>shell32</library> <library>kernel32</library> <library>ntdll</library> - <file>shfolder_main.c</file> <file>version.rc</file> <file>shfolder.spec</file> </module> Removed: trunk/reactos/dll/win32/shfolder/shfolder_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shfolder/shfolde…
============================================================================== --- trunk/reactos/dll/win32/shfolder/shfolder_main.c (original) +++ trunk/reactos/dll/win32/shfolder/shfolder_main.c (removed) @@ -1,1 +1,0 @@ -/* nothing here yet */
17 years, 3 months
1
0
0
0
[winesync] 27917: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 14:05:21 2007 New Revision: 27917 URL:
http://svn.reactos.org/svn/reactos?rev=27917&view=rev
Log: Autosyncing with Wine HEAD Modified: trunk/reactos/dll/win32/riched20/caret.c trunk/reactos/dll/win32/riched20/editor.c trunk/reactos/dll/win32/riched20/editstr.h trunk/reactos/dll/win32/riched20/reader.c trunk/reactos/dll/win32/riched20/riched20.rbuild trunk/reactos/dll/win32/riched20/string.c trunk/reactos/dll/win32/riched20/txtsrv.c Modified: trunk/reactos/dll/win32/riched20/caret.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/caret.c…
============================================================================== --- trunk/reactos/dll/win32/riched20/caret.c (original) +++ trunk/reactos/dll/win32/riched20/caret.c Fri Jul 27 14:05:21 2007 @@ -232,21 +232,28 @@ ME_WrapMarkedParagraphs(editor); ME_GetCursorCoordinates(editor, &editor->pCursors[0], &x, &y, &height); - CreateCaret(editor->hWnd, NULL, 0, height); - SetCaretPos(x, y); + if(editor->bHaveFocus) + { + CreateCaret(editor->hWnd, NULL, 0, height); + SetCaretPos(x, y); + } } void ME_ShowCaret(ME_TextEditor *ed) { ME_MoveCaret(ed); - ShowCaret(ed->hWnd); + if(ed->bHaveFocus) + ShowCaret(ed->hWnd); } void ME_HideCaret(ME_TextEditor *ed) { - HideCaret(ed->hWnd); - DestroyCaret(); + if(ed->bHaveFocus) + { + HideCaret(ed->hWnd); + DestroyCaret(); + } } void ME_InternalDeleteText(ME_TextEditor *editor, int nOfs, @@ -366,6 +373,8 @@ int nChars) { assert(nCursor>=0 && nCursor<editor->nCursors); + /* text operations set modified state */ + editor->nModifyStep = 1; ME_InternalDeleteText(editor, ME_GetCursorOfs(editor, nCursor), nChars); } Modified: trunk/reactos/dll/win32/riched20/editor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/editor.…
============================================================================== --- trunk/reactos/dll/win32/riched20/editor.c (original) +++ trunk/reactos/dll/win32/riched20/editor.c Fri Jul 27 14:05:21 2007 @@ -66,7 +66,7 @@ + EM_GETSELTEXT (ANSI&Unicode) + EM_GETSCROLLPOS 3.0 (only Y value valid) ! - EM_GETTHUMB - - EM_GETTEXTEX 2.0 + + EM_GETTEXTEX 2.0 + EM_GETTEXTLENGTHEX (GTL_PRECISE unimplemented) - EM_GETTEXTMODE 2.0 ? + EM_GETTEXTRANGE (ANSI&Unicode) @@ -114,7 +114,7 @@ + EM_SETSCROLLPOS 3.0 - EM_SETTABSTOPS 3.0 - EM_SETTARGETDEVICE - + EM_SETTEXTEX 3.0 (unicode only, no rich text insertion handling, proper style?) + + EM_SETTEXTEX 3.0 (no rich text insertion handling, proper style?) - EM_SETTEXTMODE 2.0 - EM_SETTYPOGRAPHYOPTIONS 3.0 + EM_SETUNDOLIMIT 2.0 @@ -226,9 +226,8 @@ #include "winreg.h" #define NO_SHLWAPI_STREAM #include "shlwapi.h" +#include "rtf.h" #include "imm.h" -#include "textserv.h" -#include "rtf.h" #define STACK_SIZE_DEFAULT 100 #define STACK_SIZE_MAX 1000 @@ -1155,6 +1154,7 @@ ed->lpOleCallback = NULL; ed->mode = TM_RICHTEXT | TM_MULTILEVELUNDO | TM_MULTICODEPAGE; ed->AutoURLDetect_bEnable = FALSE; + ed->bHaveFocus = FALSE; GetClientRect(hWnd, &ed->rcFormat); for (i=0; i<HFONT_CACHE_SIZE; i++) { @@ -1418,7 +1418,7 @@ { ME_TextEditor *editor = (ME_TextEditor *)GetWindowLongPtrW(hWnd, 0); - TRACE("hwnd %p msg %04x (%s) %x %lx, unicode %d\n", + TRACE("hwnd %p msg %04x (%s) %lx %lx, unicode %d\n", hWnd, msg, get_msg_name(msg), wParam, lParam, unicode); if (!editor && msg != WM_NCCREATE && msg != WM_NCDESTROY) { @@ -1520,7 +1520,7 @@ editor->nUndoLimit = min(wParam, STACK_SIZE_MAX); /* Setting a max stack size keeps wine from getting killed for hogging memory. Windows allocates all this memory at once, so - no program would realistically set a value above our maxiumum. */ + no program would realistically set a value above our maximum. */ return editor->nUndoLimit; } case EM_CANUNDO: @@ -1635,17 +1635,23 @@ } case EM_SETTEXTEX: { - LPWSTR wszText = (LPWSTR)lParam; + LPWSTR wszText; SETTEXTEX *pStruct = (SETTEXTEX *)wParam; - size_t len = wszText ? lstrlenW(wszText) : 0; + size_t len; int from, to; ME_Style *style; int oldModify = editor->nModifyStep; - TRACE("EM_SETTEXTEX - %s, flags %d, cp %d\n", debugstr_w(wszText), (int)pStruct->flags, pStruct->codepage); - if (pStruct->codepage != 1200) { - FIXME("EM_SETTEXTEX only supports unicode right now!\n"); - return 0; - } + + if (!pStruct) return 0; + + TRACE("EM_SETTEXTEX - %s, flags %d, cp %d\n", + pStruct->codepage == 1200 ? debugstr_w((LPCWSTR)lParam) : debugstr_a((LPCSTR)lParam), + pStruct->flags, pStruct->codepage); + + /* FIXME: make use of pStruct->codepage in the to unicode translation */ + wszText = lParam ? ME_ToUnicode(pStruct->codepage == 1200, (void *)lParam) : NULL; + len = wszText ? lstrlenW(wszText) : 0; + /* FIXME: this should support RTF strings too, according to MSDN */ if (pStruct->flags & ST_SELECTION) { ME_GetSelection(editor, &from, &to); @@ -2001,7 +2007,7 @@ nStart = 0; nCount = ex->cb - 1; } - if (ex->codepage == 1200 || unicode) + if (ex->codepage == 1200) { nCount = min(nCount, ex->cb / sizeof(WCHAR) - 1); return ME_GetTextW(editor, (LPWSTR)lParam, nStart, nCount, ex->flags & GT_USECRLF); @@ -2018,6 +2024,7 @@ buflen = ME_GetTextW(editor, buffer, nStart, nCount, ex->flags & GT_USECRLF); rc = WideCharToMultiByte(ex->codepage, flags, buffer, -1, (LPSTR)lParam, ex->cb, ex->lpDefaultChar, ex->lpUsedDefaultChar); + if (rc) rc--; /* do not count 0 terminator */ richedit_free(buffer); return rc; @@ -2183,7 +2190,7 @@ nNextLineOfs = ME_FindItemFwd(item, diParagraphOrEnd)->member.para.nCharOfs - (editor->bEmulateVersion10?2:1); nChars = nNextLineOfs - nThisLineOfs; - TRACE("EM_LINELENGTH(%d)==%d\n",wParam, nChars); + TRACE("EM_LINELENGTH(%ld)==%d\n",wParam, nChars); return nChars; } case EM_EXLIMITTEXT: @@ -2330,11 +2337,13 @@ } break; case WM_SETFOCUS: + editor->bHaveFocus = TRUE; ME_ShowCaret(editor); ME_SendOldNotify(editor, EN_SETFOCUS); return 0; case WM_KILLFOCUS: ME_HideCaret(editor); + editor->bHaveFocus = FALSE; ME_SendOldNotify(editor, EN_KILLFOCUS); return 0; case WM_ERASEBKGND: @@ -2507,6 +2516,64 @@ ME_RewrapRepaint(editor); return DefWindowProcW(hWnd, msg, wParam, lParam); } + /* IME messages to make richedit controls IME aware */ + case WM_IME_SETCONTEXT: + case WM_IME_CONTROL: + case WM_IME_SELECT: + case WM_IME_COMPOSITIONFULL: + return 0; + case WM_IME_STARTCOMPOSITION: + { + editor->imeStartIndex=ME_GetCursorOfs(editor,0); + ME_DeleteSelection(editor); + ME_CommitUndo(editor); + ME_UpdateRepaint(editor); + return 0; + } + case WM_IME_COMPOSITION: + { + HIMC hIMC; + + ME_Style *style = ME_GetInsertStyle(editor, 0); + hIMC = ImmGetContext(hWnd); + ME_DeleteSelection(editor); + ME_CommitUndo(editor); + ME_SaveTempStyle(editor); + if (lParam & GCS_RESULTSTR) + { + LPWSTR lpCompStr = NULL; + DWORD dwBufLen; + + dwBufLen = ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, NULL, 0); + lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR)); + ImmGetCompositionStringW(hIMC, GCS_RESULTSTR, lpCompStr, dwBufLen); + lpCompStr[dwBufLen/sizeof(WCHAR)] = 0; + ME_InsertTextFromCursor(editor,0,lpCompStr,dwBufLen/sizeof(WCHAR),style); + } + else if (lParam & GCS_COMPSTR) + { + LPWSTR lpCompStr = NULL; + DWORD dwBufLen; + + dwBufLen = ImmGetCompositionStringW(hIMC, GCS_COMPSTR, NULL, 0); + lpCompStr = HeapAlloc(GetProcessHeap(),0,dwBufLen + sizeof(WCHAR)); + ImmGetCompositionStringW(hIMC, GCS_COMPSTR, lpCompStr, dwBufLen); + lpCompStr[dwBufLen/sizeof(WCHAR)] = 0; + + ME_InsertTextFromCursor(editor,0,lpCompStr,dwBufLen/sizeof(WCHAR),style); + ME_SetSelection(editor,editor->imeStartIndex, + editor->imeStartIndex + dwBufLen/sizeof(WCHAR)); + } + ME_ReleaseStyle(style); + ME_UpdateRepaint(editor); + return 0; + } + case WM_IME_ENDCOMPOSITION: + { + ME_DeleteSelection(editor); + editor->imeStartIndex=-1; + return 0; + } case EM_GETOLEINTERFACE: { LPVOID *ppvObj = (LPVOID*) lParam; @@ -2789,14 +2856,14 @@ LRESULT WINAPI REComboWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { /* FIXME: Not implemented */ - TRACE("hWnd %p msg %04x (%s) %08x %08lx\n", + TRACE("hWnd %p msg %04x (%s) %08lx %08lx\n", hWnd, msg, get_msg_name(msg), wParam, lParam); return DefWindowProcW(hWnd, msg, wParam, lParam); } LRESULT WINAPI REListWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { /* FIXME: Not implemented */ - TRACE("hWnd %p msg %04x (%s) %08x %08lx\n", + TRACE("hWnd %p msg %04x (%s) %08lx %08lx\n", hWnd, msg, get_msg_name(msg), wParam, lParam); return DefWindowProcW(hWnd, msg, wParam, lParam); } Modified: trunk/reactos/dll/win32/riched20/editstr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/editstr…
============================================================================== --- trunk/reactos/dll/win32/riched20/editstr.h (original) +++ trunk/reactos/dll/win32/riched20/editstr.h Fri Jul 27 14:05:21 2007 @@ -321,6 +321,9 @@ BOOL bHideSelection; BOOL AutoURLDetect_bEnable; WCHAR cPasswordMask; + BOOL bHaveFocus; + /*for IME */ + int imeStartIndex; } ME_TextEditor; typedef struct tagME_Context Modified: trunk/reactos/dll/win32/riched20/reader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/reader.…
============================================================================== --- trunk/reactos/dll/win32/riched20/reader.c (original) +++ trunk/reactos/dll/win32/riched20/reader.c Fri Jul 27 14:05:21 2007 @@ -2682,7 +2682,7 @@ RTFFlushCPOutputBuffer(RTF_Info *info) { int bufferMax = info->dwCPOutputCount * 2 * sizeof(WCHAR); - WCHAR *buffer = (WCHAR *)RTFAlloc(bufferMax); + WCHAR *buffer = RTFAlloc(bufferMax); int length; length = MultiByteToWideChar(info->codePage, 0, info->cpOutputBuffer, Modified: trunk/reactos/dll/win32/riched20/riched20.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/riched2…
============================================================================== --- trunk/reactos/dll/win32/riched20/riched20.rbuild (original) +++ trunk/reactos/dll/win32/riched20/riched20.rbuild Fri Jul 27 14:05:21 2007 @@ -10,6 +10,7 @@ <define name="WINVER">0x501</define> <library>wine</library> <library>ole32</library> + <library>imm32</library> <library>user32</library> <library>gdi32</library> <library>kernel32</library> Modified: trunk/reactos/dll/win32/riched20/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/string.…
============================================================================== --- trunk/reactos/dll/win32/riched20/string.c (original) +++ trunk/reactos/dll/win32/riched20/string.c Fri Jul 27 14:05:21 2007 @@ -130,7 +130,7 @@ s = ME_MakeString(orig->szData+charidx); orig->nLen = charidx; - orig->szData[charidx] = L'\0'; + orig->szData[charidx] = '\0'; return s; } @@ -347,6 +347,8 @@ LPWSTR ME_ToUnicode(BOOL unicode, LPVOID psz) { + assert(psz != NULL); + if (unicode) return (LPWSTR)psz; else { Modified: trunk/reactos/dll/win32/riched20/txtsrv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/riched20/txtsrv.…
============================================================================== --- trunk/reactos/dll/win32/riched20/txtsrv.c (original) +++ trunk/reactos/dll/win32/riched20/txtsrv.c Fri Jul 27 14:05:21 2007 @@ -28,7 +28,6 @@ #include "editor.h" #include "ole2.h" #include "richole.h" -#include "winreg.h" #include "imm.h" #include "textserv.h" #include "wine/debug.h"
17 years, 3 months
1
0
0
0
[winesync] 27916: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 14:03:59 2007 New Revision: 27916 URL:
http://svn.reactos.org/svn/reactos?rev=27916&view=rev
Log: Autosyncing with Wine HEAD Modified: trunk/reactos/dll/win32/powrprof/powrprof.c trunk/reactos/dll/win32/powrprof/powrprof_ros.diff Modified: trunk/reactos/dll/win32/powrprof/powrprof.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/powrprof/powrpro…
============================================================================== --- trunk/reactos/dll/win32/powrprof/powrprof.c (original) +++ trunk/reactos/dll/win32/powrprof/powrprof.c Fri Jul 27 14:03:59 2007 @@ -29,7 +29,6 @@ #include "powrprof.h" #include "wine/debug.h" #include "wine/unicode.h" -#include "stdlib.h" WINE_DEFAULT_DEBUG_CHANNEL(powrprof); @@ -82,7 +81,7 @@ r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ | KEY_WRITE, &hKey); if (r != ERROR_SUCCESS) { - TRACE("RegOpenKeyEx failed: %ld\n", r); + TRACE("RegOpenKeyEx failed: %d\n", r); bSuccess = FALSE; } @@ -165,7 +164,7 @@ r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, szPowerCfgSubKey, 0, KEY_READ, &hKey); if (r != ERROR_SUCCESS) { - TRACE("RegOpenKeyEx failed: %ld\n", r); + TRACE("RegOpenKeyEx failed: %d\n", r); TRACE("Using defaults: 3600, 3\n"); *RangeMax = 3600; *RangeMin = 3; @@ -175,7 +174,7 @@ r = RegQueryValueExW(hKey, szDiskMax, 0, 0, lpValue, &cbValue); if (r != ERROR_SUCCESS) { - TRACE("Couldn't open DiskSpinDownMax: %ld\n", r); + TRACE("Couldn't open DiskSpinDownMax: %d\n", r); TRACE("Using default: 3600\n"); *RangeMax = 3600; } else { @@ -186,7 +185,7 @@ r = RegQueryValueExW(hKey, szDiskMin, 0, 0, lpValue, &cbValue); if (r != ERROR_SUCCESS) { - TRACE("Couldn't open DiskSpinDownMin: %ld\n", r); + TRACE("Couldn't open DiskSpinDownMin: %d\n", r); TRACE("Using default: 3\n"); *RangeMin = 3; } else { @@ -315,7 +314,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - FIXME("(%p, %ld, %p) not fully implemented\n", hinstDLL, fdwReason, lpvReserved); + FIXME("(%p, %d, %p) not fully implemented\n", hinstDLL, fdwReason, lpvReserved); switch(fdwReason) { case DLL_PROCESS_ATTACH: { @@ -341,7 +340,7 @@ PPRegSemaphore = CreateSemaphoreW(NULL, 1, 1, szSemaphoreName); if (PPRegSemaphore == NULL) { - ERR("Couldn't create Semaphore: %ld\n", GetLastError()); + ERR("Couldn't create Semaphore: %d\n", GetLastError()); return FALSE; } break; Modified: trunk/reactos/dll/win32/powrprof/powrprof_ros.diff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/powrprof/powrpro…
============================================================================== --- trunk/reactos/dll/win32/powrprof/powrprof_ros.diff (original) +++ trunk/reactos/dll/win32/powrprof/powrprof_ros.diff Fri Jul 27 14:03:59 2007 @@ -1,7 +1,27 @@ -Index: D:/reactos/dll/win32/powrprof/powrprof.spec +Index: powrprof.c =================================================================== ---- D:/reactos/dll/win32/powrprof/powrprof.spec (revision 22834) -+++ D:/reactos/dll/win32/powrprof/powrprof.spec (revision 22835) +--- powrprof.c (revision 26779) ++++ powrprof.c (working copy) +@@ -303,6 +303,15 @@ + return FALSE; + } + ++BOOLEAN WINAPI ValidatePowerPolicies(PGLOBAL_POWER_POLICY pGPP, PPOWER_POLICY pPP) ++{ ++ /* FIXME: See note #3 */ ++ FIXME("(%p, %p) stub!\n", pGPP, pPP); ++ SetLastError(ERROR_CALL_NOT_IMPLEMENTED); ++ return TRUE; ++ ++} ++ + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) + { + FIXME("(%p, %d, %p) not fully implemented\n", hinstDLL, fdwReason, lpvReserved); +Index: powrprof.spec +=================================================================== +--- powrprof.spec (revision 26779) ++++ powrprof.spec (working copy) @@ -18,3 +18,4 @@ @ stdcall WriteGlobalPwrPolicy (ptr) @ stdcall WriteProcessorPwrScheme (long ptr)
17 years, 3 months
1
0
0
0
[winesync] 27915: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 14:00:38 2007 New Revision: 27915 URL:
http://svn.reactos.org/svn/reactos?rev=27915&view=rev
Log: Autosyncing with Wine HEAD Modified: trunk/reactos/dll/win32/oledlg/insobjdlg.c trunk/reactos/dll/win32/oledlg/oledlg_En.rc trunk/reactos/dll/win32/oledlg/oledlg_Es.rc trunk/reactos/dll/win32/oledlg/oledlg_Ko.rc trunk/reactos/dll/win32/oledlg/pastespl.c Modified: trunk/reactos/dll/win32/oledlg/insobjdlg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oledlg/insobjdlg…
============================================================================== --- trunk/reactos/dll/win32/oledlg/insobjdlg.c (original) +++ trunk/reactos/dll/win32/oledlg/insobjdlg.c Fri Jul 27 14:00:38 2007 @@ -25,7 +25,6 @@ #include "winbase.h" #include "winreg.h" #include "winternl.h" -#include "winnls.h" #include "winerror.h" #include "wingdi.h" #include "winuser.h" Modified: trunk/reactos/dll/win32/oledlg/oledlg_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oledlg/oledlg_En…
============================================================================== --- trunk/reactos/dll/win32/oledlg/oledlg_En.rc (original) +++ trunk/reactos/dll/win32/oledlg/oledlg_En.rc Fri Jul 27 14:00:38 2007 @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT UIINSERTOBJECT DIALOG DISCARDABLE 0, 0, 294, 151 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU Modified: trunk/reactos/dll/win32/oledlg/oledlg_Es.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oledlg/oledlg_Es…
============================================================================== --- trunk/reactos/dll/win32/oledlg/oledlg_Es.rc (original) +++ trunk/reactos/dll/win32/oledlg/oledlg_Es.rc Fri Jul 27 14:00:38 2007 @@ -1,5 +1,5 @@ /* - * Copyright 2004 José Manuel Ferrer Ortiz + * Copyright 2004, 2007 José Manuel Ferrer Ortiz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -53,3 +53,43 @@ IDS_NOTOLEMOD "El archivo no parece ser un módulo OLE válido. Incapaz de registrar el control OLE." IDS_NOTOLEMODCAPTION "Añadir control" } + +IDD_PASTESPECIAL4 DIALOG DISCARDABLE 3, 15, 293, 140 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Pegado especial" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Origen:", -1, 6, 9, 30, 8, WS_VISIBLE | WS_GROUP + CONTROL "&Pegar", IDC_PS_PASTE, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP | WS_VISIBLE, + 6, 38, 55, 10 + CONTROL "Pegar &enlace", IDC_PS_PASTELINK, "Button", BS_AUTORADIOBUTTON | WS_VISIBLE, + 6, 63, 55, 10 + LTEXT "&Como:", -1, 65, 25, 16, 8, WS_VISIBLE | WS_GROUP + LISTBOX IDC_PS_PASTELIST, 65, 36, 153, 57, LBS_NOTIFY | LBS_USETABSTOPS | WS_VSCROLL | WS_BORDER | NOT WS_VISIBLE + LISTBOX IDC_PS_PASTELINKLIST, 65, 36, 153, 57, LBS_NOTIFY | LBS_USETABSTOPS | WS_VSCROLL | WS_BORDER | NOT WS_VISIBLE + LISTBOX IDC_PS_DISPLAYLIST, 65, 36, 153, 57, LBS_NOTIFY | LBS_USETABSTOPS | WS_VSCROLL | WS_BORDER | WS_VISIBLE + CONTROL "Aceptar", IDOK, "Button", BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP | WS_VISIBLE, 224, 6, 66, 14 + CONTROL "Cancelar", IDCANCEL, "Button", BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE, 224, 23, 66, 14 + CONTROL "A&yuda", IDC_OLEUIHELP, "Button", BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE, 224, 42, 66, 14 + CONTROL "&Mostrar como icono", IDC_PS_DISPLAYASICON, "Button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_VISIBLE, 224, 59, 66, 14 + CONTROL "", IDC_PS_ICONDISPLAY, "Static", SS_ICON | WS_VISIBLE, 224, 75, 66, 44 + CONTROL "Cambiar &icono...", IDC_PS_CHANGEICON, "Button", BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE, 224, 123, 66, 14 + CONTROL "", IDC_PS_RESULTIMAGE, "Static", SS_ICON | WS_VISIBLE, 8, 101, 42, 34 + CONTROL "<< el texto del resultado va aquí >>", IDC_PS_RESULTTEXT, "Static", SS_NOPREFIX | WS_VISIBLE, 54, 100, 159, 35 + CONTROL "Resultado", -1, "Button", BS_GROUPBOX | WS_GROUP | WS_VISIBLE, 6, 90, 212, 48 + CONTROL "", IDC_PS_SOURCETEXT, "Edit", ES_READONLY | ES_AUTOHSCROLL | WS_VISIBLE, 37, 9, 180, 8 +END + +STRINGTABLE DISCARDABLE +{ + IDS_PS_PASTE_DATA "Inserta el contenido del portapapeles en su documento como %s." + IDS_PS_PASTE_OBJECT "Inserta el contenido del portapapeles en su documento de modo que pueda activarlo usando %s." + IDS_PS_PASTE_OBJECT_AS_ICON "Inserta el contenido del portapapeles en su documento de modo que pueda activarlo usando %s. Será mostrado como un icono." + IDS_PS_PASTE_LINK_DATA "Inserta el contenido del portapapeles en su documento como %s. Los datos estarán enlazados al archivo de origen, por lo que los cambios en el archivo se reflejarán en su documento." + IDS_PS_PASTE_LINK_OBJECT "Inserta una imagen del contenido del portapapeles en su documento. La imagen estará enlazada al archivo de origen, por lo que los cambios en el archivo se reflejarán en su documento." + IDS_PS_PASTE_LINK_OBJECT_AS_ICON "Inserta un acceso directo que apunte a la localización del contenido del portapapeles. El acceso directo estará enlazado al archivo de origen, por lo que los cambios en el archivo se reflejarán en su documento." + IDS_PS_NON_OLE "Inserta el contenido del portapapeles en su documento." + IDS_PS_UNKNOWN_TYPE "Tipo desconocido" + IDS_PS_UNKNOWN_SRC "Origen desconocido" + IDS_PS_UNKNOWN_APP "el programa que lo creó" +} Modified: trunk/reactos/dll/win32/oledlg/oledlg_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oledlg/oledlg_Ko…
============================================================================== --- trunk/reactos/dll/win32/oledlg/oledlg_Ko.rc (original) +++ trunk/reactos/dll/win32/oledlg/oledlg_Ko.rc Fri Jul 27 14:00:38 2007 @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT +LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL UIINSERTOBJECT DIALOG DISCARDABLE 0, 0, 294, 151 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU Modified: trunk/reactos/dll/win32/oledlg/pastespl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oledlg/pastespl.…
============================================================================== --- trunk/reactos/dll/win32/oledlg/pastespl.c (original) +++ trunk/reactos/dll/win32/oledlg/pastespl.c Fri Jul 27 14:00:38 2007 @@ -516,7 +516,7 @@ static const WCHAR prop_name[] = {'W','i','n','e','_','S','t','r','u','c','t','u','r','e',0}; ps_struct_t *ps_struct; - TRACE("(%p, %04x, %08x, %08lx)\n", hdlg, msg, wp, lp); + TRACE("(%p, %04x, %08lx, %08lx)\n", hdlg, msg, wp, lp); ps_struct = GetPropW(hdlg, prop_name);
17 years, 3 months
1
0
0
0
[winesync] 27914: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 13:59:17 2007 New Revision: 27914 URL:
http://svn.reactos.org/svn/reactos?rev=27914&view=rev
Log: Autosyncing with Wine HEAD Modified: trunk/reactos/dll/win32/oleaut32/dispatch.c trunk/reactos/dll/win32/oleaut32/oleaut.c trunk/reactos/dll/win32/oleaut32/oleaut32_En.rc trunk/reactos/dll/win32/oleaut32/oleaut32_Ko.rc trunk/reactos/dll/win32/oleaut32/oleaut32_No.rc trunk/reactos/dll/win32/oleaut32/oleaut32_Pt.rc trunk/reactos/dll/win32/oleaut32/oleaut32_Sv.rc trunk/reactos/dll/win32/oleaut32/oleaut32_ros.diff trunk/reactos/dll/win32/oleaut32/olefont.c trunk/reactos/dll/win32/oleaut32/olepicture.c trunk/reactos/dll/win32/oleaut32/safearray.c trunk/reactos/dll/win32/oleaut32/tmarshal.c trunk/reactos/dll/win32/oleaut32/typelib.c trunk/reactos/dll/win32/oleaut32/typelib16.c trunk/reactos/dll/win32/oleaut32/typelib2.c trunk/reactos/dll/win32/oleaut32/usrmarshal.c trunk/reactos/dll/win32/oleaut32/variant.c trunk/reactos/dll/win32/oleaut32/vartype.c Modified: trunk/reactos/dll/win32/oleaut32/dispatch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/dispatc…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/dispatch.c (original) +++ trunk/reactos/dll/win32/oleaut32/dispatch.c Fri Jul 27 13:59:17 2007 @@ -34,8 +34,6 @@ #include "objbase.h" #include "oleauto.h" #include "winerror.h" -#include "winreg.h" -#include "winnls.h" /* for PRIMARYLANGID */ #include "wine/debug.h" Modified: trunk/reactos/dll/win32/oleaut32/oleaut.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut.…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/oleaut.c (original) +++ trunk/reactos/dll/win32/oleaut32/oleaut.c Fri Jul 27 13:59:17 2007 @@ -266,7 +266,7 @@ * string. */ stringBuffer = (WCHAR*)newBuffer; - stringBuffer[len] = L'\0'; + stringBuffer[len] = '\0'; return (LPWSTR)stringBuffer; } @@ -691,8 +691,8 @@ extern HRESULT OLEAUTPS_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv); -extern void _get_STDFONT_CF(LPVOID); -extern void _get_STDPIC_CF(LPVOID); +extern void _get_STDFONT_CF(LPVOID *); +extern void _get_STDPIC_CF(LPVOID *); static HRESULT WINAPI PSDispatchFacBuf_QueryInterface(IPSFactoryBuffer *iface, REFIID riid, void **ppv) { Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/oleaut32_En.rc (original) +++ trunk/reactos/dll/win32/oleaut32/oleaut32_En.rc Fri Jul 27 13:59:17 2007 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE { Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/oleaut32_Ko.rc (original) +++ trunk/reactos/dll/win32/oleaut32/oleaut32_Ko.rc Fri Jul 27 13:59:17 2007 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT +LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE { Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_No.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/oleaut32_No.rc (original) +++ trunk/reactos/dll/win32/oleaut32/oleaut32_No.rc Fri Jul 27 13:59:17 2007 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL STRINGTABLE DISCARDABLE { Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_Pt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/oleaut32_Pt.rc (original) +++ trunk/reactos/dll/win32/oleaut32/oleaut32_Pt.rc Fri Jul 27 13:59:17 2007 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN STRINGTABLE DISCARDABLE { Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_Sv.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/oleaut32_Sv.rc (original) +++ trunk/reactos/dll/win32/oleaut32/oleaut32_Sv.rc Fri Jul 27 13:59:17 2007 @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE { Modified: trunk/reactos/dll/win32/oleaut32/oleaut32_ros.diff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut3…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/oleaut32_ros.diff (original) +++ trunk/reactos/dll/win32/oleaut32/oleaut32_ros.diff Fri Jul 27 13:59:17 2007 @@ -39,7 +39,7 @@ --- oleaut32_Ja.rc (revision 23782) +++ oleaut32_Ja.rc (working copy) @@ -0,0 +1,11 @@ -+LANGUAGE LANG_JAPANESE, SUBLANG_NEUTRAL ++LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +{ @@ -109,3 +109,15 @@ /* * FIXME: +Index: oleaut32.rbuild +=================================================================== +--- oleaut32.rbuild (revision 23782) ++++ oleaut32.rbuild (working copy) +@@ -20,6 +20,7 @@ + <library>comctl32</library> + <library>urlmon</library> + <library>uuid</library> ++ <library>pseh</library> + <file>connpt.c</file> + <file>dispatch.c</file> + <file>hash.c</file> Modified: trunk/reactos/dll/win32/oleaut32/olefont.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/olefont…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/olefont.c (original) +++ trunk/reactos/dll/win32/oleaut32/olefont.c Fri Jul 27 13:59:17 2007 @@ -176,7 +176,7 @@ * Prototypes for the implementation functions for the IFont * interface */ -static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc); +static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc); static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc); static ULONG WINAPI OLEFontImpl_AddRef(IFont* iface); @@ -2201,7 +2201,7 @@ * The caller of this method must release the object when it's * done with it. */ -static OLEFontImpl* OLEFontImpl_Construct(LPFONTDESC fontDesc) +static OLEFontImpl* OLEFontImpl_Construct(const FONTDESC *fontDesc) { OLEFontImpl* newObject = 0; Modified: trunk/reactos/dll/win32/oleaut32/olepicture.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/olepict…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/olepicture.c (original) +++ trunk/reactos/dll/win32/oleaut32/olepicture.c Fri Jul 27 13:59:17 2007 @@ -67,7 +67,7 @@ #include "wine/wingdi16.h" -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG /* This is a hack, so jpeglib.h does not redefine INT32 and the like*/ #define XMD_H #define UINT8 JPEG_UINT8 @@ -77,9 +77,11 @@ # include <jpeglib.h> #undef jpeg_boolean #undef UINT16 -#ifndef SONAME_LIBJPEG -#define SONAME_LIBJPEG "libjpeg.so" #endif + +#ifdef HAVE_PNG_H +#undef FAR +#include <png.h> #endif #include "ungif.h" @@ -365,6 +367,7 @@ DeleteEnhMetaFile(Obj->desc.u.emf.hemf); break; case PICTYPE_NONE: + case PICTYPE_UNINITIALIZED: /* Nothing to do */ break; default: @@ -505,6 +508,7 @@ TRACE("(%p)->(%p)\n", This, phandle); switch(This->desc.picType) { case PICTYPE_NONE: + case PICTYPE_UNINITIALIZED: *phandle = 0; break; case PICTYPE_BITMAP: @@ -674,7 +678,16 @@ break; case PICTYPE_METAFILE: + PlayMetaFile(hdc, This->desc.u.wmf.hmeta); + break; + case PICTYPE_ENHMETAFILE: + { + RECT rc = { x, y, cx, cy }; + PlayEnhMetaFile(hdc, This->desc.u.emf.hemf, &rc); + break; + } + default: FIXME("type %d not implemented\n", This->desc.picType); return E_NOTIMPL; @@ -795,6 +808,7 @@ switch (This->desc.picType) { case PICTYPE_BITMAP: if (This->hbmMask) *pdwAttr = PICTURE_TRANSPARENT; break; /* not 'truly' scalable, see MSDN. */ case PICTYPE_ICON: *pdwAttr = PICTURE_TRANSPARENT;break; + case PICTYPE_ENHMETAFILE: /* fall through */ case PICTYPE_METAFILE: *pdwAttr = PICTURE_TRANSPARENT|PICTURE_SCALABLE;break; default:FIXME("Unknown pictype %d\n",This->desc.picType);break; } @@ -925,7 +939,7 @@ return E_NOTIMPL; } -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG static void *libjpeg_handle; #define MAKE_FUNCPTR(f) static typeof(f) * p##f @@ -979,7 +993,7 @@ return FALSE; } static void _jpeg_term_source(j_decompress_ptr cinfo) { } -#endif /* HAVE_JPEGLIB_H */ +#endif /* SONAME_LIBJPEG */ struct gifdata { unsigned char *data; @@ -1198,7 +1212,7 @@ static HRESULT OLEPictureImpl_LoadJpeg(OLEPictureImpl *This, BYTE *xbuf, ULONG xread) { -#ifdef HAVE_JPEGLIB_H +#ifdef SONAME_LIBJPEG struct jpeg_decompress_struct jd; struct jpeg_error_mgr jerr; int ret; @@ -1324,6 +1338,193 @@ OLEPictureImpl_SetBitmap(This); return S_OK; } + +/***************************************************** +* start of PNG-specific code +* currently only supports colortype PNG_COLOR_TYPE_RGB +*/ +#ifdef SONAME_LIBPNG +typedef struct{ + ULONG position; + ULONG size; + BYTE * buff; +} png_io; + +static void png_stream_read_data(png_structp png_ptr, png_bytep data, + png_size_t length) +{ + png_io * io_ptr = png_ptr->io_ptr; + + if(length + io_ptr->position > io_ptr->size){ + length = io_ptr->size - io_ptr->position; + } + + memcpy(data, io_ptr->buff + io_ptr->position, length); + + io_ptr->position += length; +} + +static void *libpng_handle; +#define MAKE_FUNCPTR(f) static typeof(f) * p##f +MAKE_FUNCPTR(png_create_read_struct); +MAKE_FUNCPTR(png_create_info_struct); +MAKE_FUNCPTR(png_set_read_fn); +MAKE_FUNCPTR(png_read_info); +MAKE_FUNCPTR(png_read_image); +MAKE_FUNCPTR(png_get_rowbytes); +MAKE_FUNCPTR(png_set_bgr); +MAKE_FUNCPTR(png_destroy_read_struct); +MAKE_FUNCPTR(png_set_palette_to_rgb); +MAKE_FUNCPTR(png_read_update_info); +#undef MAKE_FUNCPTR + +static void *load_libpng(void) +{ + if((libpng_handle = wine_dlopen(SONAME_LIBPNG, RTLD_NOW, NULL, 0)) != NULL) { + +#define LOAD_FUNCPTR(f) \ + if((p##f = wine_dlsym(libpng_handle, #f, NULL, 0)) == NULL) { \ + libpng_handle = NULL; \ + return NULL; \ + } + LOAD_FUNCPTR(png_create_read_struct); + LOAD_FUNCPTR(png_create_info_struct); + LOAD_FUNCPTR(png_set_read_fn); + LOAD_FUNCPTR(png_read_info); + LOAD_FUNCPTR(png_read_image); + LOAD_FUNCPTR(png_get_rowbytes); + LOAD_FUNCPTR(png_set_bgr); + LOAD_FUNCPTR(png_destroy_read_struct); + LOAD_FUNCPTR(png_set_palette_to_rgb); + LOAD_FUNCPTR(png_read_update_info); + +#undef LOAD_FUNCPTR + } + return libpng_handle; +} +#endif /* SONAME_LIBPNG */ + +static HRESULT OLEPictureImpl_LoadPNG(OLEPictureImpl *This, BYTE *xbuf, ULONG xread) +{ +#ifdef SONAME_LIBPNG + png_io io; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + INT row, rowsize, height, width; + png_bytep* row_pointers = NULL; + png_bytep pngdata = NULL; + BITMAPINFOHEADER bmi; + HDC hdcref = NULL; + HRESULT ret; + BOOL set_bgr = FALSE; + + if(!libpng_handle) { + if(!load_libpng()) { + ERR("Failed reading PNG because unable to find %s\n",SONAME_LIBPNG); + return E_FAIL; + } + } + + io.size = xread; + io.position = 0; + io.buff = xbuf; + + png_ptr = ppng_create_read_struct(PNG_LIBPNG_VER_STRING, + NULL, NULL, NULL); + + if(setjmp(png_jmpbuf(png_ptr))){ + TRACE("Error in libpng\n"); + ret = E_FAIL; + goto pngend; + } + + info_ptr = ppng_create_info_struct(png_ptr); + ppng_set_read_fn(png_ptr, &io, png_stream_read_data); + ppng_read_info(png_ptr, info_ptr); + + if(!(png_ptr->color_type == PNG_COLOR_TYPE_RGB || + png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)){ + FIXME("Unsupported .PNG type: %d\n", png_ptr->color_type); + ret = E_FAIL; + goto pngend; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE){ + ppng_set_palette_to_rgb(png_ptr); + set_bgr = TRUE; + } + + if (png_ptr->color_type == PNG_COLOR_TYPE_RGB || + png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA || + set_bgr){ + ppng_set_bgr(png_ptr); + } + + ppng_read_update_info(png_ptr, info_ptr); + + rowsize = ppng_get_rowbytes(png_ptr, info_ptr); + /* align rowsize to 4-byte boundary */ + rowsize = (rowsize + 3) & ~3; + height = info_ptr->height; + width = info_ptr->width; + + pngdata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, height * rowsize); + row_pointers = HeapAlloc(GetProcessHeap(), 0, height * (sizeof(VOID *))); + + if(!pngdata || !row_pointers){ + ret = E_FAIL; + goto pngend; + } + + for (row = 0; row < height; row++){ + row_pointers[row] = pngdata + row * rowsize; + } + + ppng_read_image(png_ptr, row_pointers); + + bmi.biSize = sizeof(bmi); + bmi.biWidth = width; + bmi.biHeight = -height; + bmi.biPlanes = 1; + bmi.biBitCount = info_ptr->channels * 8; + bmi.biCompression = BI_RGB; + bmi.biSizeImage = height * rowsize; + bmi.biXPelsPerMeter = 0; + bmi.biYPelsPerMeter = 0; + bmi.biClrUsed = 0; + bmi.biClrImportant = 0; + + hdcref = GetDC(0); + This->desc.u.bmp.hbitmap = CreateDIBitmap( + hdcref, + &bmi, + CBM_INIT, + pngdata, + (BITMAPINFO*)&bmi, + DIB_RGB_COLORS + ); + ReleaseDC(0, hdcref); + This->desc.picType = PICTYPE_BITMAP; + OLEPictureImpl_SetBitmap(This); + ret = S_OK; + +pngend: + if(png_ptr) + ppng_destroy_read_struct(&png_ptr, + (info_ptr ? &info_ptr : (png_infopp) NULL), + (png_infopp)NULL); + HeapFree(GetProcessHeap(), 0, row_pointers); + HeapFree(GetProcessHeap(), 0, pngdata); + return ret; +#else /* SONAME_LIBPNG */ + ERR("Trying to load PNG picture, but PNG supported not compiled in.\n"); + return E_FAIL; +#endif +} + +/***************************************************** +* start of Icon-specific code +*/ static HRESULT OLEPictureImpl_LoadIcon(OLEPictureImpl *This, BYTE *xbuf, ULONG xread) { @@ -1385,6 +1586,43 @@ } } +static HRESULT OLEPictureImpl_LoadMetafile(OLEPictureImpl *This, + const BYTE *data, ULONG size) +{ + HMETAFILE hmf; + HENHMETAFILE hemf; + + /* SetMetaFileBitsEx performs data check on its own */ + hmf = SetMetaFileBitsEx(size, data); + if (hmf) + { + This->desc.picType = PICTYPE_METAFILE; + This->desc.u.wmf.hmeta = hmf; + This->desc.u.wmf.xExt = 0; + This->desc.u.wmf.yExt = 0; + + This->origWidth = 0; + This->origHeight = 0; + This->himetricWidth = 0; + This->himetricHeight = 0; + + return S_OK; + } + + hemf = SetEnhMetaFileBits(size, data); + if (!hemf) return E_FAIL; + + This->desc.picType = PICTYPE_ENHMETAFILE; + This->desc.u.emf.hemf = hemf; + + This->origWidth = 0; + This->origHeight = 0; + This->himetricWidth = 0; + This->himetricHeight = 0; + + return S_OK; +} + /************************************************************************ * OLEPictureImpl_IPersistStream_Load (IUnknown) * @@ -1393,7 +1631,7 @@ * DWORD magic; * DWORD len; * - * Currently implemented: BITMAP, ICON, JPEG, GIF + * Currently implemented: BITMAP, ICON, JPEG, GIF, WMF, EMF */ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) { HRESULT hr = E_FAIL; @@ -1527,6 +1765,8 @@ */ magic = xbuf[0] + (xbuf[1]<<8); + This->loadtime_format = magic; + switch (magic) { case 0x4947: /* GIF */ hr = OLEPictureImpl_LoadGif(This, xbuf, xread); @@ -1537,6 +1777,9 @@ case 0x4d42: /* Bitmap */ hr = OLEPictureImpl_LoadDIB(This, xbuf, xread); break; + case 0x5089: /* PNG */ + hr = OLEPictureImpl_LoadPNG(This, xbuf, xread); + break; case 0x0000: { /* ICON , first word is dwReserved */ hr = OLEPictureImpl_LoadIcon(This, xbuf, xread); break; @@ -1544,6 +1787,11 @@ default: { unsigned int i; + + /* let's see if it's a metafile */ + hr = OLEPictureImpl_LoadMetafile(This, xbuf, xread); + if (hr == S_OK) break; + FIXME("Unknown magic %04x, %d read bytes:\n",magic,xread); hr=E_FAIL; for (i=0;i<xread+8;i++) { @@ -1826,6 +2074,9 @@ break; case 0x4947: FIXME("(%p,%p,%d), PICTYPE_BITMAP (format GIF) not implemented!\n",This,pStm,fClearDirty); + break; + case 0x5089: + FIXME("(%p,%p,%d), PICTYPE_BITMAP (format PNG) not implemented!\n",This,pStm,fClearDirty); break; default: FIXME("(%p,%p,%d), PICTYPE_BITMAP (format UNKNOWN, using BMP?) not implemented!\n",This,pStm,fClearDirty); Modified: trunk/reactos/dll/win32/oleaut32/safearray.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/safearr…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/safearray.c (original) +++ trunk/reactos/dll/win32/oleaut32/safearray.c Fri Jul 27 13:59:17 2007 @@ -204,7 +204,7 @@ } /* Create an array */ -static SAFEARRAY* SAFEARRAY_Create(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound, ULONG ulSize) +static SAFEARRAY* SAFEARRAY_Create(VARTYPE vt, UINT cDims, const SAFEARRAYBOUND *rgsabound, ULONG ulSize) { SAFEARRAY *psa = NULL; int i; Modified: trunk/reactos/dll/win32/oleaut32/tmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/tmarsha…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/tmarshal.c (original) +++ trunk/reactos/dll/win32/oleaut32/tmarshal.c Fri Jul 27 13:59:17 2007 @@ -40,7 +40,6 @@ #include "winnls.h" #include "winreg.h" #include "winuser.h" -#include "excpt.h" #include "ole2.h" #include "propidl.h" /* for LPSAFEARRAY_User* functions */ @@ -97,7 +96,7 @@ } static HRESULT -xbuf_add(marshal_state *buf, LPBYTE stuff, DWORD size) +xbuf_add(marshal_state *buf, const BYTE *stuff, DWORD size) { HRESULT hr; @@ -286,14 +285,12 @@ ERR("No %s key found.\n",interfacekey); return E_FAIL; } - type = (1<<REG_SZ); tlguidlen = sizeof(tlguid); if (RegQueryValueExA(ikey,NULL,NULL,&type,(LPBYTE)tlguid,&tlguidlen)) { ERR("Getting typelib guid failed.\n"); RegCloseKey(ikey); return E_FAIL; } - type = (1<<REG_SZ); verlen = sizeof(ver); if (RegQueryValueExA(ikey,"Version",NULL,&type,(LPBYTE)ver,&verlen)) { ERR("Could not get version value?\n"); @@ -323,49 +320,49 @@ return hres; } -/* Determine nr of functions. Since we use the toplevel interface and all - * inherited ones have lower numbers, we are ok to not to descent into - * the inheritance tree I think. +/* + * Determine the number of functions including all inherited functions. + * Note for non-dual dispinterfaces we simply return the size of IDispatch. */ -static int _nroffuncs(ITypeInfo *tinfo) { - int n, i, j; - const FUNCDESC *fdesc; - HRESULT hres; +static HRESULT num_of_funcs(ITypeInfo *tinfo, unsigned int *num) +{ + HRESULT hres; TYPEATTR *attr; ITypeInfo *tinfo2; - n=0; + *num = 0; hres = ITypeInfo_GetTypeAttr(tinfo, &attr); if (hres) { ERR("GetTypeAttr failed with %x\n",hres); return hres; } - /* look in inherited ifaces. */ - for (j=0;j<attr->cImplTypes;j++) { + + if(attr->typekind == TKIND_DISPATCH && (attr->wTypeFlags & TYPEFLAG_FDUAL)) + { HREFTYPE href; - hres = ITypeInfo_GetRefTypeOfImplType(tinfo, j, &href); - if (hres) { - ERR("Did not find a reftype for interface offset %d?\n",j); - break; + hres = ITypeInfo_GetRefTypeOfImplType(tinfo, -1, &href); + if(FAILED(hres)) + { + ERR("Unable to get interface href from dual dispinterface\n"); + goto end; } hres = ITypeInfo_GetRefTypeInfo(tinfo, href, &tinfo2); - if (hres) { - ERR("Did not find a typeinfo for reftype %d?\n",href); - continue; + if(FAILED(hres)) + { + ERR("Unable to get interface from dual dispinterface\n"); + goto end; } - n += _nroffuncs(tinfo2); + hres = num_of_funcs(tinfo2, num); ITypeInfo_Release(tinfo2); } + else + { + *num = attr->cbSizeVft / 4; + } + + end: ITypeInfo_ReleaseTypeAttr(tinfo, attr); - i = 0; - while (1) { - hres = ITypeInfoImpl_GetInternalFuncDesc(tinfo,i,&fdesc); - if (hres) - return n; - n++; - i++; - } - /*NOTREACHED*/ + return hres; } #ifdef __i386__ @@ -526,7 +523,7 @@ } static int -_xsize(TYPEDESC *td) { +_xsize(const TYPEDESC *td) { switch (td->vt) { case VT_DATE: return sizeof(DATE); @@ -534,7 +531,7 @@ return sizeof(VARIANT)+3; case VT_CARRAY: { int i, arrsize = 1; - ARRAYDESC *adesc = td->u.lpadesc; + const ARRAYDESC *adesc = td->u.lpadesc; for (i=0;i<adesc->cDims;i++) arrsize *= adesc->rgbounds[i].cElements; @@ -1198,63 +1195,99 @@ } } -/* Searches function, also in inherited interfaces */ -static HRESULT -_get_funcdesc( - ITypeInfo *tinfo, int iMethod, ITypeInfo **tactual, const FUNCDESC **fdesc, BSTR *iname, BSTR *fname) -{ - int i = 0, j = 0; - HRESULT hres; +/* Retrieves a function's funcdesc, searching back into inherited interfaces. */ +static HRESULT get_funcdesc(ITypeInfo *tinfo, int iMethod, ITypeInfo **tactual, const FUNCDESC **fdesc, + BSTR *iname, BSTR *fname, UINT *num) +{ + HRESULT hr; + UINT i, impl_types; + UINT inherited_funcs = 0; + TYPEATTR *attr; if (fname) *fname = NULL; if (iname) *iname = NULL; - - while (1) { - hres = ITypeInfoImpl_GetInternalFuncDesc(tinfo, i, fdesc); - - if (hres) { - ITypeInfo *tinfo2; - HREFTYPE href; - TYPEATTR *attr; - - hres = ITypeInfo_GetTypeAttr(tinfo, &attr); - if (hres) { - ERR("GetTypeAttr failed with %x\n",hres); - return hres; - } - /* Not found, so look in inherited ifaces. */ - for (j=0;j<attr->cImplTypes;j++) { - hres = ITypeInfo_GetRefTypeOfImplType(tinfo, j, &href); - if (hres) { - ERR("Did not find a reftype for interface offset %d?\n",j); - break; - } - hres = ITypeInfo_GetRefTypeInfo(tinfo, href, &tinfo2); - if (hres) { - ERR("Did not find a typeinfo for reftype %d?\n",href); - continue; - } - hres = _get_funcdesc(tinfo2,iMethod,tactual,fdesc,iname,fname); - ITypeInfo_Release(tinfo2); - if (!hres) { - ITypeInfo_ReleaseTypeAttr(tinfo, attr); - return S_OK; - } - } - ITypeInfo_ReleaseTypeAttr(tinfo, attr); - return hres; - } - if (((*fdesc)->oVft/4) == iMethod) { - if (fname) - ITypeInfo_GetDocumentation(tinfo,(*fdesc)->memid,fname,NULL,NULL,NULL); - if (iname) - ITypeInfo_GetDocumentation(tinfo,-1,iname,NULL,NULL,NULL); - *tactual = tinfo; - ITypeInfo_AddRef(*tactual); - return S_OK; - } - i++; - } + if (num) *num = 0; + *tactual = NULL; + + hr = ITypeInfo_GetTypeAttr(tinfo, &attr); + if (FAILED(hr)) + { + ERR("GetTypeAttr failed with %x\n",hr); + return hr; + } + + if(attr->typekind == TKIND_DISPATCH) + { + if(attr->wTypeFlags & TYPEFLAG_FDUAL) + { + HREFTYPE href; + ITypeInfo *tinfo2; + + hr = ITypeInfo_GetRefTypeOfImplType(tinfo, -1, &href); + if(FAILED(hr)) + { + ERR("Cannot get interface href from dual dispinterface\n"); + ITypeInfo_ReleaseTypeAttr(tinfo, attr); + return hr; + } + hr = ITypeInfo_GetRefTypeInfo(tinfo, href, &tinfo2); + if(FAILED(hr)) + { + ERR("Cannot get interface from dual dispinterface\n"); + ITypeInfo_ReleaseTypeAttr(tinfo, attr); + return hr; + } + hr = get_funcdesc(tinfo2, iMethod, tactual, fdesc, iname, fname, num); + ITypeInfo_Release(tinfo2); + ITypeInfo_ReleaseTypeAttr(tinfo, attr); + return hr; + } + ERR("Shouldn't be called with a non-dual dispinterface\n"); + return E_FAIL; + } + + impl_types = attr->cImplTypes; + ITypeInfo_ReleaseTypeAttr(tinfo, attr); + + for (i = 0; i < impl_types; i++) + { + HREFTYPE href; + ITypeInfo *pSubTypeInfo; + UINT sub_funcs; + + hr = ITypeInfo_GetRefTypeOfImplType(tinfo, i, &href); + if (FAILED(hr)) return hr; + hr = ITypeInfo_GetRefTypeInfo(tinfo, href, &pSubTypeInfo); + if (FAILED(hr)) return hr; + + hr = get_funcdesc(pSubTypeInfo, iMethod, tactual, fdesc, iname, fname, &sub_funcs); + inherited_funcs += sub_funcs; + ITypeInfo_Release(pSubTypeInfo); + if(SUCCEEDED(hr)) return hr; + } + if(iMethod < inherited_funcs) + { + ERR("shouldn't be here\n"); + return E_INVALIDARG; + } + + for(i = inherited_funcs; i <= iMethod; i++) + { + hr = ITypeInfoImpl_GetInternalFuncDesc(tinfo, i - inherited_funcs, fdesc); + if(FAILED(hr)) + { + if(num) *num = i; + return hr; + } + } + + /* found it. We don't care about num so zero it */ + if(num) *num = 0; + *tactual = tinfo; + ITypeInfo_AddRef(*tactual); + if (fname) ITypeInfo_GetDocumentation(tinfo,(*fdesc)->memid,fname,NULL,NULL,NULL); + if (iname) ITypeInfo_GetDocumentation(tinfo,-1,iname,NULL,NULL,NULL); + return S_OK; } static inline BOOL is_in_elem(const ELEMDESC *elem) @@ -1286,10 +1319,9 @@ EnterCriticalSection(&tpinfo->crit); - hres = _get_funcdesc(tpinfo->tinfo,method,&tinfo,&fdesc,&iname,&fname); + hres = get_funcdesc(tpinfo->tinfo,method,&tinfo,&fdesc,&iname,&fname,NULL); if (hres) { ERR("Did not find typeinfo/funcdesc entry for method %d!\n",method); - ITypeInfo_Release(tinfo); LeaveCriticalSection(&tpinfo->crit); return E_FAIL; } @@ -1639,84 +1671,32 @@ &IID_IPSFactoryBuffer, (LPVOID*)facbuf); } -static HRESULT WINAPI -PSFacBuf_CreateProxy( - LPPSFACTORYBUFFER iface, IUnknown* pUnkOuter, REFIID riid, - IRpcProxyBuffer **ppProxy, LPVOID *ppv) -{ - HRESULT hres; - ITypeInfo *tinfo; - int i, nroffuncs; +static HRESULT init_proxy_entry_point(TMProxyImpl *proxy, unsigned int num) +{ + int j; + /* nrofargs without This */ + int nrofargs; + ITypeInfo *tinfo2; + TMAsmProxy *xasm = proxy->asmstubs + num; + HRESULT hres; const FUNCDESC *fdesc; - TMProxyImpl *proxy; - TYPEATTR *typeattr; - - TRACE("(...%s...)\n",debugstr_guid(riid)); - hres = _get_typeinfo_for_iid(riid,&tinfo); + + hres = get_funcdesc(proxy->tinfo, num, &tinfo2, &fdesc, NULL, NULL, NULL); if (hres) { - ERR("No typeinfo for %s?\n",debugstr_guid(riid)); - return hres; - } - nroffuncs = _nroffuncs(tinfo); - proxy = CoTaskMemAlloc(sizeof(TMProxyImpl)); - if (!proxy) return E_OUTOFMEMORY; - - assert(sizeof(TMAsmProxy) == 12); - - proxy->dispatch = NULL; - proxy->dispatch_proxy = NULL; - proxy->outerunknown = pUnkOuter; - proxy->asmstubs = VirtualAlloc(NULL, sizeof(TMAsmProxy) * nroffuncs, MEM_COMMIT, PAGE_EXECUTE_READWRITE); - if (!proxy->asmstubs) { - ERR("Could not commit pages for proxy thunks\n"); - CoTaskMemFree(proxy); - return E_OUTOFMEMORY; - } - proxy->lpvtbl2 = &tmproxyvtable; - /* one reference for the proxy */ - proxy->ref = 1; - proxy->tinfo = tinfo; - memcpy(&proxy->iid,riid,sizeof(*riid)); - proxy->chanbuf = 0; - - InitializeCriticalSection(&proxy->crit); - proxy->crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": TMProxyImpl.crit"); - - proxy->lpvtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPBYTE)*nroffuncs); - for (i=0;i<nroffuncs;i++) { - TMAsmProxy *xasm = proxy->asmstubs+i; - - switch (i) { - case 0: - proxy->lpvtbl[i] = ProxyIUnknown_QueryInterface; - break; - case 1: - proxy->lpvtbl[i] = ProxyIUnknown_AddRef; - break; - case 2: - proxy->lpvtbl[i] = ProxyIUnknown_Release; - break; - default: { - int j; - /* nrofargs without This */ - int nrofargs; - ITypeInfo *tinfo2; - hres = _get_funcdesc(tinfo,i,&tinfo2,&fdesc,NULL,NULL); - ITypeInfo_Release(tinfo2); - if (hres) { - ERR("GetFuncDesc %x should not fail here.\n",hres); - return hres; - } - /* some args take more than 4 byte on the stack */ - nrofargs = 0; - for (j=0;j<fdesc->cParams;j++) - nrofargs += _argsize(fdesc->lprgelemdescParam[j].tdesc.vt); + ERR("GetFuncDesc %x should not fail here.\n",hres); + return hres; + } + ITypeInfo_Release(tinfo2); + /* some args take more than 4 byte on the stack */ + nrofargs = 0; + for (j=0;j<fdesc->cParams;j++) + nrofargs += _argsize(fdesc->lprgelemdescParam[j].tdesc.vt); #ifdef __i386__ - if (fdesc->callconv != CC_STDCALL) { - ERR("calling convention is not stdcall????\n"); - return E_FAIL; - } + if (fdesc->callconv != CC_STDCALL) { + ERR("calling convention is not stdcall????\n"); + return E_FAIL; + } /* popl %eax - return ptr * pushl <nr> * pushl %eax @@ -1726,24 +1706,74 @@ * * arg3 arg2 arg1 <method> <returnptr> */ - xasm->popleax = 0x58; - xasm->pushlval = 0x6a; - xasm->nr = i; - xasm->pushleax = 0x50; - xasm->lcall = 0xe8; /* relative jump */ - xasm->xcall = (DWORD)xCall; - xasm->xcall -= (DWORD)&(xasm->lret); - xasm->lret = 0xc2; - xasm->bytestopop= (nrofargs+2)*4; /* pop args, This, iMethod */ - proxy->lpvtbl[i] = xasm; - break; + xasm->popleax = 0x58; + xasm->pushlval = 0x6a; + xasm->nr = num; + xasm->pushleax = 0x50; + xasm->lcall = 0xe8; /* relative jump */ + xasm->xcall = (DWORD)xCall; + xasm->xcall -= (DWORD)&(xasm->lret); + xasm->lret = 0xc2; + xasm->bytestopop = (nrofargs+2)*4; /* pop args, This, iMethod */ + proxy->lpvtbl[num] = xasm; #else - FIXME("not implemented on non i386\n"); - return E_FAIL; + FIXME("not implemented on non i386\n"); + return E_FAIL; #endif - } - } - } + return S_OK; +} + +static HRESULT WINAPI +PSFacBuf_CreateProxy( + LPPSFACTORYBUFFER iface, IUnknown* pUnkOuter, REFIID riid, + IRpcProxyBuffer **ppProxy, LPVOID *ppv) +{ + HRESULT hres; + ITypeInfo *tinfo; + unsigned int i, nroffuncs; + TMProxyImpl *proxy; + TYPEATTR *typeattr; + BOOL defer_to_dispatch = FALSE; + + TRACE("(...%s...)\n",debugstr_guid(riid)); + hres = _get_typeinfo_for_iid(riid,&tinfo); + if (hres) { + ERR("No typeinfo for %s?\n",debugstr_guid(riid)); + return hres; + } + + hres = num_of_funcs(tinfo, &nroffuncs); + if (FAILED(hres)) { + ERR("Cannot get number of functions for typeinfo %s\n",debugstr_guid(riid)); + ITypeInfo_Release(tinfo); + return hres; + } + + proxy = CoTaskMemAlloc(sizeof(TMProxyImpl)); + if (!proxy) return E_OUTOFMEMORY; + + assert(sizeof(TMAsmProxy) == 12); + + proxy->dispatch = NULL; + proxy->dispatch_proxy = NULL; + proxy->outerunknown = pUnkOuter; + proxy->asmstubs = VirtualAlloc(NULL, sizeof(TMAsmProxy) * nroffuncs, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + if (!proxy->asmstubs) { + ERR("Could not commit pages for proxy thunks\n"); + CoTaskMemFree(proxy); + return E_OUTOFMEMORY; + } + proxy->lpvtbl2 = &tmproxyvtable; + /* one reference for the proxy */ + proxy->ref = 1; + proxy->tinfo = tinfo; + memcpy(&proxy->iid,riid,sizeof(*riid)); + proxy->chanbuf = 0; + + InitializeCriticalSection(&proxy->crit); + proxy->crit.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": TMProxyImpl.crit"); + + proxy->lpvtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPBYTE)*nroffuncs); /* if we derive from IDispatch then defer to its proxy for its methods */ hres = ITypeInfo_GetTypeAttr(tinfo, &typeattr); @@ -1767,13 +1797,59 @@ } if (hres == S_OK) { - proxy->lpvtbl[3] = ProxyIDispatch_GetTypeInfoCount; - proxy->lpvtbl[4] = ProxyIDispatch_GetTypeInfo; - proxy->lpvtbl[5] = ProxyIDispatch_GetIDsOfNames; - proxy->lpvtbl[6] = ProxyIDispatch_Invoke; + defer_to_dispatch = TRUE; } } ITypeInfo_ReleaseTypeAttr(tinfo, typeattr); + } + + for (i=0;i<nroffuncs;i++) { + switch (i) { + case 0: + proxy->lpvtbl[i] = ProxyIUnknown_QueryInterface; + break; + case 1: + proxy->lpvtbl[i] = ProxyIUnknown_AddRef; + break; + case 2: + proxy->lpvtbl[i] = ProxyIUnknown_Release; + break; + case 3: + if(!defer_to_dispatch) + { + hres = init_proxy_entry_point(proxy, i); + if(FAILED(hres)) return hres; + } + else proxy->lpvtbl[3] = ProxyIDispatch_GetTypeInfoCount; + break; + case 4: + if(!defer_to_dispatch) + { + hres = init_proxy_entry_point(proxy, i); + if(FAILED(hres)) return hres; + } + else proxy->lpvtbl[4] = ProxyIDispatch_GetTypeInfo; + break; + case 5: + if(!defer_to_dispatch) + { + hres = init_proxy_entry_point(proxy, i); + if(FAILED(hres)) return hres; + } + else proxy->lpvtbl[5] = ProxyIDispatch_GetIDsOfNames; + break; + case 6: + if(!defer_to_dispatch) + { + hres = init_proxy_entry_point(proxy, i); + if(FAILED(hres)) return hres; + } + else proxy->lpvtbl[6] = ProxyIDispatch_Invoke; + break; + default: + hres = init_proxy_entry_point(proxy, i); + if(FAILED(hres)) return hres; + } } if (hres == S_OK) @@ -1917,7 +1993,7 @@ memcpy(buf.base, xmsg->Buffer, xmsg->cbBuffer); buf.curoff = 0; - hres = _get_funcdesc(This->tinfo,xmsg->iMethod,&tinfo,&fdesc,&iname,NULL); + hres = get_funcdesc(This->tinfo,xmsg->iMethod,&tinfo,&fdesc,&iname,NULL,NULL); if (hres) { ERR("GetFuncDesc on method %d failed with %x\n",xmsg->iMethod,hres); return hres; Modified: trunk/reactos/dll/win32/oleaut32/typelib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/typelib.c (original) +++ trunk/reactos/dll/win32/oleaut32/typelib.c Fri Jul 27 13:59:17 2007 @@ -70,6 +70,7 @@ #include "typelib.h" #include "wine/debug.h" #include "variant.h" +#include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DECLARE_DEBUG_CHANNEL(typelib); @@ -103,6 +104,8 @@ #define FromLEDWord(X) (X) #endif +#define DISPATCH_HREF_OFFSET 0x01000000 +#define DISPATCH_HREF_MASK 0xff000000 /**************************************************************************** * FromLExxx @@ -894,8 +897,11 @@ TLBImpLib * pImpLibs; /* linked list to all imported typelibs */ int ctTypeDesc; /* number of items in type desc array */ TYPEDESC * pTypeDesc; /* array of TypeDescriptions found in the - library. Only used while read MSFT + library. Only used while reading MSFT typelibs */ + struct list ref_list; /* list of ref types in this typelib */ + HREFTYPE dispatch_href; /* reference to IDispatch, -1 if unused */ + /* typelibs are cached, keyed by path and index, so store the linked list info within them */ struct tagITypeLibImpl *next, *prev; @@ -932,7 +938,7 @@ TLB_REF_INTERNAL for internal refs TLB_REF_NOT_FOUND for broken refs */ - struct tagTLBRefType * next; + struct list entry; } TLBRefType; #define TLB_REF_USE_GUID -2 @@ -1015,7 +1021,6 @@ /* Implemented Interfaces */ TLBImplType * impltypelist; - TLBRefType * reflist; int ctCustData; TLBCustData * pCustData; /* linked list to cust data; */ struct tagITypeInfoImpl * next; @@ -1042,7 +1047,7 @@ } TLBContext; -static void MSFT_DoRefType(TLBContext *pcx, ITypeInfoImpl *pTI, int offset); +static void MSFT_DoRefType(TLBContext *pcx, ITypeLibImpl *pTL, int offset); /* debug @@ -1200,23 +1205,24 @@ import->wVersionMinor, import->lcid, import->offset); } -static void dump_TLBRefType(const TLBRefType * prt) -{ - while (prt) - { - TRACE_(typelib)("href:0x%08x\n", prt->reference); - if(prt->index == -1) - TRACE_(typelib)("%s\n", debugstr_guid(&(prt->guid))); - else - TRACE_(typelib)("type no: %d\n", prt->index); - - if(prt->pImpTLInfo != TLB_REF_INTERNAL && - prt->pImpTLInfo != TLB_REF_NOT_FOUND) { - TRACE_(typelib)("in lib\n"); - dump_TLBImpLib(prt->pImpTLInfo); - } - prt = prt->next; - }; +static void dump_TLBRefType(const ITypeLibImpl *pTL) +{ + TLBRefType *ref; + + LIST_FOR_EACH_ENTRY(ref, &pTL->ref_list, TLBRefType, entry) + { + TRACE_(typelib)("href:0x%08x\n", ref->reference); + if(ref->index == -1) + TRACE_(typelib)("%s\n", debugstr_guid(&(ref->guid))); + else + TRACE_(typelib)("type no: %d\n", ref->index); + + if(ref->pImpTLInfo != TLB_REF_INTERNAL && ref->pImpTLInfo != TLB_REF_NOT_FOUND) + { + TRACE_(typelib)("in lib\n"); + dump_TLBImpLib(ref->pImpTLInfo); + } + } } static void dump_TLBImplType(const TLBImplType * impl) @@ -1630,7 +1636,7 @@ MSFT_Read(ptr, size, pcx, DO_NOT_SEEK);/* read string (ANSI) */ V_BSTR(pVar)=SysAllocStringLen(NULL,size); /* FIXME: do we need a AtoW conversion here? */ - V_UNION(pVar, bstrVal[size])=L'\0'; + V_UNION(pVar, bstrVal[size])='\0'; while(size--) V_UNION(pVar, bstrVal[size])=ptr[size]; TLB_Free(ptr); } @@ -1697,7 +1703,7 @@ *pTd=pcx->pLibInfo->pTypeDesc[type/(2*sizeof(INT))]; if(pTd->vt == VT_USERDEFINED) - MSFT_DoRefType(pcx, pTI, pTd->u.hreftype); + MSFT_DoRefType(pcx, pTI->pTypeLib, pTd->u.hreftype); TRACE_(typelib)("vt type = %X\n", pTd->vt); } @@ -1718,7 +1724,7 @@ break; case VT_USERDEFINED: - MSFT_DoRefType(pcx, pTI, + MSFT_DoRefType(pcx, pTI->pTypeLib, lpTypeDesc->u.hreftype); lpTypeDesc = NULL; @@ -2002,22 +2008,21 @@ * in the typelib, it's just an (file) offset in the type info base dir. * If comes from import, it's an offset+1 in the ImpInfo table * */ -static void MSFT_DoRefType(TLBContext *pcx, ITypeInfoImpl *pTI, +static void MSFT_DoRefType(TLBContext *pcx, ITypeLibImpl *pTL, int offset) { int j; - TLBRefType **ppRefType = &pTI->reflist; + TLBRefType *ref; TRACE_(typelib)("TLB context %p, TLB offset %x\n", pcx, offset); - while(*ppRefType) { - if((*ppRefType)->reference == offset) - return; - ppRefType = &(*ppRefType)->next; - } - - *ppRefType = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(**ppRefType)); + LIST_FOR_EACH_ENTRY(ref, &pTL->ref_list, TLBRefType, entry) + { + if(ref->reference == offset) return; + } + + ref = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ref)); + list_add_tail(&pTL->ref_list, &ref->entry); if(!MSFT_HREFTYPE_INTHISFILE( offset)) { /* external typelib */ @@ -2033,24 +2038,24 @@ pImpLib=pImpLib->next; } if(pImpLib){ - (*ppRefType)->reference=offset; - (*ppRefType)->pImpTLInfo = pImpLib; + ref->reference = offset; + ref->pImpTLInfo = pImpLib; if(impinfo.flags & MSFT_IMPINFO_OFFSET_IS_GUID) { - MSFT_ReadGuid(&(*ppRefType)->guid, impinfo.oGuid, pcx); - TRACE("importing by guid %s\n", debugstr_guid(&(*ppRefType)->guid)); - (*ppRefType)->index = TLB_REF_USE_GUID; + MSFT_ReadGuid(&ref->guid, impinfo.oGuid, pcx); + TRACE("importing by guid %s\n", debugstr_guid(&ref->guid)); + ref->index = TLB_REF_USE_GUID; } else - (*ppRefType)->index = impinfo.oGuid; + ref->index = impinfo.oGuid; }else{ ERR("Cannot find a reference\n"); - (*ppRefType)->reference=-1; - (*ppRefType)->pImpTLInfo=TLB_REF_NOT_FOUND; + ref->reference = -1; + ref->pImpTLInfo = TLB_REF_NOT_FOUND; } }else{ /* in this typelib */ - (*ppRefType)->index = MSFT_HREFTYPE_INDEX(offset); - (*ppRefType)->reference=offset; - (*ppRefType)->pImpTLInfo=TLB_REF_INTERNAL; + ref->index = MSFT_HREFTYPE_INDEX(offset); + ref->reference = offset; + ref->pImpTLInfo = TLB_REF_INTERNAL; } } @@ -2068,7 +2073,7 @@ if(offset<0) break; /* paranoia */ *ppImpl=TLB_Alloc(sizeof(**ppImpl)); MSFT_ReadLEDWords(&refrec,sizeof(refrec),pcx,offset+pcx->pTblDir->pRefTab.offset); - MSFT_DoRefType(pcx, pTI, refrec.reftype); + MSFT_DoRefType(pcx, pTI->pTypeLib, refrec.reftype); (*ppImpl)->hRef = refrec.reftype; (*ppImpl)->implflags=refrec.flags; (*ppImpl)->ctCustData= @@ -2083,7 +2088,6 @@ static ITypeInfoImpl * MSFT_DoTypeInfo( TLBContext *pcx, int count, - INT dispatch_href, ITypeLibImpl * pLibInfo) { MSFT_TypeInfoBase tiBase; @@ -2153,22 +2157,22 @@ tiBase.datatype1); break; case TKIND_DISPATCH: - ptiRet->impltypelist=TLB_Alloc(sizeof(TLBImplType)); + /* This is not -1 when the interface is a non-base dual interface or + when a dispinterface wraps an interface ie the idl 'dispinterface x {interface y;};'. + Note however that GetRefTypeOfImplType(0) always returns a ref to IDispatch and + not this interface. + */ if (tiBase.datatype1 != -1) { - MSFT_DoRefType(pcx, ptiRet, tiBase.datatype1); - ptiRet->impltypelist->hRef = tiBase.datatype1; + ptiRet->impltypelist = TLB_Alloc(sizeof(TLBImplType)); + ptiRet->impltypelist->hRef = tiBase.datatype1; + MSFT_DoRefType(pcx, pLibInfo, tiBase.datatype1); } - else - { - MSFT_DoRefType(pcx, ptiRet, dispatch_href); - ptiRet->impltypelist->hRef = dispatch_href; - } - break; + break; default: ptiRet->impltypelist=TLB_Alloc(sizeof(TLBImplType)); - MSFT_DoRefType(pcx, ptiRet, tiBase.datatype1); + MSFT_DoRefType(pcx, pLibInfo, tiBase.datatype1); ptiRet->impltypelist->hRef = tiBase.datatype1; break; } @@ -2361,6 +2365,9 @@ pTypeLibImpl->lpVtbl = &tlbvt; pTypeLibImpl->lpVtblTypeComp = &tlbtcvt; pTypeLibImpl->ref = 1; + + list_init(&pTypeLibImpl->ref_list); + pTypeLibImpl->dispatch_href = -1; return pTypeLibImpl; } @@ -2556,6 +2563,10 @@ } } + pTypeLibImpl->dispatch_href = tlbHeader.dispatchpos; + if(pTypeLibImpl->dispatch_href != -1) + MSFT_DoRefType(&cx, pTypeLibImpl, pTypeLibImpl->dispatch_href); + /* type info's */ if(tlbHeader.nrtypeinfos >= 0 ) { @@ -2565,7 +2576,7 @@ for(i = 0; i<(int)tlbHeader.nrtypeinfos; i++) { - *ppTI = MSFT_DoTypeInfo(&cx, i, tlbHeader.dispatchpos, pTypeLibImpl); + *ppTI = MSFT_DoTypeInfo(&cx, i, pTypeLibImpl); ppTI = &((*ppTI)->next); (pTypeLibImpl->TypeInfoCount)++; @@ -2693,7 +2704,27 @@ return ptr - (char*)pLibBlk; } -static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD) +/* stores a mapping between the sltg typeinfo's references and the typelib's HREFTYPEs */ +typedef struct +{ + unsigned int num; + HREFTYPE refs[1]; +} sltg_ref_lookup_t; + +static HRESULT sltg_get_typelib_ref(sltg_ref_lookup_t *table, DWORD typeinfo_ref, HREFTYPE *typelib_ref) +{ + if(typeinfo_ref < table->num) + { + *typelib_ref = table->refs[typeinfo_ref]; + return S_OK; + } + + ERR("Unable to find reference\n"); + *typelib_ref = -1; + return E_FAIL; +} + +static WORD *SLTG_DoType(WORD *pType, char *pBlk, TYPEDESC *pTD, sltg_ref_lookup_t *ref_lookup) { BOOL done = FALSE; @@ -2714,7 +2745,7 @@ case VT_USERDEFINED: pTD->vt = VT_USERDEFINED; - pTD->u.hreftype = *(++pType) / 4; + sltg_get_typelib_ref(ref_lookup, *(++pType) / 4, &pTD->u.hreftype); done = TRUE; break; @@ -2759,7 +2790,7 @@ return pType; } -static WORD *SLTG_DoElem(WORD *pType, char *pBlk, ELEMDESC *pElem) +static WORD *SLTG_DoElem(WORD *pType, char *pBlk, ELEMDESC *pElem, sltg_ref_lookup_t *ref_lookup) { /* Handle [in/out] first */ if((*pType & 0xc000) == 0xc000) @@ -2777,36 +2808,44 @@ if(*pType & 0x80) pElem->u.paramdesc.wParamFlags |= PARAMFLAG_FRETVAL; - return SLTG_DoType(pType, pBlk, &pElem->tdesc); -} - - -static void SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeInfoImpl *pTI, + return SLTG_DoType(pType, pBlk, &pElem->tdesc, ref_lookup); +} + + +static sltg_ref_lookup_t *SLTG_DoRefs(SLTG_RefInfo *pRef, ITypeLibImpl *pTL, char *pNameTable) { int ref; char *name; - TLBRefType **ppRefType; + TLBRefType *ref_type; + sltg_ref_lookup_t *table; + HREFTYPE typelib_ref; if(pRef->magic != SLTG_REF_MAGIC) { FIXME("Ref magic = %x\n", pRef->magic); - return; + return NULL; } name = ( (char*)(&pRef->names) + pRef->number); - ppRefType = &pTI->reflist; + table = HeapAlloc(GetProcessHeap(), 0, sizeof(*table) + ((pRef->number >> 3) - 1) * sizeof(table->refs[0])); + table->num = pRef->number >> 3; + + /* FIXME should scan the existing list and reuse matching refs added by previous typeinfos */ + + /* We don't want the first href to be 0 */ + typelib_ref = (list_count(&pTL->ref_list) + 1) << 2; + for(ref = 0; ref < pRef->number >> 3; ref++) { char *refname; unsigned int lib_offs, type_num; - *ppRefType = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(**ppRefType)); + ref_type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ref_type)); name += SLTG_ReadStringA(name, &refname); if(sscanf(refname, "*\\R%x*#%x", &lib_offs, &type_num) != 2) FIXME("Can't sscanf ref\n"); if(lib_offs != 0xffff) { - TLBImpLib **import = &pTI->pTypeLib->pImpLibs; + TLBImpLib **import = &pTL->pImpLibs; while(*import) { if((*import)->offset == lib_offs) @@ -2835,23 +2874,32 @@ fname[len-1] = '\0'; (*import)->name = TLB_MultiByteToBSTR(fname); } - (*ppRefType)->pImpTLInfo = *import; + ref_type->pImpTLInfo = *import; + + /* Store a reference to IDispatch */ + if(pTL->dispatch_href == -1 && IsEqualGUID(&(*import)->guid, &IID_StdOle) && type_num == 4) + pTL->dispatch_href = typelib_ref; + } else { /* internal ref */ - (*ppRefType)->pImpTLInfo = TLB_REF_INTERNAL; + ref_type->pImpTLInfo = TLB_REF_INTERNAL; } - (*ppRefType)->reference = ref; - (*ppRefType)->index = type_num; + ref_type->reference = typelib_ref; + ref_type->index = type_num; HeapFree(GetProcessHeap(), 0, refname); - ppRefType = &(*ppRefType)->next; + list_add_tail(&pTL->ref_list, &ref_type->entry); + + table->refs[ref] = typelib_ref; + typelib_ref += 4; } if((BYTE)*name != SLTG_REF_MAGIC) FIXME("End of ref block magic = %x\n", *name); - dump_TLBRefType(pTI->reflist); + dump_TLBRefType(pTL); + return table; } static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI, - BOOL OneOnly) + BOOL OneOnly, sltg_ref_lookup_t *ref_lookup) { SLTG_ImplInfo *info; TLBImplType **ppImplType = &pTI->impltypelist; @@ -2866,7 +2914,7 @@ while(1) { *ppImplType = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(**ppImplType)); - (*ppImplType)->hRef = info->ref; + sltg_get_typelib_ref(ref_lookup, info->ref, &(*ppImplType)->hRef); (*ppImplType)->implflags = info->impltypeflags; pTI->TypeAttr.cImplTypes++; ppImplType = &(*ppImplType)->next; @@ -2881,7 +2929,7 @@ return (char*)info; } -static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cVars, char *pNameTable) +static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cVars, char *pNameTable, sltg_ref_lookup_t *ref_lookup) { TLBVarDesc **ppVarDesc = &pTI->varlist; BSTR bstrPrevName = NULL; @@ -2945,7 +2993,7 @@ FIXME_(typelib)("unhandled flags = %02x\n", pItem->flags & ~0xd2); SLTG_DoElem(pType, pBlk, - &(*ppVarDesc)->vardesc.elemdescVar); + &(*ppVarDesc)->vardesc.elemdescVar, ref_lookup); dump_TypeDesc(&(*ppVarDesc)->vardesc.elemdescVar.tdesc, buf); @@ -2955,7 +3003,7 @@ pTI->TypeAttr.cVars = cVars; } -static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cFuncs, char *pNameTable) +static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cFuncs, char *pNameTable, sltg_ref_lookup_t *ref_lookup) { SLTG_Function *pFunc; unsigned short i; @@ -3003,7 +3051,7 @@ else pType = (WORD*)(pBlk + pFunc->rettype); - SLTG_DoElem(pType, pBlk, &(*ppFuncDesc)->funcdesc.elemdescFunc); + SLTG_DoElem(pType, pBlk, &(*ppFuncDesc)->funcdesc.elemdescFunc, ref_lookup); (*ppFuncDesc)->funcdesc.lprgelemdescParam = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, @@ -3041,13 +3089,13 @@ if(HaveOffs) { /* the next word is an offset to type */ pType = (WORD*)(pBlk + *pArg); SLTG_DoElem(pType, pBlk, - &(*ppFuncDesc)->funcdesc.lprgelemdescParam[param]); + &(*ppFuncDesc)->funcdesc.lprgelemdescParam[param], ref_lookup); pArg++; } else { if(paramName) paramName--; pArg = SLTG_DoElem(pArg, pBlk, - &(*ppFuncDesc)->funcdesc.lprgelemdescParam[param]); + &(*ppFuncDesc)->funcdesc.lprgelemdescParam[param], ref_lookup); } /* Are we an optional param ? */ @@ -3072,17 +3120,19 @@ SLTG_TypeInfoTail *pTITail) { char *pFirstItem, *pNextItem; + sltg_ref_lookup_t *ref_lookup = NULL; if(pTIHeader->href_table != 0xffffffff) { - SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI, + ref_lookup = SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI->pTypeLib, pNameTable); } pFirstItem = pNextItem = pBlk; if(*(WORD*)pFirstItem == SLTG_IMPL_MAGIC) { - pNextItem = SLTG_DoImpls(pFirstItem, pTI, FALSE); - } + pNextItem = SLTG_DoImpls(pFirstItem, pTI, FALSE, ref_lookup); + } + HeapFree(GetProcessHeap(), 0, ref_lookup); } @@ -3091,20 +3141,23 @@ SLTG_TypeInfoTail *pTITail) { char *pFirstItem, *pNextItem; + sltg_ref_lookup_t *ref_lookup = NULL; if(pTIHeader->href_table != 0xffffffff) { - SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI, + ref_lookup = SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI->pTypeLib, pNameTable); } pFirstItem = pNextItem = pBlk; if(*(WORD*)pFirstItem == SLTG_IMPL_MAGIC) { - pNextItem = SLTG_DoImpls(pFirstItem, pTI, TRUE); + pNextItem = SLTG_DoImpls(pFirstItem, pTI, TRUE, ref_lookup); } if (pTITail->funcs_off != 0xffff) - SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable); + SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable, ref_lookup); + + HeapFree(GetProcessHeap(), 0, ref_lookup); if (TRACE_ON(typelib)) dump_TLBFuncDesc(pTI->funclist); @@ -3114,7 +3167,7 @@ char *pNameTable, SLTG_TypeInfoHeader *pTIHeader, SLTG_TypeInfoTail *pTITail) { - SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable); + SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable, NULL); } static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI, @@ -3122,6 +3175,7 @@ SLTG_TypeInfoTail *pTITail) { WORD *pType; + sltg_ref_lookup_t *ref_lookup = NULL; if (pTITail->simple_alias) { /* if simple alias, no more processing required */ @@ -3130,35 +3184,39 @@ } if(pTIHeader->href_table != 0xffffffff) { - SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI, + ref_lookup = SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI->pTypeLib, pNameTable); } /* otherwise it is an offset to a type */ pType = (WORD *)(pBlk + pTITail->tdescalias_vt); - SLTG_DoType(pType, pBlk, &pTI->TypeAttr.tdescAlias); + SLTG_DoType(pType, pBlk, &pTI->TypeAttr.tdescAlias, ref_lookup); + + HeapFree(GetProcessHeap(), 0, ref_lookup); } static void SLTG_ProcessDispatch(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable, SLTG_TypeInfoHeader *pTIHeader, SLTG_TypeInfoTail *pTITail) { + sltg_ref_lookup_t *ref_lookup = NULL; if (pTIHeader->href_table != 0xffffffff) - SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI, + ref_lookup = SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI->pTypeLib, pNameTable); if (pTITail->vars_off != 0xffff) - SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable); + SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable, ref_lookup); if (pTITail->funcs_off != 0xffff) - SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable); + SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable, ref_lookup); /* this is necessary to cope with MSFT typelibs that set cFuncs to the number * of dispinterface functons including the IDispatch ones, so * ITypeInfo::GetFuncDesc takes the real value for cFuncs from cbSizeVft */ pTI->TypeAttr.cbSizeVft = pTI->TypeAttr.cFuncs * sizeof(void *); + HeapFree(GetProcessHeap(), 0, ref_lookup); if (TRACE_ON(typelib)) dump_TLBFuncDesc(pTI->funclist); } @@ -3167,22 +3225,24 @@ char *pNameTable, SLTG_TypeInfoHeader *pTIHeader, SLTG_TypeInfoTail *pTITail) { - SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable); + SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable, NULL); } static void SLTG_ProcessModule(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable, SLTG_TypeInfoHeader *pTIHeader, SLTG_TypeInfoTail *pTITail) { + sltg_ref_lookup_t *ref_lookup = NULL; if (pTIHeader->href_table != 0xffffffff) - SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI, + ref_lookup = SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI->pTypeLib, pNameTable); if (pTITail->vars_off != 0xffff) - SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable); + SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable, ref_lookup); if (pTITail->funcs_off != 0xffff) - SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable); + SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable, ref_lookup); + HeapFree(GetProcessHeap(), 0, ref_lookup); } /* Because SLTG_OtherTypeInfo is such a painful struct, we make a more @@ -3553,6 +3613,8 @@ { TLBImpLib *pImpLib, *pImpLibNext; TLBCustData *pCustData, *pCustDataNext; + TLBRefType *ref_type; + void *cursor2; int i; /* remove cache entry */ @@ -3614,6 +3676,12 @@ pImpLibNext = pImpLib->next; TLB_Free(pImpLib); + } + + LIST_FOR_EACH_ENTRY_SAFE(ref_type, cursor2, &This->ref_list, TLBRefType, entry) + { + list_remove(&ref_type->entry); + TLB_Free(ref_type); } if (This->pTypeInfo) /* can be NULL */ @@ -4402,7 +4470,6 @@ TLBFuncDesc *pFInfo, *pFInfoNext; TLBVarDesc *pVInfo, *pVInfoNext; TLBImplType *pImpl, *pImplNext; - TLBRefType *pRefType,*pRefTypeNext; TLBCustData *pCustData, *pCustDataNext; TRACE("destroying ITypeInfo(%p)\n",This); @@ -4481,11 +4548,6 @@ pImplNext = pImpl->next; TLB_Free(pImpl); } - for(pRefType = This->reflist; pRefType; pRefType = pRefTypeNext) - { - pRefTypeNext = pRefType->next; - TLB_Free(pRefType); - } TLB_Free(This->pCustData); finish_free: @@ -4690,47 +4752,47 @@ return S_OK; } - return E_INVALIDARG; + return TYPE_E_ELEMENTNOTFOUND; } /* internal function to make the inherited interfaces' methods appear * part of the interface */ static HRESULT ITypeInfoImpl_GetInternalDispatchFuncDesc( ITypeInfo *iface, - UINT index, const FUNCDESC **ppFuncDesc, UINT *funcs) + UINT index, const FUNCDESC **ppFuncDesc, UINT *funcs, UINT *hrefoffset) { ITypeInfoImpl *This = (ITypeInfoImpl *)iface; HRESULT hr; - UINT i; UINT implemented_funcs = 0; if (funcs) *funcs = 0; - - for (i = 0; i < This->TypeAttr.cImplTypes; i++) - { - HREFTYPE href; + else + *hrefoffset = DISPATCH_HREF_OFFSET; + + if(This->impltypelist) + { ITypeInfo *pSubTypeInfo; UINT sub_funcs; - hr = ITypeInfo_GetRefTypeOfImplType(iface, i, &href); - if (FAILED(hr)) - return hr; - hr = ITypeInfo_GetRefTypeInfo(iface, href, &pSubTypeInfo); + hr = ITypeInfo_GetRefTypeInfo(iface, This->impltypelist->hRef, &pSubTypeInfo); if (FAILED(hr)) return hr; hr = ITypeInfoImpl_GetInternalDispatchFuncDesc(pSubTypeInfo, index, ppFuncDesc, - &sub_funcs); + &sub_funcs, hrefoffset); implemented_funcs += sub_funcs; ITypeInfo_Release(pSubTypeInfo); if (SUCCEEDED(hr)) return hr; + *hrefoffset += DISPATCH_HREF_OFFSET; } if (funcs) *funcs = implemented_funcs + This->TypeAttr.cFuncs; + else + *hrefoffset = 0; if (index < implemented_funcs) return E_INVALIDARG; @@ -4738,6 +4800,37 @@ ppFuncDesc); } +static inline void ITypeInfoImpl_ElemDescAddHrefOffset( LPELEMDESC pElemDesc, UINT hrefoffset) +{ + TYPEDESC *pTypeDesc = &pElemDesc->tdesc; + while (TRUE) + { + switch (pTypeDesc->vt) + { + case VT_USERDEFINED: + pTypeDesc->u.hreftype += hrefoffset; + return; + case VT_PTR: + case VT_SAFEARRAY: + pTypeDesc = pTypeDesc->u.lptdesc; + break; + case VT_CARRAY: + pTypeDesc = &pTypeDesc->u.lpadesc->tdescElem; + break; + default: + return; + } + } +} + +static inline void ITypeInfoImpl_FuncDescAddHrefOffset( LPFUNCDESC pFuncDesc, UINT hrefoffset) +{ + SHORT i; + for (i = 0; i < pFuncDesc->cParams; i++) + ITypeInfoImpl_ElemDescAddHrefOffset(&pFuncDesc->lprgelemdescParam[i], hrefoffset); + ITypeInfoImpl_ElemDescAddHrefOffset(&pFuncDesc->elemdescFunc, hrefoffset); +} + /* ITypeInfo::GetFuncDesc * * Retrieves the FUNCDESC structure that contains information about a @@ -4750,13 +4843,14 @@ ITypeInfoImpl *This = (ITypeInfoImpl *)iface; const FUNCDESC *internal_funcdesc; HRESULT hr; + UINT hrefoffset = 0; TRACE("(%p) index %d\n", This, index); - if ((This->TypeAttr.typekind == TKIND_DISPATCH) && - (This->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL)) + if (This->TypeAttr.typekind == TKIND_DISPATCH) hr = ITypeInfoImpl_GetInternalDispatchFuncDesc((ITypeInfo *)iface, index, - &internal_funcdesc, NULL); + &internal_funcdesc, NULL, + &hrefoffset); else hr = ITypeInfoImpl_GetInternalFuncDesc((ITypeInfo *)iface, index, &internal_funcdesc); @@ -4766,10 +4860,16 @@ return hr; } - return TLB_AllocAndInitFuncDesc( + hr = TLB_AllocAndInitFuncDesc( internal_funcdesc, ppFuncDesc, This->TypeAttr.typekind == TKIND_DISPATCH); + + if ((This->TypeAttr.typekind == TKIND_DISPATCH) && hrefoffset) + ITypeInfoImpl_FuncDescAddHrefOffset(*ppFuncDesc, hrefoffset); + + TRACE("-- 0x%08x\n", hr); + return hr; } static HRESULT TLB_AllocAndInitVarDesc( const VARDESC *src, VARDESC **dest_ptr ) @@ -4885,7 +4985,7 @@ } else { - if(This->TypeAttr.cImplTypes && + if(This->impltypelist && (This->TypeAttr.typekind==TKIND_INTERFACE || This->TypeAttr.typekind==TKIND_DISPATCH)) { /* recursive search */ ITypeInfo *pTInfo; @@ -4950,6 +5050,11 @@ hr = TYPE_E_ELEMENTNOTFOUND; } } + else if(index == 0 && This->TypeAttr.typekind == TKIND_DISPATCH) + { + /* All TKIND_DISPATCHs are made to look like they inherit from IDispatch */ + *pRefType = This->pTypeLib->dispatch_href; + } else { /* get element n from linked list */ @@ -5043,7 +5148,7 @@ } } /* not found, see if it can be found in an inherited interface */ - if(This->TypeAttr.cImplTypes) { + if(This->impltypelist) { /* recursive search */ ITypeInfo *pTInfo; ret=ITypeInfo_GetRefTypeInfo(iface, @@ -5151,6 +5256,27 @@ case 23: res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22]); break; + case 24: + res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22],args[23]); + break; + case 25: + res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22],args[23],args[24]); + break; + case 26: + res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22],args[23],args[24],args[25]); + break; + case 27: + res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22],args[23],args[24],args[25],args[26]); + break; + case 28: + res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22],args[23],args[24],args[25],args[26],args[27]); + break; + case 29: + res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22],args[23],args[24],args[25],args[26],args[27],args[28]); + break; + case 30: + res = func(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11],args[12],args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20],args[21],args[22],args[23],args[24],args[25],args[26],args[27],args[28],args[29]); + break; default: FIXME("unsupported number of arguments %d in stdcall\n",nrargs); res = -1; @@ -5202,7 +5328,7 @@ break; case TKIND_INTERFACE: - if (IsEqualIID(&IID_IDispatch, &tattr->guid)) + if (tattr->wTypeFlags & TYPEFLAG_FDISPATCHABLE) *vt |= VT_DISPATCH; else *vt |= VT_UNKNOWN; @@ -5489,6 +5615,13 @@ rgdispidNamedArgs++; } + if (func_desc->cParamsOpt < 0 && cNamedArgs) + { + ERR("functions with the vararg attribute do not support named arguments\n"); + hres = DISP_E_NONAMEDARGS; + goto func_fail; + } + for (i = 0; i < func_desc->cParams; i++) { TYPEDESC *tdesc = &func_desc->lprgelemdescParam[i].tdesc; @@ -5567,6 +5700,36 @@ hres = VariantCopy(&missing_arg[i], src_arg); V_VARIANTREF(&rgvarg[i]) = &missing_arg[i]; } + V_VT(&rgvarg[i]) = rgvt[i]; + } + else if (rgvt[i] == (VT_VARIANT | VT_ARRAY) && func_desc->cParamsOpt < 0 && i == func_desc->cParams-1) + { + SAFEARRAY *a; + SAFEARRAYBOUND bound; + VARIANT *v; + LONG j; + bound.lLbound = 0; + bound.cElements = pDispParams->cArgs-i; + if (!(a = SafeArrayCreate(VT_VARIANT, 1, &bound))) + { + ERR("SafeArrayCreate failed\n"); + break; + } + hres = SafeArrayAccessData(a, (LPVOID)&v); + if (hres != S_OK) + { + ERR("SafeArrayAccessData failed with %x\n", hres); + break; + } + for (j = 0; j < bound.cElements; j++) + VariantCopy(&v[j], &pDispParams->rgvarg[pDispParams->cArgs - 1 - i - j]); + hres = SafeArrayUnaccessData(a); + if (hres != S_OK) + { + ERR("SafeArrayUnaccessData failed with %x\n", hres); + break; + } + V_ARRAY(&rgvarg[i]) = a; V_VT(&rgvarg[i]) = rgvt[i]; } else if ((rgvt[i] & VT_BYREF) && !V_ISBYREF(src_arg)) @@ -5635,12 +5798,6 @@ } } if (FAILED(hres)) goto func_fail; /* FIXME: we don't free changed types here */ - if (func_desc->cParamsOpt < 0) - { - FIXME("Does not support safearray optional parameters\n"); - hres = DISP_E_BADPARAMCOUNT; - goto func_fail; /* FIXME: we don't free changed types here */ - } /* VT_VOID is a special case for return types, so it is not * handled in the general function */ @@ -5704,6 +5861,34 @@ break; } } + else if (V_VT(prgpvarg[i]) == (VT_VARIANT | VT_ARRAY) && + func_desc->cParamsOpt < 0 && + i == func_desc->cParams-1) + { + SAFEARRAY *a = V_ARRAY(prgpvarg[i]); + LONG j, ubound; + VARIANT *v; + hres = SafeArrayGetUBound(a, 1, &ubound); + if (hres != S_OK) + { + ERR("SafeArrayGetUBound failed with %x\n", hres); + break; + } + hres = SafeArrayAccessData(a, (LPVOID)&v); + if (hres != S_OK) + { + ERR("SafeArrayAccessData failed with %x\n", hres); + break; + } + for (j = 0; j <= ubound; j++) + VariantClear(&v[j]); + hres = SafeArrayUnaccessData(a); + if (hres != S_OK) + { + ERR("SafeArrayUnaccessData failed with %x\n", hres); + break; + } + } VariantClear(&rgvarg[i]); } else if (wParamFlags & PARAMFLAG_FOPT) @@ -5747,7 +5932,7 @@ } if (SUCCEEDED(hres) && pVarResult && (func_desc->cParams == 1) && - (wFlags == INVOKE_PROPERTYGET) && + (func_desc->invkind & INVOKE_PROPERTYGET) && (func_desc->lprgelemdescParam[0].u.paramdesc.wParamFlags & PARAMFLAG_FRETVAL) && (pDispParams->cArgs != 0)) { @@ -5814,11 +5999,10 @@ /* not found, look for it in inherited interfaces */ ITypeInfo2_GetTypeKind(iface, &type_kind); if(type_kind == TKIND_INTERFACE || type_kind == TKIND_DISPATCH) { - HREFTYPE ref_type; - if(SUCCEEDED(ITypeInfo2_GetRefTypeOfImplType(iface, 0, &ref_type))) { + if(This->impltypelist) { /* recursive search */ ITypeInfo *pTInfo; - hres = ITypeInfo_GetRefTypeInfo(iface, ref_type, &pTInfo); + hres = ITypeInfo_GetRefTypeInfo(iface, This->impltypelist->hRef, &pTInfo); if(SUCCEEDED(hres)){ hres = ITypeInfo_Invoke(pTInfo,pIUnk,memid,wFlags,pDispParams,pVarResult,pExcepInfo,pArgErr); ITypeInfo_Release(pTInfo); @@ -5881,7 +6065,7 @@ } } - if(This->TypeAttr.cImplTypes && + if(This->impltypelist && (This->TypeAttr.typekind==TKIND_INTERFACE || This->TypeAttr.typekind==TKIND_DISPATCH)) { /* recursive search */ ITypeInfo *pTInfo; @@ -5947,6 +6131,38 @@ return TYPE_E_ELEMENTNOTFOUND; } +/* internal function to make the inherited interfaces' methods appear + * part of the interface */ +static HRESULT ITypeInfoImpl_GetDispatchRefTypeInfo( ITypeInfo *iface, + HREFTYPE *hRefType, ITypeInfo **ppTInfo) +{ + ITypeInfoImpl *This = (ITypeInfoImpl *)iface; + HRESULT hr; + + TRACE("%p, 0x%x\n", iface, *hRefType); + + if (This->impltypelist && (*hRefType & DISPATCH_HREF_MASK)) + { + ITypeInfo *pSubTypeInfo; + + hr = ITypeInfo_GetRefTypeInfo(iface, This->impltypelist->hRef, &pSubTypeInfo); + if (FAILED(hr)) + return hr; + + hr = ITypeInfoImpl_GetDispatchRefTypeInfo(pSubTypeInfo, + hRefType, ppTInfo); + ITypeInfo_Release(pSubTypeInfo); + if (SUCCEEDED(hr)) + return hr; + } + *hRefType -= DISPATCH_HREF_OFFSET; + + if (!(*hRefType & DISPATCH_HREF_MASK)) + return ITypeInfo_GetRefTypeInfo(iface, *hRefType, ppTInfo); + else + return E_FAIL; +} + /* ITypeInfo::GetRefTypeInfo * * If a type description references other type descriptions, it retrieves @@ -5967,8 +6183,8 @@ result = S_OK; } else if (hRefType == -1 && - (((ITypeInfoImpl*) This)->TypeAttr.typekind == TKIND_DISPATCH) && - (((ITypeInfoImpl*) This)->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL)) + (This->TypeAttr.typekind == TKIND_DISPATCH) && + (This->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL)) { /* when we meet a DUAL dispinterface, we must create the interface * version of it. @@ -5998,52 +6214,62 @@ result = S_OK; + } else if ((hRefType != -1) && (hRefType & DISPATCH_HREF_MASK) && + (This->TypeAttr.typekind == TKIND_DISPATCH) && + (This->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL)) + { + HREFTYPE href_dispatch = hRefType; + result = ITypeInfoImpl_GetDispatchRefTypeInfo((ITypeInfo *)iface, &href_dispatch, ppTInfo); } else { - TLBRefType *pRefType; - for(pRefType = This->reflist; pRefType; pRefType = pRefType->next) { - if(pRefType->reference == hRefType) - break; - } - if(!pRefType) - FIXME("Can't find pRefType for ref %x\n", hRefType); - if(pRefType && hRefType != -1) { + TLBRefType *ref_type; + LIST_FOR_EACH_ENTRY(ref_type, &This->pTypeLib->ref_list, TLBRefType, entry) + { + if(ref_type->reference == hRefType) + break; + } + if(&ref_type->entry == &This->pTypeLib->ref_list) + { + FIXME("Can't find pRefType for ref %x\n", hRefType); + goto end; + } + if(hRefType != -1) { ITypeLib *pTLib = NULL; - if(pRefType->pImpTLInfo == TLB_REF_INTERNAL) { + if(ref_type->pImpTLInfo == TLB_REF_INTERNAL) { UINT Index; result = ITypeInfo_GetContainingTypeLib(iface, &pTLib, &Index); } else { - if(pRefType->pImpTLInfo->pImpTypeLib) { + if(ref_type->pImpTLInfo->pImpTypeLib) { TRACE("typeinfo in imported typelib that is already loaded\n"); - pTLib = (ITypeLib*)pRefType->pImpTLInfo->pImpTypeLib; + pTLib = (ITypeLib*)ref_type->pImpTLInfo->pImpTypeLib; ITypeLib2_AddRef((ITypeLib*) pTLib); result = S_OK; } else { TRACE("typeinfo in imported typelib that isn't already loaded\n"); - result = LoadRegTypeLib( &pRefType->pImpTLInfo->guid, - pRefType->pImpTLInfo->wVersionMajor, - pRefType->pImpTLInfo->wVersionMinor, - pRefType->pImpTLInfo->lcid, + result = LoadRegTypeLib( &ref_type->pImpTLInfo->guid, + ref_type->pImpTLInfo->wVersionMajor, + ref_type->pImpTLInfo->wVersionMinor, + ref_type->pImpTLInfo->lcid, &pTLib); if(!SUCCEEDED(result)) { - BSTR libnam=SysAllocString(pRefType->pImpTLInfo->name); + BSTR libnam=SysAllocString(ref_type->pImpTLInfo->name); result=LoadTypeLib(libnam, &pTLib); SysFreeString(libnam); } if(SUCCEEDED(result)) { - pRefType->pImpTLInfo->pImpTypeLib = (ITypeLibImpl*)pTLib; + ref_type->pImpTLInfo->pImpTypeLib = (ITypeLibImpl*)pTLib; ITypeLib2_AddRef(pTLib); } } } if(SUCCEEDED(result)) { - if(pRefType->index == TLB_REF_USE_GUID) + if(ref_type->index == TLB_REF_USE_GUID) result = ITypeLib2_GetTypeInfoOfGuid(pTLib, - &pRefType->guid, + &ref_type->guid, ppTInfo); else - result = ITypeLib2_GetTypeInfo(pTLib, pRefType->index, + result = ITypeLib2_GetTypeInfo(pTLib, ref_type->index, ppTInfo); } if (pTLib != NULL) @@ -6051,6 +6277,7 @@ } } +end: TRACE("(%p) hreftype 0x%04x loaded %s (%p)\n", This, hRefType, SUCCEEDED(result)? "SUCCESS":"FAILURE", *ppTInfo); return result; @@ -6809,6 +7036,7 @@ ITypeLibImpl *pTypeLibImpl; int param, func; TLBFuncDesc **ppFuncDesc; + TLBRefType *ref; TRACE("\n"); pTypeLibImpl = TypeLibImpl_Constructor(); @@ -6865,6 +7093,7 @@ (*ppFuncDesc)->ctCustData = 0; (*ppFuncDesc)->pCustData = NULL; (*ppFuncDesc)->next = NULL; + pTIIface->TypeAttr.cFuncs++; ppFuncDesc = &(*ppFuncDesc)->next; } @@ -6892,12 +7121,13 @@ pTIClass->TypeAttr.wTypeFlags = 0; pTIClass->impltypelist = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pTIClass->impltypelist)); - pTIClass->impltypelist->hRef = 1; - - pTIClass->reflist = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pTIClass->reflist)); - pTIClass->reflist->index = 0; - pTIClass->reflist->reference = 1; - pTIClass->reflist->pImpTLInfo = TLB_REF_INTERNAL; + pTIClass->impltypelist->hRef = 0; + + ref = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ref)); + ref->index = 0; + ref->reference = 0; + ref->pImpTLInfo = TLB_REF_INTERNAL; + list_add_head(&pTypeLibImpl->ref_list, &ref->entry); dump_TypeInfo(pTIClass); @@ -6989,7 +7219,7 @@ } } /* FIXME: search each inherited interface, not just the first */ - if (hr == DISP_E_MEMBERNOTFOUND && This->TypeAttr.cImplTypes) { + if (hr == DISP_E_MEMBERNOTFOUND && This->impltypelist) { /* recursive search */ ITypeInfo *pTInfo; ITypeComp *pTComp; Modified: trunk/reactos/dll/win32/oleaut32/typelib16.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/typelib16.c (original) +++ trunk/reactos/dll/win32/oleaut32/typelib16.c Fri Jul 27 13:59:17 2007 @@ -33,7 +33,6 @@ #include "winerror.h" #include "windef.h" #include "winbase.h" -#include "winnls.h" #include "winreg.h" #include "winuser.h" Modified: trunk/reactos/dll/win32/oleaut32/typelib2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/typelib2.c (original) +++ trunk/reactos/dll/win32/oleaut32/typelib2.c Fri Jul 27 13:59:17 2007 @@ -43,7 +43,6 @@ #include "windef.h" #include "winbase.h" #include "winnls.h" -#include "winreg.h" #include "winuser.h" #include "wine/unicode.h" Modified: trunk/reactos/dll/win32/oleaut32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/usrmars…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/usrmarshal.c (original) +++ trunk/reactos/dll/win32/oleaut32/usrmarshal.c Fri Jul 27 13:59:17 2007 @@ -277,14 +277,14 @@ return 7; } -static unsigned interface_variant_size(ULONG *pFlags, REFIID riid, VARIANT *pvar) +static unsigned interface_variant_size(ULONG *pFlags, REFIID riid, IUnknown *punk) { ULONG size; HRESULT hr; /* find the buffer size of the marshalled dispatch interface */ - hr = CoGetMarshalSizeMax(&size, riid, V_UNKNOWN(pvar), LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL); + hr = CoGetMarshalSizeMax(&size, riid, punk, LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL); if (FAILED(hr)) { - if (!V_DISPATCH(pvar)) + if (!punk) WARN("NULL dispatch pointer\n"); else ERR("Dispatch variant buffer size calculation failed, HRESULT=0x%x\n", hr); @@ -313,9 +313,13 @@ case VT_VARIANT | VT_BYREF: return VARIANT_UserSize(pFlags, Start, V_VARIANTREF(pvar)); case VT_UNKNOWN: - return Start + interface_variant_size(pFlags, &IID_IUnknown, pvar); + return Start + interface_variant_size(pFlags, &IID_IUnknown, V_UNKNOWN(pvar)); + case VT_UNKNOWN | VT_BYREF: + return Start + interface_variant_size(pFlags, &IID_IUnknown, *V_UNKNOWNREF(pvar)); case VT_DISPATCH: - return Start + interface_variant_size(pFlags, &IID_IDispatch, pvar); + return Start + interface_variant_size(pFlags, &IID_IDispatch, (IUnknown*)V_DISPATCH(pvar)); + case VT_DISPATCH | VT_BYREF: + return Start + interface_variant_size(pFlags, &IID_IDispatch, (IUnknown*)*V_DISPATCHREF(pvar)); case VT_RECORD: FIXME("wire-size record\n"); return Start; @@ -329,7 +333,7 @@ } /* helper: called for VT_DISPATCH variants to marshal the IDispatch* into the buffer. returns Buffer on failure, new position otherwise */ -static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, VARIANT *pvar) +static unsigned char* interface_variant_marshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, IUnknown *punk) { IStream *working; HGLOBAL working_mem; @@ -338,7 +342,7 @@ ULONG size; HRESULT hr; - TRACE("pFlags=%d, Buffer=%p, pvar=%p\n", *pFlags, Buffer, pvar); + TRACE("pFlags=%d, Buffer=%p, pUnk=%p\n", *pFlags, Buffer, punk); oldpos = Buffer; @@ -348,7 +352,7 @@ * but that would be overkill here, hence this implementation. We save the size because the unmarshal * code has no way to know how long the marshalled buffer is. */ - size = wire_extra_user_size(pFlags, 0, pvar); + size = interface_variant_size(pFlags, riid, punk); working_mem = GlobalAlloc(0, size); if (!working_mem) return oldpos; @@ -359,7 +363,7 @@ return oldpos; } - hr = CoMarshalInterface(working, riid, V_UNKNOWN(pvar), LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL); + hr = CoMarshalInterface(working, riid, punk, LOWORD(*pFlags), NULL, MSHLFLAGS_NORMAL); if (hr != S_OK) { IStream_Release(working); /* this also releases the hglobal */ return oldpos; @@ -378,7 +382,7 @@ } /* helper: called for VT_DISPATCH / VT_UNKNOWN variants to unmarshal the buffer. returns Buffer on failure, new position otherwise */ -static unsigned char *interface_variant_unmarshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, VARIANT *pvar) +static unsigned char *interface_variant_unmarshal(ULONG *pFlags, unsigned char *Buffer, REFIID riid, IUnknown **ppunk) { IStream *working; HGLOBAL working_mem; @@ -387,10 +391,10 @@ ULONG size; HRESULT hr; - TRACE("pFlags=%d, Buffer=%p, pvar=%p\n", *pFlags, Buffer, pvar); + TRACE("pFlags=%d, Buffer=%p, ppUnk=%p\n", *pFlags, Buffer, ppunk); oldpos = Buffer; - + /* get the buffersize */ memcpy(&size, Buffer, sizeof(ULONG)); TRACE("buffersize=%d\n", size); @@ -410,7 +414,7 @@ memcpy(working_memlocked, Buffer + sizeof(ULONG), size); GlobalUnlock(working_mem); - hr = CoUnmarshalInterface(working, riid, (void**)&V_UNKNOWN(pvar)); + hr = CoUnmarshalInterface(working, riid, (void**)ppunk); if (hr != S_OK) { IStream_Release(working); return oldpos; @@ -520,16 +524,21 @@ case VT_VARIANT | VT_BYREF: Pos = VARIANT_UserMarshal(pFlags, Pos, V_VARIANTREF(pvar)); break; - case VT_DISPATCH | VT_BYREF: - FIXME("handle DISPATCH by ref\n"); - break; case VT_UNKNOWN: /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */ - Pos = interface_variant_marshal(pFlags, Pos, &IID_IUnknown, pvar); + Pos = interface_variant_marshal(pFlags, Pos, &IID_IUnknown, V_UNKNOWN(pvar)); + break; + case VT_UNKNOWN | VT_BYREF: + /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */ + Pos = interface_variant_marshal(pFlags, Pos, &IID_IUnknown, *V_UNKNOWNREF(pvar)); break; case VT_DISPATCH: /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */ - Pos = interface_variant_marshal(pFlags, Pos, &IID_IDispatch, pvar); + Pos = interface_variant_marshal(pFlags, Pos, &IID_IDispatch, (IUnknown*)V_DISPATCH(pvar)); + break; + case VT_DISPATCH | VT_BYREF: + /* this should probably call WdtpInterfacePointer_UserMarshal in ole32.dll */ + Pos = interface_variant_marshal(pFlags, Pos, &IID_IDispatch, (IUnknown*)*V_DISPATCHREF(pvar)); break; case VT_RECORD: FIXME("handle BRECORD by val\n"); @@ -609,16 +618,21 @@ case VT_VARIANT | VT_BYREF: Pos = VARIANT_UserUnmarshal(pFlags, Pos, V_VARIANTREF(pvar)); break; - case VT_DISPATCH | VT_BYREF: - FIXME("handle DISPATCH by ref\n"); - break; case VT_UNKNOWN: /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */ - Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IUnknown, pvar); + Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IUnknown, &V_UNKNOWN(pvar)); + break; + case VT_UNKNOWN | VT_BYREF: + /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */ + Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IUnknown, V_UNKNOWNREF(pvar)); break; case VT_DISPATCH: /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */ - Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IDispatch, pvar); + Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IDispatch, (IUnknown**)&V_DISPATCH(pvar)); + break; + case VT_DISPATCH | VT_BYREF: + /* this should probably call WdtpInterfacePointer_UserUnmarshal in ole32.dll */ + Pos = interface_variant_unmarshal(pFlags, Pos, &IID_IDispatch, (IUnknown**)V_DISPATCHREF(pvar)); break; case VT_RECORD: FIXME("handle BRECORD by val\n"); @@ -697,6 +711,8 @@ hr = SafeArrayGetVartype(psa, &vt); if (FAILED(hr)) { + if(psa->fFeatures & FADF_VARIANT) return SF_VARIANT; + switch(psa->cbElements) { case 1: vt = VT_I1; break; Modified: trunk/reactos/dll/win32/oleaut32/variant.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/variant…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/variant.c (original) +++ trunk/reactos/dll/win32/oleaut32/variant.c Fri Jul 27 13:59:17 2007 @@ -2929,7 +2929,7 @@ } ExtraFlags = leftExtraFlags; - /* Native VarAnd always returns a error when using any extra + /* Native VarAnd always returns an error when using extra * flags or if the variant combination is I8 and INT. */ if ((leftvt == VT_I8 && rightvt == VT_INT) || @@ -3563,7 +3563,7 @@ } ExtraFlags = leftExtraFlags; - /* Native VarDiv always returns a error when using any extra flags */ + /* Native VarDiv always returns an error when using extra flags */ if (ExtraFlags != 0) { hres = DISP_E_BADVARTYPE; @@ -4273,15 +4273,28 @@ { VARIANT varIn; HRESULT hRet = S_OK; + VARIANT temp; + + VariantInit(&temp); TRACE("(%p->(%s%s),%p)\n", pVarIn, debugstr_VT(pVarIn), debugstr_VF(pVarIn), pVarOut); + + /* Handle VT_DISPATCH by storing and taking address of returned value */ + if ((V_VT(pVarIn) & VT_TYPEMASK) == VT_DISPATCH && ((V_VT(pVarIn) & ~VT_TYPEMASK) == 0)) + { + hRet = VARIANT_FetchDispatchValue(pVarIn, &temp); + if (FAILED(hRet)) goto VarAbs_Exit; + pVarIn = &temp; + } if (V_ISARRAY(pVarIn) || V_VT(pVarIn) == VT_UNKNOWN || V_VT(pVarIn) == VT_DISPATCH || V_VT(pVarIn) == VT_RECORD || V_VT(pVarIn) == VT_ERROR) - return DISP_E_TYPEMISMATCH; - + { + hRet = DISP_E_TYPEMISMATCH; + goto VarAbs_Exit; + } *pVarOut = *pVarIn; /* Shallow copy the value, and invert it if needed */ #define ABS_CASE(typ,min) \ @@ -4331,6 +4344,8 @@ hRet = DISP_E_BADVARTYPE; } +VarAbs_Exit: + VariantClear(&temp); return hRet; } @@ -4362,10 +4377,20 @@ HRESULT WINAPI VarFix(LPVARIANT pVarIn, LPVARIANT pVarOut) { HRESULT hRet = S_OK; + VARIANT temp; + + VariantInit(&temp); TRACE("(%p->(%s%s),%p)\n", pVarIn, debugstr_VT(pVarIn), debugstr_VF(pVarIn), pVarOut); + /* Handle VT_DISPATCH by storing and taking address of returned value */ + if ((V_VT(pVarIn) & VT_TYPEMASK) == VT_DISPATCH && ((V_VT(pVarIn) & ~VT_TYPEMASK) == 0)) + { + hRet = VARIANT_FetchDispatchValue(pVarIn, &temp); + if (FAILED(hRet)) goto VarFix_Exit; + pVarIn = &temp; + } V_VT(pVarOut) = V_VT(pVarIn); switch (V_VT(pVarIn)) @@ -4423,8 +4448,10 @@ else hRet = DISP_E_TYPEMISMATCH; } +VarFix_Exit: if (FAILED(hRet)) V_VT(pVarOut) = VT_EMPTY; + VariantClear(&temp); return hRet; } @@ -4457,10 +4484,20 @@ HRESULT WINAPI VarInt(LPVARIANT pVarIn, LPVARIANT pVarOut) { HRESULT hRet = S_OK; + VARIANT temp; + + VariantInit(&temp); TRACE("(%p->(%s%s),%p)\n", pVarIn, debugstr_VT(pVarIn), debugstr_VF(pVarIn), pVarOut); + /* Handle VT_DISPATCH by storing and taking address of returned value */ + if ((V_VT(pVarIn) & VT_TYPEMASK) == VT_DISPATCH && ((V_VT(pVarIn) & ~VT_TYPEMASK) == 0)) + { + hRet = VARIANT_FetchDispatchValue(pVarIn, &temp); + if (FAILED(hRet)) goto VarInt_Exit; + pVarIn = &temp; + } V_VT(pVarOut) = V_VT(pVarIn); switch (V_VT(pVarIn)) @@ -4484,8 +4521,10 @@ hRet = VarDecInt(&V_DECIMAL(pVarIn), &V_DECIMAL(pVarOut)); break; default: - return VarFix(pVarIn, pVarOut); - } + hRet = VarFix(pVarIn, pVarOut); + } +VarInt_Exit: + VariantClear(&temp); return hRet; } @@ -4758,10 +4797,20 @@ HRESULT WINAPI VarNeg(LPVARIANT pVarIn, LPVARIANT pVarOut) { HRESULT hRet = S_OK; + VARIANT temp; + + VariantInit(&temp); TRACE("(%p->(%s%s),%p)\n", pVarIn, debugstr_VT(pVarIn), debugstr_VF(pVarIn), pVarOut); + /* Handle VT_DISPATCH by storing and taking address of returned value */ + if ((V_VT(pVarIn) & VT_TYPEMASK) == VT_DISPATCH && ((V_VT(pVarIn) & ~VT_TYPEMASK) == 0)) + { + hRet = VARIANT_FetchDispatchValue(pVarIn, &temp); + if (FAILED(hRet)) goto VarNeg_Exit; + pVarIn = &temp; + } V_VT(pVarOut) = V_VT(pVarIn); switch (V_VT(pVarIn)) @@ -4833,8 +4882,10 @@ else hRet = DISP_E_TYPEMISMATCH; } +VarNeg_Exit: if (FAILED(hRet)) V_VT(pVarOut) = VT_EMPTY; + VariantClear(&temp); return hRet; } @@ -4876,9 +4927,20 @@ { VARIANT varIn; HRESULT hRet = S_OK; + VARIANT temp; + + VariantInit(&temp); TRACE("(%p->(%s%s),%p)\n", pVarIn, debugstr_VT(pVarIn), debugstr_VF(pVarIn), pVarOut); + + /* Handle VT_DISPATCH by storing and taking address of returned value */ + if ((V_VT(pVarIn) & VT_TYPEMASK) == VT_DISPATCH && ((V_VT(pVarIn) & ~VT_TYPEMASK) == 0)) + { + hRet = VARIANT_FetchDispatchValue(pVarIn, &temp); + if (FAILED(hRet)) goto VarNot_Exit; + pVarIn = &temp; + } V_VT(pVarOut) = V_VT(pVarIn); @@ -4951,8 +5013,10 @@ else hRet = DISP_E_TYPEMISMATCH; } +VarNot_Exit: if (FAILED(hRet)) V_VT(pVarOut) = VT_EMPTY; + VariantClear(&temp); return hRet; } @@ -4981,8 +5045,19 @@ VARIANT varIn; HRESULT hRet = S_OK; float factor; + VARIANT temp; + + VariantInit(&temp); TRACE("(%p->(%s%s),%d)\n", pVarIn, debugstr_VT(pVarIn), debugstr_VF(pVarIn), deci); + + /* Handle VT_DISPATCH by storing and taking address of returned value */ + if ((V_VT(pVarIn) & VT_TYPEMASK) == VT_DISPATCH && ((V_VT(pVarIn) & ~VT_TYPEMASK) == 0)) + { + hRet = VARIANT_FetchDispatchValue(pVarIn, &temp); + if (FAILED(hRet)) goto VarRound_Exit; + pVarIn = &temp; + } switch (V_VT(pVarIn)) { @@ -5074,9 +5149,10 @@ V_VT(pVarIn) & VT_TYPEMASK, deci); hRet = DISP_E_BADVARTYPE; } - +VarRound_Exit: if (FAILED(hRet)) V_VT(pVarOut) = VT_EMPTY; + VariantClear(&temp); TRACE("returning 0x%08x (%s%s),%f\n", hRet, debugstr_VT(pVarOut), debugstr_VF(pVarOut), (V_VT(pVarOut) == VT_R4) ? V_R4(pVarOut) : @@ -5131,7 +5207,7 @@ } ExtraFlags = leftExtraFlags; - /* Native VarIdiv always returns a error when using any extra + /* Native VarIdiv always returns an error when using extra * flags or if the variant combination is I8 and INT. */ if ((leftvt == VT_I8 && rightvt == VT_INT) || @@ -5543,7 +5619,7 @@ } ExtraFlags = leftExtraFlags; - /* Native VarPow always returns a error when using any extra flags */ + /* Native VarPow always returns an error when using extra flags */ if (ExtraFlags != 0) { hr = DISP_E_BADVARTYPE; @@ -5659,7 +5735,7 @@ } ExtraFlags = leftExtraFlags; - /* Native VarImp always returns a error when using any extra + /* Native VarImp always returns an error when using extra * flags or if the variants are I8 and INT. */ if ((leftvt == VT_I8 && rightvt == VT_INT) || Modified: trunk/reactos/dll/win32/oleaut32/vartype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/vartype…
============================================================================== --- trunk/reactos/dll/win32/oleaut32/vartype.c (original) +++ trunk/reactos/dll/win32/oleaut32/vartype.c Fri Jul 27 13:59:17 2007 @@ -3523,7 +3523,6 @@ if (result_fpstatus & 0x9) /* Overflow | Invalid */ return DISP_E_OVERFLOW; - return S_OK; #else /* This version produces slightly different results for boundary cases */ if (dblIn < -922337203685477.5807 || dblIn >= 922337203685477.5807) @@ -7425,7 +7424,7 @@ /* Parse the string into our structure */ while (*strIn) { - if (dp.dwCount > 6) + if (dp.dwCount >= 6) break; if (isdigitW(*strIn))
17 years, 3 months
1
0
0
0
[winesync] 27913: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 13:52:38 2007 New Revision: 27913 URL:
http://svn.reactos.org/svn/reactos?rev=27913&view=rev
Log: Autosyncing with Wine HEAD Modified: trunk/reactos/dll/win32/oleacc/main.c Modified: trunk/reactos/dll/win32/oleacc/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleacc/main.c?re…
============================================================================== --- trunk/reactos/dll/win32/oleacc/main.c (original) +++ trunk/reactos/dll/win32/oleacc/main.c Fri Jul 27 13:52:38 2007 @@ -38,7 +38,7 @@ HRESULT WINAPI LresultFromObject( REFIID riid, WPARAM wParam, LPUNKNOWN pAcc ) { - FIXME("%s %d %p\n", debugstr_guid(riid), wParam, pAcc ); + FIXME("%s %ld %p\n", debugstr_guid(riid), wParam, pAcc ); return E_NOTIMPL; }
17 years, 3 months
1
0
0
0
[winesync] 27912: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 13:49:52 2007 New Revision: 27912 URL:
http://svn.reactos.org/svn/reactos?rev=27912&view=rev
Log: Autosyncing with Wine HEAD Removed: trunk/reactos/dll/win32/ole32/ole32_ros.diff Modified: trunk/reactos/dll/win32/ole32/classmoniker.c trunk/reactos/dll/win32/ole32/compobj.c trunk/reactos/dll/win32/ole32/compobj_private.h trunk/reactos/dll/win32/ole32/dictionary.c trunk/reactos/dll/win32/ole32/enumx.c trunk/reactos/dll/win32/ole32/enumx.h trunk/reactos/dll/win32/ole32/errorinfo.c trunk/reactos/dll/win32/ole32/filemoniker.c trunk/reactos/dll/win32/ole32/git.c trunk/reactos/dll/win32/ole32/hglobalstream.c trunk/reactos/dll/win32/ole32/ifs.c trunk/reactos/dll/win32/ole32/marshal.c trunk/reactos/dll/win32/ole32/ole16.c trunk/reactos/dll/win32/ole32/ole2.c trunk/reactos/dll/win32/ole32/ole2_16.c trunk/reactos/dll/win32/ole32/ole2impl.c trunk/reactos/dll/win32/ole32/ole2nls.c trunk/reactos/dll/win32/ole32/ole32.rbuild trunk/reactos/dll/win32/ole32/ole32.spec trunk/reactos/dll/win32/ole32/ole32_main.c trunk/reactos/dll/win32/ole32/oleproxy.c trunk/reactos/dll/win32/ole32/rpc.c trunk/reactos/dll/win32/ole32/stg_bigblockfile.c trunk/reactos/dll/win32/ole32/stg_prop.c trunk/reactos/dll/win32/ole32/stg_stream.c trunk/reactos/dll/win32/ole32/storage.c trunk/reactos/dll/win32/ole32/storage32.c trunk/reactos/dll/win32/ole32/storage32.h trunk/reactos/dll/win32/ole32/stubmanager.c Modified: trunk/reactos/dll/win32/ole32/classmoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/classmonik…
============================================================================== --- trunk/reactos/dll/win32/ole32/classmoniker.c (original) +++ trunk/reactos/dll/win32/ole32/classmoniker.c Fri Jul 27 13:49:52 2007 @@ -31,7 +31,6 @@ #include "windef.h" #include "winbase.h" #include "winuser.h" -#include "winnls.h" #include "wine/debug.h" #include "ole2.h" #include "wine/unicode.h" Modified: trunk/reactos/dll/win32/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/compobj.c (original) +++ trunk/reactos/dll/win32/ole32/compobj.c Fri Jul 27 13:49:52 2007 @@ -76,9 +76,10 @@ * TODO: Most of these things will have to be made thread-safe. */ -static HRESULT COM_GetRegisteredClassObject(REFCLSID rclsid, DWORD dwClsContext, LPUNKNOWN* ppUnk); -static void COM_RevokeAllClasses(void); -static HRESULT get_inproc_class_object(HKEY hkeydll, REFCLSID rclsid, REFIID riid, void **ppv); +static HRESULT COM_GetRegisteredClassObject(const struct apartment *apt, REFCLSID rclsid, + DWORD dwClsContext, LPUNKNOWN* ppUnk); +static void COM_RevokeAllClasses(const struct apartment *apt); +static HRESULT get_inproc_class_object(APARTMENT *apt, HKEY hkeydll, REFCLSID rclsid, REFIID riid, void **ppv); static APARTMENT *MTA; /* protected by csApartment */ static APARTMENT *MainApartment; /* the first STA apartment */ @@ -121,6 +122,7 @@ { struct list entry; CLSID classIdentifier; + OXID apartment_id; LPUNKNOWN classObject; DWORD runContext; DWORD connectFlags; @@ -186,10 +188,11 @@ static LRESULT CALLBACK apartment_wndproc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath, REFCLSID rclsid, REFIID riid, void **ppv); +static void apartment_freeunusedlibraries(struct apartment *apt); static HRESULT COMPOBJ_DllList_Add(LPCWSTR library_name, OpenDll **ret); static OpenDll *COMPOBJ_DllList_Get(LPCWSTR library_name); -static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry); +static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry, BOOL free_entry); static DWORD COM_RegReadPath(HKEY hkeyroot, const WCHAR *keyname, const WCHAR *valuename, WCHAR * dst, DWORD dstlen); @@ -325,7 +328,7 @@ return apt; } -static inline BOOL apartment_is_model(APARTMENT *apt, DWORD model) +static inline BOOL apartment_is_model(const APARTMENT *apt, DWORD model) { return (apt->multi_threaded == !(model & COINIT_APARTMENTTHREADED)); } @@ -361,12 +364,16 @@ TRACE("destroying apartment %p, oxid %s\n", apt, wine_dbgstr_longlong(apt->oxid)); + /* Release the references to the registered class objects */ + COM_RevokeAllClasses(apt); + /* no locking is needed for this apartment, because no other thread * can access it at this point */ apartment_disconnectproxies(apt); if (apt->win) DestroyWindow(apt->win); + if (apt->host_apt_tid) PostThreadMessageW(apt->host_apt_tid, WM_QUIT, 0, 0); LIST_FOR_EACH_SAFE(cursor, cursor2, &apt->stubmgrs) { @@ -395,10 +402,16 @@ if (apt->filter) IUnknown_Release(apt->filter); + /* free as many unused libraries as possible... */ + apartment_freeunusedlibraries(apt); + + /* ... and free the memory for the apartment loaded dll entry and + * release the dll list reference without freeing the library for the + * rest */ while ((cursor = list_head(&apt->loaded_dlls))) { struct apartment_loaded_dll *apartment_loaded_dll = LIST_ENTRY(cursor, struct apartment_loaded_dll, entry); - COMPOBJ_DllList_ReleaseRef(apartment_loaded_dll->dll); + COMPOBJ_DllList_ReleaseRef(apartment_loaded_dll->dll, FALSE); list_remove(cursor); HeapFree(GetProcessHeap(), 0, apartment_loaded_dll); } @@ -462,33 +475,18 @@ return result; } -/* gets an apartment which has a given type. The caller must +/* gets the main apartment if it exists. The caller must * release the reference from the apartment as soon as the apartment pointer * is no longer required. */ -static APARTMENT *apartment_findfromtype(BOOL multi_threaded, BOOL main_apartment) -{ - APARTMENT *result = NULL; - struct apartment *apt; +static APARTMENT *apartment_findmain(void) +{ + APARTMENT *result; EnterCriticalSection(&csApartment); - if (!multi_threaded && main_apartment) - { - result = MainApartment; - if (result) apartment_addref(result); - LeaveCriticalSection(&csApartment); - return result; - } - - LIST_FOR_EACH_ENTRY( apt, &apts, struct apartment, entry ) - { - if (apt->multi_threaded == multi_threaded) - { - result = apt; - apartment_addref(result); - break; - } - } + result = MainApartment; + if (result) apartment_addref(result); + LeaveCriticalSection(&csApartment); return result; @@ -499,6 +497,8 @@ HKEY hkeydll; CLSID clsid; /* clsid of object to marshal */ IID iid; /* interface to marshal */ + HANDLE event; /* event signalling when ready for multi-threaded case */ + HRESULT hr; /* result for multi-threaded case */ IStream *stream; /* stream that the object will be marshaled into */ }; @@ -510,7 +510,7 @@ static const LARGE_INTEGER llZero; WCHAR dllpath[MAX_PATH+1]; - TRACE("\n"); + TRACE("clsid %s, iid %s\n", debugstr_guid(¶ms->clsid), debugstr_guid(¶ms->iid)); if (COM_RegReadPath(params->hkeydll, NULL, NULL, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS) { @@ -545,6 +545,167 @@ } } +struct host_thread_params +{ + COINIT threading_model; + HANDLE ready_event; + HWND apartment_hwnd; +}; + +static DWORD CALLBACK apartment_hostobject_thread(LPVOID p) +{ + struct host_thread_params *params = p; + MSG msg; + HRESULT hr; + struct apartment *apt; + + TRACE("\n"); + + hr = CoInitializeEx(NULL, params->threading_model); + if (FAILED(hr)) return hr; + + apt = COM_CurrentApt(); + if (params->threading_model == COINIT_APARTMENTTHREADED) + { + apartment_createwindowifneeded(apt); + params->apartment_hwnd = apartment_getwindow(apt); + } + else + params->apartment_hwnd = NULL; + + /* force the message queue to be created before signaling parent thread */ + PeekMessageW(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); + + SetEvent(params->ready_event); + params = NULL; /* can't touch params after here as it may be invalid */ + + while (GetMessageW(&msg, NULL, 0, 0)) + { + if (!msg.hwnd && (msg.message == DM_HOSTOBJECT)) + { + struct host_object_params *params = (struct host_object_params *)msg.lParam; + params->hr = apartment_hostobject(apt, params); + SetEvent(params->event); + } + else + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } + } + + TRACE("exiting\n"); + + CoUninitialize(); + + return S_OK; +} + +static HRESULT apartment_hostobject_in_hostapt(struct apartment *apt, BOOL multi_threaded, BOOL main_apartment, HKEY hkeydll, REFCLSID rclsid, REFIID riid, void **ppv) +{ + struct host_object_params params; + HWND apartment_hwnd = NULL; + DWORD apartment_tid = 0; + HRESULT hr; + + if (!multi_threaded && main_apartment) + { + APARTMENT *host_apt = apartment_findmain(); + if (host_apt) + { + apartment_hwnd = apartment_getwindow(host_apt); + apartment_release(host_apt); + } + } + + if (!apartment_hwnd) + { + EnterCriticalSection(&apt->cs); + + if (!apt->host_apt_tid) + { + struct host_thread_params thread_params; + HANDLE handles[2]; + DWORD wait_value; + + thread_params.threading_model = multi_threaded ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED; + handles[0] = thread_params.ready_event = CreateEventW(NULL, FALSE, FALSE, NULL); + thread_params.apartment_hwnd = NULL; + handles[1] = CreateThread(NULL, 0, apartment_hostobject_thread, &thread_params, 0, &apt->host_apt_tid); + if (!handles[1]) + { + CloseHandle(handles[0]); + LeaveCriticalSection(&apt->cs); + return E_OUTOFMEMORY; + } + wait_value = WaitForMultipleObjects(2, handles, FALSE, INFINITE); + CloseHandle(handles[0]); + CloseHandle(handles[1]); + if (wait_value == WAIT_OBJECT_0) + apt->host_apt_hwnd = thread_params.apartment_hwnd; + else + { + LeaveCriticalSection(&apt->cs); + return E_OUTOFMEMORY; + } + } + + if (multi_threaded || !main_apartment) + { + apartment_hwnd = apt->host_apt_hwnd; + apartment_tid = apt->host_apt_tid; + } + + LeaveCriticalSection(&apt->cs); + } + + /* another thread may have become the main apartment in the time it took + * us to create the thread for the host apartment */ + if (!apartment_hwnd && !multi_threaded && main_apartment) + { + APARTMENT *host_apt = apartment_findmain(); + if (host_apt) + { + apartment_hwnd = apartment_getwindow(host_apt); + apartment_release(host_apt); + } + } + + params.hkeydll = hkeydll; + params.clsid = *rclsid; + params.iid = *riid; + hr = CreateStreamOnHGlobal(NULL, TRUE, ¶ms.stream); + if (FAILED(hr)) + return hr; + if (multi_threaded) + { + params.hr = S_OK; + params.event = CreateEventW(NULL, FALSE, FALSE, NULL); + if (!PostThreadMessageW(apartment_tid, DM_HOSTOBJECT, 0, (LPARAM)¶ms)) + hr = E_OUTOFMEMORY; + else + { + WaitForSingleObject(params.event, INFINITE); + hr = params.hr; + } + CloseHandle(params.event); + } + else + { + if (!apartment_hwnd) + { + ERR("host apartment didn't create window\n"); + hr = E_OUTOFMEMORY; + } + else + hr = SendMessageW(apartment_hwnd, DM_HOSTOBJECT, 0, (LPARAM)¶ms); + } + if (SUCCEEDED(hr)) + hr = CoUnmarshalInterface(params.stream, riid, ppv); + IStream_Release(params.stream); + return hr; +} + HRESULT apartment_createwindowifneeded(struct apartment *apt) { if (apt->multi_threaded) @@ -568,7 +729,7 @@ return S_OK; } -HWND apartment_getwindow(struct apartment *apt) +HWND apartment_getwindow(const struct apartment *apt) { assert(!apt->multi_threaded); return apt->win; @@ -583,9 +744,23 @@ static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath, REFCLSID rclsid, REFIID riid, void **ppv) { + static const WCHAR wszOle32[] = {'o','l','e','3','2','.','d','l','l',0}; HRESULT hr = S_OK; BOOL found = FALSE; struct apartment_loaded_dll *apartment_loaded_dll; + + if (!strcmpiW(dllpath, wszOle32)) + { + /* we don't need to control the lifetime of this dll, so use the local + * implementation of DllGetClassObject directly */ + TRACE("calling ole32!DllGetClassObject\n"); + hr = DllGetClassObject(rclsid, riid, ppv); + + if (hr != S_OK) + ERR("DllGetClassObject returned error 0x%08x\n", hr); + + return hr; + } EnterCriticalSection(&apt->cs); @@ -639,7 +814,7 @@ if (entry->dll->DllCanUnloadNow && (entry->dll->DllCanUnloadNow() == S_OK)) { list_remove(&entry->entry); - COMPOBJ_DllList_ReleaseRef(entry->dll); + COMPOBJ_DllList_ReleaseRef(entry->dll, TRUE); HeapFree(GetProcessHeap(), 0, entry); } } @@ -675,9 +850,9 @@ return E_ACCESSDENIED; /* FIXME: or should this be CO_E_DLLNOTFOUND? */ } - DllCanUnloadNow = GetProcAddress(hLibrary, "DllCanUnloadNow"); + DllCanUnloadNow = (void *)GetProcAddress(hLibrary, "DllCanUnloadNow"); /* Note: failing to find DllCanUnloadNow is not a failure */ - DllGetClassObject = GetProcAddress(hLibrary, "DllGetClassObject"); + DllGetClassObject = (void *)GetProcAddress(hLibrary, "DllGetClassObject"); if (!DllGetClassObject) { /* failure: the dll did not export DllGetClassObject */ @@ -741,9 +916,11 @@ return ret; } -static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry) -{ - if (!InterlockedDecrement(&entry->refs)) +/* pass FALSE for free_entry to release a reference without destroying the + * entry if it reaches zero or TRUE otherwise */ +static void COMPOBJ_DllList_ReleaseRef(OpenDll *entry, BOOL free_entry) +{ + if (!InterlockedDecrement(&entry->refs) && free_entry) { EnterCriticalSection(&csOpenDllList); list_remove(&entry->entry); @@ -879,31 +1056,6 @@ return hr; } -/* On COM finalization for a STA thread, the message queue is flushed to ensure no - pending RPCs are ignored. Non-COM messages are discarded at this point. - */ -static void COM_FlushMessageQueue(void) -{ - MSG message; - APARTMENT *apt = COM_CurrentApt(); - - if (!apt || !apt->win) return; - - TRACE("Flushing STA message queue\n"); - - while (PeekMessageA(&message, NULL, 0, 0, PM_REMOVE)) - { - if (message.hwnd != apt->win) - { - WARN("discarding message 0x%x for window %p\n", message.message, message.hwnd); - continue; - } - - TranslateMessage(&message); - DispatchMessageA(&message); - } -} - /*********************************************************************** * CoUninitialize [OLE32.@] * @@ -954,15 +1106,6 @@ TRACE("() - Releasing the COM libraries\n"); RunningObjectTableImpl_UnInitialize(); - - /* Release the references to the registered class objects */ - COM_RevokeAllClasses(); - - /* This will free the loaded COM Dlls */ - CoFreeAllLibraries(); - - /* This ensures we deal with any pending RPCs */ - COM_FlushMessageQueue(); } else if (lCOMRefCnt<1) { ERR( "CoUninitialize() - not CoInitialized.\n" ); @@ -1581,10 +1724,8 @@ * to normal COM usage, this method will increase the * reference count on this object. */ -static HRESULT COM_GetRegisteredClassObject( - REFCLSID rclsid, - DWORD dwClsContext, - LPUNKNOWN* ppUnk) +static HRESULT COM_GetRegisteredClassObject(const struct apartment *apt, REFCLSID rclsid, + DWORD dwClsContext, LPUNKNOWN* ppUnk) { HRESULT hr = S_FALSE; RegisteredClass *curClass; @@ -1601,7 +1742,8 @@ /* * Check if we have a match on the class ID and context. */ - if ((dwClsContext & curClass->runContext) && + if ((apt->oxid == curClass->apartment_id) && + (dwClsContext & curClass->runContext) && IsEqualGUID(&(curClass->classIdentifier), rclsid)) { /* @@ -1642,6 +1784,11 @@ * * SEE ALSO * CoRevokeClassObject, CoGetClassObject + * + * NOTES + * In-process objects are only registered for the current apartment. + * CoGetClassObject() and CoCreateInstance() will not return objects registered + * in other apartments. * * BUGS * MSDN claims that multiple interface registrations are legal, but we @@ -1657,6 +1804,7 @@ RegisteredClass* newClass; LPUNKNOWN foundObject; HRESULT hr; + APARTMENT *apt; TRACE("(%s,%p,0x%08x,0x%08x,%p)\n", debugstr_guid(rclsid),pUnk,dwClsContext,flags,lpdwRegister); @@ -1664,7 +1812,8 @@ if ( (lpdwRegister==0) || (pUnk==0) ) return E_INVALIDARG; - if (!COM_CurrentApt()) + apt = COM_CurrentApt(); + if (!apt) { ERR("COM was not initialized\n"); return CO_E_NOTINITIALIZED; @@ -1681,7 +1830,7 @@ * First, check if the class is already registered. * If it is, this should cause an error. */ - hr = COM_GetRegisteredClassObject(rclsid, dwClsContext, &foundObject); + hr = COM_GetRegisteredClassObject(apt, rclsid, dwClsContext, &foundObject); if (hr == S_OK) { if (flags & REGCLS_MULTIPLEUSE) { if (dwClsContext & CLSCTX_LOCAL_SERVER) @@ -1699,6 +1848,7 @@ return E_OUTOFMEMORY; newClass->classIdentifier = *rclsid; + newClass->apartment_id = apt->oxid; newClass->runContext = dwClsContext; newClass->connectFlags = flags; newClass->pMarshaledData = NULL; @@ -1724,28 +1874,18 @@ *lpdwRegister = newClass->dwCookie; if (dwClsContext & CLSCTX_LOCAL_SERVER) { - IClassFactory *classfac; - - hr = IUnknown_QueryInterface(newClass->classObject, &IID_IClassFactory, - (LPVOID*)&classfac); - if (hr) return hr; - hr = CreateStreamOnHGlobal(0, TRUE, &newClass->pMarshaledData); if (hr) { FIXME("Failed to create stream on hglobal, %x\n", hr); - IUnknown_Release(classfac); return hr; } hr = CoMarshalInterface(newClass->pMarshaledData, &IID_IClassFactory, - (LPVOID)classfac, MSHCTX_LOCAL, NULL, + newClass->classObject, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG); if (hr) { FIXME("CoMarshalInterface failed, %x!\n",hr); - IUnknown_Release(classfac); return hr; } - - IUnknown_Release(classfac); hr = RPC_StartLocalServer(&newClass->classIdentifier, newClass->pMarshaledData, @@ -1755,6 +1895,44 @@ return S_OK; } +static void COM_RevokeRegisteredClassObject(RegisteredClass *curClass) +{ + list_remove(&curClass->entry); + + if (curClass->runContext & CLSCTX_LOCAL_SERVER) + RPC_StopLocalServer(curClass->RpcRegistration); + + /* + * Release the reference to the class object. + */ + IUnknown_Release(curClass->classObject); + + if (curClass->pMarshaledData) + { + LARGE_INTEGER zero; + memset(&zero, 0, sizeof(zero)); + IStream_Seek(curClass->pMarshaledData, zero, STREAM_SEEK_SET, NULL); + CoReleaseMarshalData(curClass->pMarshaledData); + } + + HeapFree(GetProcessHeap(), 0, curClass); +} + +static void COM_RevokeAllClasses(const struct apartment *apt) +{ + RegisteredClass *curClass, *cursor; + + EnterCriticalSection( &csRegisteredClassList ); + + LIST_FOR_EACH_ENTRY_SAFE(curClass, cursor, &RegisteredClassList, RegisteredClass, entry) + { + if (curClass->apartment_id == apt->oxid) + COM_RevokeRegisteredClassObject(curClass); + } + + LeaveCriticalSection( &csRegisteredClassList ); +} + /*********************************************************************** * CoRevokeClassObject [OLE32.@] * @@ -1767,6 +1945,10 @@ * Success: S_OK. * Failure: HRESULT code. * + * NOTES + * Must be called from the same apartment that called CoRegisterClassObject(), + * otherwise it will fail with RPC_E_WRONG_THREAD. + * * SEE ALSO * CoRegisterClassObject */ @@ -1775,8 +1957,16 @@ { HRESULT hr = E_INVALIDARG; RegisteredClass *curClass; + APARTMENT *apt; TRACE("(%08x)\n",dwRegister); + + apt = COM_CurrentApt(); + if (!apt) + { + ERR("COM was not initialized\n"); + return CO_E_NOTINITIALIZED; + } EnterCriticalSection( &csRegisteredClassList ); @@ -1787,30 +1977,17 @@ */ if (curClass->dwCookie == dwRegister) { - list_remove(&curClass->entry); - - if (curClass->runContext & CLSCTX_LOCAL_SERVER) - RPC_StopLocalServer(curClass->RpcRegistration); - - /* - * Release the reference to the class object. - */ - IUnknown_Release(curClass->classObject); - - if (curClass->pMarshaledData) + if (curClass->apartment_id == apt->oxid) { - LARGE_INTEGER zero; - memset(&zero, 0, sizeof(zero)); - IStream_Seek(curClass->pMarshaledData, zero, STREAM_SEEK_SET, NULL); - CoReleaseMarshalData(curClass->pMarshaledData); + COM_RevokeRegisteredClassObject(curClass); + hr = S_OK; } - - /* - * Free the memory used by the chain node. - */ - HeapFree(GetProcessHeap(), 0, curClass); - - hr = S_OK; + else + { + ERR("called from wrong apartment, should be called from %s\n", + wine_dbgstr_longlong(curClass->apartment_id)); + hr = RPC_E_WRONG_THREAD; + } break; } } @@ -1858,53 +2035,27 @@ value[0] = '\0'; } -static HRESULT get_inproc_class_object(HKEY hkeydll, REFCLSID rclsid, REFIID riid, void **ppv) +static HRESULT get_inproc_class_object(APARTMENT *apt, HKEY hkeydll, + REFCLSID rclsid, REFIID riid, void **ppv) { static const WCHAR wszApartment[] = {'A','p','a','r','t','m','e','n','t',0}; static const WCHAR wszFree[] = {'F','r','e','e',0}; static const WCHAR wszBoth[] = {'B','o','t','h',0}; WCHAR dllpath[MAX_PATH+1]; WCHAR threading_model[10 /* strlenW(L"apartment")+1 */]; - HRESULT hr; - APARTMENT *apt = COM_CurrentApt(); get_threading_model(hkeydll, threading_model, ARRAYSIZE(threading_model)); /* "Apartment" */ if (!strcmpiW(threading_model, wszApartment)) { if (apt->multi_threaded) - { - /* try to find an STA */ - APARTMENT *host_apt = apartment_findfromtype(FALSE, FALSE); - if (!host_apt) - FIXME("create a host apartment for apartment-threaded object %s\n", debugstr_guid(rclsid)); - if (host_apt) - { - struct host_object_params params; - HWND hwnd = apartment_getwindow(host_apt); - - params.hkeydll = hkeydll; - params.clsid = *rclsid; - params.iid = *riid; - hr = CreateStreamOnHGlobal(NULL, TRUE, ¶ms.stream); - if (FAILED(hr)) - return hr; - hr = SendMessageW(hwnd, DM_HOSTOBJECT, 0, (LPARAM)¶ms); - if (SUCCEEDED(hr)) - hr = CoUnmarshalInterface(params.stream, riid, ppv); - IStream_Release(params.stream); - return hr; - } - } + return apartment_hostobject_in_hostapt(apt, FALSE, FALSE, hkeydll, rclsid, riid, ppv); } /* "Free" */ else if (!strcmpiW(threading_model, wszFree)) { if (!apt->multi_threaded) - { - FIXME("should create object %s in multi-threaded apartment\n", - debugstr_guid(rclsid)); - } + return apartment_hostobject_in_hostapt(apt, TRUE, FALSE, hkeydll, rclsid, riid, ppv); } /* everything except "Apartment", "Free" and "Both" */ else if (strcmpiW(threading_model, wszBoth)) @@ -1915,29 +2066,7 @@ debugstr_w(threading_model), debugstr_guid(rclsid)); if (apt->multi_threaded || !apt->main) - { - /* try to find an STA */ - APARTMENT *host_apt = apartment_findfromtype(FALSE, TRUE); - if (!host_apt) - FIXME("create a host apartment for main-threaded object %s\n", debugstr_guid(rclsid)); - if (host_apt) - { - struct host_object_params params; - HWND hwnd = apartment_getwindow(host_apt); - - params.hkeydll = hkeydll; - params.clsid = *rclsid; - params.iid = *riid; - hr = CreateStreamOnHGlobal(NULL, TRUE, ¶ms.stream); - if (FAILED(hr)) - return hr; - hr = SendMessageW(hwnd, DM_HOSTOBJECT, 0, (LPARAM)¶ms); - if (SUCCEEDED(hr)) - hr = CoUnmarshalInterface(params.stream, riid, ppv); - IStream_Release(params.stream); - return hr; - } - } + return apartment_hostobject_in_hostapt(apt, FALSE, TRUE, hkeydll, rclsid, riid, ppv); } if (COM_RegReadPath(hkeydll, NULL, NULL, dllpath, ARRAYSIZE(dllpath)) != ERROR_SUCCESS) @@ -1982,6 +2111,7 @@ { LPUNKNOWN regClassObject; HRESULT hres = E_UNEXPECTED; + APARTMENT *apt; TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid)); @@ -1990,7 +2120,8 @@ *ppv = NULL; - if (!COM_CurrentApt()) + apt = COM_CurrentApt(); + if (!apt) { ERR("apartment not initialised\n"); return CO_E_NOTINITIALIZED; @@ -2005,7 +2136,8 @@ * First, try and see if we can't match the class ID with one of the * registered classes. */ - if (S_OK == COM_GetRegisteredClassObject(rclsid, dwClsContext, ®ClassObject)) + if (S_OK == COM_GetRegisteredClassObject(apt, rclsid, dwClsContext, + ®ClassObject)) { /* Get the required interface from the retrieved pointer. */ hres = IUnknown_QueryInterface(regClassObject, iid, ppv); @@ -2034,13 +2166,16 @@ { if (hres == REGDB_E_CLASSNOTREG) ERR("class %s not registered\n", debugstr_guid(rclsid)); - else + else if (hres == REGDB_E_KEYMISSING) + { WARN("class %s not registered as in-proc server\n", debugstr_guid(rclsid)); + hres = REGDB_E_CLASSNOTREG; + } } if (SUCCEEDED(hres)) { - hres = get_inproc_class_object(hkey, rclsid, iid, ppv); + hres = get_inproc_class_object(apt, hkey, rclsid, iid, ppv); RegCloseKey(hkey); } @@ -2061,13 +2196,16 @@ { if (hres == REGDB_E_CLASSNOTREG) ERR("class %s not registered\n", debugstr_guid(rclsid)); - else + else if (hres == REGDB_E_KEYMISSING) + { WARN("class %s not registered in-proc handler\n", debugstr_guid(rclsid)); + hres = REGDB_E_CLASSNOTREG; + } } if (SUCCEEDED(hres)) { - hres = get_inproc_class_object(hkey, rclsid, iid, ppv); + hres = get_inproc_class_object(apt, hkey, rclsid, iid, ppv); RegCloseKey(hkey); } @@ -2386,20 +2524,6 @@ { GetSystemTimeAsFileTime( lpFileTime ); return S_OK; -} - -static void COM_RevokeAllClasses(void) -{ - EnterCriticalSection( &csRegisteredClassList ); - - while (list_head(&RegisteredClassList)) - { - RegisteredClass *curClass = LIST_ENTRY(list_head(&RegisteredClassList), - RegisteredClass, entry); - CoRevokeClassObject(curClass->dwCookie); - } - - LeaveCriticalSection( &csRegisteredClassList ); } /****************************************************************************** Modified: trunk/reactos/dll/win32/ole32/compobj_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj_pr…
============================================================================== --- trunk/reactos/dll/win32/ole32/compobj_private.h (original) +++ trunk/reactos/dll/win32/ole32/compobj_private.h Fri Jul 27 13:49:52 2007 @@ -158,6 +158,8 @@ LONG remoting_started; /* has the RPC system been started for this apartment? (LOCK) */ struct list psclsids; /* list of registered PS CLSIDs (CS cs) */ struct list loaded_dlls; /* list of dlls loaded by this apartment (CS cs) */ + DWORD host_apt_tid; /* thread ID of apartment hosting objects of differing threading model (CS cs) */ + HWND host_apt_hwnd; /* handle to apartment window of host apartment (CS cs) */ /* FIXME: OID's should be given out by RPCSS */ OID oidc; /* object ID counter, starts at 1, zero is invalid OID (CS cs) */ @@ -253,13 +255,13 @@ DWORD apartment_release(struct apartment *apt); HRESULT apartment_disconnectproxies(struct apartment *apt); void apartment_disconnectobject(struct apartment *apt, void *object); -static inline HRESULT apartment_getoxid(struct apartment *apt, OXID *oxid) +static inline HRESULT apartment_getoxid(const struct apartment *apt, OXID *oxid) { *oxid = apt->oxid; return S_OK; } HRESULT apartment_createwindowifneeded(struct apartment *apt); -HWND apartment_getwindow(struct apartment *apt); +HWND apartment_getwindow(const struct apartment *apt); void apartment_joinmta(void); Modified: trunk/reactos/dll/win32/ole32/dictionary.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/dictionary…
============================================================================== --- trunk/reactos/dll/win32/ole32/dictionary.c (original) +++ trunk/reactos/dll/win32/ole32/dictionary.c Fri Jul 27 13:49:52 2007 @@ -126,8 +126,8 @@ } else { - struct dictionary_entry *elem = (struct dictionary_entry *) - HeapAlloc(GetProcessHeap(), 0, sizeof(struct dictionary_entry)); + struct dictionary_entry *elem = HeapAlloc(GetProcessHeap(), 0, + sizeof(struct dictionary_entry)); if (!elem) return; Modified: trunk/reactos/dll/win32/ole32/enumx.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/enumx.c?re…
============================================================================== --- trunk/reactos/dll/win32/ole32/enumx.c (original) +++ trunk/reactos/dll/win32/ole32/enumx.c Fri Jul 27 13:49:52 2007 @@ -189,7 +189,7 @@ * * Add an element to the enumeration. */ -void *enumx_add_element(enumx_impl *enumx, void *data) +void *enumx_add_element(enumx_impl *enumx, const void *data) { struct list *element; Modified: trunk/reactos/dll/win32/ole32/enumx.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/enumx.h?re…
============================================================================== --- trunk/reactos/dll/win32/ole32/enumx.h (original) +++ trunk/reactos/dll/win32/ole32/enumx.h Fri Jul 27 13:49:52 2007 @@ -29,6 +29,6 @@ extern HRESULT WINAPI enumx_Reset(enumx_impl *); extern HRESULT WINAPI enumx_Clone(enumx_impl *, enumx_impl **); extern enumx_impl *enumx_allocate(REFIID, const void *, ULONG); -extern void *enumx_add_element(enumx_impl *, void *); +extern void *enumx_add_element(enumx_impl *, const void *); #endif Modified: trunk/reactos/dll/win32/ole32/errorinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/errorinfo.…
============================================================================== --- trunk/reactos/dll/win32/ole32/errorinfo.c (original) +++ trunk/reactos/dll/win32/ole32/errorinfo.c Fri Jul 27 13:49:52 2007 @@ -465,8 +465,18 @@ ISupportErrorInfoImpl_InterfaceSupportsErrorInfo }; + /*********************************************************************** * CreateErrorInfo (OLE32.@) + * + * Creates an object used to set details for an error info object. + * + * PARAMS + * pperrinfo [O]. Address where error info creation object will be stored. + * + * RETURNS + * Success: S_OK. + * Failure: HRESULT code. */ HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo) { @@ -483,6 +493,21 @@ /*********************************************************************** * GetErrorInfo (OLE32.@) + * + * Retrieves the error information object for the current thread. + * + * PARAMS + * dwReserved [I]. Reserved. Must be zero. + * pperrinfo [O]. Address where error information object will be stored on return. + * + * RETURNS + * Success: S_OK if an error information object was set for the current thread. + * S_FALSE if otherwise. + * Failure: E_INVALIDARG if dwReserved is not zero. + * + * NOTES + * This function causes the current error info object for the thread to be + * cleared if one was set beforehand. */ HRESULT WINAPI GetErrorInfo(ULONG dwReserved, IErrorInfo **pperrinfo) { @@ -511,6 +536,16 @@ /*********************************************************************** * SetErrorInfo (OLE32.@) + * + * Sets the error information object for the current thread. + * + * PARAMS + * dwReserved [I] Reserved. Must be zero. + * perrinfo [I] Error info object. + * + * RETURNS + * Success: S_OK. + * Failure: E_INVALIDARG if dwReserved is not zero. */ HRESULT WINAPI SetErrorInfo(ULONG dwReserved, IErrorInfo *perrinfo) { Modified: trunk/reactos/dll/win32/ole32/filemoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/filemonike…
============================================================================== --- trunk/reactos/dll/win32/ole32/filemoniker.c (original) +++ trunk/reactos/dll/win32/ole32/filemoniker.c Fri Jul 27 13:49:52 2007 @@ -1011,19 +1011,27 @@ int FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) { static const WCHAR bSlash[] = {'\\',0}; - WCHAR word[MAX_PATH]; - int i=0,j,tabIndex=0; + LPOLESTR word; + int i=0,j,tabIndex=0, ret=0; LPOLESTR *strgtable ; int len=lstrlenW(str); TRACE("%s, %p\n", debugstr_w(str), *stringTable); - strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR)); + strgtable = CoTaskMemAlloc(len*sizeof(WCHAR)); if (strgtable==NULL) return E_OUTOFMEMORY; + word = CoTaskMemAlloc((len + 1)*sizeof(WCHAR)); + + if (word==NULL) + { + ret = E_OUTOFMEMORY; + goto lend; + } + while(str[i]!=0){ if(str[i]==bSlash[0]){ @@ -1031,7 +1039,10 @@ strgtable[tabIndex]=CoTaskMemAlloc(2*sizeof(WCHAR)); if (strgtable[tabIndex]==NULL) - return E_OUTOFMEMORY; + { + ret = E_OUTOFMEMORY; + goto lend; + } strcpyW(strgtable[tabIndex++],bSlash); @@ -1048,7 +1059,10 @@ strgtable[tabIndex]=CoTaskMemAlloc(sizeof(WCHAR)*(j+1)); if (strgtable[tabIndex]==NULL) - return E_OUTOFMEMORY; + { + ret = E_OUTOFMEMORY; + goto lend; + } strcpyW(strgtable[tabIndex++],word); } @@ -1057,7 +1071,21 @@ *stringTable=strgtable; - return tabIndex; + ret = tabIndex; + +lend: + if (ret < 0) + { + for (i = 0; i < tabIndex; i++) + CoTaskMemFree(strgtable[i]); + + CoTaskMemFree(strgtable); + } + + if (word) + CoTaskMemFree(word); + + return ret; } /****************************************************************************** Modified: trunk/reactos/dll/win32/ole32/git.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/git.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/ole32/git.c (original) +++ trunk/reactos/dll/win32/ole32/git.c Fri Jul 27 13:49:52 2007 @@ -96,7 +96,7 @@ /*** * A helper function to traverse the list and find the entry that matches the cookie. - * Returns NULL if not found + * Returns NULL if not found. Must be called inside git_section critical section. */ static StdGITEntry* StdGlobalInterfaceTable_FindEntry(IGlobalInterfaceTable* iface, DWORD cookie) @@ -106,14 +106,10 @@ TRACE("iface=%p, cookie=0x%x\n", iface, (UINT)cookie); - EnterCriticalSection(&git_section); LIST_FOR_EACH_ENTRY(e, &self->list, StdGITEntry, entry) { - if (e->cookie == cookie) { - LeaveCriticalSection(&git_section); + if (e->cookie == cookie) return e; - } - } - LeaveCriticalSection(&git_section); + } TRACE("Entry not found\n"); return NULL; @@ -232,12 +228,19 @@ HRESULT hr; TRACE("iface=%p, dwCookie=0x%x\n", iface, (UINT)dwCookie); - + + EnterCriticalSection(&git_section); + entry = StdGlobalInterfaceTable_FindEntry(iface, dwCookie); if (entry == NULL) { TRACE("Entry not found\n"); + LeaveCriticalSection(&git_section); return E_INVALIDARG; /* not found */ } + + list_remove(&entry->entry); + + LeaveCriticalSection(&git_section); /* Free the stream */ hr = CoReleaseMarshalData(entry->stream); @@ -248,11 +251,6 @@ } IStream_Release(entry->stream); - /* chop entry out of the list, and free the memory */ - EnterCriticalSection(&git_section); - list_remove(&entry->entry); - LeaveCriticalSection(&git_section); - HeapFree(GetProcessHeap(), 0, entry); return S_OK; } @@ -264,36 +262,39 @@ { StdGITEntry* entry; HRESULT hres; - LARGE_INTEGER move; - LPUNKNOWN lpUnk; - + IStream *stream; + TRACE("dwCookie=0x%x, riid=%s, ppv=%p\n", dwCookie, debugstr_guid(riid), ppv); - + + EnterCriticalSection(&git_section); + entry = StdGlobalInterfaceTable_FindEntry(iface, dwCookie); - if (entry == NULL) return E_INVALIDARG; - - if (!IsEqualIID(&entry->iid, riid)) { - WARN("entry->iid (%s) != riid\n", debugstr_guid(&entry->iid)); + if (entry == NULL) { + WARN("Entry for cookie 0x%x not found\n", dwCookie); + LeaveCriticalSection(&git_section); return E_INVALIDARG; } + TRACE("entry=%p\n", entry); - + + hres = IStream_Clone(entry->stream, &stream); + + LeaveCriticalSection(&git_section); + + if (hres) { + WARN("Failed to clone stream with error 0x%08x\n", hres); + return hres; + } + /* unmarshal the interface */ - hres = CoUnmarshalInterface(entry->stream, riid, ppv); - - /* rewind stream, in case it's used again */ - move.u.LowPart = 0; - move.u.HighPart = 0; - IStream_Seek(entry->stream, move, STREAM_SEEK_SET, NULL); + hres = CoUnmarshalInterface(stream, riid, ppv); + IStream_Release(stream); if (hres) { WARN("Failed to unmarshal stream\n"); return hres; } - /* addref it */ - lpUnk = *ppv; - IUnknown_AddRef(lpUnk); TRACE("ppv=%p\n", *ppv); return S_OK; } Modified: trunk/reactos/dll/win32/ole32/hglobalstream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/hglobalstr…
============================================================================== --- trunk/reactos/dll/win32/ole32/hglobalstream.c (original) +++ trunk/reactos/dll/win32/ole32/hglobalstream.c Fri Jul 27 13:49:52 2007 @@ -39,7 +39,6 @@ #include "objbase.h" #include "ole2.h" #include "winerror.h" -#include "winreg.h" #include "winternl.h" #include "wine/debug.h" @@ -234,6 +233,12 @@ * Lock the buffer in position and copy the data. */ supportBuffer = GlobalLock(This->supportHandle); + if (!supportBuffer) + { + WARN("read from invalid hglobal %p\n", This->supportHandle); + *pcbRead = 0; + return S_OK; + } memcpy(pv, (char *) supportBuffer+This->currentPosition.u.LowPart, bytesToReadFromBuffer); @@ -293,6 +298,8 @@ if (cb == 0) goto out; + + *pcbWritten = 0; newSize.u.HighPart = 0; newSize.u.LowPart = This->currentPosition.u.LowPart + cb; @@ -315,6 +322,11 @@ * Lock the buffer in position and copy the data. */ supportBuffer = GlobalLock(This->supportHandle); + if (!supportBuffer) + { + WARN("write to invalid hglobal %p\n", This->supportHandle); + return S_OK; + } memcpy((char *) supportBuffer+This->currentPosition.u.LowPart, pv, cb); Modified: trunk/reactos/dll/win32/ole32/ifs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ifs.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/ole32/ifs.c (original) +++ trunk/reactos/dll/win32/ole32/ifs.c Fri Jul 27 13:49:52 2007 @@ -56,7 +56,7 @@ DWORD SpyedAllocationsLeft; /* number of spyed allocations left */ BOOL SpyReleasePending; /* CoRevokeMallocSpy called with spyed allocations left*/ LPVOID * SpyedBlocks; /* root of the table */ - int SpyedBlockTableLength; /* size of the table*/ + DWORD SpyedBlockTableLength;/* size of the table*/ } _Malloc32; /* this is the static object instance */ @@ -73,7 +73,7 @@ static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 }; /* resize the old table */ -static int SetSpyedBlockTableLength ( int NewLength ) +static int SetSpyedBlockTableLength ( DWORD NewLength ) { LPVOID *NewSpyedBlocks; @@ -103,7 +103,9 @@ Current++; if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) { /* no more space in table, grow it */ + DWORD old_length = Malloc32.SpyedBlockTableLength; if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000 )) return 0; + Current = Malloc32.SpyedBlocks + old_length; } }; @@ -114,7 +116,7 @@ return 1; } -static int RemoveMemoryLocation(LPVOID * pMem) +static int RemoveMemoryLocation(LPCVOID pMem) { LPVOID * Current; Modified: trunk/reactos/dll/win32/ole32/marshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/marshal.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/marshal.c (original) +++ trunk/reactos/dll/win32/ole32/marshal.c Fri Jul 27 13:49:52 2007 @@ -283,6 +283,7 @@ { hr = IRemUnknown_RemQueryInterface(remunk, ipid, NORMALEXTREFS, nonlocal_mqis, iids, &qiresults); + IRemUnknown_Release(remunk); if (FAILED(hr)) ERR("IRemUnknown_RemQueryInterface failed with error 0x%08x\n", hr); } @@ -297,7 +298,7 @@ ULONG index = mapping[i]; HRESULT hrobj = qiresults[i].hResult; if (hrobj == S_OK) - hrobj = unmarshal_object(&qiresults[i].std, This->parent, + hrobj = unmarshal_object(&qiresults[i].std, COM_CurrentApt(), This->dest_context, This->dest_context_data, pMQIs[index].pIID, &This->oxid_info, @@ -375,22 +376,29 @@ if (SUCCEEDED(hr)) { STDOBJREF stdobjref = ifproxy->stdobjref; - ULONG cPublicRefs = ifproxy->refs; - ULONG cPublicRefsOld; - - /* optimization - share out proxy's public references if possible - * instead of making new proxy do a roundtrip through the server */ - do - { - ULONG cPublicRefsNew; - cPublicRefsOld = cPublicRefs; - stdobjref.cPublicRefs = cPublicRefs / 2; - cPublicRefsNew = cPublicRefs - stdobjref.cPublicRefs; - cPublicRefs = InterlockedCompareExchange( - (LONG *)&ifproxy->refs, cPublicRefsNew, cPublicRefsOld); - } while (cPublicRefs != cPublicRefsOld); - - if (!stdobjref.cPublicRefs) + + stdobjref.cPublicRefs = 0; + + if ((mshlflags != MSHLFLAGS_TABLEWEAK) && + (mshlflags != MSHLFLAGS_TABLESTRONG)) + { + ULONG cPublicRefs = ifproxy->refs; + ULONG cPublicRefsOld; + /* optimization - share out proxy's public references if possible + * instead of making new proxy do a roundtrip through the server */ + do + { + ULONG cPublicRefsNew; + cPublicRefsOld = cPublicRefs; + stdobjref.cPublicRefs = cPublicRefs / 2; + cPublicRefsNew = cPublicRefs - stdobjref.cPublicRefs; + cPublicRefs = InterlockedCompareExchange( + (LONG *)&ifproxy->refs, cPublicRefsNew, cPublicRefsOld); + } while (cPublicRefs != cPublicRefsOld); + } + + /* normal and table-strong marshaling need at least one reference */ + if (!stdobjref.cPublicRefs && (mshlflags != MSHLFLAGS_TABLEWEAK)) { IRemUnknown *remunk; hr = proxy_manager_get_remunknown(This, &remunk); @@ -399,11 +407,17 @@ HRESULT hrref = S_OK; REMINTERFACEREF rif; rif.ipid = ifproxy->stdobjref.ipid; - rif.cPublicRefs = NORMALEXTREFS; + rif.cPublicRefs = (mshlflags == MSHLFLAGS_TABLESTRONG) ? 1 : NORMALEXTREFS; rif.cPrivateRefs = 0; hr = IRemUnknown_RemAddRef(remunk, 1, &rif, &hrref); + IRemUnknown_Release(remunk); if (hr == S_OK && hrref == S_OK) - stdobjref.cPublicRefs = rif.cPublicRefs; + { + /* table-strong marshaling doesn't give the refs to the + * client that unmarshals the STDOBJREF */ + if (mshlflags != MSHLFLAGS_TABLESTRONG) + stdobjref.cPublicRefs = rif.cPublicRefs; + } else ERR("IRemUnknown_RemAddRef returned with 0x%08x, hrref = 0x%08x\n", hr, hrref); } @@ -455,6 +469,7 @@ } else ERR("IRemUnknown_RemQueryInterface failed with error 0x%08x\n", hr); + IRemUnknown_Release(remunk); } } @@ -565,6 +580,7 @@ rif.cPublicRefs = NORMALEXTREFS; rif.cPrivateRefs = 0; hr = IRemUnknown_RemAddRef(remunk, 1, &rif, &hrref); + IRemUnknown_Release(remunk); if (hr == S_OK && hrref == S_OK) InterlockedExchangeAdd((LONG *)&This->refs, NORMALEXTREFS); else @@ -602,6 +618,7 @@ rif.cPublicRefs = public_refs; rif.cPrivateRefs = 0; hr = IRemUnknown_RemRelease(remunk, 1, &rif); + IRemUnknown_Release(remunk); if (hr == S_OK) InterlockedExchangeAdd((LONG *)&This->refs, -public_refs); else if (hr == RPC_E_DISCONNECTED) @@ -947,16 +964,30 @@ static HRESULT proxy_manager_get_remunknown(struct proxy_manager * This, IRemUnknown **remunk) { HRESULT hr = S_OK; + struct apartment *apt; + BOOL called_in_original_apt; /* we don't want to try and unmarshal or use IRemUnknown if we don't want * lifetime management */ if (This->sorflags & SORFP_NOLIFETIMEMGMT) return S_FALSE; + apt = COM_CurrentApt(); + if (!apt) + return CO_E_NOTINITIALIZED; + + called_in_original_apt = This->parent && (This->parent->oxid == apt->oxid); + EnterCriticalSection(&This->cs); - if (This->remunk) + /* only return the cached object if called from the original apartment. + * in future, we might want to make the IRemUnknown proxy callable from any + * apartment to avoid these checks */ + if (This->remunk && called_in_original_apt) + { /* already created - return existing object */ *remunk = This->remunk; + IRemUnknown_AddRef(*remunk); + } else if (!This->parent) /* disconnected - we can't create IRemUnknown */ hr = S_FALSE; @@ -974,11 +1005,14 @@ stdobjref.ipid = This->oxid_info.ipidRemUnknown; /* do the unmarshal */ - hr = unmarshal_object(&stdobjref, This->parent, This->dest_context, + hr = unmarshal_object(&stdobjref, COM_CurrentApt(), This->dest_context, This->dest_context_data, &IID_IRemUnknown, - &This->oxid_info, (void**)&This->remunk); - if (hr == S_OK) - *remunk = This->remunk; + &This->oxid_info, (void**)remunk); + if (hr == S_OK && called_in_original_apt) + { + This->remunk = *remunk; + IRemUnknown_AddRef(This->remunk); + } } LeaveCriticalSection(&This->cs); Modified: trunk/reactos/dll/win32/ole32/ole16.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole16.c?re…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole16.c (original) +++ trunk/reactos/dll/win32/ole32/ole16.c Fri Jul 27 13:49:52 2007 @@ -35,7 +35,6 @@ #include "winuser.h" #include "objbase.h" #include "ole2.h" -#include "ole2ver.h" #include "rpc.h" #include "winerror.h" #include "winreg.h" Modified: trunk/reactos/dll/win32/ole32/ole2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2.c?rev…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2.c (original) +++ trunk/reactos/dll/win32/ole32/ole2.c Fri Jul 27 13:49:52 2007 @@ -41,10 +41,8 @@ #include "winuser.h" #include "winnls.h" #include "winreg.h" -#include "commctrl.h" #include "ole2.h" #include "ole2ver.h" -#include "wownt32.h" #include "wine/unicode.h" #include "compobj_private.h" @@ -149,7 +147,7 @@ static void OLEDD_Initialize(void); static DropTargetNode* OLEDD_FindDropTarget( HWND hwndOfTarget); -static void OLEDD_FreeDropTarget(DropTargetNode*); +static void OLEDD_FreeDropTarget(DropTargetNode*, BOOL); static LRESULT WINAPI OLEDD_DragTrackerWindowProc( HWND hwnd, UINT uMsg, @@ -355,7 +353,7 @@ if (dropTargetInfo==NULL) return DRAGDROP_E_NOTREGISTERED; - OLEDD_FreeDropTarget(dropTargetInfo); + OLEDD_FreeDropTarget(dropTargetInfo, TRUE); return S_OK; } @@ -1389,7 +1387,7 @@ OleMenuHookItem *pHookItem = NULL; WORD fuFlags; - TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam ); + TRACE("%i, %04lx, %08lx\n", code, wParam, lParam ); /* Check if we're being asked to process the message */ if ( HC_ACTION != code ) @@ -1494,7 +1492,7 @@ OleMenuHookItem *pHookItem = NULL; WORD wCode; - TRACE("%i, %04x, %08x\n", code, wParam, (unsigned)lParam ); + TRACE("%i, %04lx, %08lx\n", code, wParam, lParam ); /* Check if we're being asked to process a messages */ if ( HC_ACTION != code ) @@ -1713,9 +1711,8 @@ return FALSE; } if((lpMsg->message != WM_KEYDOWN && - lpMsg->message != WM_KEYUP && lpMsg->message != WM_SYSKEYDOWN && - lpMsg->message != WM_SYSKEYUP && + lpMsg->message != WM_SYSCHAR && lpMsg->message != WM_CHAR)) return FALSE; lpAccelTbl = HeapAlloc(GetProcessHeap(), 0, cAccelEntries * sizeof(ACCEL)); if (NULL == lpAccelTbl) @@ -1730,7 +1727,7 @@ } TRACE_(accel)("hAccel=%p, cAccelEntries=%d," - "msg->hwnd=%p, msg->message=%04x, wParam=%08x, lParam=%08lx\n", + "msg->hwnd=%p, msg->message=%04x, wParam=%08lx, lParam=%08lx\n", hAccel, cAccelEntries, lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam); for(i = 0; i < cAccelEntries; i++) @@ -1742,7 +1739,7 @@ { if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY)) { - TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", lpMsg->wParam & 0xff); + TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", LOWORD(lpMsg->wParam) & 0xff); goto found; } } @@ -1751,7 +1748,7 @@ if(lpAccelTbl[i].fVirt & FVIRTKEY) { INT mask = 0; - TRACE_(accel)("found accel for virt_key %04x (scan %04x)\n", + TRACE_(accel)("found accel for virt_key %04lx (scan %04x)\n", lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff); if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT; if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL; @@ -1765,7 +1762,7 @@ { if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000)) { /* ^^ ALT pressed */ - TRACE_(accel)("found accel for Alt-%c\n", lpMsg->wParam & 0xff); + TRACE_(accel)("found accel for Alt-%c\n", LOWORD(lpMsg->wParam) & 0xff); goto found; } } @@ -1897,10 +1894,10 @@ * * Frees the drag and drop data structure */ -static void OLEDD_FreeDropTarget(DropTargetNode *dropTargetInfo) +static void OLEDD_FreeDropTarget(DropTargetNode *dropTargetInfo, BOOL release_drop_target) { list_remove(&dropTargetInfo->entry); - IDropTarget_Release(dropTargetInfo->dropTarget); + if (release_drop_target) IDropTarget_Release(dropTargetInfo->dropTarget); HeapFree(GetProcessHeap(), 0, dropTargetInfo); } @@ -1916,9 +1913,8 @@ */ while (!list_empty(&targetListHead)) { - DropTargetNode* curNode; - curNode = LIST_ENTRY(list_head(&targetListHead), DropTargetNode, entry); - OLEDD_FreeDropTarget(curNode); + DropTargetNode* curNode = LIST_ENTRY(list_head(&targetListHead), DropTargetNode, entry); + OLEDD_FreeDropTarget(curNode, FALSE); } } @@ -2601,7 +2597,7 @@ * string. */ stringBuffer = (WCHAR*)newBuffer; - stringBuffer[len] = L'\0'; + stringBuffer[len] = '\0'; return (LPWSTR)stringBuffer; } Modified: trunk/reactos/dll/win32/ole32/ole2_16.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2_16.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2_16.c (original) +++ trunk/reactos/dll/win32/ole32/ole2_16.c Fri Jul 27 13:49:52 2007 @@ -35,12 +35,8 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "winnls.h" -#include "commctrl.h" #include "ole2.h" -#include "ole2ver.h" #include "winerror.h" -#include "wownt32.h" #include "wine/winbase16.h" #include "wine/wingdi16.h" Modified: trunk/reactos/dll/win32/ole32/ole2impl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2impl.c…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2impl.c (original) +++ trunk/reactos/dll/win32/ole32/ole2impl.c Fri Jul 27 13:49:52 2007 @@ -32,7 +32,6 @@ #include "wine/debug.h" #include "ole2.h" #include "olestd.h" -#include "winreg.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); Modified: trunk/reactos/dll/win32/ole32/ole2nls.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2nls.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2nls.c (original) +++ trunk/reactos/dll/win32/ole32/ole2nls.c Fri Jul 27 13:49:52 2007 @@ -31,11 +31,8 @@ #include "windef.h" #include "winbase.h" -#include "winerror.h" #include "winnls.h" -#include "winreg.h" #include "winuser.h" -#include "winver.h" #include "wine/winbase16.h" Modified: trunk/reactos/dll/win32/ole32/ole32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.rbui…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole32.rbuild (original) +++ trunk/reactos/dll/win32/ole32/ole32.rbuild Fri Jul 27 13:49:52 2007 @@ -2,7 +2,6 @@ <autoregister infsection="OleControlDlls" type="DllRegisterServer" /> <importlibrary definition="ole32.spec.def" /> <include base="ole32">.</include> - <include base="ole32" root="intermediate">.</include> <include base="ReactOS">include/reactos/wine</include> <define name="__REACTOS__" /> <define name="__WINESRC__" /> @@ -54,5 +53,6 @@ <file>usrmarshal.c</file> <file>ole32res.rc</file> <file>dcom.idl</file> + <include base="ole32" root="intermediate">.</include> <file>ole32.spec</file> </module> Modified: trunk/reactos/dll/win32/ole32/ole32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.spec…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole32.spec (original) +++ trunk/reactos/dll/win32/ole32/ole32.spec Fri Jul 27 13:49:52 2007 @@ -58,6 +58,7 @@ @ stdcall CoRegisterMessageFilter(ptr ptr) @ stdcall CoRegisterPSClsid(ptr ptr) @ stub CoRegisterSurrogate +@ stub CoRegisterSurrogateEx @ stdcall CoReleaseMarshalData(ptr) @ stdcall CoReleaseServerProcess() @ stdcall CoResumeClassObjects() Modified: trunk/reactos/dll/win32/ole32/ole32_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32_main…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole32_main.c (original) +++ trunk/reactos/dll/win32/ole32/ole32_main.c Fri Jul 27 13:49:52 2007 @@ -22,7 +22,6 @@ #include <stdio.h> #include "windef.h" -#include "winerror.h" #include "winbase.h" #include "wingdi.h" #include "winuser.h" Removed: trunk/reactos/dll/win32/ole32/ole32_ros.diff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32_ros.…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole32_ros.diff (original) +++ trunk/reactos/dll/win32/ole32/ole32_ros.diff (removed) @@ -1,12 +1,0 @@ -Index: rpc.c -=================================================================== ---- rpc.c (revision 23782) -+++ rpc.c (working copy) -@@ -24,6 +24,7 @@ - #include "wine/port.h" - - #include <stdarg.h> -+#include <stdio.h> - #include <string.h> - - #define COBJMACROS Modified: trunk/reactos/dll/win32/ole32/oleproxy.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/oleproxy.c…
============================================================================== --- trunk/reactos/dll/win32/ole32/oleproxy.c (original) +++ trunk/reactos/dll/win32/ole32/oleproxy.c Fri Jul 27 13:49:52 2007 @@ -53,7 +53,6 @@ #include "ole2.h" #include "rpc.h" #include "winerror.h" -#include "winreg.h" #include "wtypes.h" #include "compobj_private.h" Modified: trunk/reactos/dll/win32/ole32/rpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/rpc.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/ole32/rpc.c (original) +++ trunk/reactos/dll/win32/ole32/rpc.c Fri Jul 27 13:49:52 2007 @@ -24,7 +24,6 @@ #include "wine/port.h" #include <stdarg.h> -#include <stdio.h> #include <string.h> #define COBJMACROS Modified: trunk/reactos/dll/win32/ole32/stg_bigblockfile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_bigblo…
============================================================================== --- trunk/reactos/dll/win32/ole32/stg_bigblockfile.c (original) +++ trunk/reactos/dll/win32/ole32/stg_bigblockfile.c Fri Jul 27 13:49:52 2007 @@ -896,7 +896,7 @@ if (bytes_left) { - readPtr = (LPBYTE)readPtr + bytes_to_page; + readPtr = (const BYTE *)readPtr + bytes_to_page; page_index ++; offset_in_page = 0; if (bytes_left > PAGE_SIZE) @@ -920,7 +920,7 @@ } HRESULT BIGBLOCKFILE_WriteAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset, - void* buffer, const ULONG size, ULONG* bytesRead) + const void* buffer, ULONG size, ULONG* bytesRead) { if (This->fileBased) return ImplBIGBLOCKFILE_WriteAt(This,offset,buffer,size,bytesRead); Modified: trunk/reactos/dll/win32/ole32/stg_prop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_prop.c…
============================================================================== --- trunk/reactos/dll/win32/ole32/stg_prop.c (original) +++ trunk/reactos/dll/win32/ole32/stg_prop.c Fri Jul 27 13:49:52 2007 @@ -1617,7 +1617,7 @@ } static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This, - DWORD propNum, DWORD propid, PROPVARIANT *var, DWORD *sectionOffset) + DWORD propNum, DWORD propid, const PROPVARIANT *var, DWORD *sectionOffset) { HRESULT hr; LARGE_INTEGER seek; @@ -1717,7 +1717,7 @@ FILETIME temp; StorageUtl_WriteULargeInteger((BYTE *)&temp, 0, - (ULARGE_INTEGER *)&var->u.filetime); + (const ULARGE_INTEGER *)&var->u.filetime); hr = IStream_Write(This->stm, &temp, sizeof(FILETIME), &count); bytesWritten = count; break; @@ -1775,8 +1775,8 @@ assert(value); assert(extra); assert(closure); - c->hr = PropertyStorage_WritePropertyToStream(This, - c->propNum++, (DWORD)key, (PROPVARIANT *)value, c->sectionOffset); + c->hr = PropertyStorage_WritePropertyToStream(This, c->propNum++, + (DWORD)key, value, c->sectionOffset); return SUCCEEDED(c->hr); } Modified: trunk/reactos/dll/win32/ole32/stg_stream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_stream…
============================================================================== --- trunk/reactos/dll/win32/ole32/stg_stream.c (original) +++ trunk/reactos/dll/win32/ole32/stg_stream.c Fri Jul 27 13:49:52 2007 @@ -36,7 +36,6 @@ #include "windef.h" #include "winbase.h" #include "winerror.h" -#include "winreg.h" #include "winternl.h" #include "wine/debug.h" Modified: trunk/reactos/dll/win32/ole32/storage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/storage.c (original) +++ trunk/reactos/dll/win32/ole32/storage.c Fri Jul 27 13:49:52 2007 @@ -36,7 +36,6 @@ #define NONAMELESSSTRUCT #include "windef.h" #include "winbase.h" -#include "winreg.h" #include "winternl.h" #include "winerror.h" #include "wine/winbase16.h" @@ -553,7 +552,7 @@ * STORAGE_put_small_block [INTERNAL] */ static BOOL -STORAGE_put_small_block(stream_access16 *str,int blocknr,BYTE *sblock) { +STORAGE_put_small_block(stream_access16 *str,int blocknr,const BYTE *sblock) { BYTE block[BIGSIZE]; int bigblocknr; struct storage_pps_entry root; @@ -655,7 +654,7 @@ * STORAGE_put_pps_entry [Internal] */ static int -STORAGE_put_pps_entry(stream_access16*str,int n,struct storage_pps_entry *pstde) { +STORAGE_put_pps_entry(stream_access16*str,int n,const struct storage_pps_entry *pstde) { int blocknr; BYTE block[BIGSIZE]; struct storage_pps_entry *stde = (struct storage_pps_entry*)(((LPBYTE)block)+128*(n&3)); Modified: trunk/reactos/dll/win32/ole32/storage32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
============================================================================== --- trunk/reactos/dll/win32/ole32/storage32.c (original) +++ trunk/reactos/dll/win32/ole32/storage32.c Fri Jul 27 13:49:52 2007 @@ -91,7 +91,7 @@ DWORD openFlags, ULONG rootTropertyIndex); static void StorageImpl_Destroy(StorageBaseImpl* iface); static BOOL StorageImpl_ReadBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer); -static BOOL StorageImpl_WriteBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer); +static BOOL StorageImpl_WriteBigBlock(StorageImpl* This, ULONG blockIndex, const void* buffer); static void StorageImpl_SetNextBlockInChain(StorageImpl* This, ULONG blockIndex, ULONG nextBlock); static HRESULT StorageImpl_LoadFileHeader(StorageImpl* This); static void StorageImpl_SaveFileHeader(StorageImpl* This); @@ -279,7 +279,7 @@ static HRESULT StorageImpl_WriteAt(StorageImpl* This, ULARGE_INTEGER offset, - void* buffer, + const void* buffer, const ULONG size, ULONG* bytesWritten) { @@ -753,6 +753,7 @@ grfStatFlag); pstatstg->grfMode = This->openFlags; + pstatstg->grfStateBits = This->stateBits; res = S_OK; goto end; @@ -2352,8 +2353,9 @@ DWORD grfStateBits,/* [in] */ DWORD grfMask) /* [in] */ { - FIXME("not implemented!\n"); - return E_NOTIMPL; + StorageImpl* const This = (StorageImpl*)iface; + This->base.stateBits = (This->base.stateBits & ~grfMask) | (grfStateBits & grfMask); + return S_OK; } /* @@ -3371,9 +3373,9 @@ * Write the specified property into the property chain */ BOOL StorageImpl_WriteProperty( - StorageImpl* This, - ULONG index, - StgProperty* buffer) + StorageImpl* This, + ULONG index, + const StgProperty* buffer) { BYTE currentProperty[PROPSET_BLOCK_SIZE]; ULARGE_INTEGER offsetInPropSet; @@ -3490,9 +3492,9 @@ } static BOOL StorageImpl_WriteBigBlock( - StorageImpl* This, - ULONG blockIndex, - void* buffer) + StorageImpl* This, + ULONG blockIndex, + const void* buffer) { ULARGE_INTEGER ulOffset; DWORD wrote; @@ -4223,16 +4225,13 @@ /* * Allocate space for the new storage object */ - newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageInternalImpl)); + newStorage = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(StorageInternalImpl)); if (newStorage!=0) { - memset(newStorage, 0, sizeof(StorageInternalImpl)); - /* * Initialize the stream list */ - list_init(&newStorage->base.strmHead); /* @@ -4338,9 +4337,9 @@ } void StorageUtl_CopyPropertyToSTATSTG( - STATSTG* destination, - StgProperty* source, - int statFlags) + STATSTG* destination, + const StgProperty* source, + int statFlags) { /* * The copy of the string occurs only when the flag is not set @@ -4644,10 +4643,6 @@ return STG_E_DOCFILECORRUPT; } - /* - * Here, I'm casting away the constness on the buffer variable - * This is OK since we don't intend to modify that buffer. - */ *bytesWritten = 0; bufferWalker = (const BYTE*)buffer; @@ -4668,7 +4663,7 @@ StorageImpl_WriteAt(This->parentStorage, ulOffset, - (BYTE*)bufferWalker, + bufferWalker, bytesToWrite, &bytesWrittenAt); @@ -5683,6 +5678,10 @@ if (reserved != 0) return STG_E_INVALIDPARAMETER; + /* if no share mode given then DENY_NONE is the default */ + if (STGM_SHARE_MODE(grfMode) == 0) + grfMode |= STGM_SHARE_DENY_NONE; + /* * Validate the STGM flags */ @@ -5699,14 +5698,6 @@ goto end; } - /* if no share mode given then DENY_NONE is the default */ - if (STGM_SHARE_MODE(grfMode) == 0) - grfMode |= STGM_SHARE_DENY_NONE; - - /* must have at least one access mode */ - if (STGM_ACCESS_MODE(grfMode) == 0) - goto end; - /* in direct mode, can only use SHARE_EXCLUSIVE */ if (!(grfMode & STGM_TRANSACTED) && (STGM_SHARE_MODE(grfMode) != STGM_SHARE_EXCLUSIVE)) goto end; @@ -6869,7 +6860,7 @@ * * */ -static void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, BYTE *pBuffer, DWORD nBufferLength) +static void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, const BYTE *pBuffer, DWORD nBufferLength) { HRESULT hRes; HANDLE hFile; @@ -7419,7 +7410,7 @@ * Might need to verify the data and return appropriate error message * */ -static void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, BYTE *pData, DWORD dwDataLength) +static void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, const BYTE *pData, DWORD dwDataLength) { HRESULT hRes; IStream *pStream; Modified: trunk/reactos/dll/win32/ole32/storage32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
============================================================================== --- trunk/reactos/dll/win32/ole32/storage32.h (original) +++ trunk/reactos/dll/win32/ole32/storage32.h Fri Jul 27 13:49:52 2007 @@ -189,7 +189,7 @@ HRESULT BIGBLOCKFILE_ReadAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset, void* buffer, ULONG size, ULONG* bytesRead); HRESULT BIGBLOCKFILE_WriteAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset, - void* buffer, const ULONG size, ULONG* bytesRead); + const void* buffer, ULONG size, ULONG* bytesRead); /************************************************************************* * Ole Convert support @@ -245,6 +245,11 @@ * flags that this storage was opened or created with */ DWORD openFlags; + + /* + * State bits appear to only be preserved while running. No in the stream + */ + DWORD stateBits; }; /**************************************************************************** @@ -306,14 +311,14 @@ }; BOOL StorageImpl_ReadProperty( - StorageImpl* This, - ULONG index, - StgProperty* buffer); + StorageImpl* This, + ULONG index, + StgProperty* buffer); BOOL StorageImpl_WriteProperty( - StorageImpl* This, - ULONG index, - StgProperty* buffer); + StorageImpl* This, + ULONG index, + const StgProperty* buffer); BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks( StorageImpl* This, @@ -418,9 +423,8 @@ const ULARGE_INTEGER *value); void StorageUtl_ReadGUID(const BYTE* buffer, ULONG offset, GUID* value); void StorageUtl_WriteGUID(BYTE* buffer, ULONG offset, const GUID* value); -void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination, - StgProperty* source, - int statFlags); +void StorageUtl_CopyPropertyToSTATSTG(STATSTG* destination, const StgProperty* source, + int statFlags); /**************************************************************************** * BlockChainStream definitions. Modified: trunk/reactos/dll/win32/ole32/stubmanager.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stubmanage…
============================================================================== --- trunk/reactos/dll/win32/ole32/stubmanager.c (original) +++ trunk/reactos/dll/win32/ole32/stubmanager.c Fri Jul 27 13:49:52 2007 @@ -364,7 +364,7 @@ { /* FIXME: hack for IRemUnknown */ if (ipid->Data2 == 0xffff) - *stub_apt = apartment_findfromoxid(*(OXID *)ipid->Data4, TRUE); + *stub_apt = apartment_findfromoxid(*(const OXID *)ipid->Data4, TRUE); else *stub_apt = apartment_findfromtid(ipid->Data2); if (!*stub_apt)
17 years, 3 months
1
0
0
0
[winesync] 27911: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 13:46:28 2007 New Revision: 27911 URL:
http://svn.reactos.org/svn/reactos?rev=27911&view=rev
Log: Autosyncing with Wine HEAD Added: trunk/reactos/dll/win32/netapi32/local_group.c (with props) trunk/reactos/dll/win32/netapi32/share.c (with props) Removed: trunk/reactos/dll/win32/netapi32/netapi32_misc.h Modified: trunk/reactos/dll/win32/netapi32/access.c trunk/reactos/dll/win32/netapi32/apibuf.c trunk/reactos/dll/win32/netapi32/browsr.c trunk/reactos/dll/win32/netapi32/ds.c trunk/reactos/dll/win32/netapi32/nbcmdqueue.c trunk/reactos/dll/win32/netapi32/nbcmdqueue.h trunk/reactos/dll/win32/netapi32/nbnamecache.c trunk/reactos/dll/win32/netapi32/nbnamecache.h trunk/reactos/dll/win32/netapi32/nbt.c trunk/reactos/dll/win32/netapi32/netapi32.c trunk/reactos/dll/win32/netapi32/netapi32.rbuild trunk/reactos/dll/win32/netapi32/netapi32.spec trunk/reactos/dll/win32/netapi32/netbios.c trunk/reactos/dll/win32/netapi32/netbios.h trunk/reactos/dll/win32/netapi32/wksta.c Modified: trunk/reactos/dll/win32/netapi32/access.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/access.…
============================================================================== --- trunk/reactos/dll/win32/netapi32/access.c (original) +++ trunk/reactos/dll/win32/netapi32/access.c Fri Jul 27 13:46:28 2007 @@ -15,11 +15,13 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include <stdarg.h> +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" #include "winerror.h" @@ -27,15 +29,41 @@ #include "lmaccess.h" #include "lmapibuf.h" #include "lmerr.h" -#include "netapi32_misc.h" +#include "ntsecapi.h" #include "wine/debug.h" #include "wine/unicode.h" +#include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(netapi32); + +/* NOTE: So far, this is implemented to support tests that require user logins, + * but not designed to handle real user databases. Those should probably + * be synced with either the host's user database or with Samba. + * + * FIXME: The user database should hold all the information the USER_INFO_4 struct + * needs, but for the first try, I will just implement the USER_INFO_1 fields. + */ + +struct sam_user +{ + struct list entry; + WCHAR user_name[LM20_UNLEN+1]; + WCHAR user_password[PWLEN + 1]; + DWORD sec_since_passwd_change; + DWORD user_priv; + LPWSTR home_dir; + LPWSTR user_comment; + DWORD user_flags; + LPWSTR user_logon_script_path; +}; static const WCHAR sAdminUserName[] = {'A','d','m','i','n','i','s','t','r','a','t', 'o','r',0}; static const WCHAR sGuestUserName[] = {'G','u','e','s','t',0}; + +static struct list user_list = LIST_INIT( user_list ); + +BOOL NETAPI_IsLocalComputer(LPCWSTR ServerName); /************************************************************ * NETAPI_ValidateServername @@ -62,35 +90,23 @@ } /************************************************************ - * NETAPI_IsKnownUser - * - * Checks whether the user name indicates current user. - */ -static BOOL NETAPI_IsKnownUser(LPCWSTR UserName) -{ - DWORD dwSize = UNLEN + 1; - BOOL Result; - LPWSTR buf; - - if (!lstrcmpW(UserName, sAdminUserName) || - !lstrcmpW(UserName, sGuestUserName)) - return TRUE; - NetApiBufferAllocate(dwSize * sizeof(WCHAR), (LPVOID *) &buf); - Result = GetUserNameW(buf, &dwSize); - - Result = Result && !lstrcmpW(UserName, buf); - NetApiBufferFree(buf); - - return Result; -} - -#define NETAPI_ForceKnownUser(UserName, FailureCode) \ - if (!NETAPI_IsKnownUser(UserName)) \ - { \ - FIXME("Can't find information for user %s\n", \ - debugstr_w(UserName)); \ - return FailureCode; \ - } + * NETAPI_FindUser + * + * Looks for a user in the user database. + * Returns a pointer to the entry in the user list when the user + * is found, NULL otherwise. + */ +static struct sam_user* NETAPI_FindUser(LPCWSTR UserName) +{ + struct sam_user *user; + + LIST_FOR_EACH_ENTRY(user, &user_list, struct sam_user, entry) + { + if(lstrcmpW(user->user_name, UserName) == 0) + return user; + } + return NULL; +} /************************************************************ * NetUserAdd (NETAPI32.@) @@ -99,18 +115,74 @@ DWORD level, LPBYTE bufptr, LPDWORD parm_err) { NET_API_STATUS status; - FIXME("(%s, %ld, %p, %p) stub!\n", debugstr_w(servername), level, bufptr, parm_err); - - status = NETAPI_ValidateServername(servername); - if (status != NERR_Success) + struct sam_user * su = NULL; + + FIXME("(%s, %d, %p, %p) stub!\n", debugstr_w(servername), level, bufptr, parm_err); + + if((status = NETAPI_ValidateServername(servername)) != NERR_Success) return status; - - if ((bufptr != NULL) && (level > 0) && (level <= 4)) + + switch(level) + { + /* Level 3 and 4 are identical for the purposes of NetUserAdd */ + case 4: + case 3: + FIXME("Level 3 and 4 not implemented.\n"); + /* Fall through */ + case 2: + FIXME("Level 2 not implemented.\n"); + /* Fall throught */ + case 1: { PUSER_INFO_1 ui = (PUSER_INFO_1) bufptr; - TRACE("usri%ld_name: %s\n", level, debugstr_w(ui->usri1_name)); - TRACE("usri%ld_password: %s\n", level, debugstr_w(ui->usri1_password)); - TRACE("usri%ld_comment: %s\n", level, debugstr_w(ui->usri1_comment)); + su = HeapAlloc(GetProcessHeap(), 0, sizeof(struct sam_user)); + if(!su) + { + status = NERR_InternalError; + break; + } + + if(lstrlenW(ui->usri1_name) > LM20_UNLEN) + { + status = NERR_BadUsername; + break; + } + + /*FIXME: do other checks for a valid username */ + lstrcpyW(su->user_name, ui->usri1_name); + + if(lstrlenW(ui->usri1_password) > PWLEN) + { + /* Always return PasswordTooShort on invalid passwords. */ + status = NERR_PasswordTooShort; + break; + } + lstrcpyW(su->user_password, ui->usri1_password); + + su->sec_since_passwd_change = ui->usri1_password_age; + su->user_priv = ui->usri1_priv; + su->user_flags = ui->usri1_flags; + + /*FIXME: set the other LPWSTRs to NULL for now */ + su->home_dir = NULL; + su->user_comment = NULL; + su->user_logon_script_path = NULL; + + list_add_head(&user_list, &su->entry); + return NERR_Success; + } + default: + TRACE("Invalid level %d specified.\n", level); + status = ERROR_INVALID_LEVEL; + break; + } + + if(su) + { + HeapFree(GetProcessHeap(), 0, su->home_dir); + HeapFree(GetProcessHeap(), 0, su->user_comment); + HeapFree(GetProcessHeap(), 0, su->user_logon_script_path); + HeapFree(GetProcessHeap(), 0, su); } return status; } @@ -121,17 +193,24 @@ NET_API_STATUS WINAPI NetUserDel(LPCWSTR servername, LPCWSTR username) { NET_API_STATUS status; - FIXME("(%s, %s) stub!\n", debugstr_w(servername), debugstr_w(username)); - - status = NETAPI_ValidateServername(servername); - if (status != NERR_Success) + struct sam_user *user; + + TRACE("(%s, %s)\n", debugstr_w(servername), debugstr_w(username)); + + if((status = NETAPI_ValidateServername(servername))!= NERR_Success) return status; - if (!NETAPI_IsKnownUser(username)) + if ((user = NETAPI_FindUser(username)) == NULL) return NERR_UserNotFound; - /* Delete the user here */ - return status; + list_remove(&user->entry); + + HeapFree(GetProcessHeap(), 0, user->home_dir); + HeapFree(GetProcessHeap(), 0, user->user_comment); + HeapFree(GetProcessHeap(), 0, user->user_logon_script_path); + HeapFree(GetProcessHeap(), 0, user); + + return NERR_Success; } /************************************************************ @@ -142,13 +221,24 @@ LPBYTE* bufptr) { NET_API_STATUS status; - TRACE("(%s, %s, %ld, %p)\n", debugstr_w(servername), debugstr_w(username), + TRACE("(%s, %s, %d, %p)\n", debugstr_w(servername), debugstr_w(username), level, bufptr); status = NETAPI_ValidateServername(servername); if (status != NERR_Success) return status; - NETAPI_ForceLocalComputer(servername, NERR_InvalidComputer); - NETAPI_ForceKnownUser(username, NERR_UserNotFound); + + if(!NETAPI_IsLocalComputer(servername)) + { + FIXME("Only implemented for local computer, but remote server" + "%s was requested.\n", debugstr_w(servername)); + return NERR_InvalidComputer; + } + + if(!NETAPI_FindUser(username)) + { + TRACE("User %s is unknown.\n", debugstr_w(username)); + return NERR_UserNotFound; + } switch (level) { @@ -288,17 +378,43 @@ case 1052: case 1053: { - FIXME("Level %ld is not implemented\n", level); - break; + FIXME("Level %d is not implemented\n", level); + return NERR_InternalError; } default: - ERR("Invalid level %ld is specified\n", level); + TRACE("Invalid level %d is specified\n", level); return ERROR_INVALID_LEVEL; } return NERR_Success; } - +/************************************************************ + * NetUserGetLocalGroups (NETAPI32.@) + */ +NET_API_STATUS WINAPI +NetUserGetLocalGroups(LPCWSTR servername, LPCWSTR username, DWORD level, + DWORD flags, LPBYTE* bufptr, DWORD prefmaxlen, + LPDWORD entriesread, LPDWORD totalentries) +{ + NET_API_STATUS status; + + FIXME("(%s, %s, %d, %08x, %p %d, %p, %p) stub!\n", + debugstr_w(servername), debugstr_w(username), level, flags, bufptr, + prefmaxlen, entriesread, totalentries); + + status = NETAPI_ValidateServername(servername); + if (status != NERR_Success) + return status; + + if (!NETAPI_FindUser(username)) + return NERR_UserNotFound; + + if (bufptr) *bufptr = NULL; + if (entriesread) *entriesread = 0; + if (totalentries) *totalentries = 0; + + return NERR_Success; +} /************************************************************ * NetUserEnum (NETAPI32.@) @@ -308,7 +424,7 @@ DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle) { - FIXME("(%s,%ld, 0x%ld,%p,%ld,%p,%p,%p) stub!\n", debugstr_w(servername), level, + FIXME("(%s,%d, 0x%d,%p,%d,%p,%p,%p) stub!\n", debugstr_w(servername), level, filter, bufptr, prefmaxlen, entriesread, totalentries, resume_handle); return ERROR_ACCESS_DENIED; @@ -394,10 +510,9 @@ } /************************************************************ - * NetQueryDisplayInformation (NETAPI32.@) * Copies NET_DISPLAY_USER record. */ -static void ACCESS_CopyDisplayUser(PNET_DISPLAY_USER dest, LPWSTR *dest_buf, +static void ACCESS_CopyDisplayUser(const NET_DISPLAY_USER *dest, LPWSTR *dest_buf, PNET_DISPLAY_USER src) { LPWSTR str = *dest_buf; @@ -437,10 +552,17 @@ DWORD PreferredMaximumLength, LPDWORD ReturnedEntryCount, PVOID *SortedBuffer) { - TRACE("(%s, %ld, %ld, %ld, %ld, %p, %p)\n", debugstr_w(ServerName), + TRACE("(%s, %d, %d, %d, %d, %p, %p)\n", debugstr_w(ServerName), Level, Index, EntriesRequested, PreferredMaximumLength, ReturnedEntryCount, SortedBuffer); - NETAPI_ForceLocalComputer(ServerName, ERROR_ACCESS_DENIED); + + if(!NETAPI_IsLocalComputer(ServerName)) + { + FIXME("Only implemented on local computer, but requested for " + "remote server %s\n", debugstr_w(ServerName)); + return ERROR_ACCESS_DENIED; + } + switch (Level) { case 1: @@ -462,7 +584,7 @@ */ int records = 3; - FIXME("Level %ld partially implemented\n", Level); + FIXME("Level %d partially implemented\n", Level); *ReturnedEntryCount = records; comment_sz = 1; full_name_sz = 1; @@ -522,12 +644,12 @@ case 2: case 3: { - FIXME("Level %ld is not implemented\n", Level); + FIXME("Level %d is not implemented\n", Level); break; } default: - ERR("Invalid level %ld is specified\n", Level); + TRACE("Invalid level %d is specified\n", Level); return ERROR_INVALID_LEVEL; } return NERR_Success; @@ -548,48 +670,171 @@ } -/************************************************************ - * NetUserModalsGet (NETAPI32.@) - */ -NET_API_STATUS WINAPI NetUserModalsGet(LPCWSTR szServer, DWORD level, LPBYTE *pbuffer) -{ - FIXME("(%s %ld %p) stub!\n", debugstr_w(szServer), level, pbuffer); - return NERR_InternalError; -} - -/************************************************************ - * NetLocalGroupAdd (NETAPI32.@) - */ -NET_API_STATUS WINAPI NetLocalGroupAdd(LPCWSTR servername, DWORD level, - LPBYTE buf, LPDWORD parm_err) -{ - FIXME("(%s %ld %p %p) stub!\n", debugstr_w(servername), level, buf, parm_err); +/****************************************************************************** + * NetUserModalsGet (NETAPI32.@) + * + * Retrieves global information for all users and global groups in the security + * database. + * + * PARAMS + * szServer [I] Specifies the DNS or the NetBIOS name of the remote server + * on which the function is to execute. + * level [I] Information level of the data. + * 0 Return global passwords parameters. bufptr points to a + * USER_MODALS_INFO_0 struct. + * 1 Return logon server and domain controller information. bufptr + * points to a USER_MODALS_INFO_1 struct. + * 2 Return domain name and identifier. bufptr points to a + * USER_MODALS_INFO_2 struct. + * 3 Return lockout information. bufptr points to a USER_MODALS_INFO_3 + * struct. + * pbuffer [I] Buffer that receives the data. + * + * RETURNS + * Success: NERR_Success. + * Failure: + * ERROR_ACCESS_DENIED - the user does not have access to the info. + * NERR_InvalidComputer - computer name is invalid. + */ +NET_API_STATUS WINAPI NetUserModalsGet( + LPCWSTR szServer, DWORD level, LPBYTE *pbuffer) +{ + TRACE("(%s %d %p)\n", debugstr_w(szServer), level, pbuffer); + + switch (level) + { + case 0: + /* return global passwords parameters */ + FIXME("level 0 not implemented!\n"); + *pbuffer = NULL; + return NERR_InternalError; + case 1: + /* return logon server and domain controller info */ + FIXME("level 1 not implemented!\n"); + *pbuffer = NULL; + return NERR_InternalError; + case 2: + { + /* return domain name and identifier */ + PUSER_MODALS_INFO_2 umi; + LSA_HANDLE policyHandle; + LSA_OBJECT_ATTRIBUTES objectAttributes; + PPOLICY_ACCOUNT_DOMAIN_INFO domainInfo; + NTSTATUS ntStatus; + PSID domainIdentifier = NULL; + int domainNameLen; + + ZeroMemory(&objectAttributes, sizeof(objectAttributes)); + objectAttributes.Length = sizeof(objectAttributes); + + ntStatus = LsaOpenPolicy(NULL, &objectAttributes, + POLICY_VIEW_LOCAL_INFORMATION, + &policyHandle); + if (ntStatus != STATUS_SUCCESS) + { + WARN("LsaOpenPolicy failed with NT status %x\n", + LsaNtStatusToWinError(ntStatus)); + return ntStatus; + } + + ntStatus = LsaQueryInformationPolicy(policyHandle, + PolicyAccountDomainInformation, + (PVOID *)&domainInfo); + if (ntStatus != STATUS_SUCCESS) + { + WARN("LsaQueryInformationPolicy failed with NT status %x\n", + LsaNtStatusToWinError(ntStatus)); + LsaClose(policyHandle); + return ntStatus; + } + + domainIdentifier = domainInfo->DomainSid; + domainNameLen = lstrlenW(domainInfo->DomainName.Buffer) + 1; + LsaClose(policyHandle); + + ntStatus = NetApiBufferAllocate(sizeof(USER_MODALS_INFO_2) + + GetLengthSid(domainIdentifier) + + domainNameLen * sizeof(WCHAR), + (LPVOID *)pbuffer); + + if (ntStatus != NERR_Success) + { + WARN("NetApiBufferAllocate() failed\n"); + LsaFreeMemory(domainInfo); + return ntStatus; + } + + umi = (USER_MODALS_INFO_2 *) *pbuffer; + umi->usrmod2_domain_id = (PSID)(*pbuffer + + sizeof(USER_MODALS_INFO_2)); + umi->usrmod2_domain_name = (LPWSTR)(*pbuffer + + sizeof(USER_MODALS_INFO_2) + GetLengthSid(domainIdentifier)); + + lstrcpynW(umi->usrmod2_domain_name, + domainInfo->DomainName.Buffer, + domainNameLen); + CopySid(GetLengthSid(domainIdentifier), umi->usrmod2_domain_id, + domainIdentifier); + + LsaFreeMemory(domainInfo); + + break; + } + case 3: + /* return lockout information */ + FIXME("level 3 not implemented!\n"); + *pbuffer = NULL; + return NERR_InternalError; + default: + TRACE("Invalid level %d is specified\n", level); + *pbuffer = NULL; + return ERROR_INVALID_LEVEL; + } + return NERR_Success; } -/************************************************************ - * NetLocalGroupEnum (NETAPI32.@) - */ -NET_API_STATUS WINAPI NetLocalGroupEnum(LPCWSTR servername, DWORD level, - LPBYTE *bufptr, DWORD prefmaxlen, PDWORD entriesread, - PDWORD totalentries, PDWORD resumehandle) -{ - FIXME("(%s %ld %p %u %p %p %p) stub!\n", debugstr_w(servername), - level, bufptr, entriesread, totalentries, resumehandle); - *entriesread = 0; - *totalentries = 0; - *resumehandle = 0; +/****************************************************************************** + * NetUserChangePassword (NETAPI32.@) + * PARAMS + * domainname [I] Optional. Domain on which the user resides or the logon + * domain of the current user if NULL. + * username [I] Optional. Username to change the password for or the name + * of the current user if NULL. + * oldpassword [I] The user's current password. + * newpassword [I] The password that the user will be changed to using. + * + * RETURNS + * Success: NERR_Success. + * Failure: NERR_* failure code or win error code. + * + */ +NET_API_STATUS WINAPI NetUserChangePassword(LPCWSTR domainname, LPCWSTR username, + LPCWSTR oldpassword, LPCWSTR newpassword) +{ + struct sam_user *user; + + TRACE("(%s, %s, ..., ...)\n", debugstr_w(domainname), debugstr_w(username)); + + if(domainname) + FIXME("Ignoring domainname %s.\n", debugstr_w(domainname)); + + if((user = NETAPI_FindUser(username)) == NULL) + return NERR_UserNotFound; + + if(lstrcmpW(user->user_password, oldpassword) != 0) + return ERROR_INVALID_PASSWORD; + + if(lstrlenW(newpassword) > PWLEN) + return ERROR_PASSWORD_RESTRICTION; + + lstrcpyW(user->user_password, newpassword); + return NERR_Success; } -/************************************************************ - * NetLocalGroupSetMember (NETAPI32.@) - */ - -NET_API_STATUS WINAPI NetLocalGroupSetMembers(LPCWSTR servername, - LPCWSTR groupname, DWORD level, LPBYTE buf, DWORD totalentries) -{ - FIXME("(%s %s %ld %p %ld) stub!\n", debugstr_w(servername), - debugstr_w(groupname),level, buf, totalentries); +NET_API_STATUS NetUseAdd(LMSTR servername, DWORD level, LPBYTE bufptr, LPDWORD parm_err) +{ + FIXME("%s %d %p %p stub\n", debugstr_w(servername), level, bufptr, parm_err); return NERR_Success; } Modified: trunk/reactos/dll/win32/netapi32/apibuf.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/apibuf.…
============================================================================== --- trunk/reactos/dll/win32/netapi32/apibuf.c (original) +++ trunk/reactos/dll/win32/netapi32/apibuf.c Fri Jul 27 13:46:28 2007 @@ -15,7 +15,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include <stdarg.h> @@ -35,7 +35,9 @@ */ NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID* Buffer) { - TRACE("(%ld, %p)\n", ByteCount, Buffer); + TRACE("(%d, %p)\n", ByteCount, Buffer); + + if (Buffer == NULL) return ERROR_INVALID_PARAMETER; *Buffer = HeapAlloc(GetProcessHeap(), 0, ByteCount); if (*Buffer) return NERR_Success; @@ -59,7 +61,7 @@ NET_API_STATUS WINAPI NetApiBufferReallocate(LPVOID OldBuffer, DWORD NewByteCount, LPVOID* NewBuffer) { - TRACE("(%p, %ld, %p)\n", OldBuffer, NewByteCount, NewBuffer); + TRACE("(%p, %d, %p)\n", OldBuffer, NewByteCount, NewBuffer); if (NewByteCount) { if (OldBuffer) @@ -87,7 +89,7 @@ if (Buffer == NULL) return ERROR_INVALID_PARAMETER; dw = HeapSize(GetProcessHeap(), 0, Buffer); - TRACE("size: %ld\n", dw); + TRACE("size: %d\n", dw); if (dw != 0xFFFFFFFF) *ByteCount = dw; else Modified: trunk/reactos/dll/win32/netapi32/browsr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/browsr.…
============================================================================== --- trunk/reactos/dll/win32/netapi32/browsr.c (original) +++ trunk/reactos/dll/win32/netapi32/browsr.c Fri Jul 27 13:46:28 2007 @@ -15,7 +15,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include <stdarg.h> @@ -26,9 +26,6 @@ #include "lmcons.h" #include "lmbrowsr.h" #include "lmshare.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(netapi32); /************************************************************ * I_BrowserSetNetlogonState (NETAPI32.@) @@ -49,14 +46,3 @@ { return ERROR_NOT_SUPPORTED; } - -/************************************************************ - * NetShareEnum (NETAPI32.@) - */ -NET_API_STATUS WINAPI NetShareEnum( LPWSTR servername, DWORD level, LPBYTE* bufptr, - DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle) -{ - FIXME("%s %ld %p %ld %p %p %p\n", debugstr_w(servername), level, bufptr, - prefmaxlen, entriesread, totalentries, resume_handle); - return ERROR_NOT_SUPPORTED; -} Modified: trunk/reactos/dll/win32/netapi32/ds.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/ds.c?re…
============================================================================== --- trunk/reactos/dll/win32/netapi32/ds.c (original) +++ trunk/reactos/dll/win32/netapi32/ds.c Fri Jul 27 13:46:28 2007 @@ -15,18 +15,48 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include <stdarg.h> +#include "ntstatus.h" +#define WIN32_NO_STATUS #include "windef.h" #include "winbase.h" #include "winerror.h" +#include "ntsecapi.h" #include "wine/debug.h" #include "dsrole.h" +#include "dsgetdc.h" WINE_DEFAULT_DEBUG_CHANNEL(ds); + +DWORD WINAPI DsGetDcNameW(LPCWSTR ComputerName, LPCWSTR AvoidDCName, + GUID* DomainGuid, LPCWSTR SiteName, ULONG Flags, + PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo) +{ + FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_w(ComputerName), + debugstr_w(AvoidDCName), debugstr_guid(DomainGuid), + debugstr_w(SiteName), Flags, DomainControllerInfo); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD WINAPI DsGetDcNameA(LPCSTR ComputerName, LPCSTR AvoidDCName, + GUID* DomainGuid, LPCSTR SiteName, ULONG Flags, + PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo) +{ + FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_a(ComputerName), + debugstr_a(AvoidDCName), debugstr_guid(DomainGuid), + debugstr_a(SiteName), Flags, DomainControllerInfo); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD WINAPI DsGetSiteNameW(LPCWSTR ComputerName, LPWSTR *SiteName) +{ + FIXME("(%s, %p): stub\n", debugstr_w(ComputerName), SiteName); + return ERROR_CALL_NOT_IMPLEMENTED; +} /************************************************************ * DsRoleFreeMemory (NETAPI32.@) @@ -39,7 +69,8 @@ */ VOID WINAPI DsRoleFreeMemory(PVOID Buffer) { - FIXME("(%p) stub\n", Buffer); + TRACE("(%p)\n", Buffer); + HeapFree(GetProcessHeap(), 0, Buffer); } /************************************************************ @@ -59,6 +90,8 @@ LPCWSTR lpServer, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel, PBYTE* Buffer) { + DWORD ret; + FIXME("(%p, %d, %p) stub\n", lpServer, InfoLevel, Buffer); /* Check some input parameters */ @@ -66,5 +99,51 @@ if (!Buffer) return ERROR_INVALID_PARAMETER; if ((InfoLevel < DsRolePrimaryDomainInfoBasic) || (InfoLevel > DsRoleOperationState)) return ERROR_INVALID_PARAMETER; - return E_NOTIMPL; + switch (InfoLevel) + { + case DsRolePrimaryDomainInfoBasic: + { + LSA_OBJECT_ATTRIBUTES ObjectAttributes; + LSA_HANDLE PolicyHandle; + PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo; + NTSTATUS NtStatus; + int logon_domain_sz; + DWORD size; + PDSROLE_PRIMARY_DOMAIN_INFO_BASIC basic; + + ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes)); + NtStatus = LsaOpenPolicy(NULL, &ObjectAttributes, + POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle); + if (NtStatus != STATUS_SUCCESS) + { + TRACE("LsaOpenPolicyFailed with NT status %x\n", + LsaNtStatusToWinError(NtStatus)); + return ERROR_OUTOFMEMORY; + } + LsaQueryInformationPolicy(PolicyHandle, + PolicyAccountDomainInformation, (PVOID*)&DomainInfo); + logon_domain_sz = lstrlenW(DomainInfo->DomainName.Buffer) + 1; + LsaClose(PolicyHandle); + + size = sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC) + + logon_domain_sz * sizeof(WCHAR); + basic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + if (basic) + { + basic->MachineRole = DsRole_RoleStandaloneWorkstation; + basic->DomainNameFlat = (LPWSTR)((LPBYTE)basic + + sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC)); + lstrcpyW(basic->DomainNameFlat, DomainInfo->DomainName.Buffer); + ret = ERROR_SUCCESS; + } + else + ret = ERROR_OUTOFMEMORY; + *Buffer = (PBYTE)basic; + LsaFreeMemory(DomainInfo); + } + break; + default: + ret = ERROR_CALL_NOT_IMPLEMENTED; + } + return ret; } Added: trunk/reactos/dll/win32/netapi32/local_group.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/local_g…
============================================================================== --- trunk/reactos/dll/win32/netapi32/local_group.c (added) +++ trunk/reactos/dll/win32/netapi32/local_group.c Fri Jul 27 13:46:28 2007 @@ -1,0 +1,200 @@ +/* + * Copyright 2006 Robert Reif + * + * netapi32 local group functions + * + * 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 <stdarg.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "lmcons.h" +#include "lmaccess.h" +#include "lmapibuf.h" +#include "lmerr.h" +#include "winreg.h" +#include "ntsecapi.h" +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(netapi32); + +/************************************************************ + * NetLocalGroupAdd (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupAdd( + LPCWSTR servername, + DWORD level, + LPBYTE buf, + LPDWORD parm_err) +{ + FIXME("(%s %d %p %p) stub!\n", debugstr_w(servername), level, buf, + parm_err); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupAddMember (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupAddMember( + LPCWSTR servername, + LPCWSTR groupname, + PSID membersid) +{ + FIXME("(%s %s %p) stub!\n", debugstr_w(servername), + debugstr_w(groupname), membersid); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupAddMembers (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupAddMembers( + LPCWSTR servername, + LPCWSTR groupname, + DWORD level, + LPBYTE buf, + DWORD totalentries) +{ + FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername), + debugstr_w(groupname), level, buf, totalentries); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupDel (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupDel( + LPCWSTR servername, + LPCWSTR groupname) +{ + FIXME("(%s %s) stub!\n", debugstr_w(servername), debugstr_w(groupname)); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupDelMember (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupDelMember( + LPCWSTR servername, + LPCWSTR groupname, + PSID membersid) +{ + FIXME("(%s %s %p) stub!\n", debugstr_w(servername), + debugstr_w(groupname), membersid); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupDelMembers (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupDelMembers( + LPCWSTR servername, + LPCWSTR groupname, + DWORD level, + LPBYTE buf, + DWORD totalentries) +{ + FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername), + debugstr_w(groupname), level, buf, totalentries); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupEnum (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupEnum( + LPCWSTR servername, + DWORD level, + LPBYTE* bufptr, + DWORD prefmaxlen, + LPDWORD entriesread, + LPDWORD totalentries, + PDWORD_PTR resumehandle) +{ + FIXME("(%s %d %p %d %p %p %p) stub!\n", debugstr_w(servername), + level, bufptr, prefmaxlen, entriesread, totalentries, resumehandle); + *entriesread = 0; + *totalentries = 0; + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupGetInfo (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupGetInfo( + LPCWSTR servername, + LPCWSTR groupname, + DWORD level, + LPBYTE* bufptr) +{ + FIXME("(%s %s %d %p) stub!\n", debugstr_w(servername), + debugstr_w(groupname), level, bufptr); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupGetMembers (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupGetMembers( + LPCWSTR servername, + LPCWSTR localgroupname, + DWORD level, + LPBYTE* bufptr, + DWORD prefmaxlen, + LPDWORD entriesread, + LPDWORD totalentries, + PDWORD_PTR resumehandle) +{ + FIXME("(%s %s %d %p %d, %p %p %p) stub!\n", debugstr_w(servername), + debugstr_w(localgroupname), level, bufptr, prefmaxlen, entriesread, + totalentries, resumehandle); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupSetInfo (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupSetInfo( + LPCWSTR servername, + LPCWSTR groupname, + DWORD level, + LPBYTE buf, + LPDWORD parm_err) +{ + FIXME("(%s %s %d %p %p) stub!\n", debugstr_w(servername), + debugstr_w(groupname), level, buf, parm_err); + return NERR_Success; +} + +/************************************************************ + * NetLocalGroupSetMember (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetLocalGroupSetMembers( + LPCWSTR servername, + LPCWSTR groupname, + DWORD level, + LPBYTE buf, + DWORD totalentries) +{ + FIXME("(%s %s %d %p %d) stub!\n", debugstr_w(servername), + debugstr_w(groupname), level, buf, totalentries); + return NERR_Success; +} Propchange: trunk/reactos/dll/win32/netapi32/local_group.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/netapi32/nbcmdqueue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbcmdqu…
============================================================================== --- trunk/reactos/dll/win32/netapi32/nbcmdqueue.c (original) +++ trunk/reactos/dll/win32/netapi32/nbcmdqueue.c Fri Jul 27 13:46:28 2007 @@ -12,7 +12,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "config.h" #include "wine/debug.h" @@ -62,6 +62,7 @@ { queue->heap = heap; InitializeCriticalSection(&queue->cs); + queue->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NBCmdQueue.cs"); queue->head = NULL; } return queue; @@ -193,6 +194,7 @@ if (queue) { NBCmdQueueCancelAll(queue); + queue->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&queue->cs); HeapFree(queue->heap, 0, queue); } Modified: trunk/reactos/dll/win32/netapi32/nbcmdqueue.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbcmdqu…
============================================================================== --- trunk/reactos/dll/win32/netapi32/nbcmdqueue.h (original) +++ trunk/reactos/dll/win32/netapi32/nbcmdqueue.h Fri Jul 27 13:46:28 2007 @@ -12,7 +12,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __NBCMDQUEUE_H__ #define __NBCMDQUEUE_H__ Modified: trunk/reactos/dll/win32/netapi32/nbnamecache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbnamec…
============================================================================== --- trunk/reactos/dll/win32/netapi32/nbnamecache.c (original) +++ trunk/reactos/dll/win32/netapi32/nbnamecache.c Fri Jul 27 13:46:28 2007 @@ -12,7 +12,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * * This implementation uses a linked list, because I don't have a decent * hash table implementation handy. This is somewhat inefficient, but it's @@ -21,11 +21,8 @@ #include "config.h" #include "wine/port.h" -#include "wine/debug.h" #include "nbnamecache.h" - -WINE_DEFAULT_DEBUG_CHANNEL(netbios); typedef struct _NBNameCacheNode { @@ -107,6 +104,7 @@ { cache->heap = heap; InitializeCriticalSection(&cache->cs); + cache->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NBNameCache.cs"); cache->entryExpireTimeMS = entryExpireTimeMS; cache->head = NULL; } @@ -166,7 +164,7 @@ NBNameCacheNode **node; EnterCriticalSection(&cache->cs); - node = NBNameCacheWalk(cache, (char*)name); + node = NBNameCacheWalk(cache, (const char *)name); if (node) ret = (*node)->entry; else @@ -188,7 +186,7 @@ NBNameCacheNode **node; EnterCriticalSection(&cache->cs); - node = NBNameCacheWalk(cache, (char*)name); + node = NBNameCacheWalk(cache, (const char *)name); if (node && *node && (*node)->entry) { memcpy((*node)->entry->nbname, nbname, NCBNAMSZ); @@ -207,6 +205,7 @@ { if (cache) { + cache->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&cache->cs); while (cache->head) NBNameCacheUnlinkNode(cache, &cache->head); Modified: trunk/reactos/dll/win32/netapi32/nbnamecache.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbnamec…
============================================================================== --- trunk/reactos/dll/win32/netapi32/nbnamecache.h (original) +++ trunk/reactos/dll/win32/netapi32/nbnamecache.h Fri Jul 27 13:46:28 2007 @@ -12,7 +12,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __WINE_NBNAMECACHE_H #define __WINE_NBNAMECACHE_H Modified: trunk/reactos/dll/win32/netapi32/nbt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbt.c?r…
============================================================================== --- trunk/reactos/dll/win32/netapi32/nbt.c (original) +++ trunk/reactos/dll/win32/netapi32/nbt.c Fri Jul 27 13:46:28 2007 @@ -12,7 +12,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * * I am heavily indebted to Chris Hertel's excellent Implementing CIFS, *
http://ubiqx.org/cifs/
, for whatever understanding I have of NBT. @@ -288,7 +288,7 @@ * Returns NRC_GOODRET on timeout or a valid response received, something else * on error. */ -static UCHAR NetBTWaitForNameResponse(NetBTAdapter *adapter, SOCKET fd, +static UCHAR NetBTWaitForNameResponse(const NetBTAdapter *adapter, SOCKET fd, DWORD waitUntil, NetBTAnswerCallback answerCallback, void *data) { BOOL found = FALSE; @@ -424,7 +424,7 @@ queryData->cacheEntry->numAddresses < answerCount) { queryData->cacheEntry->addresses[queryData->cacheEntry-> - numAddresses++] = *(PDWORD)(rData + 2); + numAddresses++] = *(const DWORD *)(rData + 2); ret = queryData->cacheEntry->numAddresses < answerCount; } else @@ -444,7 +444,7 @@ * Returns NRC_GOODRET on success, though this may not mean the name was * resolved--check whether *cacheEntry is NULL. */ -static UCHAR NetBTNameWaitLoop(NetBTAdapter *adapter, SOCKET fd, PNCB ncb, +static UCHAR NetBTNameWaitLoop(const NetBTAdapter *adapter, SOCKET fd, const NCB *ncb, DWORD sendTo, BOOL broadcast, DWORD timeout, DWORD maxQueries, NBNameCacheEntry **cacheEntry) { @@ -1028,7 +1028,7 @@ ret = NRC_CMDTMO; else { - static UCHAR fakedCalledName[] = "*SMBSERVER"; + static const UCHAR fakedCalledName[] = "*SMBSERVER"; const UCHAR *calledParty = cacheEntry->nbname[0] == '*' ? fakedCalledName : cacheEntry->nbname; @@ -1050,6 +1050,7 @@ { session->fd = fd; InitializeCriticalSection(&session->cs); + session->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBTSession.cs"); *sess = session; } else @@ -1111,7 +1112,7 @@ } else if (bytesSent < NBSS_HDRSIZE + ncb->ncb_length) { - FIXME("Only sent %ld bytes (of %d), hanging up session\n", bytesSent, + FIXME("Only sent %d bytes (of %d), hanging up session\n", bytesSent, NBSS_HDRSIZE + ncb->ncb_length); NetBIOSHangupSession(ncb); ret = NRC_SABORT; @@ -1243,6 +1244,7 @@ closesocket(session->fd); session->fd = INVALID_SOCKET; session->bytesPending = 0; + session->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&session->cs); HeapFree(GetProcessHeap(), 0, session); @@ -1272,7 +1274,7 @@ } } -static UCHAR NetBTRegisterAdapter(PMIB_IPADDRROW ipRow) +static UCHAR NetBTRegisterAdapter(const MIB_IPADDRROW *ipRow) { UCHAR ret; NetBTAdapter *adapter; Modified: trunk/reactos/dll/win32/netapi32/netapi32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.c (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.c Fri Jul 27 13:46:28 2007 @@ -13,7 +13,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "config.h" @@ -24,11 +24,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(netbios); -HMODULE NETAPI32_hModule = 0; +static HMODULE NETAPI32_hModule; BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - TRACE("%p,%lx,%p\n", hinstDLL, fdwReason, lpvReserved); + TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved); switch (fdwReason) { case DLL_PROCESS_ATTACH: @@ -49,6 +49,9 @@ return TRUE; } +/************************************************************ + * NetServerEnum (NETAPI32.@) + */ NET_API_STATUS WINAPI NetServerEnum( LPCWSTR servername, DWORD level, @@ -61,20 +64,40 @@ LPDWORD resume_handle ) { - FIXME("Stub (%s %ld %p %ld %p %p %ld %s %p)\n", debugstr_w(servername), + FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(servername), level, bufptr, prefmaxlen, entriesread, totalentries, servertype, debugstr_w(domain), resume_handle); return ERROR_NO_BROWSER_SERVERS_FOUND; } +/************************************************************ + * NetServerEnumEx (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetServerEnumEx( + LPCWSTR ServerName, + DWORD Level, + LPBYTE *Bufptr, + DWORD PrefMaxlen, + LPDWORD EntriesRead, + LPDWORD totalentries, + DWORD servertype, + LPCWSTR domain, + LPCWSTR FirstNameToReturn) +{ + FIXME("Stub (%s %d %p %d %p %p %d %s %p)\n", debugstr_w(ServerName), + Level, Bufptr, PrefMaxlen, EntriesRead, totalentries, servertype, + debugstr_w(domain), debugstr_w(FirstNameToReturn)); + + return ERROR_NO_BROWSER_SERVERS_FOUND; +} /************************************************************ * NetServerGetInfo (NETAPI32.@) */ NET_API_STATUS WINAPI NetServerGetInfo(LMSTR servername, DWORD level, LPBYTE* bufptr) { - FIXME("stub (%p, %ld, %p)\n", servername, level, bufptr); + FIXME("stub (%p, %d, %p)\n", servername, level, bufptr); return ERROR_ACCESS_DENIED; } @@ -86,7 +109,7 @@ DWORD level, DWORD options, LPBYTE *bufptr) { - TRACE("(%p, %p, %ld, %ld, %p)\n", server, service, level, options, bufptr); + TRACE("(%p, %p, %d, %d, %p)\n", server, service, level, options, bufptr); return NERR_InternalError; } Modified: trunk/reactos/dll/win32/netapi32/netapi32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.rbuild (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.rbuild Fri Jul 27 13:46:28 2007 @@ -3,26 +3,28 @@ <include base="netapi32">.</include> <include base="ReactOS">include/reactos/wine</include> <define name="__REACTOS__" /> + <define name="__WINESRC__" /> <define name="__USE_W32API" /> <define name="_WIN32_IE">0x600</define> <define name="_WIN32_WINNT">0x501</define> <define name="WINVER">0x501</define> - <define name="_SVRAPI_" /> <library>wine</library> + <library>iphlpapi</library> + <library>ws2_32</library> + <library>advapi32</library> + <library>kernel32</library> <library>ntdll</library> - <library>kernel32</library> - <library>advapi32</library> - <library>ws2_32</library> - <library>iphlpapi</library> <file>access.c</file> <file>apibuf.c</file> <file>browsr.c</file> <file>ds.c</file> + <file>local_group.c</file> <file>nbcmdqueue.c</file> <file>nbnamecache.c</file> <file>nbt.c</file> <file>netapi32.c</file> <file>netbios.c</file> + <file>share.c</file> <file>wksta.c</file> <file>netapi32.spec</file> </module> Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.spec (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.spec Fri Jul 27 13:46:28 2007 @@ -3,12 +3,14 @@ @ stub DsDeregisterDnsHostRecords @ stub DsEnumerateDomainTrusts @ stub DsGetDcClose -@ stub DsGetDcName +@ stdcall DsGetDcNameA(str str ptr str long ptr) +@ stdcall DsGetDcNameW(wstr wstr ptr wstr long ptr) @ stub DsGetDcNext @ stub DsGetDcOpen @ stub DsGetDcSiteCoverage @ stub DsGetForestTrustInformationW -@ stub DsGetSiteName +@ stub DsGetSiteNameA # (str str) +@ stdcall DsGetSiteNameW(wstr wstr) @ stub DsMergeForestTrustInformationW @ stdcall DsRoleFreeMemory(ptr) @ stdcall DsRoleGetPrimaryDomainInformation(wstr long ptr) @@ -102,16 +104,16 @@ @ stub NetGroupSetInfo @ stub NetGroupSetUsers @ stdcall NetLocalGroupAdd(wstr long ptr ptr) -@ stub NetLocalGroupAddMember -@ stub NetLocalGroupAddMembers -@ stub NetLocalGroupDel -@ stub NetLocalGroupDelMember -@ stub NetLocalGroupDelMembers +@ stdcall NetLocalGroupAddMember(wstr wstr ptr) +@ stdcall NetLocalGroupAddMembers(wstr wstr long ptr long) +@ stdcall NetLocalGroupDel(wstr wstr) +@ stdcall NetLocalGroupDelMember(wstr wstr ptr) +@ stdcall NetLocalGroupDelMembers(wstr wstr long ptr long) @ stdcall NetLocalGroupEnum(wstr long ptr long ptr ptr ptr) -@ stub NetLocalGroupGetInfo -@ stub NetLocalGroupGetMembers -@ stub NetLocalGroupSetInfo -@ stdcall NetLocalGroupSetMembers(wstr wstr long ptr ptr) +@ stdcall NetLocalGroupGetInfo(wstr wstr long ptr) +@ stdcall NetLocalGroupGetMembers(wstr wstr long ptr long ptr ptr ptr) +@ stdcall NetLocalGroupSetInfo(wstr wstr long ptr ptr) +@ stdcall NetLocalGroupSetMembers(wstr wstr long ptr long) @ stub NetMessageBufferSend @ stub NetMessageNameAdd @ stub NetMessageNameDel @@ -172,7 +174,7 @@ @ stub NetServerComputerNameDel @ stub NetServerDiskEnum @ stdcall NetServerEnum(wstr long ptr long ptr ptr long wstr ptr) -@ stub NetServerEnumEx +@ stdcall NetServerEnumEx(wstr long ptr long ptr ptr long wstr wstr) @ stdcall NetServerGetInfo(wstr long ptr) @ stub NetServerSetInfo @ stub NetServerTransportAdd @@ -184,28 +186,28 @@ @ stub NetServiceGetInfo @ stub NetServiceInstall @ stub NetSessionDel -@ stub NetSessionEnum +@ stdcall NetSessionEnum(wstr wstr wstr long ptr long ptr ptr ptr) @ stub NetSessionGetInfo @ stub NetShareAdd @ stub NetShareCheck -@ stub NetShareDel +@ stdcall NetShareDel(wstr wstr long) @ stub NetShareDelSticky @ stdcall NetShareEnum(wstr long ptr long ptr ptr ptr) @ stub NetShareEnumSticky @ stub NetShareGetInfo @ stub NetShareSetInfo @ stdcall NetStatisticsGet(wstr wstr long long ptr) -@ stub NetUseAdd +@ stdcall NetUseAdd(wstr long ptr ptr) @ stub NetUseDel @ stub NetUseEnum @ stub NetUseGetInfo @ stdcall NetUserAdd(wstr long ptr ptr) -@ stub NetUserChangePassword +@ stdcall NetUserChangePassword(wstr wstr wstr wstr) @ stdcall NetUserDel(wstr wstr) @ stdcall NetUserEnum(wstr long long ptr long ptr ptr ptr) @ stub NetUserGetGroups @ stdcall NetUserGetInfo(wstr wstr long ptr) -@ stub NetUserGetLocalGroups +@ stdcall NetUserGetLocalGroups(wstr wstr long long ptr long ptr ptr) @ stdcall NetUserModalsGet(wstr long ptr) @ stub NetUserModalsSet @ stub NetUserSetGroups Removed: trunk/reactos/dll/win32/netapi32/netapi32_misc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32_misc.h (original) +++ trunk/reactos/dll/win32/netapi32/netapi32_misc.h (removed) @@ -1,35 +1,0 @@ -/* - * Copyright 2002 Andriy Palamarchuk - * - * netapi32 internal functions. - * - * 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, writ -e to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __WINE_NETAPI32_MISC_H -#define __WINE_NETAPI32_MISC_H - -extern BOOL NETAPI_IsLocalComputer(LPCWSTR ServerName); - -#define NETAPI_ForceLocalComputer(ServerName, FailureCode) \ - if (!NETAPI_IsLocalComputer(ServerName)) \ - { \ - FIXME("Action Implemented for local computer only. " \ - "Requested for server %s\n", debugstr_w(ServerName)); \ - return FailureCode; \ - } - -#endif Modified: trunk/reactos/dll/win32/netapi32/netbios.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netbios…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netbios.c (original) +++ trunk/reactos/dll/win32/netapi32/netbios.c Fri Jul 27 13:46:28 2007 @@ -12,7 +12,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "config.h" #include "wine/debug.h" @@ -104,6 +104,7 @@ { memset(&gNBTable, 0, sizeof(gNBTable)); InitializeCriticalSection(&gNBTable.cs); + gNBTable.cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBIOSAdapterTable.cs"); } void NetBIOSShutdown(void) @@ -122,6 +123,7 @@ if (gTransports[i].transport.cleanup) gTransports[i].transport.cleanup(); LeaveCriticalSection(&gNBTable.cs); + gNBTable.cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&gNBTable.cs); HeapFree(GetProcessHeap(), 0, gNBTable.table); } @@ -130,13 +132,12 @@ { BOOL ret; - TRACE(": transport 0x%08lx, p %p\n", id, transport); + TRACE(": transport 0x%08x, p %p\n", id, transport); if (!transport) ret = FALSE; else if (gNumTransports >= sizeof(gTransports) / sizeof(gTransports[0])) { - FIXME("You tried to add %d transports, but I only have space for %d\n", - gNumTransports + 1, sizeof(gTransports) / sizeof(gTransports[0])); + FIXME("Too many transports %d\n", gNumTransports + 1); ret = FALSE; } else @@ -148,7 +149,7 @@ { if (gTransports[i].id == id) { - WARN("Replacing NetBIOS transport ID %ld\n", id); + WARN("Replacing NetBIOS transport ID %d\n", id); memcpy(&gTransports[i].transport, transport, sizeof(NetBIOSTransport)); ret = TRUE; @@ -176,15 +177,15 @@ BOOL ret; UCHAR i; - TRACE(": transport 0x%08lx, ifIndex 0x%08lx, data %p\n", transport, ifIndex, + TRACE(": transport 0x%08x, ifIndex 0x%08x, data %p\n", transport, ifIndex, data); for (i = 0; i < gNumTransports && gTransports[i].id != transport; i++) ; - if (gTransports[i].id == transport) + if ((i < gNumTransports) && gTransports[i].id == transport) { NetBIOSTransport *transportPtr = &gTransports[i].transport; - TRACE(": found transport %p for id 0x%08lx\n", transportPtr, transport); + TRACE(": found transport %p for id 0x%08x\n", transportPtr, transport); EnterCriticalSection(&gNBTable.cs); ret = FALSE; @@ -211,6 +212,7 @@ gNBTable.table[i].impl.data = data; gNBTable.table[i].cmdQueue = NBCmdQueueCreate(GetProcessHeap()); InitializeCriticalSection(&gNBTable.table[i].cs); + gNBTable.table[i].cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": NetBIOSAdapterTable.NetBIOSAdapter.cs"); gNBTable.table[i].enabled = TRUE; ret = TRUE; } @@ -247,6 +249,7 @@ if (adapter->transport->cleanupAdapter) adapter->transport->cleanupAdapter(adapter->impl.data); NBCmdQueueDestroy(adapter->cmdQueue); + adapter->cs.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&adapter->cs); memset(adapter, 0, sizeof(NetBIOSAdapter)); } @@ -293,7 +296,7 @@ void NetBIOSEnumAdapters(ULONG transport, NetBIOSEnumAdaptersCallback cb, void *closure) { - TRACE("transport 0x%08lx, callback %p, closure %p\n", transport, cb, + TRACE("transport 0x%08x, callback %p, closure %p\n", transport, cb, closure); if (cb) { @@ -637,7 +640,7 @@ return NRC_GOODRET; } -static UCHAR nbHangup(NetBIOSAdapter *adapter, PNCB ncb) +static UCHAR nbHangup(NetBIOSAdapter *adapter, const NCB *ncb) { UCHAR ret; NetBIOSSession *session; @@ -658,7 +661,7 @@ return ret; } -void NetBIOSHangupSession(PNCB ncb) +void NetBIOSHangupSession(const NCB *ncb) { NetBIOSAdapter *adapter; @@ -795,7 +798,7 @@ ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = nbEnum(ncb); else if (cmd == NCBADDNAME) { - FIXME("NCBADDNAME: stub, returning success"); + FIXME("NCBADDNAME: stub, returning success\n"); ncb->ncb_retcode = ncb->ncb_cmd_cplt = ret = NRC_GOODRET; } else Modified: trunk/reactos/dll/win32/netapi32/netbios.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netbios…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netbios.h (original) +++ trunk/reactos/dll/win32/netapi32/netbios.h Fri Jul 27 13:46:28 2007 @@ -12,7 +12,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef __WINE_NETBIOS_H__ #define __WINE_NETBIOS_H__ @@ -92,7 +92,7 @@ * This function is intended for use by a transport, if the session is closed * by some error in the transport layer. */ -void NetBIOSHangupSession(PNCB ncb); +void NetBIOSHangupSession(const NCB *ncb); /** * Functions a transport implementation must implement @@ -132,7 +132,7 @@ * some calls (recv) will block indefinitely, so a reset, shutdown, etc. will * never occur. */ -#define NCB_CANCELLED(pncb) *(PBOOL)((pncb)->ncb_reserve) +#define NCB_CANCELLED(pncb) *(const BOOL *)((pncb)->ncb_reserve) typedef UCHAR (*NetBIOSAstat)(void *adapter, PNCB ncb); typedef UCHAR (*NetBIOSFindName)(void *adapter, PNCB ncb); Added: trunk/reactos/dll/win32/netapi32/share.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/share.c…
============================================================================== --- trunk/reactos/dll/win32/netapi32/share.c (added) +++ trunk/reactos/dll/win32/netapi32/share.c Fri Jul 27 13:46:28 2007 @@ -1,0 +1,94 @@ +/* Copyright 2006 Paul Vriens + * + * 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 "wine/debug.h" +#include "lm.h" +#include "winerror.h" + +WINE_DEFAULT_DEBUG_CHANNEL(share); + +/************************************************************ + * NetSessionEnum (NETAPI32.@) + * + * PARAMS + * servername [I] Pointer to a string with the name of the server + * UncClientName [I] Pointer to a string with the name of the session + * username [I] Pointer to a string with the name of the user + * level [I] Data information level + * bufptr [O] Buffer to the data + * prefmaxlen [I] Preferred maximum length of the data + * entriesread [O] Pointer to the number of entries enumerated + * totalentries [O] Pointer to the possible number of entries + * resume_handle [I/O] Pointer to a handle for subsequent searches + * + * RETURNS + * If successful, the function returns NERR_Success + * On failure it returns: + * ERROR_ACCESS_DENIED User has no access to the requested information + * ERROR_INVALID_LEVEL Value of 'level' is not correct + * ERROR_INVALID_PARAMETER Wrong parameter + * ERROR_MORE_DATA Need a larger buffer + * ERROR_NOT_ENOUGH_MEMORY Not enough memory + * NERR_ClientNameNotFound A session does not exist on a given computer + * NERR_InvalidComputer Invalid computer name + * NERR_UserNotFound User name could not be found. + */ +NET_API_STATUS WINAPI NetSessionEnum(LPWSTR servername, LPWSTR UncClientName, + LPWSTR username, DWORD level, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread, + LPDWORD totalentries, LPDWORD resume_handle) +{ + FIXME("Stub (%s %s %s %d %p %d %p %p %p)\n", debugstr_w(servername), + debugstr_w(UncClientName), debugstr_w(username), + level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle); + + return NERR_Success; +} + +/************************************************************ + * NetShareEnum (NETAPI32.@) + * + * PARAMS + * servername [I] Pointer to a string with the name of the server + * level [I] Data information level + * bufptr [O] Buffer to the data + * prefmaxlen [I] Preferred maximum length of the data + * entriesread [O] Pointer to the number of entries enumerated + * totalentries [O] Pointer to the possible number of entries + * resume_handle [I/O] Pointer to a handle for subsequent searches + * + * RETURNS + * If successful, the function returns NERR_Success + * On failure it returns a system error code (FIXME: find out which) + * + */ +NET_API_STATUS WINAPI NetShareEnum( LPWSTR servername, DWORD level, LPBYTE* bufptr, + DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resume_handle) +{ + FIXME("Stub (%s %d %p %d %p %p %p)\n", debugstr_w(servername), level, bufptr, + prefmaxlen, entriesread, totalentries, resume_handle); + + return ERROR_NOT_SUPPORTED; +} + +/************************************************************ + * NetShareDel (NETAPI32.@) + */ +NET_API_STATUS WINAPI NetShareDel(LMSTR servername, LMSTR netname, DWORD reserved) +{ + FIXME("Stub (%s %s %d)\n", debugstr_w(servername), debugstr_w(netname), reserved); + return NERR_Success; +} Propchange: trunk/reactos/dll/win32/netapi32/share.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/netapi32/wksta.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/wksta.c…
============================================================================== --- trunk/reactos/dll/win32/netapi32/wksta.c (original) +++ trunk/reactos/dll/win32/netapi32/wksta.c Fri Jul 27 13:46:28 2007 @@ -15,7 +15,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #include "config.h" @@ -35,7 +35,6 @@ #include "lmwksta.h" #include "iphlpapi.h" #include "winerror.h" -#include "winreg.h" #include "ntsecapi.h" #include "netbios.h" #include "wine/debug.h" @@ -72,7 +71,7 @@ } } -static void wprint_mac(WCHAR* buffer, int len, PMIB_IFROW ifRow) +static void wprint_mac(WCHAR* buffer, int len, const MIB_IFROW *ifRow) { int i; unsigned char val; @@ -254,7 +253,7 @@ { NET_API_STATUS ret; - TRACE(":%s, 0x%08lx, %p, 0x%08lx, %p, %p, %p\n", debugstr_w(ServerName), + TRACE(":%s, 0x%08x, %p, 0x%08x, %p, %p, %p\n", debugstr_w(ServerName), level, pbuf, prefmaxlen, read_entries, total_entries,hresume); if (!NETAPI_IsLocalComputer(ServerName)) { @@ -295,7 +294,7 @@ break; } default: - ERR("Invalid level %ld is specified\n", level); + TRACE("Invalid level %d is specified\n", level); ret = ERROR_INVALID_LEVEL; } } @@ -309,7 +308,7 @@ NET_API_STATUS WINAPI NetWkstaUserGetInfo(LPWSTR reserved, DWORD level, PBYTE* bufptr) { - TRACE("(%s, %ld, %p)\n", debugstr_w(reserved), level, bufptr); + TRACE("(%s, %d, %p)\n", debugstr_w(reserved), level, bufptr); switch (level) { case 0: @@ -366,7 +365,7 @@ &PolicyHandle); if (NtStatus != STATUS_SUCCESS) { - ERR("LsaOpenPolicyFailed with NT status %lx\n", + TRACE("LsaOpenPolicyFailed with NT status %x\n", LsaNtStatusToWinError(NtStatus)); NetApiBufferFree(ui0); return ERROR_NOT_ENOUGH_MEMORY; @@ -426,7 +425,7 @@ break; } default: - ERR("Invalid level %ld is specified\n", level); + TRACE("Invalid level %d is specified\n", level); return ERROR_INVALID_LEVEL; } return NERR_Success; @@ -444,7 +443,7 @@ if (GetComputerNameW(*Buffer, &dwSize)) { NetApiBufferReallocate( - *Buffer, dwSize * sizeof(WCHAR), + *Buffer, (dwSize + 1) * sizeof(WCHAR), (LPVOID *) Buffer); return NERR_Success; } @@ -475,7 +474,7 @@ { NET_API_STATUS ret; - TRACE("%s %ld %p\n", debugstr_w( servername ), level, bufptr ); + TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr ); if (servername) { if (!NETAPI_IsLocalComputer(servername)) @@ -489,7 +488,10 @@ switch (level) { case 100: - { + case 101: + case 102: + { + static const WCHAR lanroot[] = {'c',':','\\','l','a','n','m','a','n',0}; /* FIXME */ DWORD computerNameLen, domainNameLen, size; WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1]; LSA_OBJECT_ATTRIBUTES ObjectAttributes; @@ -512,28 +514,31 @@ LsaQueryInformationPolicy(PolicyHandle, PolicyAccountDomainInformation, (PVOID*)&DomainInfo); domainNameLen = lstrlenW(DomainInfo->DomainName.Buffer) + 1; - size = sizeof(WKSTA_INFO_100) + computerNameLen * sizeof(WCHAR) - + domainNameLen * sizeof(WCHAR); + size = sizeof(WKSTA_INFO_102) + computerNameLen * sizeof(WCHAR) + + domainNameLen * sizeof(WCHAR) + sizeof(lanroot); ret = NetApiBufferAllocate(size, (LPVOID *)bufptr); if (ret == NERR_Success) { - PWKSTA_INFO_100 info = (PWKSTA_INFO_100)*bufptr; + /* INFO_100 and INFO_101 structures are subsets of INFO_102 */ + PWKSTA_INFO_102 info = (PWKSTA_INFO_102)*bufptr; OSVERSIONINFOW verInfo; - info->wki100_platform_id = PLATFORM_ID_NT; - info->wki100_computername = (LPWSTR)(*bufptr + - sizeof(WKSTA_INFO_100)); - memcpy(info->wki100_computername, computerName, + info->wki102_platform_id = PLATFORM_ID_NT; + info->wki102_computername = (LPWSTR)(*bufptr + + sizeof(WKSTA_INFO_102)); + memcpy(info->wki102_computername, computerName, computerNameLen * sizeof(WCHAR)); - info->wki100_langroup = (LPWSTR)(*bufptr + - sizeof(WKSTA_INFO_100) + computerNameLen * sizeof(WCHAR)); - memcpy(info->wki100_langroup, DomainInfo->DomainName.Buffer, + info->wki102_langroup = info->wki102_computername + computerNameLen; + memcpy(info->wki102_langroup, DomainInfo->DomainName.Buffer, domainNameLen * sizeof(WCHAR)); + info->wki102_lanroot = info->wki102_langroup + domainNameLen; + memcpy(info->wki102_lanroot, lanroot, sizeof(lanroot)); memset(&verInfo, 0, sizeof(verInfo)); verInfo.dwOSVersionInfoSize = sizeof(verInfo); GetVersionExW(&verInfo); - info->wki100_ver_major = verInfo.dwMajorVersion; - info->wki100_ver_minor = verInfo.dwMinorVersion; + info->wki102_ver_major = verInfo.dwMajorVersion; + info->wki102_ver_minor = verInfo.dwMinorVersion; + info->wki102_logged_on_users = 1; } LsaFreeMemory(DomainInfo); LsaClose(PolicyHandle); @@ -542,7 +547,7 @@ } default: - FIXME("level %ld unimplemented\n", level); + FIXME("level %d unimplemented\n", level); ret = ERROR_INVALID_LEVEL; } return ret;
17 years, 3 months
1
0
0
0
[winesync] 27910: Autosyncing with Wine HEAD
by winesync@svn.reactos.org
Author: winesync Date: Fri Jul 27 13:45:02 2007 New Revision: 27910 URL:
http://svn.reactos.org/svn/reactos?rev=27910&view=rev
Log: Autosyncing with Wine HEAD Modified: trunk/reactos/dll/win32/msvfw32/mciwnd.c trunk/reactos/dll/win32/msvfw32/msvfw32_En.rc trunk/reactos/dll/win32/msvfw32/msvfw32_Ko.rc trunk/reactos/dll/win32/msvfw32/msvfw32_No.rc trunk/reactos/dll/win32/msvfw32/msvideo_main.c Modified: trunk/reactos/dll/win32/msvfw32/mciwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/mciwnd.c…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/mciwnd.c (original) +++ trunk/reactos/dll/win32/msvfw32/mciwnd.c Fri Jul 27 13:45:02 2007 @@ -28,7 +28,6 @@ #include "winnls.h" #include "wingdi.h" #include "winuser.h" -#include "winreg.h" #include "winternl.h" #include "vfw.h" #include "digitalv.h" @@ -448,7 +447,7 @@ { MCIWndInfo *mwi; - TRACE("%p %04x %08x %08lx\n", hWnd, wMsg, wParam, lParam); + TRACE("%p %04x %08lx %08lx\n", hWnd, wMsg, wParam, lParam); mwi = (MCIWndInfo*)GetWindowLongW(hWnd, 0); if (!mwi && wMsg != WM_CREATE) @@ -1057,7 +1056,7 @@ return mwi->inactive_timer; case MCIWNDM_CHANGESTYLES: - TRACE("MCIWNDM_CHANGESTYLES mask %08x, set %08lx\n", wParam, lParam); + TRACE("MCIWNDM_CHANGESTYLES mask %08lx, set %08lx\n", wParam, lParam); /* FIXME: update the visual window state as well: * add/remove trackbar, autosize, etc. */ @@ -1121,7 +1120,7 @@ { MCI_STATUS_PARMS mci_status; - TRACE("MCIWNDM_GETTIMEFORMAT %08x %08lx\n", wParam, lParam); + TRACE("MCIWNDM_GETTIMEFORMAT %08lx %08lx\n", wParam, lParam); /* get format string if requested */ if (wParam && lParam) Modified: trunk/reactos/dll/win32/msvfw32/msvfw32_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/msvfw32_…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/msvfw32_En.rc (original) +++ trunk/reactos/dll/win32/msvfw32/msvfw32_En.rc Fri Jul 27 13:45:02 2007 @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT ICM_CHOOSE_COMPRESSOR DIALOG DISCARDABLE 36, 24, 187, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU Modified: trunk/reactos/dll/win32/msvfw32/msvfw32_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/msvfw32_…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/msvfw32_Ko.rc (original) +++ trunk/reactos/dll/win32/msvfw32/msvfw32_Ko.rc Fri Jul 27 13:45:02 2007 @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT +LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL ICM_CHOOSE_COMPRESSOR DIALOG DISCARDABLE 36, 24, 187, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU Modified: trunk/reactos/dll/win32/msvfw32/msvfw32_No.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/msvfw32_…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/msvfw32_No.rc (original) +++ trunk/reactos/dll/win32/msvfw32/msvfw32_No.rc Fri Jul 27 13:45:02 2007 @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL ICM_CHOOSE_COMPRESSOR DIALOG DISCARDABLE 36, 24, 187, 95 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU Modified: trunk/reactos/dll/win32/msvfw32/msvideo_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/msvideo_…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/msvideo_main.c (original) +++ trunk/reactos/dll/win32/msvfw32/msvideo_main.c Fri Jul 27 13:45:02 2007 @@ -107,9 +107,8 @@ static BOOL enum_drivers(DWORD fccType, enum_handler_t handler, void* param) { CHAR buf[2048], fccTypeStr[5], *s; - DWORD i, cnt = 0, bufLen, lRet; + DWORD i, cnt = 0, lRet; BOOL result = FALSE; - FILETIME lastWrite; HKEY hKey; fourcc_to_string(fccTypeStr, fccType); @@ -119,14 +118,17 @@ lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, HKLM_DRIVERS32, 0, KEY_QUERY_VALUE, &hKey); if (lRet == ERROR_SUCCESS) { - DWORD numkeys; - RegQueryInfoKeyA( hKey, 0, 0, 0, &numkeys, 0, 0, 0, 0, 0, 0, 0); - for (i = 0; i < numkeys; i++) + DWORD name, data, type; + i = 0; + for (;;) { - bufLen = sizeof(buf) / sizeof(buf[0]); - lRet = RegEnumKeyExA(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite); + name = 10; + data = sizeof buf - name; + lRet = RegEnumValueA(hKey, i++, buf, &name, 0, &type, (LPBYTE)(buf+name), &data); + if (lRet == ERROR_NO_MORE_ITEMS) break; if (lRet != ERROR_SUCCESS) continue; - if (strncasecmp(buf, fccTypeStr, 5) || buf[9] != '=') continue; + if (name != 9 || strncasecmp(buf, fccTypeStr, 5)) continue; + buf[name] = '='; if ((result = handler(buf, cnt++, param))) break; } RegCloseKey( hKey ); @@ -1294,10 +1296,9 @@ cbHdr = ICDecompressGetFormatSize(hic,lpbiIn); if ( cbHdr < sizeof(BITMAPINFOHEADER) ) goto err; - pHdr = HeapAlloc(GetProcessHeap(),0,cbHdr+sizeof(RGBQUAD)*256); + pHdr = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,cbHdr+sizeof(RGBQUAD)*256); if ( pHdr == NULL ) goto err; - ZeroMemory( pHdr, cbHdr+sizeof(RGBQUAD)*256 ); if ( ICDecompressGetFormat( hic, lpbiIn, (BITMAPINFO*)pHdr ) != ICERR_OK ) goto err; lpbiOut = (BITMAPINFO*)pHdr;
17 years, 3 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
71
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Results per page:
10
25
50
100
200