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
2025
January
2024
December
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
November 2005
----- 2025 -----
January 2025
----- 2024 -----
December 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
27 participants
875 discussions
Start a n
N
ew thread
[gedmurphy] 19312: Improve stopping control of the service
by gedmurphy@svn.reactos.com
Improve stopping control of the service Modified: trunk/reactos/services/tcpsvcs/chargen.c Modified: trunk/reactos/services/tcpsvcs/discard.c Modified: trunk/reactos/services/tcpsvcs/echo.c Modified: trunk/reactos/services/tcpsvcs/qotd.c Modified: trunk/reactos/services/tcpsvcs/skelserver.c Modified: trunk/reactos/services/tcpsvcs/tcpsvcs.c _____ Modified: trunk/reactos/services/tcpsvcs/chargen.c --- trunk/reactos/services/tcpsvcs/chargen.c 2005-11-17 21:12:27 UTC (rev 19311) +++ trunk/reactos/services/tcpsvcs/chargen.c 2005-11-17 21:35:56 UTC (rev 19312) @@ -17,6 +17,8 @@ #include <tchar.h> #include "tcpsvcs.h" +extern BOOL bShutDown; + DWORD WINAPI ChargenHandler(VOID* Sock_) { DWORD RetVal = 0; @@ -60,7 +62,7 @@ /* where we will start output from */ loopIndex = 0; - while (1) + while (! bShutDown) { /* if the loop index is equal to the last char, * start the loop again from the beginning */ @@ -82,14 +84,17 @@ Line[LINESIZ - 2] = L'\r'; Line[LINESIZ - 1] = L'\n'; - if (!SendLine(Sock, Line)) + if (! SendLine(Sock, Line)) break; /* increment loop index to start printing from next char in ring */ loopIndex++; } - - return TRUE; + + if (bShutDown) + return FALSE; + else + return TRUE; } BOOL SendLine(SOCKET Sock, TCHAR* Line) @@ -121,7 +126,7 @@ } else LogEvent(_T("Chargen: unknown error\n"), 0, FALSE); - //WSAGetLastError() + // return FALSE; LogEvent(_T("Chargen: Connection closed by peer.\n"), 0, FALSE); return TRUE; _____ Modified: trunk/reactos/services/tcpsvcs/discard.c --- trunk/reactos/services/tcpsvcs/discard.c 2005-11-17 21:12:27 UTC (rev 19311) +++ trunk/reactos/services/tcpsvcs/discard.c 2005-11-17 21:35:56 UTC (rev 19312) @@ -14,6 +14,8 @@ #include "tcpsvcs.h" +extern BOOL bShutDown; + DWORD WINAPI DiscardHandler(VOID* Sock_) { DWORD RetVal = 0; @@ -43,7 +45,7 @@ BOOL RecieveIncomingPackets(SOCKET Sock) { TCHAR ReadBuffer[BUF]; - TCHAR temp[512]; // temp for holding LogEvent text + TCHAR buf[256]; INT ReadBytes; do @@ -51,17 +53,19 @@ ReadBytes = recv(Sock, ReadBuffer, BUF, 0); if (ReadBytes > 0) { - _stprintf(temp, _T("Received %d bytes from client\n"), ReadBytes); - LogEvent(temp, 0, FALSE); + _stprintf(buf, _T("Received %d bytes from client\n"), ReadBytes); + LogEvent(buf, 0, FALSE); } else if (ReadBytes == SOCKET_ERROR) { - _stprintf(temp, ("Socket Error: %d\n"), WSAGetLastError()); - LogEvent(temp, 0, TRUE); + _stprintf(buf, ("Socket Error: %d\n"), WSAGetLastError()); + LogEvent(buf, 0, TRUE); return FALSE; } - } while (ReadBytes > 0); + } while ((ReadBytes > 0) && (! bShutDown)); - LogEvent(_T("Discard: Connection closed by peer.\n"), 0, FALSE); + if (! bShutDown) + LogEvent(_T("Discard: Connection closed by peer.\n"), 0, FALSE); + return TRUE; } _____ Modified: trunk/reactos/services/tcpsvcs/echo.c --- trunk/reactos/services/tcpsvcs/echo.c 2005-11-17 21:12:27 UTC (rev 19311) +++ trunk/reactos/services/tcpsvcs/echo.c 2005-11-17 21:35:56 UTC (rev 19312) @@ -14,6 +14,8 @@ #include "tcpsvcs.h" +extern BOOL bShutDown; + DWORD WINAPI EchoHandler(VOID* Sock_) { DWORD RetVal = 0; @@ -43,7 +45,7 @@ BOOL EchoIncomingPackets(SOCKET Sock) { TCHAR ReadBuffer[BUF]; - TCHAR temp[512]; // temp for holding LogEvent text + TCHAR buf[256]; // temp for holding LogEvent text INT Temp; INT ReadBytes; INT SentBytes; @@ -52,8 +54,8 @@ ReadBytes = recv(Sock, ReadBuffer, BUF, 0); if (ReadBytes > 0) { - _stprintf(temp, _T("Received %d bytes from client\n"), ReadBytes); - LogEvent(temp, 0, FALSE); + _stprintf(buf, _T("Received %d bytes from client\n"), ReadBytes); + LogEvent(buf, 0, FALSE); SentBytes = 0; while (SentBytes < ReadBytes) @@ -62,8 +64,8 @@ ReadBytes - SentBytes, 0); if (Temp > 0) { - _stprintf(temp, _T("Sent %d bytes back to client\n"), Temp); - LogEvent(temp, 0, FALSE); + _stprintf(buf, _T("Sent %d bytes back to client\n"), Temp); + LogEvent(buf, 0, FALSE); SentBytes += Temp; } else if (Temp == SOCKET_ERROR) @@ -72,8 +74,8 @@ { /* Client closed connection before we could reply to all the data it sent, so quit early. */ - _stprintf(temp, _T("Peer unexpectedly dropped connection!\n")); - LogEvent(temp, 0, FALSE); + _stprintf(buf, _T("Peer unexpectedly dropped connection!\n")); + LogEvent(buf, 0, FALSE); return FALSE; } } @@ -81,8 +83,10 @@ else if (ReadBytes == SOCKET_ERROR) return FALSE; - } while (ReadBytes != 0); + } while ((ReadBytes != 0) && (! bShutDown)); - LogEvent(_T("Echo: Connection closed by peer.\n"), 0, FALSE); + if (! bShutDown) + LogEvent(_T("Echo: Connection closed by peer.\n"), 0, FALSE); + return TRUE; } _____ Modified: trunk/reactos/services/tcpsvcs/qotd.c --- trunk/reactos/services/tcpsvcs/qotd.c 2005-11-17 21:12:27 UTC (rev 19311) +++ trunk/reactos/services/tcpsvcs/qotd.c 2005-11-17 21:35:56 UTC (rev 19312) @@ -44,10 +44,10 @@ LogEvent(_T("QOTD: Opening quotes file\n"), 0, FALSE); if ((fp = _tfopen(Sys, "r")) == NULL) { - TCHAR temp[512]; + TCHAR buf[256]; - _stprintf(temp, _T("QOTD: Error opening quote file : %s\n"), Sys); - LogEvent(temp, 0, TRUE); + _stprintf(buf, _T("QOTD: Error opening quote file : %s\n"), Sys); + LogEvent(buf, 0, TRUE); LogEvent(_T("QOTD: Terminating thread\n"), 0, FALSE); ExitThread(-1); } _____ Modified: trunk/reactos/services/tcpsvcs/skelserver.c --- trunk/reactos/services/tcpsvcs/skelserver.c 2005-11-17 21:12:27 UTC (rev 19311) +++ trunk/reactos/services/tcpsvcs/skelserver.c 2005-11-17 21:35:56 UTC (rev 19312) @@ -14,18 +14,18 @@ #include "tcpsvcs.h" -extern BOOL bShutDownFlag; -extern BOOL bPauseFlag; +extern BOOL bShutDown; +extern BOOL bPause; DWORD WINAPI StartServer(LPVOID lpParam) { SOCKET ListeningSocket; PSERVICES pServices; const TCHAR* HostIP = "127.0.0.1"; - TCHAR temp[512]; + TCHAR buf[256]; pServices = (PSERVICES)lpParam; - + //DebugBreak(); ListeningSocket = SetUpListener(HostIP, htons(pServices->Port)); if (ListeningSocket == INVALID_SOCKET) @@ -34,15 +34,14 @@ return 3; } - _stprintf(temp, _T("%s is waiting for connections on port %d...\n"), + _stprintf(buf, _T("%s is waiting for connections on port %d...\n"), pServices->Name, pServices->Port); - LogEvent(temp, 0, FALSE); + LogEvent(buf, 0, FALSE); - AcceptConnections(ListeningSocket, pServices->Service, pServices->Name); + if (! bShutDown) + AcceptConnections(ListeningSocket, pServices->Service, pServices->Name); - LogEvent(_T("Detaching Winsock2...\n"), 0, FALSE); - WSACleanup(); - return 0; + ExitThread(0); } @@ -72,7 +71,7 @@ /* note: consider allowing a maximum number of connections * A number of threads can be allocated and worker threads will * only be spawned if a free space is available - + typedef struct _WORKER_THREAD { DWORD num; BOOL available; @@ -91,7 +90,7 @@ FD_SET ReadFDS; INT nAddrSize = sizeof(Client); DWORD ThreadID; - TCHAR temp[512]; + TCHAR buf[256]; INT TimeOut = 2000; // 2 seconds //DebugBreak(); @@ -102,7 +101,7 @@ TimeVal.tv_sec = TimeOut / 1000; TimeVal.tv_usec = TimeOut % 1000; - while (! bShutDownFlag) // (i<MAX_CLIENTS && !bShutDownFlag) + while (! bShutDown) // (i<MAX_CLIENTS && !bShutDown) { FD_SET(ListeningSocket, &ReadFDS); if (select(0, &ReadFDS, NULL, NULL, &TimeVal) == SOCKET_ERROR) @@ -110,31 +109,32 @@ LogEvent(_T("select failed\n"), 0, TRUE); return; } - - if (FD_ISSET(ListeningSocket, &ReadFDS)) + + /* don't call FD_ISSET if bShutDown flag is set */ + if ((! bShutDown) || (FD_ISSET(ListeningSocket, &ReadFDS))) { Sock = accept(ListeningSocket, (SOCKADDR*)&Client, &nAddrSize); if (Sock != INVALID_SOCKET) { - _stprintf(temp, _T("Accepted connection to %s server from %s:%d\n"), + _stprintf(buf, _T("Accepted connection to %s server from %s:%d\n"), Name, inet_ntoa(Client.sin_addr), ntohs(Client.sin_port)); - LogEvent(temp, 0, FALSE); - _stprintf(temp, _T("Creating new thread for %s\n"), Name); - LogEvent(temp, 0, FALSE); + LogEvent(buf, 0, FALSE); + _stprintf(buf, _T("Creating new thread for %s\n"), Name); + LogEvent(buf, 0, FALSE); hThread = CreateThread(0, 0, Service, (void*)Sock, 0, &ThreadID); - /* Check the return value for success. */ + /* Check the return value for success. */ if (hThread == NULL) { - _stprintf(temp, _T("Failed to start worker thread for " + _stprintf(buf, _T("Failed to start worker thread for " "the %s server....\n"), Name); - LogEvent(temp, 0, TRUE); + LogEvent(buf, 0, TRUE); } - //Do we need to wait, or just kill it? WaitForSingleObject(hThread, INFINITE); - + + CloseHandle(hThread); } else { @@ -147,7 +147,7 @@ BOOL ShutdownConnection(SOCKET Sock, BOOL bRec) { - TCHAR temp[512]; + TCHAR buf[256]; /* Disallow any further data sends. This will tell the other side that we want to go away now. If we skip this step, we don't @@ -171,8 +171,8 @@ return FALSE; else if (NewBytes != 0) { - _stprintf(temp, _T("FYI, received %d unexpected bytes during shutdown\n"), NewBytes); - LogEvent(temp, 0, FALSE); + _stprintf(buf, _T("FYI, received %d unexpected bytes during shutdown\n"), NewBytes); + LogEvent(buf, 0, FALSE); } } _____ Modified: trunk/reactos/services/tcpsvcs/tcpsvcs.c --- trunk/reactos/services/tcpsvcs/tcpsvcs.c 2005-11-17 21:12:27 UTC (rev 19311) +++ trunk/reactos/services/tcpsvcs/tcpsvcs.c 2005-11-17 21:35:56 UTC (rev 19312) @@ -17,8 +17,8 @@ * - write debugging function and print all dbg info via that. * - change 'temp' to something meaningfull */ - + #include "tcpsvcs.h" //#define NDEBUG @@ -34,8 +34,8 @@ static SERVICE_STATUS_HANDLE hSStat; FILE *hLogFile; -BOOL bShutDownFlag = FALSE; -BOOL bPauseFlag = FALSE; +BOOL bShutDown = FALSE; +BOOL bPause = FALSE; LPCTSTR LogFileName = "\\tcpsvcs_log.log"; LPTSTR ServiceName = _T("Simp Tcp"); @@ -60,7 +60,7 @@ {ServiceName, ServiceMain}, {NULL, NULL} }; - + //DPRINT("Starting tcpsvcs service. See \system32%s for logs\n", LogFileName); if (! StartServiceCtrlDispatcher(ServiceTable)) @@ -79,19 +79,19 @@ if(! GetSystemDirectory(LogFilePath, MAX_PATH)) return; - + _tcscat(LogFilePath, LogFileName); hLogFile = fopen(LogFilePath, _T("w")); if (hLogFile == NULL) { - TCHAR *temp = NULL; - - _stprintf(temp, _T("Could not open log file: %s"), LogFilePath); - MessageBox(NULL, temp, NULL, MB_OK); + TCHAR buf[50]; + + _stprintf(buf, _T("Could not open log file: %s"), LogFilePath); + MessageBox(NULL, buf, NULL, MB_OK); return; } - + LogEvent(_T("Entering ServiceMain"), 0, FALSE); hServStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; @@ -102,7 +102,7 @@ hServStatus.dwServiceSpecificExitCode = NO_ERROR; hServStatus.dwCheckPoint = 0; hServStatus.dwWaitHint = 2*CS_TIMEOUT; - + hSStat = RegisterServiceCtrlHandler(ServiceName, ServerCtrlHandler); if (hSStat == 0) LogEvent(_T("Failed to register service\n"), -1, TRUE); @@ -118,7 +118,7 @@ SetServiceStatus(hSStat, &hServStatus); return; } - + LogEvent(_T("Service threads shut down. Set SERVICE_STOPPED status"), 0, FALSE); /* We will only return here when the ServiceSpecific function completes, indicating system shutdown. */ @@ -137,14 +137,14 @@ { case SERVICE_CONTROL_SHUTDOWN: /* fall through */ case SERVICE_CONTROL_STOP: - bShutDownFlag = TRUE; + bShutDown = TRUE; UpdateStatus(SERVICE_STOP_PENDING, -1); break; case SERVICE_CONTROL_PAUSE: - bPauseFlag = TRUE; + bPause = TRUE; break; case SERVICE_CONTROL_CONTINUE: - bPauseFlag = FALSE; + bPause = FALSE; break; case SERVICE_CONTROL_INTERROGATE: break; @@ -164,13 +164,13 @@ hServStatus.dwCheckPoint++; else hServStatus.dwCheckPoint = Check; - + if (NewStatus >= 0) hServStatus.dwCurrentState = NewStatus; - + if (! SetServiceStatus (hSStat, &hServStatus)) LogEvent(_T("Cannot set service status"), -1, TRUE); - + return; } @@ -180,17 +180,17 @@ DWORD dwThreadId[NUM_SERVICES]; HANDLE hThread[NUM_SERVICES]; WSADATA wsaData; - TCHAR temp[512]; // temp for holding LogEvent text + TCHAR buf[256]; // temp for holding LogEvent text INT i; DWORD RetVal; - + if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0) { - _stprintf(temp, _T("WSAStartup() failed : %lu\n"), RetVal); - LogEvent(temp, RetVal, TRUE); + _stprintf(buf, _T("WSAStartup() failed : %lu\n"), RetVal); + LogEvent(buf, RetVal, TRUE); return -1; } - + UpdateStatus(-1, -1); /* increment checkpoint */ LogEvent(_T("Creating server Threads\n"), 0, FALSE); @@ -198,8 +198,8 @@ /* Create MAX_THREADS worker threads. */ for( i=0; i<NUM_SERVICES; i++ ) { - _stprintf(temp, _T("Starting %s server....\n"), Services[i].Name); - LogEvent(temp, 0, FALSE); + _stprintf(buf, _T("Starting %s server....\n"), Services[i].Name); + LogEvent(buf, 0, FALSE); hThread[i] = CreateThread( NULL, // default security attributes @@ -212,14 +212,14 @@ /* Check the return value for success. */ if (hThread[i] == NULL) { - _stprintf(temp, _T("Failed to start %s server....\n"), Services[i].Name); + _stprintf(buf, _T("Failed to start %s server....\n"), Services[i].Name); /* don't exit process via LogEvent. We want to exit via the server * which failed to start, which could mean i=0 */ - LogEvent(temp, 0, TRUE); + LogEvent(buf, 0, TRUE); ExitProcess(i); } } - + LogEvent(_T("setting service status to running\n"), 0, FALSE); UpdateStatus(SERVICE_RUNNING, 0); @@ -232,6 +232,10 @@ { CloseHandle(hThread[i]); } + + LogEvent(_T("Detaching Winsock2...\n"), 0, FALSE); + WSACleanup(); + return 0; }
19 years, 1 month
1
0
0
0
[gvg] 19311: Sync to Wine-0_9_1:
by gvg@svn.reactos.com
Sync to Wine-0_9_1: YunSong Hwang <hys545(a)dreamwiz.com> Add Korean translations. Added: trunk/reactos/lib/oledlg/oledlg_Ko.rc Modified: trunk/reactos/lib/oledlg/rsrc.rc _____ Copied: trunk/reactos/lib/oledlg/oledlg_Ko.rc (from rev 19310, vendor/wine/dlls/oledlg/current/oledlg_Ko.rc) Property changes on: trunk/reactos/lib/oledlg/oledlg_Ko.rc ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Modified: trunk/reactos/lib/oledlg/rsrc.rc --- trunk/reactos/lib/oledlg/rsrc.rc 2005-11-17 21:02:48 UTC (rev 19310) +++ trunk/reactos/lib/oledlg/rsrc.rc 2005-11-17 21:12:27 UTC (rev 19311) @@ -38,6 +38,7 @@ #include "oledlg_Fr.rc" #include "oledlg_It.rc" #include "oledlg_Ja.rc" +#include "oledlg_Ko.rc" #include "oledlg_Nl.rc" #include "oledlg_No.rc" #include "oledlg_Pt.rc"
19 years, 1 month
1
0
0
0
[gvg] 19310: Wine-0_9_1 vendor import. Changes for ReactOS by cwittich
by gvg@svn.reactos.com
Wine-0_9_1 vendor import. Changes for ReactOS by cwittich Added: trunk/reactos/lib/crypt32/ Deleted: trunk/reactos/lib/crypt32/Makefile.in Modified: trunk/reactos/lib/crypt32/cert.c Added: trunk/reactos/lib/crypt32/crypt32.def Added: trunk/reactos/lib/crypt32/crypt32.rc Added: trunk/reactos/lib/crypt32/crypt32.xml Modified: trunk/reactos/lib/crypt32/encode.c Modified: trunk/reactos/lib/crypt32/main.c Added: trunk/reactos/lib/crypt32/precomp.h Modified: trunk/reactos/lib/crypt32/protectdata.c _____ Copied: trunk/reactos/lib/crypt32 (from rev 19309, vendor/wine/dlls/crypt32/current) Property changes on: trunk/reactos/lib/crypt32 ___________________________________________________________________ Name: svn:ignore + GNUmakefile _____ Deleted: trunk/reactos/lib/crypt32/Makefile.in --- vendor/wine/dlls/crypt32/current/Makefile.in 2005-11-17 20:59:05 UTC (rev 19309) +++ trunk/reactos/lib/crypt32/Makefile.in 2005-11-17 21:02:48 UTC (rev 19310) @@ -1,20 +0,0 @@ -EXTRADEFS = -D_CRYPT32_ -TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../.. -SRCDIR = @srcdir@ -VPATH = @srcdir@ -MODULE = crypt32.dll -IMPORTLIB = libcrypt32.$(IMPLIBEXT) -IMPORTS = user32 advapi32 kernel32 ntdll - -C_SRCS = \ - cert.c \ - encode.c \ - protectdata.c \ - main.c - -SUBDIRS = tests - -@MAKE_DLL_RULES@ - -### Dependencies: _____ Modified: trunk/reactos/lib/crypt32/cert.c --- vendor/wine/dlls/crypt32/current/cert.c 2005-11-17 20:59:05 UTC (rev 19309) +++ trunk/reactos/lib/crypt32/cert.c 2005-11-17 21:02:48 UTC (rev 19310) @@ -1,5 +1,6 @@ /* - * Copyright 2002 Mike McCormack for CodeWeavers + * Copyright 2002 + Mike McCormack for CodeWeavers * Copyright 2004,2005 Juan Lang * * This library is free software; you can redistribute it and/or @@ -27,20 +28,9 @@ * registering and enumerating physical stores and locations.) * - Many flags, options and whatnot are unimplemented. */ -#include <assert.h> -#include <stdarg.h> -#include "windef.h" -#include "winbase.h" -#include "winnls.h" -#include "winreg.h" -#include "winuser.h" -#include "wincrypt.h" -#include "wine/debug.h" -#include "wine/list.h" -#include "excpt.h" -#include "wine/exception.h" -#include "crypt32_private.h" +#include "precomp.h" + WINE_DEFAULT_DEBUG_CHANNEL(crypt); #define WINE_CRYPTCERTSTORE_MAGIC 0x74726563 @@ -2819,7 +2809,7 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); context = NULL; _____ Added: trunk/reactos/lib/crypt32/crypt32.def --- vendor/wine/dlls/crypt32/current/crypt32.def 2005-11-17 20:59:05 UTC (rev 19309) +++ trunk/reactos/lib/crypt32/crypt32.def 2005-11-17 21:02:48 UTC (rev 19310) @@ -0,0 +1,36 @@ +LIBRARY CRYPT32.DLL +EXPORTS + +CertAlgIdToOID@4 @1030 + +CertOIDToAlgId@4 @1095 + +CryptMemAlloc@4 @1175 +CryptMemFree@4 @1176 +CryptMemRealloc@8 @1177 + +CryptProtectData@28 @1193 + +CryptRegisterDefaultOIDFunction@16 @1195 +CryptSIPAddProvider@4 @1198 + +CryptSIPLoad@12 @1201 +CryptSIPRemoveProvider@4 @1203 + +CryptSIPRetrieveSubjectGuid@12 @1205 + +CryptUnprotectData@28 @1221 + +I_CryptCreateLruCache@8 @1240 + +I_CryptDetachTls@4 @1242 + +I_CryptFindLruEntryData@4 @1247 + +I_CryptFlushLruCache@4 @1249 +I_CryptFreeLruCache@4 @1250 +I_CryptFreeTls@8 @1251 + +I_CryptGetTls@4 @1260 + +I_CryptSetTls@8 @1268 \ No newline at end of file Property changes on: trunk/reactos/lib/crypt32/crypt32.def ___________________________________________________________________ Name: svn:eol-style + native _____ Added: trunk/reactos/lib/crypt32/crypt32.rc --- vendor/wine/dlls/crypt32/current/crypt32.rc 2005-11-17 20:59:05 UTC (rev 19309) +++ trunk/reactos/lib/crypt32/crypt32.rc 2005-11-17 21:02:48 UTC (rev 19310) @@ -0,0 +1,7 @@ +/* $Id$ */ + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "Crypt\0" +#define REACTOS_STR_INTERNAL_NAME "crypt32\0" +#define REACTOS_STR_ORIGINAL_FILENAME "crypt32.dll\0" +#include <reactos/version.rc> Property changes on: trunk/reactos/lib/crypt32/crypt32.rc ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Added: trunk/reactos/lib/crypt32/crypt32.xml --- vendor/wine/dlls/crypt32/current/crypt32.xml 2005-11-17 20:59:05 UTC (rev 19309) +++ trunk/reactos/lib/crypt32/crypt32.xml 2005-11-17 21:02:48 UTC (rev 19310) @@ -0,0 +1,14 @@ +<module name="crypt32" type="win32dll" baseaddress="${BASEADDRESS_CRYPT32}" installbase="system32" installname="crypt32.dll"> + <importlibrary definition="crypt32.def" /> + <include base="crypt32">.</include> + <define name="__USE_W32API" /> + <define name="_WIN32_WINNT">0x501</define> + <library>ntdll</library> + <library>kernel32</library> + <library>wine</library> + <library>advapi32</library> + <file>main.c</file> + <file>protectdata.c</file> + <file>crypt32.rc</file> + <pch>precomp.h</pch> +</module> Property changes on: trunk/reactos/lib/crypt32/crypt32.xml ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/lib/crypt32/encode.c --- vendor/wine/dlls/crypt32/current/encode.c 2005-11-17 20:59:05 UTC (rev 19309) +++ trunk/reactos/lib/crypt32/encode.c 2005-11-17 21:02:48 UTC (rev 19310) @@ -31,22 +31,9 @@ * MSDN, especially: *
http://msdn.microsoft.com/library/en-us/seccrypto/security/constants_for
_cryptencodeobject_and_cryptdecodeobject.asp */ -#include <assert.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#define NONAMELESSUNION +#include "precomp.h" -#include "windef.h" -#include "winbase.h" -#include "excpt.h" -#include "wincrypt.h" -#include "winreg.h" -#include "snmp.h" -#include "wine/debug.h" -#include "wine/exception.h" - /* This is a bit arbitrary, but to set some limit: */ #define MAX_ENCODED_LEN 0x02000000 @@ -730,7 +717,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CERT_PUBLIC_KEY_INFO *info = (const CERT_PUBLIC_KEY_INFO *)pvStructInfo; @@ -745,12 +732,12 @@ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -760,7 +747,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CERT_SIGNED_CONTENT_INFO *info = (const CERT_SIGNED_CONTENT_INFO *)pvStructInfo; @@ -776,12 +763,12 @@ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -795,7 +782,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CERT_INFO *info = (const CERT_INFO *)pvStructInfo; struct AsnEncodeSequenceItem items[10] = { @@ -845,12 +832,12 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -955,7 +942,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CRL_INFO *info = (const CRL_INFO *)pvStructInfo; struct AsnEncodeSequenceItem items[7] = { @@ -989,12 +976,12 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1033,7 +1020,7 @@ { BOOL ret; - __TRY + _SEH_TRY { DWORD bytesNeeded, dataLen, lenBytes, i; const CERT_EXTENSIONS *exts = (const CERT_EXTENSIONS *)pvStructInfo; @@ -1073,12 +1060,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1322,7 +1309,7 @@ BOOL ret; CRYPT_DER_BLOB *blobs = NULL; - __TRY + _SEH_TRY { DWORD bytesNeeded = 0, lenBytes, i; @@ -1390,12 +1377,12 @@ CryptMemFree(blobs[i].pbData); } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); return FALSE; } - __ENDTRY + _SEH_END CryptMemFree(blobs); return ret; } @@ -1406,7 +1393,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CERT_NAME_INFO *info = (const CERT_NAME_INFO *)pvStructInfo; DWORD bytesNeeded = 0, lenBytes, size, i; @@ -1452,12 +1439,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1585,7 +1572,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CERT_ALT_NAME_INFO *info = (const CERT_ALT_NAME_INFO *)pvStructInfo; @@ -1649,12 +1636,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1664,7 +1651,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CERT_BASIC_CONSTRAINTS2_INFO *info = (const CERT_BASIC_CONSTRAINTS2_INFO *)pvStructInfo; @@ -1686,12 +1673,12 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1701,7 +1688,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const BLOBHEADER *hdr = (const BLOBHEADER *)pvStructInfo; @@ -1727,12 +1714,12 @@ pcbEncoded); } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1742,7 +1729,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CRYPT_DATA_BLOB *blob = (const CRYPT_DATA_BLOB *)pvStructInfo; DWORD bytesNeeded, lenBytes; @@ -1772,12 +1759,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END TRACE("returning %d (%08lx)\n", ret, GetLastError()); return ret; } @@ -1788,7 +1775,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CRYPT_BIT_BLOB *blob = (const CRYPT_BIT_BLOB *)pvStructInfo; DWORD bytesNeeded, lenBytes, dataBytes; @@ -1843,12 +1830,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1858,7 +1845,7 @@ { BOOL ret; - __TRY + _SEH_TRY { const CRYPT_BIT_BLOB *blob = (const CRYPT_BIT_BLOB *)pvStructInfo; CRYPT_BIT_BLOB newBlob = { blob->cbData, NULL, blob->cUnusedBits }; @@ -1882,12 +1869,12 @@ &newBlob, dwFlags, pEncodePara, pbEncoded, pcbEncoded); CryptMemFree(newBlob.pbData); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1907,7 +1894,7 @@ { BOOL ret; - __TRY + _SEH_TRY { DWORD significantBytes, lenBytes; BYTE padByte = 0, bytesNeeded; @@ -1981,12 +1968,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -1996,7 +1983,7 @@ { BOOL ret; - __TRY + _SEH_TRY { DWORD significantBytes, lenBytes; BYTE bytesNeeded; @@ -2052,12 +2039,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -2088,7 +2075,7 @@ { BOOL ret; - __TRY + _SEH_TRY { SYSTEMTIME sysTime; /* sorry, magic number: enough for tag, len, YYMMDDHHMMSSZ\0. I use a @@ -2131,12 +2118,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -2146,7 +2133,7 @@ { BOOL ret; - __TRY + _SEH_TRY { SYSTEMTIME sysTime; /* sorry, magic number: enough for tag, len, YYYYMMDDHHMMSSZ\0. I use a @@ -2180,12 +2167,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -2195,7 +2182,7 @@ { BOOL ret; - __TRY + _SEH_TRY { SYSTEMTIME sysTime; @@ -2210,12 +2197,12 @@ lpszStructType, pvStructInfo, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -2225,7 +2212,7 @@ { BOOL ret; - __TRY + _SEH_TRY { DWORD bytesNeeded, dataLen, lenBytes, i; const CRYPT_SEQUENCE_OF_ANY *seq = @@ -2259,12 +2246,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -2837,7 +2824,7 @@ TRACE("%p, %ld, %08lx, %p, %p, %ld\n", pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, *pcbStructInfo); - __TRY + _SEH_TRY { struct AsnDecodeSequenceItem items[] = { { offsetof(CERT_SIGNED_CONTENT_INFO, ToBeSigned), @@ -2858,12 +2845,12 @@ sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -2949,7 +2936,7 @@ TRACE("%p, %ld, %08lx, %p, %p, %ld\n", pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, *pcbStructInfo); - __TRY + _SEH_TRY { struct AsnDecodeSequenceItem items[] = { { offsetof(CERT_INFO, dwVersion), CRYPT_AsnDecodeCertVersion, @@ -2986,12 +2973,12 @@ sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -3138,7 +3125,7 @@ TRACE("%p, %ld, %08lx, %p, %p, %ld\n", pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, *pcbStructInfo); - __TRY + _SEH_TRY { struct AsnDecodeSequenceItem items[] = { { offsetof(CRL_INFO, dwVersion), CRYPT_AsnDecodeCertVersion, @@ -3166,12 +3153,12 @@ sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END TRACE("Returning %d (%08lx)\n", ret, GetLastError()); return ret; @@ -3337,7 +3324,7 @@ { BOOL ret = TRUE; - __TRY + _SEH_TRY { ret = CRYPT_AsnDecodeExtensionsInternal(dwCertEncodingType, lpszStructType, pbEncoded, cbEncoded, @@ -3362,12 +3349,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -3380,7 +3367,7 @@ TRACE("%p, %ld, %08lx, %p, %ld\n", pbEncoded, cbEncoded, dwFlags, pszObjId, *pcbObjId); - __TRY + _SEH_TRY { if (pbEncoded[0] == ASN_OBJECTIDENTIFIER) { @@ -3477,12 +3464,12 @@ ret = FALSE; } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -3495,7 +3482,7 @@ { BOOL ret = TRUE; - __TRY + _SEH_TRY { DWORD dataLen; @@ -3579,12 +3566,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -3596,7 +3583,7 @@ { BOOL ret; - __TRY + _SEH_TRY { if (pbEncoded[0] == (ASN_CONSTRUCTOR | ASN_SEQUENCE)) { @@ -3708,12 +3695,12 @@ ret = FALSE; } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -3722,7 +3709,7 @@ { BOOL ret = TRUE; - __TRY + _SEH_TRY { if (pbEncoded[0] == (ASN_CONSTRUCTOR | ASN_SETOF)) { @@ -3823,12 +3810,12 @@ ret = FALSE; } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -3838,7 +3825,7 @@ { BOOL ret = TRUE; - __TRY + _SEH_TRY { if (pbEncoded[0] == (ASN_CONSTRUCTOR | ASN_SEQUENCEOF)) { @@ -3933,12 +3920,12 @@ ret = FALSE; } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -4015,7 +4002,7 @@ { BOOL ret = TRUE; - __TRY + _SEH_TRY { struct AsnDecodeSequenceItem items[] = { { offsetof(CERT_PUBLIC_KEY_INFO, Algorithm), @@ -4031,12 +4018,12 @@ sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -4186,7 +4173,7 @@ { BOOL ret = TRUE; - __TRY + _SEH_TRY { if (pbEncoded[0] == ASN_SEQUENCEOF) { @@ -4284,12 +4271,12 @@ ret = FALSE; } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -4350,7 +4337,7 @@ { BOOL ret; - __TRY + _SEH_TRY { struct AsnDecodeSequenceItem items[] = { { offsetof(CERT_BASIC_CONSTRAINTS2_INFO, fCA), CRYPT_AsnDecodeBool, @@ -4364,12 +4351,12 @@ sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL); } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -4387,7 +4374,7 @@ { BOOL ret; - __TRY + _SEH_TRY { struct AsnDecodeSequenceItem items[] = { { offsetof(struct DECODED_RSA_PUB_KEY, modulus), @@ -4438,12 +4425,12 @@ LocalFree(decodedKey); } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -4510,7 +4497,7 @@ TRACE("%p, %ld, %08lx, %p, %p, %ld\n", pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, *pcbStructInfo); - __TRY + _SEH_TRY { DWORD bytesNeeded; @@ -4541,12 +4528,12 @@ ret = FALSE; } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } - __ENDTRY + _SEH_END return ret; } @@ -4623,7 +4610,7 @@ TRACE("(%p, %ld, 0x%08lx, %p, %p, %p)\n", pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo); - __TRY + _SEH_TRY { DWORD bytesNeeded; @@ -4649,12 +4636,12 @@ } } } - __EXCEPT(page_fault) + _SEH_EXCEPT(page_fault) { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; } [truncated at 1000 lines; 403 more skipped]
19 years, 1 month
1
0
0
0
[gvg] 19309: Remove in preparation for proper vendor drop
by gvg@svn.reactos.com
Remove in preparation for proper vendor drop Deleted: trunk/reactos/lib/crypt32/
19 years, 1 month
1
0
0
0
[gvg] 19308: Wine-0_9_1 vendor drop
by gvg@svn.reactos.com
Wine-0_9_1 vendor drop Added: vendor/wine/dlls/crypt32/ Added: vendor/wine/dlls/crypt32/current/ Added: vendor/wine/dlls/crypt32/current/Makefile.in Added: vendor/wine/dlls/crypt32/current/cert.c Added: vendor/wine/dlls/crypt32/current/crypt32.spec Added: vendor/wine/dlls/crypt32/current/crypt32_private.h Added: vendor/wine/dlls/crypt32/current/encode.c Added: vendor/wine/dlls/crypt32/current/main.c Added: vendor/wine/dlls/crypt32/current/protectdata.c _____ Added: vendor/wine/dlls/crypt32/current/Makefile.in --- vendor/wine/dlls/crypt32/current/Makefile.in 2005-11-17 20:49:37 UTC (rev 19307) +++ vendor/wine/dlls/crypt32/current/Makefile.in 2005-11-17 20:53:18 UTC (rev 19308) @@ -0,0 +1,20 @@ +EXTRADEFS = -D_CRYPT32_ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = crypt32.dll +IMPORTLIB = libcrypt32.$(IMPLIBEXT) +IMPORTS = user32 advapi32 kernel32 ntdll + +C_SRCS = \ + cert.c \ + encode.c \ + protectdata.c \ + main.c + +SUBDIRS = tests + +@MAKE_DLL_RULES@ + +### Dependencies: Property changes on: vendor/wine/dlls/crypt32/current/Makefile.in ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native _____ Added: vendor/wine/dlls/crypt32/current/cert.c --- vendor/wine/dlls/crypt32/current/cert.c 2005-11-17 20:49:37 UTC (rev 19307) +++ vendor/wine/dlls/crypt32/current/cert.c 2005-11-17 20:53:18 UTC (rev 19308) @@ -0,0 +1,3325 @@ +/* + * Copyright 2002 Mike McCormack for CodeWeavers + * Copyright 2004,2005 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * FIXME: + * - As you can see in the stubs below, support for CRLs and CTLs is missing. + * Mostly this should be copy-paste work, and some code (e.g. extended + * properties) could be shared between them. + * - Opening a cert store provider should be morphed to support loading + * external DLLs. + * - The concept of physical stores and locations isn't implemented. (This + * doesn't mean registry stores et al aren't implemented. See the PSDK for + * registering and enumerating physical stores and locations.) + * - Many flags, options and whatnot are unimplemented. + */ +#include <assert.h> +#include <stdarg.h> +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "winreg.h" +#include "winuser.h" +#include "wincrypt.h" +#include "wine/debug.h" +#include "wine/list.h" +#include "excpt.h" +#include "wine/exception.h" +#include "crypt32_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(crypt); + +#define WINE_CRYPTCERTSTORE_MAGIC 0x74726563 +/* The following aren't defined in wincrypt.h, as they're "reserved" */ +#define CERT_CERT_PROP_ID 32 +#define CERT_CRL_PROP_ID 33 +#define CERT_CTL_PROP_ID 34 + +/* Some typedefs that make it easier to abstract which type of context we're + * working with. + */ +typedef const void *(WINAPI *CreateContextFunc)(DWORD dwCertEncodingType, + const BYTE *pbCertEncoded, DWORD cbCertEncoded); +typedef BOOL (WINAPI *AddContextToStoreFunc)(HCERTSTORE hCertStore, + const void *context, DWORD dwAddDisposition, const void **ppStoreContext); +typedef BOOL (WINAPI *AddEncodedContextToStoreFunc)(HCERTSTORE hCertStore, + DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, + DWORD dwAddDisposition, const void **ppContext); +typedef const void *(WINAPI *EnumContextsInStoreFunc)(HCERTSTORE hCertStore, + const void *pPrevContext); +typedef BOOL (WINAPI *GetContextPropertyFunc)(const void *context, + DWORD dwPropID, void *pvData, DWORD *pcbData); +typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context, + DWORD dwPropID, DWORD dwFlags, const void *pvData); +typedef BOOL (WINAPI *SerializeElementFunc)(const void *context, DWORD dwFlags, + BYTE *pbElement, DWORD *pcbElement); +typedef BOOL (WINAPI *FreeContextFunc)(const void *context); +typedef BOOL (WINAPI *DeleteContextFunc)(const void *context); + +/* An abstract context (certificate, CRL, or CTL) interface */ +typedef struct _WINE_CONTEXT_INTERFACE +{ + CreateContextFunc create; + AddContextToStoreFunc addContextToStore; + AddEncodedContextToStoreFunc addEncodedToStore; + EnumContextsInStoreFunc enumContextsInStore; + GetContextPropertyFunc getProp; + SetContextPropertyFunc setProp; + SerializeElementFunc serialize; + FreeContextFunc free; + DeleteContextFunc deleteFromStore; +} WINE_CONTEXT_INTERFACE, *PWINE_CONTEXT_INTERFACE; + +static const WINE_CONTEXT_INTERFACE gCertInterface = { + (CreateContextFunc)CertCreateCertificateContext, + (AddContextToStoreFunc)CertAddCertificateContextToStore, + (AddEncodedContextToStoreFunc)CertAddEncodedCertificateToStore, + (EnumContextsInStoreFunc)CertEnumCertificatesInStore, + (GetContextPropertyFunc)CertGetCertificateContextProperty, + (SetContextPropertyFunc)CertSetCertificateContextProperty, + (SerializeElementFunc)CertSerializeCertificateStoreElement, + (FreeContextFunc)CertFreeCertificateContext, + (DeleteContextFunc)CertDeleteCertificateFromStore, +}; + +static const WINE_CONTEXT_INTERFACE gCRLInterface = { + (CreateContextFunc)CertCreateCRLContext, + (AddContextToStoreFunc)CertAddCRLContextToStore, + (AddEncodedContextToStoreFunc)CertAddEncodedCRLToStore, + (EnumContextsInStoreFunc)CertEnumCRLsInStore, + (GetContextPropertyFunc)CertGetCRLContextProperty, + (SetContextPropertyFunc)CertSetCRLContextProperty, + (SerializeElementFunc)CertSerializeCRLStoreElement, + (FreeContextFunc)CertFreeCRLContext, + (DeleteContextFunc)CertDeleteCRLFromStore, +}; + +static const WINE_CONTEXT_INTERFACE gCTLInterface = { + (CreateContextFunc)CertCreateCTLContext, + (AddContextToStoreFunc)CertAddCTLContextToStore, + (AddEncodedContextToStoreFunc)CertAddEncodedCTLToStore, + (EnumContextsInStoreFunc)CertEnumCTLsInStore, + (GetContextPropertyFunc)CertGetCTLContextProperty, + (SetContextPropertyFunc)CertSetCTLContextProperty, + (SerializeElementFunc)CertSerializeCTLStoreElement, + (FreeContextFunc)CertFreeCTLContext, + (DeleteContextFunc)CertDeleteCTLFromStore, +}; + +struct WINE_CRYPTCERTSTORE; + +typedef struct WINE_CRYPTCERTSTORE * (*StoreOpenFunc)(HCRYPTPROV hCryptProv, + DWORD dwFlags, const void *pvPara); + +struct _WINE_CERT_CONTEXT_REF; + +/* Called to enumerate the next certificate in a store. The returned pointer + * must be newly allocated (via CryptMemAlloc): CertFreeCertificateContext + * frees it. + */ +typedef struct _WINE_CERT_CONTEXT_REF * (*EnumCertFunc) + (struct WINE_CRYPTCERTSTORE *store, struct _WINE_CERT_CONTEXT_REF *pPrev); + +struct _WINE_CERT_CONTEXT; + +/* Called to create a new reference to an existing cert context. Should call + * CRYPT_InitCertRef to make sure the reference count is properly updated. + * If the store does not provide any additional allocated data (that is, does + * not need to implement a FreeCertFunc), it may use CRYPT_CreateCertRef for + * this. + */ +typedef struct _WINE_CERT_CONTEXT_REF * (*CreateRefFunc) + (struct _WINE_CERT_CONTEXT *context, HCERTSTORE store); + +/* Optional, called when a cert context reference is being freed. Don't free + * the ref pointer itself, CertFreeCertificateContext does that. + */ +typedef void (*FreeCertFunc)(struct _WINE_CERT_CONTEXT_REF *ref); + +typedef enum _CertStoreType { + StoreTypeMem, + StoreTypeCollection, + StoreTypeReg, + StoreTypeDummy, +} CertStoreType; + +/* A cert store is polymorphic through the use of function pointers. A type + * is still needed to distinguish collection stores from other types. + * On the function pointers: + * - closeStore is called when the store's ref count becomes 0 + * - addCert is called with a PWINE_CERT_CONTEXT as the second parameter + * - control is optional, but should be implemented by any store that supports + * persistence + */ +typedef struct WINE_CRYPTCERTSTORE +{ + DWORD dwMagic; + LONG ref; + DWORD dwOpenFlags; + HCRYPTPROV cryptProv; + CertStoreType type; + PFN_CERT_STORE_PROV_CLOSE closeStore; + PFN_CERT_STORE_PROV_WRITE_CERT addCert; + CreateRefFunc createCertRef; + EnumCertFunc enumCert; + PFN_CERT_STORE_PROV_DELETE_CERT deleteCert; + FreeCertFunc freeCert; /* optional */ + PFN_CERT_STORE_PROV_CONTROL control; /* optional */ +} WINECRYPT_CERTSTORE, *PWINECRYPT_CERTSTORE; + +/* A certificate context has pointers to data that are owned by this module, + * so rather than duplicate the data every time a certificate context is + * copied, I keep a reference count to the data. Thus I have two data + * structures, the "true" certificate context (that has the reference count) + * and a reference certificate context, that has a pointer to the true context. + * Each one can be cast to a PCERT_CONTEXT, though you'll usually be dealing + * with the reference version. + */ +typedef struct _WINE_CERT_CONTEXT +{ + CERT_CONTEXT cert; + LONG ref; + CRITICAL_SECTION cs; + struct list extendedProperties; +} WINE_CERT_CONTEXT, *PWINE_CERT_CONTEXT; + +typedef struct _WINE_CERT_CONTEXT_REF +{ + CERT_CONTEXT cert; + WINE_CERT_CONTEXT *context; +} WINE_CERT_CONTEXT_REF, *PWINE_CERT_CONTEXT_REF; + +/* An extended certificate property in serialized form is prefixed by this + * header. + */ +typedef struct _WINE_CERT_PROP_HEADER +{ + DWORD propID; + DWORD unknown; /* always 1 */ + DWORD cb; +} WINE_CERT_PROP_HEADER, *PWINE_CERT_PROP_HEADER; + +/* Stores an extended property in a cert. */ +typedef struct _WINE_CERT_PROPERTY +{ + WINE_CERT_PROP_HEADER hdr; + LPBYTE pbData; + struct list entry; +} WINE_CERT_PROPERTY, *PWINE_CERT_PROPERTY; + +/* A mem store has a list of these. They're also returned by the mem store + * during enumeration. + */ +typedef struct _WINE_CERT_LIST_ENTRY +{ + WINE_CERT_CONTEXT_REF cert; + struct list entry; +} WINE_CERT_LIST_ENTRY, *PWINE_CERT_LIST_ENTRY; + +typedef struct _WINE_MEMSTORE +{ + WINECRYPT_CERTSTORE hdr; + CRITICAL_SECTION cs; + struct list certs; +} WINE_MEMSTORE, *PWINE_MEMSTORE; + +typedef struct _WINE_HASH_TO_DELETE +{ + BYTE hash[20]; + struct list entry; +} WINE_HASH_TO_DELETE, *PWINE_HASH_TO_DELETE; + +/* Returned by a reg store during enumeration. */ +typedef struct _WINE_REG_CERT_CONTEXT +{ + WINE_CERT_CONTEXT_REF cert; + PWINE_CERT_CONTEXT_REF childContext; +} WINE_REG_CERT_CONTEXT, *PWINE_REG_CERT_CONTEXT; + +typedef struct _WINE_REGSTORE +{ + WINECRYPT_CERTSTORE hdr; + PWINECRYPT_CERTSTORE memStore; + HKEY key; + BOOL dirty; + CRITICAL_SECTION cs; + struct list certsToDelete; +} WINE_REGSTORE, *PWINE_REGSTORE; + +typedef struct _WINE_STORE_LIST_ENTRY +{ + PWINECRYPT_CERTSTORE store; + DWORD dwUpdateFlags; + DWORD dwPriority; + struct list entry; +} WINE_STORE_LIST_ENTRY, *PWINE_STORE_LIST_ENTRY; + +/* Returned by a collection store during enumeration. + * Note: relies on the list entry being valid after use, which a number of + * conditions might make untrue (reentrancy, closing a collection store before + * continuing an enumeration on it, ...). The tests seem to indicate this + * sort of unsafety is okay, since Windows isn't well-behaved in these + * scenarios either. + */ +typedef struct _WINE_COLLECTION_CERT_CONTEXT +{ + WINE_CERT_CONTEXT_REF cert; + PWINE_STORE_LIST_ENTRY entry; + PWINE_CERT_CONTEXT_REF childContext; +} WINE_COLLECTION_CERT_CONTEXT, *PWINE_COLLECTION_CERT_CONTEXT; + +typedef struct _WINE_COLLECTIONSTORE +{ + WINECRYPT_CERTSTORE hdr; + CRITICAL_SECTION cs; + struct list stores; +} WINE_COLLECTIONSTORE, *PWINE_COLLECTIONSTORE; + +/* Like CertGetCertificateContextProperty, but operates directly on the + * WINE_CERT_CONTEXT. Doesn't support special-case properties, since they + * are handled by CertGetCertificateContextProperty, and are particular to the + * store in which the property exists (which is separate from the context.) + */ +static BOOL WINAPI CRYPT_GetCertificateContextProperty( + PWINE_CERT_CONTEXT context, DWORD dwPropId, void *pvData, DWORD *pcbData); + +/* Like CertSetCertificateContextProperty, but operates directly on the + * WINE_CERT_CONTEXT. Doesn't handle special cases, since they're handled by + * CertSetCertificateContextProperty anyway. + */ +static BOOL WINAPI CRYPT_SetCertificateContextProperty( + PWINE_CERT_CONTEXT context, DWORD dwPropId, DWORD dwFlags, const void *pvData); + +/* Helper function for store reading functions and + * CertAddSerializedElementToStore. Returns a context of the appropriate type + * if it can, or NULL otherwise. Doesn't validate any of the properties in + * the serialized context (for example, bad hashes are retained.) + * *pdwContentType is set to the type of the returned context. + */ +static const void * WINAPI CRYPT_ReadSerializedElement(const BYTE *pbElement, + DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType); + +/* filter for page-fault exceptions */ +static WINE_EXCEPTION_FILTER(page_fault) +{ + if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) + return EXCEPTION_EXECUTE_HANDLER; + return EXCEPTION_CONTINUE_SEARCH; +} + +static void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv, + DWORD dwFlags, CertStoreType type) +{ + store->ref = 1; + store->dwMagic = WINE_CRYPTCERTSTORE_MAGIC; + store->type = type; + if (!hCryptProv) + { + hCryptProv = CRYPT_GetDefaultProvider(); + dwFlags |= CERT_STORE_NO_CRYPT_RELEASE_FLAG; + } + store->cryptProv = hCryptProv; + store->dwOpenFlags = dwFlags; +} + +/* Initializes the reference ref to point to pCertContext, which is assumed to + * be a PWINE_CERT_CONTEXT, and increments pCertContext's reference count. + * Also sets the hCertStore member of the reference to store. + */ +static void CRYPT_InitCertRef(PWINE_CERT_CONTEXT_REF ref, + PWINE_CERT_CONTEXT context, HCERTSTORE store) +{ + TRACE("(%p, %p)\n", ref, context); + memcpy(&ref->cert, context, sizeof(ref->cert)); + ref->context = context; + InterlockedIncrement(&context->ref); + ref->cert.hCertStore = store; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_CreateCertRef(PWINE_CERT_CONTEXT context, + HCERTSTORE store) +{ + PWINE_CERT_CONTEXT_REF pCertRef = CryptMemAlloc( + sizeof(WINE_CERT_CONTEXT_REF)); + + if (pCertRef) + CRYPT_InitCertRef(pCertRef, context, store); + return pCertRef; +} + +static BOOL WINAPI CRYPT_MemAddCert(HCERTSTORE store, PCCERT_CONTEXT pCert, + DWORD dwAddDisposition) +{ + WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; + BOOL add = FALSE, ret; + + TRACE("(%p, %p, %ld)\n", store, pCert, dwAddDisposition); + + switch (dwAddDisposition) + { + case CERT_STORE_ADD_ALWAYS: + add = TRUE; + break; + case CERT_STORE_ADD_NEW: + { + BYTE hashToAdd[20], hash[20]; + DWORD size = sizeof(hashToAdd); + + ret = CRYPT_GetCertificateContextProperty((PWINE_CERT_CONTEXT)pCert, + CERT_HASH_PROP_ID, hashToAdd, &size); + if (ret) + { + PWINE_CERT_LIST_ENTRY cursor; + + /* Add if no cert with the same hash is found. */ + add = TRUE; + EnterCriticalSection(&ms->cs); + LIST_FOR_EACH_ENTRY(cursor, &ms->certs, WINE_CERT_LIST_ENTRY, entry) + { + size = sizeof(hash); + ret = CertGetCertificateContextProperty(&cursor->cert.cert, + CERT_HASH_PROP_ID, hash, &size); + if (ret && !memcmp(hashToAdd, hash, size)) + { + TRACE("found matching certificate, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + add = FALSE; + break; + } + } + LeaveCriticalSection(&ms->cs); + } + break; + } + case CERT_STORE_ADD_REPLACE_EXISTING: + { + BYTE hashToAdd[20], hash[20]; + DWORD size = sizeof(hashToAdd); + + add = TRUE; + ret = CRYPT_GetCertificateContextProperty((PWINE_CERT_CONTEXT)pCert, + CERT_HASH_PROP_ID, hashToAdd, &size); + if (ret) + { + PWINE_CERT_LIST_ENTRY cursor, next; + + /* Look for existing cert to delete */ + EnterCriticalSection(&ms->cs); + LIST_FOR_EACH_ENTRY_SAFE(cursor, next, &ms->certs, + WINE_CERT_LIST_ENTRY, entry) + { + size = sizeof(hash); + ret = CertGetCertificateContextProperty(&cursor->cert.cert, + CERT_HASH_PROP_ID, hash, &size); + if (ret && !memcmp(hashToAdd, hash, size)) + { + TRACE("found matching certificate, replacing\n"); + list_remove(&cursor->entry); + CertFreeCertificateContext((PCCERT_CONTEXT)cursor); + break; + } + } + LeaveCriticalSection(&ms->cs); + } + break; + } + default: + FIXME("Unimplemented add disposition %ld\n", dwAddDisposition); + add = FALSE; + } + if (add) + { + PWINE_CERT_LIST_ENTRY entry = CryptMemAlloc( + sizeof(WINE_CERT_LIST_ENTRY)); + + if (entry) + { + TRACE("adding %p\n", entry); + CRYPT_InitCertRef(&entry->cert, (PWINE_CERT_CONTEXT)pCert, store); + list_init(&entry->entry); + EnterCriticalSection(&ms->cs); + list_add_tail(&ms->certs, &entry->entry); + LeaveCriticalSection(&ms->cs); + ret = TRUE; + } + else + ret = FALSE; + } + else + ret = FALSE; + return ret; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_MemEnumCert(PWINECRYPT_CERTSTORE store, + PWINE_CERT_CONTEXT_REF pPrev) +{ + WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; + PWINE_CERT_LIST_ENTRY prevEntry = (PWINE_CERT_LIST_ENTRY)pPrev, ret; + struct list *listNext; + + TRACE("(%p, %p)\n", store, pPrev); + EnterCriticalSection(&ms->cs); + if (prevEntry) + { + listNext = list_next(&ms->certs, &prevEntry->entry); + CertFreeCertificateContext((PCCERT_CONTEXT)pPrev); + } + else + listNext = list_next(&ms->certs, &ms->certs); + if (listNext) + { + ret = CryptMemAlloc(sizeof(WINE_CERT_LIST_ENTRY)); + memcpy(ret, LIST_ENTRY(listNext, WINE_CERT_LIST_ENTRY, entry), + sizeof(WINE_CERT_LIST_ENTRY)); + InterlockedIncrement(&ret->cert.context->ref); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + LeaveCriticalSection(&ms->cs); + + TRACE("returning %p\n", ret); + return (PWINE_CERT_CONTEXT_REF)ret; +} + +static BOOL WINAPI CRYPT_MemDeleteCert(HCERTSTORE hCertStore, + PCCERT_CONTEXT pCertContext, DWORD dwFlags) +{ + WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore; + WINE_CERT_CONTEXT_REF *ref = (WINE_CERT_CONTEXT_REF *)pCertContext; + PWINE_CERT_LIST_ENTRY cert, next; + BOOL ret; + + /* Find the entry associated with the passed-in context, since the + * passed-in context may not be a list entry itself (e.g. if it came from + * CertDuplicateCertificateContext.) Pointing to the same context is + * a sufficient test of equality. + */ + EnterCriticalSection(&store->cs); + LIST_FOR_EACH_ENTRY_SAFE(cert, next, &store->certs, WINE_CERT_LIST_ENTRY, + entry) + { + if (cert->cert.context == ref->context) + { + TRACE("removing %p\n", cert); + /* FIXME: this isn't entirely thread-safe, the entry itself isn't + * protected. + */ + list_remove(&cert->entry); + cert->entry.prev = cert->entry.next = &store->certs; + break; + } + } + ret = TRUE; + LeaveCriticalSection(&store->cs); + return ret; +} + +static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) +{ + WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore; + PWINE_CERT_LIST_ENTRY cert, next; + + TRACE("(%p, %08lx)\n", store, dwFlags); + if (dwFlags) + FIXME("Unimplemented flags: %08lx\n", dwFlags); + + /* Note that CertFreeCertificateContext calls HeapFree on the passed-in + * pointer if its ref-count reaches zero. That's okay here because there + * aren't any allocated data outside of the WINE_CERT_CONTEXT_REF portion + * of the CertListEntry. + */ + LIST_FOR_EACH_ENTRY_SAFE(cert, next, &store->certs, WINE_CERT_LIST_ENTRY, + entry) + { + TRACE("removing %p\n", cert); + list_remove(&cert->entry); + CertFreeCertificateContext((PCCERT_CONTEXT)cert); + } + DeleteCriticalSection(&store->cs); + CryptMemFree(store); +} + +static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv, + DWORD dwFlags, const void *pvPara) +{ + PWINE_MEMSTORE store; + + TRACE("(%ld, %08lx, %p)\n", hCryptProv, dwFlags, pvPara); + + if (dwFlags & CERT_STORE_DELETE_FLAG) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + store = NULL; + } + else + { + store = CryptMemAlloc(sizeof(WINE_MEMSTORE)); + if (store) + { + memset(store, 0, sizeof(WINE_MEMSTORE)); + CRYPT_InitStore(&store->hdr, hCryptProv, dwFlags, StoreTypeMem); + store->hdr.closeStore = CRYPT_MemCloseStore; + store->hdr.addCert = CRYPT_MemAddCert; + store->hdr.createCertRef = CRYPT_CreateCertRef; + store->hdr.enumCert = CRYPT_MemEnumCert; + store->hdr.deleteCert = CRYPT_MemDeleteCert; + store->hdr.freeCert = NULL; + InitializeCriticalSection(&store->cs); + list_init(&store->certs); + } + } + return (PWINECRYPT_CERTSTORE)store; +} + +static BOOL WINAPI CRYPT_CollectionAddCert(HCERTSTORE store, + PCCERT_CONTEXT pCert, DWORD dwAddDisposition) +{ + PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + PWINE_STORE_LIST_ENTRY entry, next; + BOOL ret; + + TRACE("(%p, %p, %ld)\n", store, pCert, dwAddDisposition); + + ret = FALSE; + EnterCriticalSection(&cs->cs); + LIST_FOR_EACH_ENTRY_SAFE(entry, next, &cs->stores, WINE_STORE_LIST_ENTRY, + entry) + { + if (entry->dwUpdateFlags & CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG) + { + ret = entry->store->addCert(entry->store, pCert, dwAddDisposition); + break; + } + } + LeaveCriticalSection(&cs->cs); + SetLastError(ret ? ERROR_SUCCESS : HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED)); + return ret; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_CollectionCreateCertRef( + PWINE_CERT_CONTEXT context, HCERTSTORE store) +{ + PWINE_COLLECTION_CERT_CONTEXT ret = CryptMemAlloc( + sizeof(WINE_COLLECTION_CERT_CONTEXT)); + + if (ret) + { + /* Initialize to empty for now, just make sure the size is right */ + CRYPT_InitCertRef((PWINE_CERT_CONTEXT_REF)ret, context, store); + ret->entry = NULL; + ret->childContext = NULL; + } + return (PWINE_CERT_CONTEXT_REF)ret; +} + +static void WINAPI CRYPT_CollectionCloseStore(HCERTSTORE store, DWORD dwFlags) +{ + PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + PWINE_STORE_LIST_ENTRY entry, next; + + TRACE("(%p, %08lx)\n", store, dwFlags); + + LIST_FOR_EACH_ENTRY_SAFE(entry, next, &cs->stores, WINE_STORE_LIST_ENTRY, + entry) + { + TRACE("closing %p\n", entry); + CertCloseStore((HCERTSTORE)entry->store, dwFlags); + CryptMemFree(entry); + } + DeleteCriticalSection(&cs->cs); + CryptMemFree(cs); +} + +/* Advances a collection enumeration by one cert, if possible, where advancing + * means: + * - calling the current store's enumeration function once, and returning + * the enumerated cert if one is returned + * - moving to the next store if the current store has no more items, and + * recursively calling itself to get the next item. + * Returns NULL if the collection contains no more items or on error. + * Assumes the collection store's lock is held. + */ +static PWINE_COLLECTION_CERT_CONTEXT CRYPT_CollectionAdvanceEnum( + PWINE_COLLECTIONSTORE store, PWINE_STORE_LIST_ENTRY storeEntry, + PWINE_COLLECTION_CERT_CONTEXT pPrev) +{ + PWINE_COLLECTION_CERT_CONTEXT ret; + PWINE_CERT_CONTEXT_REF child; + + TRACE("(%p, %p, %p)\n", store, storeEntry, pPrev); + + if (pPrev) + { + child = storeEntry->store->enumCert((HCERTSTORE)storeEntry->store, + pPrev->childContext); + if (child) + { + ret = pPrev; + memcpy(&ret->cert, child, sizeof(WINE_CERT_CONTEXT_REF)); + ret->cert.cert.hCertStore = (HCERTSTORE)store; + InterlockedIncrement(&ret->cert.context->ref); + ret->childContext = child; + } + else + { + struct list *storeNext = list_next(&store->stores, + &storeEntry->entry); + + pPrev->childContext = NULL; + CertFreeCertificateContext((PCCERT_CONTEXT)pPrev); + if (storeNext) + { + storeEntry = LIST_ENTRY(storeNext, WINE_STORE_LIST_ENTRY, + entry); + ret = CRYPT_CollectionAdvanceEnum(store, storeEntry, NULL); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + } + } + else + { + child = storeEntry->store->enumCert((HCERTSTORE)storeEntry->store, + NULL); + if (child) + { + ret = (PWINE_COLLECTION_CERT_CONTEXT)CRYPT_CollectionCreateCertRef( + child->context, store); + if (ret) + { + ret->entry = storeEntry; + ret->childContext = child; + } + else + CertFreeCertificateContext((PCCERT_CONTEXT)child); + } + else + { + struct list *storeNext = list_next(&store->stores, + &storeEntry->entry); + + if (storeNext) + { + storeEntry = LIST_ENTRY(storeNext, WINE_STORE_LIST_ENTRY, + entry); + ret = CRYPT_CollectionAdvanceEnum(store, storeEntry, NULL); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + } + } + TRACE("returning %p\n", ret); + return ret; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_CollectionEnumCert( + PWINECRYPT_CERTSTORE store, PWINE_CERT_CONTEXT_REF pPrev) +{ + PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + PWINE_COLLECTION_CERT_CONTEXT prevEntry = + (PWINE_COLLECTION_CERT_CONTEXT)pPrev, ret; + + TRACE("(%p, %p)\n", store, pPrev); + + if (prevEntry) + { + EnterCriticalSection(&cs->cs); + ret = CRYPT_CollectionAdvanceEnum(cs, prevEntry->entry, prevEntry); + LeaveCriticalSection(&cs->cs); + } + else + { + EnterCriticalSection(&cs->cs); + if (!list_empty(&cs->stores)) + { + PWINE_STORE_LIST_ENTRY storeEntry; + + storeEntry = LIST_ENTRY(cs->stores.next, WINE_STORE_LIST_ENTRY, + entry); + ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, prevEntry); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + LeaveCriticalSection(&cs->cs); + } + TRACE("returning %p\n", ret); + return (PWINE_CERT_CONTEXT_REF)ret; +} + +static BOOL WINAPI CRYPT_CollectionDeleteCert(HCERTSTORE hCertStore, + PCCERT_CONTEXT pCertContext, DWORD dwFlags) +{ + PWINE_COLLECTION_CERT_CONTEXT context = + (PWINE_COLLECTION_CERT_CONTEXT)pCertContext; + BOOL ret; + + TRACE("(%p, %p, %08lx)\n", hCertStore, pCertContext, dwFlags); + + ret = CertDeleteCertificateFromStore((PCCERT_CONTEXT)context->childContext); + if (ret) + context->childContext = NULL; + return ret; +} + +static void CRYPT_CollectionFreeCert(PWINE_CERT_CONTEXT_REF ref) +{ + PWINE_COLLECTION_CERT_CONTEXT context = (PWINE_COLLECTION_CERT_CONTEXT)ref; + + TRACE("(%p)\n", ref); + + if (context->childContext) + CertFreeCertificateContext((PCCERT_CONTEXT)context->childContext); +} + +static WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, + DWORD dwFlags, const void *pvPara) +{ + PWINE_COLLECTIONSTORE store; + + if (dwFlags & CERT_STORE_DELETE_FLAG) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + store = NULL; + } + else + { + store = CryptMemAlloc(sizeof(WINE_COLLECTIONSTORE)); + if (store) + { + memset(store, 0, sizeof(WINE_COLLECTIONSTORE)); + CRYPT_InitStore(&store->hdr, hCryptProv, dwFlags, + StoreTypeCollection); + store->hdr.closeStore = CRYPT_CollectionCloseStore; + store->hdr.addCert = CRYPT_CollectionAddCert; + store->hdr.createCertRef = CRYPT_CollectionCreateCertRef; + store->hdr.enumCert = CRYPT_CollectionEnumCert; + store->hdr.deleteCert = CRYPT_CollectionDeleteCert; + store->hdr.freeCert = CRYPT_CollectionFreeCert; + InitializeCriticalSection(&store->cs); + list_init(&store->stores); + } + } + return (PWINECRYPT_CERTSTORE)store; +} + +static void CRYPT_HashToStr(LPBYTE hash, LPWSTR asciiHash) +{ + static const WCHAR fmt[] = { '%','0','2','X',0 }; + DWORD i; + + assert(hash); + assert(asciiHash); + + for (i = 0; i < 20; i++) + wsprintfW(asciiHash + i * 2, fmt, hash[i]); +} + +static const WCHAR CertsW[] = { 'C','e','r','t','i','f','i','c','a','t','e','s', + 0 }; +static const WCHAR CRLsW[] = { 'C','R','L','s',0 }; +static const WCHAR CTLsW[] = { 'C','T','L','s',0 }; +static const WCHAR BlobW[] = { 'B','l','o','b',0 }; + +static void CRYPT_RegReadSerializedFromReg(PWINE_REGSTORE store, HKEY key, + DWORD contextType) +{ + LONG rc; + DWORD index = 0; + WCHAR subKeyName[MAX_PATH]; + + do { + DWORD size = sizeof(subKeyName) / sizeof(WCHAR); + + rc = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL, NULL, + NULL); + if (!rc) + { + HKEY subKey; + + rc = RegOpenKeyExW(key, subKeyName, 0, KEY_READ, &subKey); + if (!rc) + { + LPBYTE buf = NULL; + + size = 0; + rc = RegQueryValueExW(subKey, BlobW, NULL, NULL, NULL, &size); + if (!rc) + buf = CryptMemAlloc(size); + if (buf) + { + rc = RegQueryValueExW(subKey, BlobW, NULL, NULL, buf, + &size); + if (!rc) + { + const void *context; + DWORD addedType; + + TRACE("Adding cert with hash %s\n", + debugstr_w(subKeyName)); + context = CRYPT_ReadSerializedElement(buf, size, + contextType, &addedType); + if (context) + { + const WINE_CONTEXT_INTERFACE *contextInterface; + BYTE hash[20]; + + switch (addedType) + { + case CERT_STORE_CERTIFICATE_CONTEXT: + contextInterface = &gCertInterface; + break; + case CERT_STORE_CRL_CONTEXT: + contextInterface = &gCRLInterface; + break; + case CERT_STORE_CTL_CONTEXT: + contextInterface = &gCTLInterface; + break; + default: + contextInterface = NULL; + } + if (contextInterface) + { + size = sizeof(hash); + if (contextInterface->getProp(context, + CERT_HASH_PROP_ID, hash, &size)) + { + WCHAR asciiHash[20 * 2 + 1]; + + CRYPT_HashToStr(hash, asciiHash); + TRACE("comparing %s\n", + debugstr_w(asciiHash)); + TRACE("with %s\n", debugstr_w(subKeyName)); + if (!lstrcmpW(asciiHash, subKeyName)) + { + TRACE("hash matches, adding\n"); + contextInterface->addContextToStore( + store, context, + CERT_STORE_ADD_REPLACE_EXISTING, NULL); + } + else + { + TRACE("hash doesn't match, ignoring\n"); + contextInterface->free(context); + } + } + } + } + } + CryptMemFree(buf); + } + RegCloseKey(subKey); + } + /* Ignore intermediate errors, continue enumerating */ + rc = ERROR_SUCCESS; + } + } while (!rc); +} + +static void CRYPT_RegReadFromReg(PWINE_REGSTORE store) +{ + static const WCHAR *subKeys[] = { CertsW, CRLsW, CTLsW }; + static const DWORD contextFlags[] = { CERT_STORE_CERTIFICATE_CONTEXT_FLAG, + CERT_STORE_CRL_CONTEXT_FLAG, CERT_STORE_CTL_CONTEXT_FLAG }; + DWORD i; + + for (i = 0; i < sizeof(subKeys) / sizeof(subKeys[0]); i++) + { + HKEY key; + LONG rc; + + rc = RegCreateKeyExW(store->key, subKeys[i], 0, NULL, 0, KEY_READ, NULL, + &key, NULL); + if (!rc) + { + CRYPT_RegReadSerializedFromReg(store, key, contextFlags[i]); + RegCloseKey(key); + } + } +} [truncated at 1000 lines; 9831 more skipped]
19 years, 1 month
1
0
0
0
[gvg] 19307: Sync to Wine-0_9_1:
by gvg@svn.reactos.com
Sync to Wine-0_9_1: Ivan Leo Puoti <ivanleo(a)gmail.com> - Fix some wrong prototypes. Thomas Weidenmueller <wine-patches(a)reactsoft.com> - Passing NULL as the last two parameters to ReadFile is illegal and actually causes a crash on windows. The attached patch fixes this. Aric Stewart <aric(a)codeweavers.com> - Force files to install if the REINSTALL property is set. Mike McCormack <mike(a)codeweavers.com> - Some installers don't call the CreateFolders action before the InstallFiles action as MSDN specifies, but it still seems to work, so make sure that we create component directories in the InstallFiles action anyway. - Create component folders in the CreateFolders action. - If an action fails, print out its name as well as the error code. Use %d for error codes so it's easy to match them up to something in winerror.h. - Rename load_dynamic_stringW to msi_dup_record_field to better describe what it does, and replace a few instances with MSI_RecordGetString to avoid allocating memory. - Tidy up the RegisterProduct action a little. - Create a stub function to apply a single table transform and call it where we need to apply transforms. - Enumerate the substorage transforms for any patches that are passed on the command line with PATCH=. Need to implement table_apply_transform() before this will do anything interesting. - Simplify register_progid() and remove a fixed length buffer. - Make enter and escape trigger the default and cancel buttons in dialogs. - Switch back to using IPicture to load images. LoadImage did the resizing for us, but doesn't handle jpeg files and requires us writing a temp file, whereas IPicture handles jpeg files and can load directly from a stream. - Remove unused package parameter of register_progid_base(). - Remove an incorrect comment and check for 0 being an invalid file handle. - Add missing semicolons that caused compile trouble on FreeBSD. - Extract file directly to their target location, bypassing the need to use temporary files and move files. - Put the UI update code for cabinet file into a separate function. - Translate INVALID_HANDLE_VALUE to zero for cabinet handles. - Fix a memory leak in the cabinet extracting code. - Fix passing of NULL pointers to MsiDecomposeDescriptor and add a test. - Fix parameter handling in MsiSetTargetPath, and add a test for it. - Deleted two buggy functions that incorrectly and inefficiently check whether a row already exists in a table, and replaced them with a call to an existing working function that does the same thing correctly. - Fix and test MsiGetProperty and MsiSetProperty. - Add a stub implementation of msi.MsiSetMode. - NULL and empty strings are the same in conditions. - Add a bunch of tests for MsiEvaluateCondition and make them pass. - Fix error handling in MsiEvaluateCondition. - Create the +msidb debug channel for msi database code. - Implement transforms. This still includes some debugging code which can be enabled by setting debug_transform to 1 in the relevant places. - Define NONAMELESSUNION and NONAMELESSSTRUCT for older compilers. - Remove some redundant null pointer checks. - Make sure to unregister all the classes that were registered when msi is unloaded, so we can register again cleanly. - Fix a memory leak. - Implement the RemoveFiles action. - Add a read-only implementation of the SelectionTree control. - Make sure we only CoUninitialize after successfully initializing. Fix the address of the returned IShellLinkDataList interface. - Use an enumeration for file states. - Handle MaskEdit masks containing dashes and other constant characters. - Stub implementation for MsiAdvertiseScriptA/W. - Add a stub for the AllocateRegistrySpace action. - Explicitly check for MSICONDITION_TRUE being returned from MsiEvaluateCondition. - Stub implementation for MsiGetFileHashA/W. - Define MSIDBOPEN_ constants using LPCWSTR when compiling Wine. - Improve MsiUseFeatureEx and MsiGetFeatureState a little, add some simple test cases. - Use msi_get_property_int() in a few more places. - Implement MsiGetFeatureUsageA and MsiUseFeature(Ex)A using their W versions. - Use "static const" rather than "const static" as gcc -W complains about the former. - Add an implementation for MsiGetShortcutTargetA/W. - Don't change the UI level during ExecuteAction. - Return an error in MsiGetComponentPathW if passed a null component. - Remove the unused 1st parameter of ACTION_VerifyComponentForAction. - Fix MsiGetPropertyA/W spec declarations. - Create an internal handle-free api for reading MSI database summary information. Modified: trunk/reactos/lib/msi/action.c Modified: trunk/reactos/lib/msi/action.h Modified: trunk/reactos/lib/msi/appsearch.c Modified: trunk/reactos/lib/msi/classes.c Modified: trunk/reactos/lib/msi/cond.y Modified: trunk/reactos/lib/msi/create.c Modified: trunk/reactos/lib/msi/custom.c Modified: trunk/reactos/lib/msi/database.c Modified: trunk/reactos/lib/msi/delete.c Modified: trunk/reactos/lib/msi/dialog.c Modified: trunk/reactos/lib/msi/distinct.c Modified: trunk/reactos/lib/msi/files.c Modified: trunk/reactos/lib/msi/format.c Modified: trunk/reactos/lib/msi/helpers.c Modified: trunk/reactos/lib/msi/insert.c Modified: trunk/reactos/lib/msi/install.c Modified: trunk/reactos/lib/msi/msi.c Modified: trunk/reactos/lib/msi/msi.rc Modified: trunk/reactos/lib/msi/msi.spec Added: trunk/reactos/lib/msi/msi_Ko.rc Modified: trunk/reactos/lib/msi/msipriv.h Modified: trunk/reactos/lib/msi/msiquery.c Modified: trunk/reactos/lib/msi/order.c Modified: trunk/reactos/lib/msi/package.c Modified: trunk/reactos/lib/msi/record.c Modified: trunk/reactos/lib/msi/registry.c Modified: trunk/reactos/lib/msi/select.c Modified: trunk/reactos/lib/msi/string.c Modified: trunk/reactos/lib/msi/suminfo.c Modified: trunk/reactos/lib/msi/table.c Modified: trunk/reactos/lib/msi/update.c Modified: trunk/reactos/lib/msi/where.c Modified: trunk/reactos/w32api/include/msi.h Modified: trunk/reactos/w32api/include/msiquery.h _____ Modified: trunk/reactos/lib/msi/action.c --- trunk/reactos/lib/msi/action.c 2005-11-17 20:33:50 UTC (rev 19306) +++ trunk/reactos/lib/msi/action.c 2005-11-17 20:49:37 UTC (rev 19307) @@ -60,119 +60,119 @@ */ static const WCHAR c_colon[] = {'C',':','\\',0}; -const static WCHAR szCreateFolders[] = +static const WCHAR szCreateFolders[] = {'C','r','e','a','t','e','F','o','l','d','e','r','s',0}; -const static WCHAR szCostFinalize[] = +static const WCHAR szCostFinalize[] = {'C','o','s','t','F','i','n','a','l','i','z','e',0}; const WCHAR szInstallFiles[] = {'I','n','s','t','a','l','l','F','i','l','e','s',0}; const WCHAR szDuplicateFiles[] = {'D','u','p','l','i','c','a','t','e','F','i','l','e','s',0}; -const static WCHAR szWriteRegistryValues[] = +static const WCHAR szWriteRegistryValues[] = {'W','r','i','t','e','R','e','g','i','s','t','r','y', 'V','a','l','u','e','s',0}; -const static WCHAR szCostInitialize[] = +static const WCHAR szCostInitialize[] = {'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0}; -const static WCHAR szFileCost[] = +static const WCHAR szFileCost[] = {'F','i','l','e','C','o','s','t',0}; -const static WCHAR szInstallInitialize[] = +static const WCHAR szInstallInitialize[] = {'I','n','s','t','a','l','l','I','n','i','t','i','a','l','i','z','e',0}; -const static WCHAR szInstallValidate[] = +static const WCHAR szInstallValidate[] = {'I','n','s','t','a','l','l','V','a','l','i','d','a','t','e',0}; -const static WCHAR szLaunchConditions[] = +static const WCHAR szLaunchConditions[] = {'L','a','u','n','c','h','C','o','n','d','i','t','i','o','n','s',0}; -const static WCHAR szProcessComponents[] = +static const WCHAR szProcessComponents[] = {'P','r','o','c','e','s','s','C','o','m','p','o','n','e','n','t','s',0}; -const static WCHAR szRegisterTypeLibraries[] = +static const WCHAR szRegisterTypeLibraries[] = {'R','e','g','i','s','t','e','r','T','y','p','e', 'L','i','b','r','a','r','i','e','s',0}; const WCHAR szRegisterClassInfo[] = {'R','e','g','i','s','t','e','r','C','l','a','s','s','I','n','f','o',0}; const WCHAR szRegisterProgIdInfo[] = {'R','e','g','i','s','t','e','r','P','r','o','g','I','d','I','n','f','o' ,0}; -const static WCHAR szCreateShortcuts[] = +static const WCHAR szCreateShortcuts[] = {'C','r','e','a','t','e','S','h','o','r','t','c','u','t','s',0}; -const static WCHAR szPublishProduct[] = +static const WCHAR szPublishProduct[] = {'P','u','b','l','i','s','h','P','r','o','d','u','c','t',0}; -const static WCHAR szWriteIniValues[] = +static const WCHAR szWriteIniValues[] = {'W','r','i','t','e','I','n','i','V','a','l','u','e','s',0}; -const static WCHAR szSelfRegModules[] = +static const WCHAR szSelfRegModules[] = {'S','e','l','f','R','e','g','M','o','d','u','l','e','s',0}; -const static WCHAR szPublishFeatures[] = +static const WCHAR szPublishFeatures[] = {'P','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0}; -const static WCHAR szRegisterProduct[] = +static const WCHAR szRegisterProduct[] = {'R','e','g','i','s','t','e','r','P','r','o','d','u','c','t',0}; -const static WCHAR szInstallExecute[] = +static const WCHAR szInstallExecute[] = {'I','n','s','t','a','l','l','E','x','e','c','u','t','e',0}; -const static WCHAR szInstallExecuteAgain[] = +static const WCHAR szInstallExecuteAgain[] = {'I','n','s','t','a','l','l','E','x','e','c','u','t','e', 'A','g','a','i','n',0}; -const static WCHAR szInstallFinalize[] = +static const WCHAR szInstallFinalize[] = {'I','n','s','t','a','l','l','F','i','n','a','l','i','z','e',0}; -const static WCHAR szForceReboot[] = +static const WCHAR szForceReboot[] = {'F','o','r','c','e','R','e','b','o','o','t',0}; -const static WCHAR szResolveSource[] = +static const WCHAR szResolveSource[] = {'R','e','s','o','l','v','e','S','o','u','r','c','e',0}; const WCHAR szAppSearch[] = {'A','p','p','S','e','a','r','c','h',0}; -const static WCHAR szAllocateRegistrySpace[] = +static const WCHAR szAllocateRegistrySpace[] = {'A','l','l','o','c','a','t','e','R','e','g','i','s','t','r','y', 'S','p','a','c','e',0}; -const static WCHAR szBindImage[] = +static const WCHAR szBindImage[] = {'B','i','n','d','I','m','a','g','e',0}; -const static WCHAR szCCPSearch[] = +static const WCHAR szCCPSearch[] = {'C','C','P','S','e','a','r','c','h',0}; -const static WCHAR szDeleteServices[] = +static const WCHAR szDeleteServices[] = {'D','e','l','e','t','e','S','e','r','v','i','c','e','s',0}; -const static WCHAR szDisableRollback[] = +static const WCHAR szDisableRollback[] = {'D','i','s','a','b','l','e','R','o','l','l','b','a','c','k',0}; -const static WCHAR szExecuteAction[] = +static const WCHAR szExecuteAction[] = {'E','x','e','c','u','t','e','A','c','t','i','o','n',0}; const WCHAR szFindRelatedProducts[] = {'F','i','n','d','R','e','l','a','t','e','d', 'P','r','o','d','u','c','t','s',0}; -const static WCHAR szInstallAdminPackage[] = +static const WCHAR szInstallAdminPackage[] = {'I','n','s','t','a','l','l','A','d','m','i','n', 'P','a','c','k','a','g','e',0}; -const static WCHAR szInstallSFPCatalogFile[] = +static const WCHAR szInstallSFPCatalogFile[] = {'I','n','s','t','a','l','l','S','F','P','C','a','t','a','l','o','g', 'F','i','l','e',0}; -const static WCHAR szIsolateComponents[] = +static const WCHAR szIsolateComponents[] = {'I','s','o','l','a','t','e','C','o','m','p','o','n','e','n','t','s',0}; const WCHAR szMigrateFeatureStates[] = {'M','i','g','r','a','t','e','F','e','a','t','u','r','e', 'S','t','a','t','e','s',0}; const WCHAR szMoveFiles[] = {'M','o','v','e','F','i','l','e','s',0}; -const static WCHAR szMsiPublishAssemblies[] = +static const WCHAR szMsiPublishAssemblies[] = {'M','s','i','P','u','b','l','i','s','h', 'A','s','s','e','m','b','l','i','e','s',0}; -const static WCHAR szMsiUnpublishAssemblies[] = +static const WCHAR szMsiUnpublishAssemblies[] = {'M','s','i','U','n','p','u','b','l','i','s','h', 'A','s','s','e','m','b','l','i','e','s',0}; -const static WCHAR szInstallODBC[] = +static const WCHAR szInstallODBC[] = {'I','n','s','t','a','l','l','O','D','B','C',0}; -const static WCHAR szInstallServices[] = +static const WCHAR szInstallServices[] = {'I','n','s','t','a','l','l','S','e','r','v','i','c','e','s',0}; const WCHAR szPatchFiles[] = {'P','a','t','c','h','F','i','l','e','s',0}; -const static WCHAR szPublishComponents[] = +static const WCHAR szPublishComponents[] = {'P','u','b','l','i','s','h','C','o','m','p','o','n','e','n','t','s',0}; -const static WCHAR szRegisterComPlus[] = +static const WCHAR szRegisterComPlus[] = {'R','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0}; const WCHAR szRegisterExtensionInfo[] = {'R','e','g','i','s','t','e','r','E','x','t','e','n','s','i','o','n', 'I','n','f','o',0}; -const static WCHAR szRegisterFonts[] = +static const WCHAR szRegisterFonts[] = {'R','e','g','i','s','t','e','r','F','o','n','t','s',0}; const WCHAR szRegisterMIMEInfo[] = {'R','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o',0}; -const static WCHAR szRegisterUser[] = +static const WCHAR szRegisterUser[] = {'R','e','g','i','s','t','e','r','U','s','e','r',0}; const WCHAR szRemoveDuplicateFiles[] = {'R','e','m','o','v','e','D','u','p','l','i','c','a','t','e', 'F','i','l','e','s',0}; -const static WCHAR szRemoveEnvironmentStrings[] = +static const WCHAR szRemoveEnvironmentStrings[] = {'R','e','m','o','v','e','E','n','v','i','r','o','n','m','e','n','t', 'S','t','r','i','n','g','s',0}; const WCHAR szRemoveExistingProducts[] = @@ -180,55 +180,55 @@ 'P','r','o','d','u','c','t','s',0}; const WCHAR szRemoveFiles[] = {'R','e','m','o','v','e','F','i','l','e','s',0}; -const static WCHAR szRemoveFolders[] = +static const WCHAR szRemoveFolders[] = {'R','e','m','o','v','e','F','o','l','d','e','r','s',0}; -const static WCHAR szRemoveIniValues[] = +static const WCHAR szRemoveIniValues[] = {'R','e','m','o','v','e','I','n','i','V','a','l','u','e','s',0}; -const static WCHAR szRemoveODBC[] = +static const WCHAR szRemoveODBC[] = {'R','e','m','o','v','e','O','D','B','C',0}; -const static WCHAR szRemoveRegistryValues[] = +static const WCHAR szRemoveRegistryValues[] = {'R','e','m','o','v','e','R','e','g','i','s','t','r','y', 'V','a','l','u','e','s',0}; -const static WCHAR szRemoveShortcuts[] = +static const WCHAR szRemoveShortcuts[] = {'R','e','m','o','v','e','S','h','o','r','t','c','u','t','s',0}; -const static WCHAR szRMCCPSearch[] = +static const WCHAR szRMCCPSearch[] = {'R','M','C','C','P','S','e','a','r','c','h',0}; -const static WCHAR szScheduleReboot[] = +static const WCHAR szScheduleReboot[] = {'S','c','h','e','d','u','l','e','R','e','b','o','o','t',0}; -const static WCHAR szSelfUnregModules[] = +static const WCHAR szSelfUnregModules[] = {'S','e','l','f','U','n','r','e','g','M','o','d','u','l','e','s',0}; -const static WCHAR szSetODBCFolders[] = +static const WCHAR szSetODBCFolders[] = {'S','e','t','O','D','B','C','F','o','l','d','e','r','s',0}; -const static WCHAR szStartServices[] = +static const WCHAR szStartServices[] = {'S','t','a','r','t','S','e','r','v','i','c','e','s',0}; -const static WCHAR szStopServices[] = +static const WCHAR szStopServices[] = {'S','t','o','p','S','e','r','v','i','c','e','s',0}; -const static WCHAR szUnpublishComponents[] = +static const WCHAR szUnpublishComponents[] = {'U','n','p','u','b','l','i','s','h', 'C','o','m','p','o','n','e','n','t','s',0}; -const static WCHAR szUnpublishFeatures[] = +static const WCHAR szUnpublishFeatures[] = {'U','n','p','u','b','l','i','s','h','F','e','a','t','u','r','e','s',0}; const WCHAR szUnregisterClassInfo[] = {'U','n','r','e','g','i','s','t','e','r','C','l','a','s','s', 'I','n','f','o',0}; -const static WCHAR szUnregisterComPlus[] = +static const WCHAR szUnregisterComPlus[] = {'U','n','r','e','g','i','s','t','e','r','C','o','m','P','l','u','s',0}; const WCHAR szUnregisterExtensionInfo[] = {'U','n','r','e','g','i','s','t','e','r', 'E','x','t','e','n','s','i','o','n','I','n','f','o',0}; -const static WCHAR szUnregisterFonts[] = +static const WCHAR szUnregisterFonts[] = {'U','n','r','e','g','i','s','t','e','r','F','o','n','t','s',0}; const WCHAR szUnregisterMIMEInfo[] = {'U','n','r','e','g','i','s','t','e','r','M','I','M','E','I','n','f','o' ,0}; const WCHAR szUnregisterProgIdInfo[] = {'U','n','r','e','g','i','s','t','e','r','P','r','o','g','I','d', 'I','n','f','o',0}; -const static WCHAR szUnregisterTypeLibraries[] = +static const WCHAR szUnregisterTypeLibraries[] = {'U','n','r','e','g','i','s','t','e','r','T','y','p','e', 'L','i','b','r','a','r','i','e','s',0}; -const static WCHAR szValidateProductID[] = +static const WCHAR szValidateProductID[] = {'V','a','l','i','d','a','t','e','P','r','o','d','u','c','t','I','D',0}; -const static WCHAR szWriteEnvironmentStrings[] = +static const WCHAR szWriteEnvironmentStrings[] = {'W','r','i','t','e','E','n','v','i','r','o','n','m','e','n','t', 'S','t','r','i','n','g','s',0}; @@ -404,6 +404,171 @@ return ERROR_SUCCESS; } + +static LPWSTR* msi_split_string( LPCWSTR str, WCHAR sep ) +{ + LPWSTR p, *ret = NULL; + UINT count = 0; + + if (!str) + return ret; + + /* count the number of substrings */ + for ( p = (LPWSTR)str, count = 0; p; count++ ) + { + p = strchrW( p, sep ); + if (p) + p++; + } + + /* allocate space for an array of substring pointers and the substrings */ + ret = msi_alloc( (count+1) * sizeof (LPWSTR) + + (lstrlenW(str)+1) * sizeof(WCHAR) ); + if (!ret) + return ret; + + /* copy the string and set the pointers */ + p = (LPWSTR) &ret[count+1]; + lstrcpyW( p, str ); + for( count = 0; (ret[count] = p); count++ ) + { + p = strchrW( p, sep ); + if (p) + *p++ = 0; + } + + return ret; +} + +static UINT msi_apply_substorage_transform( MSIPACKAGE *package, + MSIDATABASE *patch_db, LPCWSTR name ) +{ + UINT ret = ERROR_FUNCTION_FAILED; + IStorage *stg = NULL; + HRESULT r; + + TRACE("%p %s\n", package, debugstr_w(name) ); + + if (*name++ != ':') + { + ERR("expected a colon in %s\n", debugstr_w(name)); + return ERROR_FUNCTION_FAILED; + } + + r = IStorage_OpenStorage( patch_db->storage, name, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &stg ); + if (SUCCEEDED(r)) + { + ret = msi_table_apply_transform( package->db, stg ); + IStorage_Release( stg ); + ret = ERROR_SUCCESS; + } + else + ERR("failed to open substorage %s\n", debugstr_w(name)); + + return ret; +} + +static UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si ) +{ + static const WCHAR szProdID[] = { 'P','r','o','d','u','c','t','I','D',0 }; + LPWSTR guid_list, *guids, product_id; + UINT i, ret = ERROR_FUNCTION_FAILED; + + product_id = msi_dup_property( package, szProdID ); + if (!product_id) + { + /* FIXME: the property ProductID should be written into the DB somewhere */ + ERR("no product ID to check\n"); + return ERROR_SUCCESS; + } + + guid_list = msi_suminfo_dup_string( si, PID_TEMPLATE ); + guids = msi_split_string( guid_list, ';' ); + for ( i = 0; guids[i] && ret != ERROR_SUCCESS; i++ ) + { + if (!lstrcmpW( guids[i], product_id )) + ret = ERROR_SUCCESS; + } + msi_free( guids ); + msi_free( guid_list ); + msi_free( product_id ); + + return ret; +} + +static UINT msi_parse_patch_summary( MSIPACKAGE *package, MSIDATABASE *patch_db ) +{ + MSISUMMARYINFO *si; + LPWSTR str, *substorage; + UINT i, r = ERROR_SUCCESS; + + si = MSI_GetSummaryInformationW( patch_db, 0 ); + if (!si) + return ERROR_FUNCTION_FAILED; + + msi_check_patch_applicable( package, si ); + + /* enumerate the substorage */ + str = msi_suminfo_dup_string( si, PID_LASTAUTHOR ); + substorage = msi_split_string( str, ';' ); + for ( i = 0; substorage && substorage[i] && r == ERROR_SUCCESS; i++ ) + r = msi_apply_substorage_transform( package, patch_db, substorage[i] ); + msi_free( substorage ); + msi_free( str ); + + /* FIXME: parse the sources in PID_REVNUMBER and do something with them... */ + + msiobj_release( &si->hdr ); + + return r; +} + +static UINT msi_apply_patch_package( MSIPACKAGE *package, LPCWSTR file ) +{ + MSIDATABASE *patch_db = NULL; + UINT r; + + TRACE("%p %s\n", package, debugstr_w( file ) ); + + /* FIXME: + * We probably want to make sure we only open a patch collection here. + * Patch collections (.msp) and databases (.msi) have different GUIDs + * but currently MSI_OpenDatabaseW will accept both. + */ + r = MSI_OpenDatabaseW( file, MSIDBOPEN_READONLY, &patch_db ); + if ( r != ERROR_SUCCESS ) + { + ERR("failed to open patch collection %s\n", debugstr_w( file ) ); + return r; + } + + msi_parse_patch_summary( package, patch_db ); + msiobj_release( &patch_db->hdr ); + + return ERROR_SUCCESS; +} + +/* get the PATCH property, and apply all the patches it specifies */ +static UINT msi_apply_patches( MSIPACKAGE *package ) +{ + static const WCHAR szPatch[] = { 'P','A','T','C','H',0 }; + LPWSTR patch_list, *patches; + UINT i, r = ERROR_SUCCESS; + + patch_list = msi_dup_property( package, szPatch ); + + TRACE("patches to be applied: %s\n", debugstr_w( patch_list ) ); + + patches = msi_split_string( patch_list, ';' ); + for( i=0; patches && patches[i] && r == ERROR_SUCCESS; i++ ) + r = msi_apply_patch_package( package, patches[i] ); + + msi_free( patches ); + msi_free( patch_list ); + + return r; +} + /**************************************************** * TOP level entry points *****************************************************/ @@ -453,6 +618,8 @@ msi_parse_command_line( package, szCommandLine ); + msi_apply_patches( package ); + if ( msi_get_property_int(package, szUILevel, 0) >= INSTALLUILEVEL_REDUCED ) { package->script->InWhatSequence |= SEQUENCE_UI; @@ -593,7 +760,7 @@ rc = ERROR_SUCCESS; if (rc != ERROR_SUCCESS) - ERR("Execution halted due to error (%i)\n",rc); + ERR("Execution halted, action %s returned %i\n", debugstr_w(action), rc); return rc; } @@ -708,7 +875,7 @@ if (rc == ERROR_SUCCESS) { - TRACE("Running the actions \n"); + TRACE("Running the actions\n"); rc = MSI_IterateRecords(view, NULL, ITERATE_Actions, &iap); msiobj_release(&view->hdr); @@ -727,6 +894,12 @@ BOOL run = force; int i; + if (!package) + { + ERR("package was null!\n"); + return FALSE; + } + if (!run && !package->script->CurrentlyScripting) run = TRUE; @@ -855,7 +1028,7 @@ dir = MSI_RecordGetString(row,1); if (!dir) { - ERR("Unable to get folder id \n"); + ERR("Unable to get folder id\n"); return ERROR_SUCCESS; } @@ -883,7 +1056,43 @@ return ERROR_SUCCESS; } +/* FIXME: probably should merge this with the above function */ +static UINT msi_create_directory( MSIPACKAGE* package, LPCWSTR dir ) +{ + UINT rc = ERROR_SUCCESS; + MSIFOLDER *folder; + LPWSTR install_path; + install_path = resolve_folder(package, dir, FALSE, FALSE, &folder); + if (!install_path) + return ERROR_FUNCTION_FAILED; + + /* create the path */ + if (folder->State == 0) + { + create_full_pathW(install_path); + folder->State = 2; + } + msi_free(install_path); + + return rc; +} + +UINT msi_create_component_directories( MSIPACKAGE *package ) +{ + MSICOMPONENT *comp; + + /* create all the folders required by the components are going to install */ + LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) + { + if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) + continue; + msi_create_directory( package, comp->Directory ); + } + + return ERROR_SUCCESS; +} + /* * Also we cannot enable/disable components either, so for now I am just going * to do all the directories for all the components. @@ -898,13 +1107,16 @@ UINT rc; MSIQUERY *view; + /* create all the empty folders specified in the CreateFolder table */ rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view ); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package); msiobj_release(&view->hdr); - + + msi_create_component_directories( package ); + return rc; } @@ -917,15 +1129,15 @@ return comp; /* fill in the data */ - comp->Component = load_dynamic_stringW( row, 1 ); + comp->Component = msi_dup_record_field( row, 1 ); TRACE("Loading Component %s\n", debugstr_w(comp->Component)); - comp->ComponentId = load_dynamic_stringW( row, 2 ); - comp->Directory = load_dynamic_stringW( row, 3 ); + comp->ComponentId = msi_dup_record_field( row, 2 ); + comp->Directory = msi_dup_record_field( row, 3 ); comp->Attributes = MSI_RecordGetInteger(row,4); - comp->Condition = load_dynamic_stringW( row, 5 ); - comp->KeyPath = load_dynamic_stringW( row, 6 ); + comp->Condition = msi_dup_record_field( row, 5 ); + comp->KeyPath = msi_dup_record_field( row, 6 ); comp->Installed = INSTALLSTATE_ABSENT; comp->Action = INSTALLSTATE_UNKNOWN; @@ -1031,19 +1243,19 @@ list_init( &feature->Components ); - feature->Feature = load_dynamic_stringW( row, 1 ); + feature->Feature = msi_dup_record_field( row, 1 ); TRACE("Loading feature %s\n",debugstr_w(feature->Feature)); - feature->Feature_Parent = load_dynamic_stringW( row, 2 ); - feature->Title = load_dynamic_stringW( row, 3 ); - feature->Description = load_dynamic_stringW( row, 4 ); + feature->Feature_Parent = msi_dup_record_field( row, 2 ); + feature->Title = msi_dup_record_field( row, 3 ); + feature->Description = msi_dup_record_field( row, 4 ); if (!MSI_RecordIsNull(row,5)) feature->Display = MSI_RecordGetInteger(row,5); feature->Level= MSI_RecordGetInteger(row,6); - feature->Directory = load_dynamic_stringW( row, 7 ); + feature->Directory = msi_dup_record_field( row, 7 ); feature->Attributes = MSI_RecordGetInteger(row,8); feature->Installed = INSTALLSTATE_ABSENT; @@ -1079,7 +1291,7 @@ if (!file) return ERROR_NOT_ENOUGH_MEMORY; - file->File = load_dynamic_stringW( row, 1 ); + file->File = msi_dup_record_field( row, 1 ); component = MSI_RecordGetString( row, 2 ); file->Component = get_loaded_component( package, component ); @@ -1087,19 +1299,19 @@ if (!file->Component) ERR("Unfound Component %s\n",debugstr_w(component)); - file->FileName = load_dynamic_stringW( row, 3 ); + file->FileName = msi_dup_record_field( row, 3 ); reduce_to_longfilename( file->FileName ); - file->ShortName = load_dynamic_stringW( row, 3 ); + file->ShortName = msi_dup_record_field( row, 3 ); reduce_to_shortfilename( file->ShortName ); file->FileSize = MSI_RecordGetInteger( row, 4 ); - file->Version = load_dynamic_stringW( row, 5 ); - file->Language = load_dynamic_stringW( row, 6 ); + file->Version = msi_dup_record_field( row, 5 ); + file->Language = msi_dup_record_field( row, 6 ); file->Attributes = MSI_RecordGetInteger( row, 7 ); file->Sequence = MSI_RecordGetInteger( row, 8 ); - file->State = 0; + file->state = msifs_invalid; TRACE("File Loaded (%s)\n",debugstr_w(file->File)); @@ -1154,11 +1366,8 @@ static const WCHAR szCosting[] = {'C','o','s','t','i','n','g','C','o','m','p','l','e','t','e',0 }; static const WCHAR szZero[] = { '0', 0 }; - WCHAR buffer[3]; - DWORD sz = 3; - MSI_GetPropertyW(package, szCosting, buffer, &sz); - if (buffer[0]=='1') + if ( 1 == msi_get_property_int( package, szCosting, 0 ) ) return ERROR_SUCCESS; MSI_SetPropertyW(package, szCosting, szZero); @@ -1239,7 +1448,7 @@ if (!row) return NULL; - ptargetdir = targetdir = load_dynamic_stringW(row,3); + ptargetdir = targetdir = msi_dup_record_field(row,3); /* split src and target dir */ if (strchrW(targetdir,':')) @@ -1404,6 +1613,8 @@ {'A','D','D','L','O','C','A','L',0}; static const WCHAR szRemove[] = {'R','E','M','O','V','E',0}; + static const WCHAR szReinstall[] = + {'R','E','I','N','S','T','A','L','L',0}; BOOL override = FALSE; MSICOMPONENT* component; MSIFEATURE *feature; @@ -1439,6 +1650,7 @@ */ override |= process_state_property(package,szAddLocal,INSTALLSTATE_LOCAL); override |= process_state_property(package,szRemove,INSTALLSTATE_ABSENT); + override |= process_state_property(package,szReinstall,INSTALLSTATE_LOCAL); if (!override) { @@ -1617,13 +1829,10 @@ UINT rc; MSIQUERY * view; LPWSTR level; - DWORD sz = 3; - WCHAR buffer[3]; - MSI_GetPropertyW(package, szCosting, buffer, &sz); - if (buffer[0]=='1') + if ( 1 == msi_get_property_int( package, szCosting, 0 ) ) return ERROR_SUCCESS; - + TRACE("Building Directory properties\n"); rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view); @@ -1661,7 +1870,7 @@ if (GetFileAttributesW(file->TargetPath) == INVALID_FILE_ATTRIBUTES) { - file->State = 1; + file->state = msifs_missing; comp->Cost += file->FileSize; continue; } @@ -1672,14 +1881,13 @@ DWORD versize; UINT sz; LPVOID version; - static const WCHAR name[] = - {'\\',0}; + static WCHAR name[] = {'\\',0}; static const WCHAR name_fmt[] = {'%','u','.','%','u','.','%','u','.','%','u',0}; WCHAR filever[0x100]; VS_FIXEDFILEINFO *lpVer; - TRACE("Version comparison.. \n"); + TRACE("Version comparison..\n"); versize = GetFileVersionInfoSizeW(file->TargetPath,&handle); version = msi_alloc(versize); GetFileVersionInfoW(file->TargetPath, 0, versize, version); @@ -1696,16 +1904,16 @@ debugstr_w(filever)); if (strcmpiW(filever,file->Version)<0) { - file->State = 2; - FIXME("cost should be diff in size\n"); + file->state = msifs_overwrite; + /* FIXME: cost should be diff in size */ comp->Cost += file->FileSize; } else - file->State = 3; + file->state = msifs_present; msi_free(version); } else - file->State = 3; + file->state = msifs_present; } TRACE("Evaluating Condition Table\n"); @@ -1893,7 +2101,7 @@ if (!comp) return ERROR_SUCCESS; - if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL)) + if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) { TRACE("Skipping write due to disabled component %s\n", debugstr_w(component)); @@ -2349,9 +2557,6 @@ MSICOMPONENT *comp; HKEY hkey=0,hkey2=0; - if (!package) - return ERROR_INVALID_HANDLE; - /* writes the Component and Features values to the registry */ rc = MSIREG_OpenComponents(&hkey); @@ -2385,8 +2590,7 @@ * Write the keypath out if the component is to be registered * and delete the key if the component is to be deregistered */ - if (ACTION_VerifyComponentForAction(package, comp, - INSTALLSTATE_LOCAL)) + if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) { rc = RegCreateKeyW(hkey,squished_cc,&hkey2); if (rc != ERROR_SUCCESS) @@ -2417,8 +2621,7 @@ msiobj_release( &uirow->hdr ); } } - else if (ACTION_VerifyComponentForAction(package, comp, - INSTALLSTATE_ABSENT)) + else if (ACTION_VerifyComponentForAction( comp, INSTALLSTATE_ABSENT)) { DWORD res; @@ -2523,7 +2726,7 @@ if (!comp) return ERROR_SUCCESS; - if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL)) + if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) { TRACE("Skipping typelib reg due to disabled component\n"); @@ -2539,19 +2742,18 @@ return ERROR_SUCCESS; module = LoadLibraryExW( file->TargetPath, NULL, LOAD_LIBRARY_AS_DATAFILE ); - if (module != NULL) + if (module) { - LPWSTR guid; - guid = load_dynamic_stringW(row,1); - CLSIDFromString(guid, &tl_struct.clsid); - msi_free(guid); + LPCWSTR guid; + guid = MSI_RecordGetString(row,1); + CLSIDFromString((LPWSTR)guid, &tl_struct.clsid); tl_struct.source = strdupW( file->TargetPath ); tl_struct.path = NULL; EnumResourceNamesW(module, szTYPELIB, Typelib_EnumResNameProc, (LONG_PTR)&tl_struct); - if (tl_struct.path != NULL) + if (tl_struct.path) { LPWSTR help = NULL; LPCWSTR helpid; @@ -2604,9 +2806,6 @@ {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', '`','T','y','p','e','L','i','b','`',0}; - if (!package) - return ERROR_INVALID_HANDLE; - rc = MSI_DatabaseOpenViewW(package->db, Query, &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -2634,7 +2833,7 @@ if (!comp) return ERROR_SUCCESS; - if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL)) + if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL )) { TRACE("Skipping shortcut creation due to disabled component\n"); @@ -2755,9 +2954,6 @@ {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', '`','S','h','o','r','t','c','u','t','`',0}; - if (!package) - return ERROR_INVALID_HANDLE; - rc = MSI_DatabaseOpenViewW(package->db, Query, &view); if (rc != ERROR_SUCCESS) return ERROR_SUCCESS; @@ -2856,9 +3052,6 @@ DWORD size; MSIHANDLE hDb, hSumInfo; - if (!package) - return ERROR_INVALID_HANDLE; - /* write out icon files */ rc = MSI_DatabaseOpenViewW(package->db, Query, &view); @@ -2925,7 +3118,7 @@ } else { - ERR("Unable to query Revision_Number... \n"); + ERR("Unable to query Revision_Number...\n"); rc = ERROR_SUCCESS; } MsiCloseHandle(hSumInfo); @@ -2959,7 +3152,7 @@ component = MSI_RecordGetString(row, 8); comp = get_loaded_component(package,component); - if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL)) + if (!ACTION_VerifyComponentForAction( comp, INSTALLSTATE_LOCAL)) { TRACE("Skipping ini file due to disabled component %s\n", debugstr_w(component)); @@ -3133,9 +3326,6 @@ HKEY hkey=0; HKEY hukey=0; - if (!package) - return ERROR_INVALID_HANDLE; - rc = MSIREG_OpenFeaturesKey(package->ProductCode,&hkey,TRUE); if (rc != ERROR_SUCCESS) goto end; @@ -3281,55 +3471,54 @@ return ERROR_SUCCESS; } +static UINT msi_write_uninstall_property_vals( MSIPACKAGE *package, HKEY hkey ) +{ + LPWSTR prop, val, key; + static const LPCSTR propval[] = { + "ARPAUTHORIZEDCDFPREFIX", "AuthorizedCDFPrefix", + "ARPCONTACT", "Contact", + "ARPCOMMENTS", "Comments", + "ProductName", "DisplayName", + "ProductVersion", "DisplayVersion", + "ARPHELPLINK", "HelpLink", + "ARPHELPTELEPHONE", "HelpTelephone", + "ARPINSTALLLOCATION", "InstallLocation", + "SourceDir", "InstallSource", + "Manufacturer", "Publisher", + "ARPREADME", "Readme", + "ARPSIZE", "Size", + "ARPURLINFOABOUT", "URLInfoAbout", + "ARPURLUPDATEINFO", "URLUpdateInfo", + NULL, + }; + const LPCSTR *p = propval; + + while( *p ) + { + prop = strdupAtoW( *p++ ); + key = strdupAtoW( *p++ ); + val = msi_dup_property( package, prop ); + msi_reg_set_val_str( hkey, key, val ); + msi_free(val); + msi_free(key); + msi_free(prop); + } + return ERROR_SUCCESS; +} + static UINT ACTION_RegisterProduct(MSIPACKAGE *package) { HKEY hkey=0; LPWSTR buffer = NULL; - UINT rc,i; + UINT rc; DWORD size, langid; static const WCHAR szWindowsInstaller[] = - {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0}; - static const WCHAR szPropKeys[][80] = - { -{'A','R','P','A','U','T','H','O','R','I','Z','E','D','C','D','F','P','R ','E','F','I','X',0}, -{'A','R','P','C','O','N','T','A','C','T',0}, -{'A','R','P','C','O','M','M','E','N','T','S',0}, -{'P','r','o','d','u','c','t','N','a','m','e',0}, -{'P','r','o','d','u','c','t','V','e','r','s','i','o','n',0}, -{'A','R','P','H','E','L','P','L','I','N','K',0}, -{'A','R','P','H','E','L','P','T','E','L','E','P','H','O','N','E',0}, -{'A','R','P','I','N','S','T','A','L','L','L','O','C','A','T','I','O','N ',0}, -{'S','o','u','r','c','e','D','i','r',0}, -{'M','a','n','u','f','a','c','t','u','r','e','r',0}, -{'A','R','P','R','E','A','D','M','E',0}, -{'A','R','P','S','I','Z','E',0}, -{'A','R','P','U','R','L','I','N','F','O','A','B','O','U','T',0}, -{'A','R','P','U','R','L','U','P','D','A','T','E','I','N','F','O',0}, -{0}, - }; - - static const WCHAR szRegKeys[][80] = - { -{'A','u','t','h','o','r','i','z','e','d','C','D','F','P','r','e','f','i ','x',0}, -{'C','o','n','t','a','c','t',0}, -{'C','o','m','m','e','n','t','s',0}, -{'D','i','s','p','l','a','y','N','a','m','e',0}, -{'D','i','s','p','l','a','y','V','e','r','s','i','o','n',0}, -{'H','e','l','p','L','i','n','k',0}, -{'H','e','l','p','T','e','l','e','p','h','o','n','e',0}, -{'I','n','s','t','a','l','l','L','o','c','a','t','i','o','n',0}, -{'I','n','s','t','a','l','l','S','o','u','r','c','e',0}, -{'P','u','b','l','i','s','h','e','r',0}, -{'R','e','a','d','m','e',0}, -{'S','i','z','e',0}, -{'U','R','L','I','n','f','o','A','b','o','u','t',0}, -{'U','R','L','U','p','d','a','t','e','I','n','f','o',0}, -{0}, - }; + {'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0}; static const WCHAR szUpgradeCode[] = {'U','p','g','r','a','d','e','C','o','d','e',0}; static const WCHAR modpath_fmt[] = - {'M','s','i','E','x','e','c','.','e','x','e',' ','/','I','[','P','r','o','d','u','c','t','C','o','d','e',']',0}; + {'M','s','i','E','x','e','c','.','e','x','e',' ', + '/','I','[','P','r','o','d','u','c','t','C','o','d','e',']',0}; static const WCHAR szModifyPath[] = {'M','o','d','i','f','y','P','a','t','h',0}; static const WCHAR szUninstallString[] = @@ -3344,23 +3533,16 @@ SYSTEMTIME systime; static const WCHAR date_fmt[] = {'%','i','%','i','%','i',0}; LPWSTR upgrade_code; + WCHAR szDate[9]; - if (!package) - return ERROR_INVALID_HANDLE; - rc = MSIREG_OpenUninstallKey(package->ProductCode,&hkey,TRUE); if (rc != ERROR_SUCCESS) - goto end; + return rc; /* dump all the info i can grab */ - FIXME("Flesh out more information \n"); + FIXME("Flesh out more information\n"); - for( i=0; szPropKeys[i][0]; i++ ) - { - buffer = msi_dup_property( package, szPropKeys[i] ); - msi_reg_set_val_str( hkey, szRegKeys[i], buffer ); - msi_free(buffer); - } + msi_write_uninstall_property_vals( package, hkey ); msi_reg_set_val_dword( hkey, szWindowsInstaller, 1 ); @@ -3376,11 +3558,8 @@ msi_reg_set_val_dword( hkey, szEstimatedSize, 0 ); GetLocalTime(&systime); - size = 9*sizeof(WCHAR); - buffer= msi_alloc(size); - sprintfW(buffer,date_fmt,systime.wYear,systime.wMonth,systime.wDay); - msi_reg_set_val_str( hkey, INSTALLPROPERTY_INSTALLDATEW, buffer ); - msi_free(buffer); + sprintfW(szDate,date_fmt,systime.wYear,systime.wMonth,systime.wDay); + msi_reg_set_val_str( hkey, INSTALLPROPERTY_INSTALLDATEW, szDate ); langid = msi_get_property_int( package, szProductLanguage, 0 ); msi_reg_set_val_dword( hkey, INSTALLPROPERTY_LANGUAGEW, langid ); @@ -3414,7 +3593,6 @@ msi_free(upgrade_code); } -end: RegCloseKey(hkey); return ERROR_SUCCESS; @@ -3422,23 +3600,13 @@ static UINT ACTION_InstallExecute(MSIPACKAGE *package) { - UINT rc; - - if (!package) - return ERROR_INVALID_HANDLE; - - rc = execute_script(package,INSTALL_SCRIPT); - - return rc; + return execute_script(package,INSTALL_SCRIPT); [truncated at 1000 lines; 5268 more skipped]
19 years, 1 month
1
0
0
0
[gvg] 19306: Add header needed to build crypt32.dll
by gvg@svn.reactos.com
Add header needed to build crypt32.dll Added: trunk/reactos/w32api/include/mssip.h _____ Added: trunk/reactos/w32api/include/mssip.h --- trunk/reactos/w32api/include/mssip.h 2005-11-17 20:21:39 UTC (rev 19305) +++ trunk/reactos/w32api/include/mssip.h 2005-11-17 20:33:50 UTC (rev 19306) @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2002 Patrik Stridvall + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __WINE_MSSIP_H +#define __WINE_MSSIP_H + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ + +/********************************************************************** / + +typedef CRYPT_HASH_BLOB CRYPT_DIGEST_DATA; + +/********************************************************************** / + +#define MSSIP_FLAGS_PROHIBIT_RESIZE_ON_CREATE 0x00010000 +#define MSSIP_FLAGS_USE_CATALOG 0x00020000 + +#define SPC_INC_PE_RESOURCES_FLAG 0x80 +#define SPC_INC_PE_DEBUG_INFO_FLAG 0x40 +#define SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG 0x20 + +#define MSSIP_ADDINFO_NONE 0 +#define MSSIP_ADDINFO_FLAT 1 +#define MSSIP_ADDINFO_CATMEMBER 2 +#define MSSIP_ADDINFO_BLOB 3 +#define MSSIP_ADDINFO_NONMSSIP 500 + +#define SIP_MAX_MAGIC_NUMBER 4 + +/********************************************************************** / + +#include <pshpack8.h> +typedef struct SIP_SUBJECTINFO_ { + DWORD cbSize; + GUID *pgSubjectType; + HANDLE hFile; + LPCWSTR pwsFileName; + LPCWSTR pwsDisplayName; + + DWORD dwReserved1; + DWORD dwIntVersion; + + HCRYPTPROV hProv; + CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm; + DWORD dwFlags; + DWORD dwEncodingType; + DWORD dwReserved2; + DWORD fdwCAPISettings; + DWORD fdwSecuritySettings; + DWORD dwIndex; + + DWORD dwUnionChoice; + union { + struct MS_ADDINFO_FLAT_ *psFlat; + struct MS_ADDINFO_CATALOGMEMBER_ *psCatMember; + struct MS_ADDINFO_BLOB_ *psBlob; + } DUMMYUNIONNAME; + + LPVOID pClientData; +} SIP_SUBJECTINFO, *LPSIP_SUBJECTINFO; +#include <poppack.h> + +#include <pshpack8.h> +typedef struct MS_ADDINFO_FLAT_ { + DWORD cbStruct; + + struct SIP_INDIRECT_DATA_ *pIndirectData; +} MS_ADDINFO_FLAT, *PMS_ADDINFO_FLAT; +#include <poppack.h> + +#include <pshpack8.h> +typedef struct MS_ADDINFO_CATALOGMEMBER_ { + DWORD cbStruct; + + struct CRYPTCATSTORE_ *pStore; + struct CRYPTCATMEMBER_ *pMember; +} MS_ADDINFO_CATALOGMEMBER, *PMS_ADDINFO_CATALOGMEMBER; +#include <poppack.h> + +#include <pshpack8.h> +typedef struct MS_ADDINFO_BLOB_ { + DWORD cbStruct; + + DWORD cbMemObject; + BYTE *pbMemObject; + + DWORD cbMemSignedMsg; + BYTE *pbMemSignedMsg; +} MS_ADDINFO_BLOB, *PMS_ADDINFO_BLOB; +#include <poppack.h> + +#include <pshpack8.h> +typedef struct SIP_INDIRECT_DATA_ { + CRYPT_ATTRIBUTE_TYPE_VALUE Data; + CRYPT_ALGORITHM_IDENTIFIER DigestAlgorithm; + CRYPT_HASH_BLOB Digest; +} SIP_INDIRECT_DATA, *PSIP_INDIRECT_DATA; +#include <poppack.h> + +typedef BOOL (WINAPI * pCryptSIPGetSignedDataMsg)(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *); +typedef BOOL (WINAPI * pCryptSIPPutSignedDataMsg)(SIP_SUBJECTINFO *,DWORD,DWORD,DWORD,BYTE); +typedef BOOL (WINAPI * pCryptSIPCreateIndirectData)(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *); +typedef BOOL (WINAPI * pCryptSIPVerifyIndirectData)(SIP_SUBJECTINFO *,SIP_INDIRECT_DATA *); +typedef BOOL (WINAPI * pCryptSIPRemoveSignedDataMsg)(SIP_SUBJECTINFO *,DWORD); + +#include <pshpack8.h> +typedef struct SIP_DISPATCH_INFO_ { + DWORD cbSize; + + HANDLE hSIP; + + pCryptSIPGetSignedDataMsg pfGet; + pCryptSIPPutSignedDataMsg pfPut; + pCryptSIPCreateIndirectData pfCreate; + pCryptSIPVerifyIndirectData pfVerify; + pCryptSIPRemoveSignedDataMsg pfRemove; +} SIP_DISPATCH_INFO, *LPSIP_DISPATCH_INFO; +#include <poppack.h> + +typedef BOOL (WINAPI *pfnIsFileSupported)(HANDLE,GUID *); +typedef BOOL (WINAPI *pfnIsFileSupportedName)(WCHAR *,GUID *); + +#include <pshpack8.h> +typedef struct SIP_ADD_NEWPROVIDER_ +{ + DWORD cbStruct; + + GUID *pgSubject; + + WCHAR *pwszDLLFileName; + WCHAR *pwszMagicNumber; + + WCHAR *pwszIsFunctionName; + + WCHAR *pwszGetFuncName; + WCHAR *pwszPutFuncName; + WCHAR *pwszCreateFuncName; + WCHAR *pwszVerifyFuncName; + WCHAR *pwszRemoveFuncName; + + WCHAR *pwszIsFunctionNameFmt2; +} SIP_ADD_NEWPROVIDER, *PSIP_ADD_NEWPROVIDER; +#include <poppack.h> + +/********************************************************************** / + +BOOL WINAPI CryptSIPGetSignedDataMsg(SIP_SUBJECTINFO *,DWORD *,DWORD,DWORD *,BYTE *); +BOOL WINAPI CryptSIPPutSignedDataMsg(SIP_SUBJECTINFO *,DWORD,DWORD,DWORD,BYTE); +BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO *,DWORD *,SIP_INDIRECT_DATA *); +BOOL WINAPI CryptSIPVerifyIndirectData(SIP_SUBJECTINFO *,SIP_INDIRECT_DATA *); +BOOL WINAPI CryptSIPRemoveSignedDataMsg(SIP_SUBJECTINFO *,DWORD); + +BOOL WINAPI CryptSIPLoad(const GUID *,DWORD,SIP_DISPATCH_INFO *); +BOOL WINAPI CryptSIPRetrieveSubjectGuidForCatalogFile(LPCWSTR,HANDLE,GUID *); +BOOL WINAPI CryptSIPAddProvider(SIP_ADD_NEWPROVIDER *); +BOOL WINAPI CryptSIPRemoveProvider(GUID *); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + +#endif /* __WINE_MSSIP_H */ Property changes on: trunk/reactos/w32api/include/mssip.h ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native
19 years, 1 month
1
0
0
0
[gvg] 19305: Sync to Wine-0_9_1:
by gvg@svn.reactos.com
Sync to Wine-0_9_1: David Kredba <kredba(a)math.cas.cz> - Czech resources update. Modified: trunk/reactos/lib/mpr/mpr.rc Modified: trunk/reactos/lib/mpr/mpr_Cs.rc Added: trunk/reactos/lib/mpr/mpr_Ko.rc _____ Modified: trunk/reactos/lib/mpr/mpr.rc --- trunk/reactos/lib/mpr/mpr.rc 2005-11-17 20:17:53 UTC (rev 19304) +++ trunk/reactos/lib/mpr/mpr.rc 2005-11-17 20:21:39 UTC (rev 19305) @@ -32,6 +32,7 @@ #include "mpr_Fr.rc" #include "mpr_It.rc" #include "mpr_Ja.rc" +#include "mpr_Ko.rc" #include "mpr_Nl.rc" #include "mpr_No.rc" #include "mpr_Pt.rc" _____ Modified: trunk/reactos/lib/mpr/mpr_Cs.rc --- trunk/reactos/lib/mpr/mpr_Cs.rc 2005-11-17 20:17:53 UTC (rev 19304) +++ trunk/reactos/lib/mpr/mpr_Cs.rc 2005-11-17 20:21:39 UTC (rev 19305) @@ -1,7 +1,7 @@ /* * Czech MPR dll resources * Copyright (C) 2004 Juan Lang - * Copyright (C) 2004 David Kredba + * Copyright (C) 2004, 2005 David Kredba * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,3 +24,23 @@ { IDS_ENTIRENETWORK "Celß sÝ?" } + +IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ZadßnÝ sÝ?ovÚho hesla" +FONT 8, "MS Shell Dlg" +{ + LTEXT "ProsÝm zadejte svÚ u¥ivatelskÚ jmÚno a heslo:", IDC_EXPLAIN, 40, 6, 150, 15 + LTEXT "Proxy", -1, 40, 26, 50, 10 +/* LTEXT "Realm", -1, 40, 46, 50, 10 */ + LTEXT "U¥ivatel", -1, 40, 66, 50, 10 + LTEXT "Heslo", -1, 40, 86, 50, 10 + LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Ulo¥it toto heslo (NenÝ bezpeÞnÚ) ?", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Zru?it", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} _____ Copied: trunk/reactos/lib/mpr/mpr_Ko.rc (from rev 19304, vendor/wine/dlls/mpr/current/mpr_Ko.rc) Property changes on: trunk/reactos/lib/mpr/mpr_Ko.rc ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native
19 years, 1 month
1
0
0
0
[cwittich] 19304: added crypt32 (still not complete, from wine 0.91)
by cwittich@svn.reactos.com
added crypt32 (still not complete, from wine 0.91) Modified: trunk/reactos/baseaddress.xml Modified: trunk/reactos/lib/advapi32/crypt/crypt.c Added: trunk/reactos/lib/crypt32/ Added: trunk/reactos/lib/crypt32/cert.c Added: trunk/reactos/lib/crypt32/crypt32.def Added: trunk/reactos/lib/crypt32/crypt32.rc Added: trunk/reactos/lib/crypt32/crypt32.xml Added: trunk/reactos/lib/crypt32/crypt32_private.h Added: trunk/reactos/lib/crypt32/encode.c Added: trunk/reactos/lib/crypt32/main.c Added: trunk/reactos/lib/crypt32/precomp.h Added: trunk/reactos/lib/crypt32/protectdata.c Modified: trunk/reactos/lib/directory.xml Modified: trunk/reactos/w32api/include/wincrypt.h _____ Modified: trunk/reactos/baseaddress.xml --- trunk/reactos/baseaddress.xml 2005-11-17 20:16:02 UTC (rev 19303) +++ trunk/reactos/baseaddress.xml 2005-11-17 20:17:53 UTC (rev 19304) @@ -104,6 +104,7 @@ <property name="BASEADDRESS_OLE32" value="0x77a50000" /> <property name="BASEADDRESS_WS2_32" value="0x77aa0000" /> <property name="BASEADDRESS_OLEPRO32" value="0x77aa0000" /> +<property name="BASEADDRESS_CRYPT32" value="0x77aa1000" /> <property name="BASEADDRESS_ADVAPI32" value="0x77dc0000" /> <property name="BASEADDRESS_USER32" value="0x77e50000" /> <property name="BASEADDRESS_GDI32" value="0x77f10000" /> _____ Modified: trunk/reactos/lib/advapi32/crypt/crypt.c --- trunk/reactos/lib/advapi32/crypt/crypt.c 2005-11-17 20:16:02 UTC (rev 19303) +++ trunk/reactos/lib/advapi32/crypt/crypt.c 2005-11-17 20:17:53 UTC (rev 19304) @@ -1480,7 +1480,7 @@ * Success: TRUE * Failure: FALSE */ -BOOL WINAPI CryptHashData (HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags) +BOOL WINAPI CryptHashData (HCRYPTHASH hHash, const BYTE *pbData, DWORD dwDataLen, DWORD dwFlags) { PCRYPTHASH hash = (PCRYPTHASH)hHash; PCRYPTPROV prov; _____ Added: trunk/reactos/lib/crypt32/cert.c --- trunk/reactos/lib/crypt32/cert.c 2005-11-17 20:16:02 UTC (rev 19303) +++ trunk/reactos/lib/crypt32/cert.c 2005-11-17 20:17:53 UTC (rev 19304) @@ -0,0 +1,3315 @@ +/* + * Copyright 2002 + Mike McCormack for CodeWeavers + * Copyright 2004,2005 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * FIXME: + * - As you can see in the stubs below, support for CRLs and CTLs is missing. + * Mostly this should be copy-paste work, and some code (e.g. extended + * properties) could be shared between them. + * - Opening a cert store provider should be morphed to support loading + * external DLLs. + * - The concept of physical stores and locations isn't implemented. (This + * doesn't mean registry stores et al aren't implemented. See the PSDK for + * registering and enumerating physical stores and locations.) + * - Many flags, options and whatnot are unimplemented. + */ + +#include "precomp.h" + +WINE_DEFAULT_DEBUG_CHANNEL(crypt); + +#define WINE_CRYPTCERTSTORE_MAGIC 0x74726563 +/* The following aren't defined in wincrypt.h, as they're "reserved" */ +#define CERT_CERT_PROP_ID 32 +#define CERT_CRL_PROP_ID 33 +#define CERT_CTL_PROP_ID 34 + +/* Some typedefs that make it easier to abstract which type of context we're + * working with. + */ +typedef const void *(WINAPI *CreateContextFunc)(DWORD dwCertEncodingType, + const BYTE *pbCertEncoded, DWORD cbCertEncoded); +typedef BOOL (WINAPI *AddContextToStoreFunc)(HCERTSTORE hCertStore, + const void *context, DWORD dwAddDisposition, const void **ppStoreContext); +typedef BOOL (WINAPI *AddEncodedContextToStoreFunc)(HCERTSTORE hCertStore, + DWORD dwCertEncodingType, const BYTE *pbEncoded, DWORD cbEncoded, + DWORD dwAddDisposition, const void **ppContext); +typedef const void *(WINAPI *EnumContextsInStoreFunc)(HCERTSTORE hCertStore, + const void *pPrevContext); +typedef BOOL (WINAPI *GetContextPropertyFunc)(const void *context, + DWORD dwPropID, void *pvData, DWORD *pcbData); +typedef BOOL (WINAPI *SetContextPropertyFunc)(const void *context, + DWORD dwPropID, DWORD dwFlags, const void *pvData); +typedef BOOL (WINAPI *SerializeElementFunc)(const void *context, DWORD dwFlags, + BYTE *pbElement, DWORD *pcbElement); +typedef BOOL (WINAPI *FreeContextFunc)(const void *context); +typedef BOOL (WINAPI *DeleteContextFunc)(const void *context); + +/* An abstract context (certificate, CRL, or CTL) interface */ +typedef struct _WINE_CONTEXT_INTERFACE +{ + CreateContextFunc create; + AddContextToStoreFunc addContextToStore; + AddEncodedContextToStoreFunc addEncodedToStore; + EnumContextsInStoreFunc enumContextsInStore; + GetContextPropertyFunc getProp; + SetContextPropertyFunc setProp; + SerializeElementFunc serialize; + FreeContextFunc free; + DeleteContextFunc deleteFromStore; +} WINE_CONTEXT_INTERFACE, *PWINE_CONTEXT_INTERFACE; + +static const WINE_CONTEXT_INTERFACE gCertInterface = { + (CreateContextFunc)CertCreateCertificateContext, + (AddContextToStoreFunc)CertAddCertificateContextToStore, + (AddEncodedContextToStoreFunc)CertAddEncodedCertificateToStore, + (EnumContextsInStoreFunc)CertEnumCertificatesInStore, + (GetContextPropertyFunc)CertGetCertificateContextProperty, + (SetContextPropertyFunc)CertSetCertificateContextProperty, + (SerializeElementFunc)CertSerializeCertificateStoreElement, + (FreeContextFunc)CertFreeCertificateContext, + (DeleteContextFunc)CertDeleteCertificateFromStore, +}; + +static const WINE_CONTEXT_INTERFACE gCRLInterface = { + (CreateContextFunc)CertCreateCRLContext, + (AddContextToStoreFunc)CertAddCRLContextToStore, + (AddEncodedContextToStoreFunc)CertAddEncodedCRLToStore, + (EnumContextsInStoreFunc)CertEnumCRLsInStore, + (GetContextPropertyFunc)CertGetCRLContextProperty, + (SetContextPropertyFunc)CertSetCRLContextProperty, + (SerializeElementFunc)CertSerializeCRLStoreElement, + (FreeContextFunc)CertFreeCRLContext, + (DeleteContextFunc)CertDeleteCRLFromStore, +}; + +static const WINE_CONTEXT_INTERFACE gCTLInterface = { + (CreateContextFunc)CertCreateCTLContext, + (AddContextToStoreFunc)CertAddCTLContextToStore, + (AddEncodedContextToStoreFunc)CertAddEncodedCTLToStore, + (EnumContextsInStoreFunc)CertEnumCTLsInStore, + (GetContextPropertyFunc)CertGetCTLContextProperty, + (SetContextPropertyFunc)CertSetCTLContextProperty, + (SerializeElementFunc)CertSerializeCTLStoreElement, + (FreeContextFunc)CertFreeCTLContext, + (DeleteContextFunc)CertDeleteCTLFromStore, +}; + +struct WINE_CRYPTCERTSTORE; + +typedef struct WINE_CRYPTCERTSTORE * (*StoreOpenFunc)(HCRYPTPROV hCryptProv, + DWORD dwFlags, const void *pvPara); + +struct _WINE_CERT_CONTEXT_REF; + +/* Called to enumerate the next certificate in a store. The returned pointer + * must be newly allocated (via CryptMemAlloc): CertFreeCertificateContext + * frees it. + */ +typedef struct _WINE_CERT_CONTEXT_REF * (*EnumCertFunc) + (struct WINE_CRYPTCERTSTORE *store, struct _WINE_CERT_CONTEXT_REF *pPrev); + +struct _WINE_CERT_CONTEXT; + +/* Called to create a new reference to an existing cert context. Should call + * CRYPT_InitCertRef to make sure the reference count is properly updated. + * If the store does not provide any additional allocated data (that is, does + * not need to implement a FreeCertFunc), it may use CRYPT_CreateCertRef for + * this. + */ +typedef struct _WINE_CERT_CONTEXT_REF * (*CreateRefFunc) + (struct _WINE_CERT_CONTEXT *context, HCERTSTORE store); + +/* Optional, called when a cert context reference is being freed. Don't free + * the ref pointer itself, CertFreeCertificateContext does that. + */ +typedef void (*FreeCertFunc)(struct _WINE_CERT_CONTEXT_REF *ref); + +typedef enum _CertStoreType { + StoreTypeMem, + StoreTypeCollection, + StoreTypeReg, + StoreTypeDummy, +} CertStoreType; + +/* A cert store is polymorphic through the use of function pointers. A type + * is still needed to distinguish collection stores from other types. + * On the function pointers: + * - closeStore is called when the store's ref count becomes 0 + * - addCert is called with a PWINE_CERT_CONTEXT as the second parameter + * - control is optional, but should be implemented by any store that supports + * persistence + */ +typedef struct WINE_CRYPTCERTSTORE +{ + DWORD dwMagic; + LONG ref; + DWORD dwOpenFlags; + HCRYPTPROV cryptProv; + CertStoreType type; + PFN_CERT_STORE_PROV_CLOSE closeStore; + PFN_CERT_STORE_PROV_WRITE_CERT addCert; + CreateRefFunc createCertRef; + EnumCertFunc enumCert; + PFN_CERT_STORE_PROV_DELETE_CERT deleteCert; + FreeCertFunc freeCert; /* optional */ + PFN_CERT_STORE_PROV_CONTROL control; /* optional */ +} WINECRYPT_CERTSTORE, *PWINECRYPT_CERTSTORE; + +/* A certificate context has pointers to data that are owned by this module, + * so rather than duplicate the data every time a certificate context is + * copied, I keep a reference count to the data. Thus I have two data + * structures, the "true" certificate context (that has the reference count) + * and a reference certificate context, that has a pointer to the true context. + * Each one can be cast to a PCERT_CONTEXT, though you'll usually be dealing + * with the reference version. + */ +typedef struct _WINE_CERT_CONTEXT +{ + CERT_CONTEXT cert; + LONG ref; + CRITICAL_SECTION cs; + struct list extendedProperties; +} WINE_CERT_CONTEXT, *PWINE_CERT_CONTEXT; + +typedef struct _WINE_CERT_CONTEXT_REF +{ + CERT_CONTEXT cert; + WINE_CERT_CONTEXT *context; +} WINE_CERT_CONTEXT_REF, *PWINE_CERT_CONTEXT_REF; + +/* An extended certificate property in serialized form is prefixed by this + * header. + */ +typedef struct _WINE_CERT_PROP_HEADER +{ + DWORD propID; + DWORD unknown; /* always 1 */ + DWORD cb; +} WINE_CERT_PROP_HEADER, *PWINE_CERT_PROP_HEADER; + +/* Stores an extended property in a cert. */ +typedef struct _WINE_CERT_PROPERTY +{ + WINE_CERT_PROP_HEADER hdr; + LPBYTE pbData; + struct list entry; +} WINE_CERT_PROPERTY, *PWINE_CERT_PROPERTY; + +/* A mem store has a list of these. They're also returned by the mem store + * during enumeration. + */ +typedef struct _WINE_CERT_LIST_ENTRY +{ + WINE_CERT_CONTEXT_REF cert; + struct list entry; +} WINE_CERT_LIST_ENTRY, *PWINE_CERT_LIST_ENTRY; + +typedef struct _WINE_MEMSTORE +{ + WINECRYPT_CERTSTORE hdr; + CRITICAL_SECTION cs; + struct list certs; +} WINE_MEMSTORE, *PWINE_MEMSTORE; + +typedef struct _WINE_HASH_TO_DELETE +{ + BYTE hash[20]; + struct list entry; +} WINE_HASH_TO_DELETE, *PWINE_HASH_TO_DELETE; + +/* Returned by a reg store during enumeration. */ +typedef struct _WINE_REG_CERT_CONTEXT +{ + WINE_CERT_CONTEXT_REF cert; + PWINE_CERT_CONTEXT_REF childContext; +} WINE_REG_CERT_CONTEXT, *PWINE_REG_CERT_CONTEXT; + +typedef struct _WINE_REGSTORE +{ + WINECRYPT_CERTSTORE hdr; + PWINECRYPT_CERTSTORE memStore; + HKEY key; + BOOL dirty; + CRITICAL_SECTION cs; + struct list certsToDelete; +} WINE_REGSTORE, *PWINE_REGSTORE; + +typedef struct _WINE_STORE_LIST_ENTRY +{ + PWINECRYPT_CERTSTORE store; + DWORD dwUpdateFlags; + DWORD dwPriority; + struct list entry; +} WINE_STORE_LIST_ENTRY, *PWINE_STORE_LIST_ENTRY; + +/* Returned by a collection store during enumeration. + * Note: relies on the list entry being valid after use, which a number of + * conditions might make untrue (reentrancy, closing a collection store before + * continuing an enumeration on it, ...). The tests seem to indicate this + * sort of unsafety is okay, since Windows isn't well-behaved in these + * scenarios either. + */ +typedef struct _WINE_COLLECTION_CERT_CONTEXT +{ + WINE_CERT_CONTEXT_REF cert; + PWINE_STORE_LIST_ENTRY entry; + PWINE_CERT_CONTEXT_REF childContext; +} WINE_COLLECTION_CERT_CONTEXT, *PWINE_COLLECTION_CERT_CONTEXT; + +typedef struct _WINE_COLLECTIONSTORE +{ + WINECRYPT_CERTSTORE hdr; + CRITICAL_SECTION cs; + struct list stores; +} WINE_COLLECTIONSTORE, *PWINE_COLLECTIONSTORE; + +/* Like CertGetCertificateContextProperty, but operates directly on the + * WINE_CERT_CONTEXT. Doesn't support special-case properties, since they + * are handled by CertGetCertificateContextProperty, and are particular to the + * store in which the property exists (which is separate from the context.) + */ +static BOOL WINAPI CRYPT_GetCertificateContextProperty( + PWINE_CERT_CONTEXT context, DWORD dwPropId, void *pvData, DWORD *pcbData); + +/* Like CertSetCertificateContextProperty, but operates directly on the + * WINE_CERT_CONTEXT. Doesn't handle special cases, since they're handled by + * CertSetCertificateContextProperty anyway. + */ +static BOOL WINAPI CRYPT_SetCertificateContextProperty( + PWINE_CERT_CONTEXT context, DWORD dwPropId, DWORD dwFlags, const void *pvData); + +/* Helper function for store reading functions and + * CertAddSerializedElementToStore. Returns a context of the appropriate type + * if it can, or NULL otherwise. Doesn't validate any of the properties in + * the serialized context (for example, bad hashes are retained.) + * *pdwContentType is set to the type of the returned context. + */ +static const void * WINAPI CRYPT_ReadSerializedElement(const BYTE *pbElement, + DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType); + +/* filter for page-fault exceptions */ +static WINE_EXCEPTION_FILTER(page_fault) +{ + if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) + return EXCEPTION_EXECUTE_HANDLER; + return EXCEPTION_CONTINUE_SEARCH; +} + +static void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv, + DWORD dwFlags, CertStoreType type) +{ + store->ref = 1; + store->dwMagic = WINE_CRYPTCERTSTORE_MAGIC; + store->type = type; + if (!hCryptProv) + { + hCryptProv = CRYPT_GetDefaultProvider(); + dwFlags |= CERT_STORE_NO_CRYPT_RELEASE_FLAG; + } + store->cryptProv = hCryptProv; + store->dwOpenFlags = dwFlags; +} + +/* Initializes the reference ref to point to pCertContext, which is assumed to + * be a PWINE_CERT_CONTEXT, and increments pCertContext's reference count. + * Also sets the hCertStore member of the reference to store. + */ +static void CRYPT_InitCertRef(PWINE_CERT_CONTEXT_REF ref, + PWINE_CERT_CONTEXT context, HCERTSTORE store) +{ + TRACE("(%p, %p)\n", ref, context); + memcpy(&ref->cert, context, sizeof(ref->cert)); + ref->context = context; + InterlockedIncrement(&context->ref); + ref->cert.hCertStore = store; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_CreateCertRef(PWINE_CERT_CONTEXT context, + HCERTSTORE store) +{ + PWINE_CERT_CONTEXT_REF pCertRef = CryptMemAlloc( + sizeof(WINE_CERT_CONTEXT_REF)); + + if (pCertRef) + CRYPT_InitCertRef(pCertRef, context, store); + return pCertRef; +} + +static BOOL WINAPI CRYPT_MemAddCert(HCERTSTORE store, PCCERT_CONTEXT pCert, + DWORD dwAddDisposition) +{ + WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; + BOOL add = FALSE, ret; + + TRACE("(%p, %p, %ld)\n", store, pCert, dwAddDisposition); + + switch (dwAddDisposition) + { + case CERT_STORE_ADD_ALWAYS: + add = TRUE; + break; + case CERT_STORE_ADD_NEW: + { + BYTE hashToAdd[20], hash[20]; + DWORD size = sizeof(hashToAdd); + + ret = CRYPT_GetCertificateContextProperty((PWINE_CERT_CONTEXT)pCert, + CERT_HASH_PROP_ID, hashToAdd, &size); + if (ret) + { + PWINE_CERT_LIST_ENTRY cursor; + + /* Add if no cert with the same hash is found. */ + add = TRUE; + EnterCriticalSection(&ms->cs); + LIST_FOR_EACH_ENTRY(cursor, &ms->certs, WINE_CERT_LIST_ENTRY, entry) + { + size = sizeof(hash); + ret = CertGetCertificateContextProperty(&cursor->cert.cert, + CERT_HASH_PROP_ID, hash, &size); + if (ret && !memcmp(hashToAdd, hash, size)) + { + TRACE("found matching certificate, not adding\n"); + SetLastError(CRYPT_E_EXISTS); + add = FALSE; + break; + } + } + LeaveCriticalSection(&ms->cs); + } + break; + } + case CERT_STORE_ADD_REPLACE_EXISTING: + { + BYTE hashToAdd[20], hash[20]; + DWORD size = sizeof(hashToAdd); + + add = TRUE; + ret = CRYPT_GetCertificateContextProperty((PWINE_CERT_CONTEXT)pCert, + CERT_HASH_PROP_ID, hashToAdd, &size); + if (ret) + { + PWINE_CERT_LIST_ENTRY cursor, next; + + /* Look for existing cert to delete */ + EnterCriticalSection(&ms->cs); + LIST_FOR_EACH_ENTRY_SAFE(cursor, next, &ms->certs, + WINE_CERT_LIST_ENTRY, entry) + { + size = sizeof(hash); + ret = CertGetCertificateContextProperty(&cursor->cert.cert, + CERT_HASH_PROP_ID, hash, &size); + if (ret && !memcmp(hashToAdd, hash, size)) + { + TRACE("found matching certificate, replacing\n"); + list_remove(&cursor->entry); + CertFreeCertificateContext((PCCERT_CONTEXT)cursor); + break; + } + } + LeaveCriticalSection(&ms->cs); + } + break; + } + default: + FIXME("Unimplemented add disposition %ld\n", dwAddDisposition); + add = FALSE; + } + if (add) + { + PWINE_CERT_LIST_ENTRY entry = CryptMemAlloc( + sizeof(WINE_CERT_LIST_ENTRY)); + + if (entry) + { + TRACE("adding %p\n", entry); + CRYPT_InitCertRef(&entry->cert, (PWINE_CERT_CONTEXT)pCert, store); + list_init(&entry->entry); + EnterCriticalSection(&ms->cs); + list_add_tail(&ms->certs, &entry->entry); + LeaveCriticalSection(&ms->cs); + ret = TRUE; + } + else + ret = FALSE; + } + else + ret = FALSE; + return ret; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_MemEnumCert(PWINECRYPT_CERTSTORE store, + PWINE_CERT_CONTEXT_REF pPrev) +{ + WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; + PWINE_CERT_LIST_ENTRY prevEntry = (PWINE_CERT_LIST_ENTRY)pPrev, ret; + struct list *listNext; + + TRACE("(%p, %p)\n", store, pPrev); + EnterCriticalSection(&ms->cs); + if (prevEntry) + { + listNext = list_next(&ms->certs, &prevEntry->entry); + CertFreeCertificateContext((PCCERT_CONTEXT)pPrev); + } + else + listNext = list_next(&ms->certs, &ms->certs); + if (listNext) + { + ret = CryptMemAlloc(sizeof(WINE_CERT_LIST_ENTRY)); + memcpy(ret, LIST_ENTRY(listNext, WINE_CERT_LIST_ENTRY, entry), + sizeof(WINE_CERT_LIST_ENTRY)); + InterlockedIncrement(&ret->cert.context->ref); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + LeaveCriticalSection(&ms->cs); + + TRACE("returning %p\n", ret); + return (PWINE_CERT_CONTEXT_REF)ret; +} + +static BOOL WINAPI CRYPT_MemDeleteCert(HCERTSTORE hCertStore, + PCCERT_CONTEXT pCertContext, DWORD dwFlags) +{ + WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore; + WINE_CERT_CONTEXT_REF *ref = (WINE_CERT_CONTEXT_REF *)pCertContext; + PWINE_CERT_LIST_ENTRY cert, next; + BOOL ret; + + /* Find the entry associated with the passed-in context, since the + * passed-in context may not be a list entry itself (e.g. if it came from + * CertDuplicateCertificateContext.) Pointing to the same context is + * a sufficient test of equality. + */ + EnterCriticalSection(&store->cs); + LIST_FOR_EACH_ENTRY_SAFE(cert, next, &store->certs, WINE_CERT_LIST_ENTRY, + entry) + { + if (cert->cert.context == ref->context) + { + TRACE("removing %p\n", cert); + /* FIXME: this isn't entirely thread-safe, the entry itself isn't + * protected. + */ + list_remove(&cert->entry); + cert->entry.prev = cert->entry.next = &store->certs; + break; + } + } + ret = TRUE; + LeaveCriticalSection(&store->cs); + return ret; +} + +static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) +{ + WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore; + PWINE_CERT_LIST_ENTRY cert, next; + + TRACE("(%p, %08lx)\n", store, dwFlags); + if (dwFlags) + FIXME("Unimplemented flags: %08lx\n", dwFlags); + + /* Note that CertFreeCertificateContext calls HeapFree on the passed-in + * pointer if its ref-count reaches zero. That's okay here because there + * aren't any allocated data outside of the WINE_CERT_CONTEXT_REF portion + * of the CertListEntry. + */ + LIST_FOR_EACH_ENTRY_SAFE(cert, next, &store->certs, WINE_CERT_LIST_ENTRY, + entry) + { + TRACE("removing %p\n", cert); + list_remove(&cert->entry); + CertFreeCertificateContext((PCCERT_CONTEXT)cert); + } + DeleteCriticalSection(&store->cs); + CryptMemFree(store); +} + +static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv, + DWORD dwFlags, const void *pvPara) +{ + PWINE_MEMSTORE store; + + TRACE("(%ld, %08lx, %p)\n", hCryptProv, dwFlags, pvPara); + + if (dwFlags & CERT_STORE_DELETE_FLAG) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + store = NULL; + } + else + { + store = CryptMemAlloc(sizeof(WINE_MEMSTORE)); + if (store) + { + memset(store, 0, sizeof(WINE_MEMSTORE)); + CRYPT_InitStore(&store->hdr, hCryptProv, dwFlags, StoreTypeMem); + store->hdr.closeStore = CRYPT_MemCloseStore; + store->hdr.addCert = CRYPT_MemAddCert; + store->hdr.createCertRef = CRYPT_CreateCertRef; + store->hdr.enumCert = CRYPT_MemEnumCert; + store->hdr.deleteCert = CRYPT_MemDeleteCert; + store->hdr.freeCert = NULL; + InitializeCriticalSection(&store->cs); + list_init(&store->certs); + } + } + return (PWINECRYPT_CERTSTORE)store; +} + +static BOOL WINAPI CRYPT_CollectionAddCert(HCERTSTORE store, + PCCERT_CONTEXT pCert, DWORD dwAddDisposition) +{ + PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + PWINE_STORE_LIST_ENTRY entry, next; + BOOL ret; + + TRACE("(%p, %p, %ld)\n", store, pCert, dwAddDisposition); + + ret = FALSE; + EnterCriticalSection(&cs->cs); + LIST_FOR_EACH_ENTRY_SAFE(entry, next, &cs->stores, WINE_STORE_LIST_ENTRY, + entry) + { + if (entry->dwUpdateFlags & CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG) + { + ret = entry->store->addCert(entry->store, pCert, dwAddDisposition); + break; + } + } + LeaveCriticalSection(&cs->cs); + SetLastError(ret ? ERROR_SUCCESS : HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED)); + return ret; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_CollectionCreateCertRef( + PWINE_CERT_CONTEXT context, HCERTSTORE store) +{ + PWINE_COLLECTION_CERT_CONTEXT ret = CryptMemAlloc( + sizeof(WINE_COLLECTION_CERT_CONTEXT)); + + if (ret) + { + /* Initialize to empty for now, just make sure the size is right */ + CRYPT_InitCertRef((PWINE_CERT_CONTEXT_REF)ret, context, store); + ret->entry = NULL; + ret->childContext = NULL; + } + return (PWINE_CERT_CONTEXT_REF)ret; +} + +static void WINAPI CRYPT_CollectionCloseStore(HCERTSTORE store, DWORD dwFlags) +{ + PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + PWINE_STORE_LIST_ENTRY entry, next; + + TRACE("(%p, %08lx)\n", store, dwFlags); + + LIST_FOR_EACH_ENTRY_SAFE(entry, next, &cs->stores, WINE_STORE_LIST_ENTRY, + entry) + { + TRACE("closing %p\n", entry); + CertCloseStore((HCERTSTORE)entry->store, dwFlags); + CryptMemFree(entry); + } + DeleteCriticalSection(&cs->cs); + CryptMemFree(cs); +} + +/* Advances a collection enumeration by one cert, if possible, where advancing + * means: + * - calling the current store's enumeration function once, and returning + * the enumerated cert if one is returned + * - moving to the next store if the current store has no more items, and + * recursively calling itself to get the next item. + * Returns NULL if the collection contains no more items or on error. + * Assumes the collection store's lock is held. + */ +static PWINE_COLLECTION_CERT_CONTEXT CRYPT_CollectionAdvanceEnum( + PWINE_COLLECTIONSTORE store, PWINE_STORE_LIST_ENTRY storeEntry, + PWINE_COLLECTION_CERT_CONTEXT pPrev) +{ + PWINE_COLLECTION_CERT_CONTEXT ret; + PWINE_CERT_CONTEXT_REF child; + + TRACE("(%p, %p, %p)\n", store, storeEntry, pPrev); + + if (pPrev) + { + child = storeEntry->store->enumCert((HCERTSTORE)storeEntry->store, + pPrev->childContext); + if (child) + { + ret = pPrev; + memcpy(&ret->cert, child, sizeof(WINE_CERT_CONTEXT_REF)); + ret->cert.cert.hCertStore = (HCERTSTORE)store; + InterlockedIncrement(&ret->cert.context->ref); + ret->childContext = child; + } + else + { + struct list *storeNext = list_next(&store->stores, + &storeEntry->entry); + + pPrev->childContext = NULL; + CertFreeCertificateContext((PCCERT_CONTEXT)pPrev); + if (storeNext) + { + storeEntry = LIST_ENTRY(storeNext, WINE_STORE_LIST_ENTRY, + entry); + ret = CRYPT_CollectionAdvanceEnum(store, storeEntry, NULL); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + } + } + else + { + child = storeEntry->store->enumCert((HCERTSTORE)storeEntry->store, + NULL); + if (child) + { + ret = (PWINE_COLLECTION_CERT_CONTEXT)CRYPT_CollectionCreateCertRef( + child->context, store); + if (ret) + { + ret->entry = storeEntry; + ret->childContext = child; + } + else + CertFreeCertificateContext((PCCERT_CONTEXT)child); + } + else + { + struct list *storeNext = list_next(&store->stores, + &storeEntry->entry); + + if (storeNext) + { + storeEntry = LIST_ENTRY(storeNext, WINE_STORE_LIST_ENTRY, + entry); + ret = CRYPT_CollectionAdvanceEnum(store, storeEntry, NULL); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + } + } + TRACE("returning %p\n", ret); + return ret; +} + +static PWINE_CERT_CONTEXT_REF CRYPT_CollectionEnumCert( + PWINECRYPT_CERTSTORE store, PWINE_CERT_CONTEXT_REF pPrev) +{ + PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store; + PWINE_COLLECTION_CERT_CONTEXT prevEntry = + (PWINE_COLLECTION_CERT_CONTEXT)pPrev, ret; + + TRACE("(%p, %p)\n", store, pPrev); + + if (prevEntry) + { + EnterCriticalSection(&cs->cs); + ret = CRYPT_CollectionAdvanceEnum(cs, prevEntry->entry, prevEntry); + LeaveCriticalSection(&cs->cs); + } + else + { + EnterCriticalSection(&cs->cs); + if (!list_empty(&cs->stores)) + { + PWINE_STORE_LIST_ENTRY storeEntry; + + storeEntry = LIST_ENTRY(cs->stores.next, WINE_STORE_LIST_ENTRY, + entry); + ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry, prevEntry); + } + else + { + SetLastError(CRYPT_E_NOT_FOUND); + ret = NULL; + } + LeaveCriticalSection(&cs->cs); + } + TRACE("returning %p\n", ret); + return (PWINE_CERT_CONTEXT_REF)ret; +} + +static BOOL WINAPI CRYPT_CollectionDeleteCert(HCERTSTORE hCertStore, + PCCERT_CONTEXT pCertContext, DWORD dwFlags) +{ + PWINE_COLLECTION_CERT_CONTEXT context = + (PWINE_COLLECTION_CERT_CONTEXT)pCertContext; + BOOL ret; + + TRACE("(%p, %p, %08lx)\n", hCertStore, pCertContext, dwFlags); + + ret = CertDeleteCertificateFromStore((PCCERT_CONTEXT)context->childContext); + if (ret) + context->childContext = NULL; + return ret; +} + +static void CRYPT_CollectionFreeCert(PWINE_CERT_CONTEXT_REF ref) +{ + PWINE_COLLECTION_CERT_CONTEXT context = (PWINE_COLLECTION_CERT_CONTEXT)ref; + + TRACE("(%p)\n", ref); + + if (context->childContext) + CertFreeCertificateContext((PCCERT_CONTEXT)context->childContext); +} + +static WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, + DWORD dwFlags, const void *pvPara) +{ + PWINE_COLLECTIONSTORE store; + + if (dwFlags & CERT_STORE_DELETE_FLAG) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + store = NULL; + } + else + { + store = CryptMemAlloc(sizeof(WINE_COLLECTIONSTORE)); + if (store) + { + memset(store, 0, sizeof(WINE_COLLECTIONSTORE)); + CRYPT_InitStore(&store->hdr, hCryptProv, dwFlags, + StoreTypeCollection); + store->hdr.closeStore = CRYPT_CollectionCloseStore; + store->hdr.addCert = CRYPT_CollectionAddCert; + store->hdr.createCertRef = CRYPT_CollectionCreateCertRef; + store->hdr.enumCert = CRYPT_CollectionEnumCert; + store->hdr.deleteCert = CRYPT_CollectionDeleteCert; + store->hdr.freeCert = CRYPT_CollectionFreeCert; + InitializeCriticalSection(&store->cs); + list_init(&store->stores); + } + } + return (PWINECRYPT_CERTSTORE)store; +} + +static void CRYPT_HashToStr(LPBYTE hash, LPWSTR asciiHash) +{ + static const WCHAR fmt[] = { '%','0','2','X',0 }; + DWORD i; + + assert(hash); + assert(asciiHash); + + for (i = 0; i < 20; i++) + wsprintfW(asciiHash + i * 2, fmt, hash[i]); +} + +static const WCHAR CertsW[] = { 'C','e','r','t','i','f','i','c','a','t','e','s', + 0 }; +static const WCHAR CRLsW[] = { 'C','R','L','s',0 }; +static const WCHAR CTLsW[] = { 'C','T','L','s',0 }; +static const WCHAR BlobW[] = { 'B','l','o','b',0 }; + +static void CRYPT_RegReadSerializedFromReg(PWINE_REGSTORE store, HKEY key, + DWORD contextType) +{ + LONG rc; + DWORD index = 0; + WCHAR subKeyName[MAX_PATH]; + + do { + DWORD size = sizeof(subKeyName) / sizeof(WCHAR); + + rc = RegEnumKeyExW(key, index++, subKeyName, &size, NULL, NULL, NULL, + NULL); + if (!rc) + { + HKEY subKey; + + rc = RegOpenKeyExW(key, subKeyName, 0, KEY_READ, &subKey); + if (!rc) + { + LPBYTE buf = NULL; + + size = 0; + rc = RegQueryValueExW(subKey, BlobW, NULL, NULL, NULL, &size); + if (!rc) + buf = CryptMemAlloc(size); + if (buf) + { + rc = RegQueryValueExW(subKey, BlobW, NULL, NULL, buf, + &size); + if (!rc) + { + const void *context; + DWORD addedType; + + TRACE("Adding cert with hash %s\n", + debugstr_w(subKeyName)); + context = CRYPT_ReadSerializedElement(buf, size, + contextType, &addedType); + if (context) + { + const WINE_CONTEXT_INTERFACE *contextInterface; + BYTE hash[20]; + + switch (addedType) + { + case CERT_STORE_CERTIFICATE_CONTEXT: + contextInterface = &gCertInterface; + break; + case CERT_STORE_CRL_CONTEXT: + contextInterface = &gCRLInterface; + break; + case CERT_STORE_CTL_CONTEXT: + contextInterface = &gCTLInterface; + break; + default: + contextInterface = NULL; + } + if (contextInterface) + { + size = sizeof(hash); + if (contextInterface->getProp(context, + CERT_HASH_PROP_ID, hash, &size)) + { + WCHAR asciiHash[20 * 2 + 1]; + + CRYPT_HashToStr(hash, asciiHash); + TRACE("comparing %s\n", + debugstr_w(asciiHash)); + TRACE("with %s\n", debugstr_w(subKeyName)); + if (!lstrcmpW(asciiHash, subKeyName)) + { + TRACE("hash matches, adding\n"); + contextInterface->addContextToStore( + store, context, + CERT_STORE_ADD_REPLACE_EXISTING, NULL); + } + else + { + TRACE("hash doesn't match, ignoring\n"); + contextInterface->free(context); + } + } + } + } + } + CryptMemFree(buf); + } + RegCloseKey(subKey); + } + /* Ignore intermediate errors, continue enumerating */ + rc = ERROR_SUCCESS; + } + } while (!rc); +} + +static void CRYPT_RegReadFromReg(PWINE_REGSTORE store) +{ + static const WCHAR *subKeys[] = { CertsW, CRLsW, CTLsW }; + static const DWORD contextFlags[] = { CERT_STORE_CERTIFICATE_CONTEXT_FLAG, + CERT_STORE_CRL_CONTEXT_FLAG, CERT_STORE_CTL_CONTEXT_FLAG }; + DWORD i; + + for (i = 0; i < sizeof(subKeys) / sizeof(subKeys[0]); i++) + { + HKEY key; + LONG rc; + + rc = RegCreateKeyExW(store->key, subKeys[i], 0, NULL, 0, KEY_READ, NULL, + &key, NULL); + if (!rc) + { + CRYPT_RegReadSerializedFromReg(store, key, contextFlags[i]); + RegCloseKey(key); + } + } +} + +/* Hash is assumed to be 20 bytes in length (a SHA-1 hash) */ +static BOOL CRYPT_WriteSerializedToReg(HKEY key, LPBYTE hash, LPBYTE buf, + DWORD len) +{ + WCHAR asciiHash[20 * 2 + 1]; + LONG rc; + HKEY subKey; + BOOL ret; + + CRYPT_HashToStr(hash, asciiHash); + rc = RegCreateKeyExW(key, asciiHash, 0, NULL, 0, KEY_ALL_ACCESS, NULL, + &subKey, NULL); + if (!rc) + { + rc = RegSetValueExW(subKey, BlobW, 0, REG_BINARY, buf, len); [truncated at 1000 lines; 10343 more skipped]
19 years, 1 month
1
0
0
0
[gvg] 19303: Wine-0_9_1 vendor import
by gvg@svn.reactos.com
Wine-0_9_1 vendor import Added: trunk/reactos/lib/dplay/ Deleted: trunk/reactos/lib/dplay/Makefile.in Added: trunk/reactos/lib/dplay/dplay.xml Added: trunk/reactos/lib/dplayx/ Deleted: trunk/reactos/lib/dplayx/Makefile.in Modified: trunk/reactos/lib/dplayx/dplay.c Added: trunk/reactos/lib/dplayx/dplayx.xml Modified: trunk/reactos/lib/dplayx/dplayx_global.c Modified: trunk/reactos/lib/dplayx/name_server.c _____ Copied: trunk/reactos/lib/dplay (from rev 19302, vendor/wine/dlls/dplay/current) _____ Deleted: trunk/reactos/lib/dplay/Makefile.in --- vendor/wine/dlls/dplay/current/Makefile.in 2005-11-17 20:11:40 UTC (rev 19302) +++ trunk/reactos/lib/dplay/Makefile.in 2005-11-17 20:16:02 UTC (rev 19303) @@ -1,15 +0,0 @@ -TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../.. -SRCDIR = @srcdir@ -VPATH = @srcdir@ -MODULE = dplay.dll -IMPORTLIB = libdplay.$(IMPLIBEXT) -IMPORTS = dplayx kernel32 - -C_SRCS = dplay_main.c - -RC_SRCS = version.rc - -@MAKE_DLL_RULES@ - -### Dependencies: _____ Added: trunk/reactos/lib/dplay/dplay.xml --- vendor/wine/dlls/dplay/current/dplay.xml 2005-11-17 20:11:40 UTC (rev 19302) +++ trunk/reactos/lib/dplay/dplay.xml 2005-11-17 20:16:02 UTC (rev 19303) @@ -0,0 +1,25 @@ +<module name="dplay" type="win32dll" baseaddress="${BASEADDRESS_DPLAY}" installbase="system32" installname="dplay.dll"> + <importlibrary definition="dplay.spec.def" /> + <include base="dinput8">.</include> + <include base="ReactOS">include/wine</include> + <define name="UNICODE" /> + <define name="_UNICODE" /> + <define name="__REACTOS__" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <define name="WINVER">0x501</define> + <library>wine</library> + <library>uuid</library> + <library>ntdll</library> + <library>kernel32</library> + <library>user32</library> + <library>advapi32</library> + <library>ole32</library> + <library>winmm</library> + <library>dxguid</library> + <library>dinput</library> + <file>version.rc</file> + <file>dplay_main.c</file> + <file>dplay.spec</file> +</module> Property changes on: trunk/reactos/lib/dplay/dplay.xml ___________________________________________________________________ Name: svn:eol-style + native _____ Copied: trunk/reactos/lib/dplayx (from rev 19302, vendor/wine/dlls/dplayx/current) _____ Deleted: trunk/reactos/lib/dplayx/Makefile.in --- vendor/wine/dlls/dplayx/current/Makefile.in 2005-11-17 20:11:40 UTC (rev 19302) +++ trunk/reactos/lib/dplayx/Makefile.in 2005-11-17 20:16:02 UTC (rev 19303) @@ -1,27 +0,0 @@ -EXTRADEFS = -DCOM_NO_WINDOWS_H -TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../.. -SRCDIR = @srcdir@ -VPATH = @srcdir@ -MODULE = dplayx.dll -IMPORTLIB = libdplayx.$(IMPLIBEXT) -IMPORTS = winmm ole32 user32 advapi32 kernel32 -EXTRALIBS = -ldxguid -luuid - -C_SRCS = \ - dpclassfactory.c \ - dplay.c \ - dplaysp.c \ - dplayx_global.c \ - dplayx_main.c \ - dplayx_messages.c \ - dplobby.c \ - lobbysp.c \ - name_server.c \ - regsvr.c - -RC_SRCS = version.rc - -@MAKE_DLL_RULES@ - -### Dependencies: _____ Modified: trunk/reactos/lib/dplayx/dplay.c --- vendor/wine/dlls/dplayx/current/dplay.c 2005-11-17 20:11:40 UTC (rev 19302) +++ trunk/reactos/lib/dplayx/dplay.c 2005-11-17 20:16:02 UTC (rev 19303) @@ -1232,8 +1232,8 @@ static void DP_DeleteDPNameStruct( LPDPNAME lpDPName ) { - HeapFree( GetProcessHeap(), HEAP_ZERO_MEMORY, lpDPName->u1.lpszShortNameA ); - HeapFree( GetProcessHeap(), HEAP_ZERO_MEMORY, lpDPName->u2.lpszLongNameA ); + HeapFree( GetProcessHeap(), HEAP_ZERO_MEMORY, lpDPName->lpszShortNameA ); + HeapFree( GetProcessHeap(), HEAP_ZERO_MEMORY, lpDPName->lpszLongNameA ); } /* This method assumes that all links to it are already deleted */ @@ -1296,40 +1296,40 @@ } /* Delete any existing pointers */ - HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA ); - HeapFree( GetProcessHeap(), 0, lpDst->u2.lpszLongNameA ); + HeapFree( GetProcessHeap(), 0, lpDst->lpszShortNameA ); + HeapFree( GetProcessHeap(), 0, lpDst->lpszLongNameA ); /* Copy as required */ CopyMemory( lpDst, lpSrc, lpSrc->dwSize ); if( bAnsi ) { - if( lpSrc->u1.lpszShortNameA ) + if( lpSrc->lpszShortNameA ) { - lpDst->u1.lpszShortNameA = HeapAlloc( GetProcessHeap(), 0, - strlen(lpSrc->u1.lpszShortNameA)+1 ); - strcpy( lpDst->u1.lpszShortNameA, lpSrc->u1.lpszShortNameA ); + lpDst->lpszShortNameA = HeapAlloc( GetProcessHeap(), 0, + strlen(lpSrc->lpszShortNameA)+1 ); + strcpy( lpDst->lpszShortNameA, lpSrc->lpszShortNameA ); } - if( lpSrc->u2.lpszLongNameA ) + if( lpSrc->lpszLongNameA ) { - lpDst->u2.lpszLongNameA = HeapAlloc( GetProcessHeap(), 0, - strlen(lpSrc->u2.lpszLongNameA)+1 ); - strcpy( lpDst->u2.lpszLongNameA, lpSrc->u2.lpszLongNameA ); + lpDst->lpszLongNameA = HeapAlloc( GetProcessHeap(), 0, + strlen(lpSrc->lpszLongNameA)+1 ); + strcpy( lpDst->lpszLongNameA, lpSrc->lpszLongNameA ); } } else { - if( lpSrc->u1.lpszShortNameA ) + if( lpSrc->lpszShortNameA ) { - lpDst->u1.lpszShortName = HeapAlloc( GetProcessHeap(), 0, - (strlenW(lpSrc->u1.lpszShortName)+1)*sizeof(WCHAR) ); - strcpyW( lpDst->u1.lpszShortName, lpSrc->u1.lpszShortName ); + lpDst->lpszShortName = HeapAlloc( GetProcessHeap(), 0, + (strlenW(lpSrc->lpszShortName)+1)*sizeof(WCHAR) ); + strcpyW( lpDst->lpszShortName, lpSrc->lpszShortName ); } - if( lpSrc->u2.lpszLongNameA ) + if( lpSrc->lpszLongNameA ) { - lpDst->u2.lpszLongName = HeapAlloc( GetProcessHeap(), 0, - (strlenW(lpSrc->u2.lpszLongName)+1)*sizeof(WCHAR) ); - strcpyW( lpDst->u2.lpszLongName, lpSrc->u2.lpszLongName ); + lpDst->lpszLongName = HeapAlloc( GetProcessHeap(), 0, + (strlenW(lpSrc->lpszLongName)+1)*sizeof(WCHAR) ); + strcpyW( lpDst->lpszLongName, lpSrc->lpszLongName ); } } @@ -2475,14 +2475,14 @@ dwRequiredDataSize = lpGData->name.dwSize; - if( lpGData->name.u1.lpszShortNameA ) + if( lpGData->name.lpszShortNameA ) { - dwRequiredDataSize += strlen( lpGData->name.u1.lpszShortNameA ) + 1; + dwRequiredDataSize += strlen( lpGData->name.lpszShortNameA ) + 1; } - if( lpGData->name.u2.lpszLongNameA ) + if( lpGData->name.lpszLongNameA ) { - dwRequiredDataSize += strlen( lpGData->name.u2.lpszLongNameA ) + 1; + dwRequiredDataSize += strlen( lpGData->name.lpszLongNameA ) + 1; } if( ( lpData == NULL ) || @@ -2496,24 +2496,24 @@ /* Copy the structure */ CopyMemory( lpName, &lpGData->name, lpGData->name.dwSize ); - if( lpGData->name.u1.lpszShortNameA ) + if( lpGData->name.lpszShortNameA ) { strcpy( ((char*)lpName)+lpGData->name.dwSize, - lpGData->name.u1.lpszShortNameA ); + lpGData->name.lpszShortNameA ); } else { - lpName->u1.lpszShortNameA = NULL; + lpName->lpszShortNameA = NULL; } - if( lpGData->name.u1.lpszShortNameA ) + if( lpGData->name.lpszShortNameA ) { strcpy( ((char*)lpName)+lpGData->name.dwSize, - lpGData->name.u2.lpszLongNameA ); + lpGData->name.lpszLongNameA ); } else { - lpName->u2.lpszLongNameA = NULL; + lpName->lpszLongNameA = NULL; } return DP_OK; @@ -2674,14 +2674,14 @@ dwRequiredDataSize = lpPList->lpPData->name.dwSize; - if( lpPList->lpPData->name.u1.lpszShortNameA ) + if( lpPList->lpPData->name.lpszShortNameA ) { - dwRequiredDataSize += strlen( lpPList->lpPData->name.u1.lpszShortNameA ) + 1; + dwRequiredDataSize += strlen( lpPList->lpPData->name.lpszShortNameA ) + 1; } - if( lpPList->lpPData->name.u2.lpszLongNameA ) + if( lpPList->lpPData->name.lpszLongNameA ) { - dwRequiredDataSize += strlen( lpPList->lpPData->name.u2.lpszLongNameA ) + 1; + dwRequiredDataSize += strlen( lpPList->lpPData->name.lpszLongNameA ) + 1; } if( ( lpData == NULL ) || @@ -2695,24 +2695,24 @@ /* Copy the structure */ CopyMemory( lpName, &lpPList->lpPData->name, lpPList->lpPData->name.dwSize ); - if( lpPList->lpPData->name.u1.lpszShortNameA ) + if( lpPList->lpPData->name.lpszShortNameA ) { strcpy( ((char*)lpName)+lpPList->lpPData->name.dwSize, - lpPList->lpPData->name.u1.lpszShortNameA ); + lpPList->lpPData->name.lpszShortNameA ); } else { - lpName->u1.lpszShortNameA = NULL; + lpName->lpszShortNameA = NULL; } - if( lpPList->lpPData->name.u1.lpszShortNameA ) + if( lpPList->lpPData->name.lpszShortNameA ) { strcpy( ((char*)lpName)+lpPList->lpPData->name.dwSize, - lpPList->lpPData->name.u2.lpszLongNameA ); + lpPList->lpPData->name.lpszLongNameA ); } else { - lpName->u2.lpszLongNameA = NULL; + lpName->lpszLongNameA = NULL; } return DP_OK; @@ -3290,28 +3290,28 @@ if( bAnsi ) { - if( lpSessDesc->u1.lpszSessionNameA ) + if( lpSessDesc->lpszSessionNameA ) { - dwSize += lstrlenA( lpSessDesc->u1.lpszSessionNameA ) + 1; + dwSize += lstrlenA( lpSessDesc->lpszSessionNameA ) + 1; } - if( lpSessDesc->u2.lpszPasswordA ) + if( lpSessDesc->lpszPasswordA ) { - dwSize += lstrlenA( lpSessDesc->u2.lpszPasswordA ) + 1; + dwSize += lstrlenA( lpSessDesc->lpszPasswordA ) + 1; } } else /* UNICODE */ { - if( lpSessDesc->u1.lpszSessionName ) + if( lpSessDesc->lpszSessionName ) { dwSize += sizeof( WCHAR ) * - ( lstrlenW( lpSessDesc->u1.lpszSessionName ) + 1 ); + ( lstrlenW( lpSessDesc->lpszSessionName ) + 1 ); } - if( lpSessDesc->u2.lpszPassword ) + if( lpSessDesc->lpszPassword ) { dwSize += sizeof( WCHAR ) * - ( lstrlenW( lpSessDesc->u2.lpszPassword ) + 1 ); + ( lstrlenW( lpSessDesc->lpszPassword ) + 1 ); } } @@ -3336,42 +3336,42 @@ if( bAnsi ) { - if( lpSessionSrc->u1.lpszSessionNameA ) + if( lpSessionSrc->lpszSessionNameA ) { lstrcpyA( (LPSTR)lpStartOfFreeSpace, - lpSessionDest->u1.lpszSessionNameA ); - lpSessionDest->u1.lpszSessionNameA = (LPSTR)lpStartOfFreeSpace; + lpSessionDest->lpszSessionNameA ); + lpSessionDest->lpszSessionNameA = (LPSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += - lstrlenA( (LPSTR)lpSessionDest->u1.lpszSessionNameA ) + 1; + lstrlenA( (LPSTR)lpSessionDest->lpszSessionNameA ) + 1; } - if( lpSessionSrc->u2.lpszPasswordA ) + if( lpSessionSrc->lpszPasswordA ) { lstrcpyA( (LPSTR)lpStartOfFreeSpace, - lpSessionDest->u2.lpszPasswordA ); - lpSessionDest->u2.lpszPasswordA = (LPSTR)lpStartOfFreeSpace; + lpSessionDest->lpszPasswordA ); + lpSessionDest->lpszPasswordA = (LPSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += - lstrlenA( (LPSTR)lpSessionDest->u2.lpszPasswordA ) + 1; + lstrlenA( (LPSTR)lpSessionDest->lpszPasswordA ) + 1; } } else /* UNICODE */ { - if( lpSessionSrc->u1.lpszSessionName ) + if( lpSessionSrc->lpszSessionName ) { lstrcpyW( (LPWSTR)lpStartOfFreeSpace, - lpSessionDest->u1.lpszSessionName ); - lpSessionDest->u1.lpszSessionName = (LPWSTR)lpStartOfFreeSpace; + lpSessionDest->lpszSessionName ); + lpSessionDest->lpszSessionName = (LPWSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += sizeof(WCHAR) * - ( lstrlenW( (LPWSTR)lpSessionDest->u1.lpszSessionName ) + 1 ); + ( lstrlenW( (LPWSTR)lpSessionDest->lpszSessionName ) + 1 ); } - if( lpSessionSrc->u2.lpszPassword ) + if( lpSessionSrc->lpszPassword ) { lstrcpyW( (LPWSTR)lpStartOfFreeSpace, - lpSessionDest->u2.lpszPassword ); - lpSessionDest->u2.lpszPassword = (LPWSTR)lpStartOfFreeSpace; + lpSessionDest->lpszPassword ); + lpSessionDest->lpszPassword = (LPWSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += sizeof(WCHAR) * - ( lstrlenW( (LPWSTR)lpSessionDest->u2.lpszPassword ) + 1 ); + ( lstrlenW( (LPWSTR)lpSessionDest->lpszPassword ) + 1 ); } } } @@ -3722,8 +3722,8 @@ /* Fill in the DPNAME struct for the service provider */ dpName.dwSize = sizeof( dpName ); dpName.dwFlags = 0; - dpName.u1.lpszShortNameA = subKeyName; - dpName.u2.lpszLongNameA = NULL; + dpName.lpszShortNameA = subKeyName; + dpName.lpszLongNameA = NULL; /* Create the compound address for the service provider. * NOTE: This is a gruesome architectural scar right now. DP @@ -3817,8 +3817,8 @@ /* Fill in the DPNAME struct for the service provider */ dpName.dwSize = sizeof( dpName ); dpName.dwFlags = 0; - dpName.u1.lpszShortNameA = subKeyName; - dpName.u2.lpszLongNameA = NULL; + dpName.lpszShortNameA = subKeyName; + dpName.lpszLongNameA = NULL; /* Create the compound address for the service provider. NOTE: This is a gruesome architectural scar right now. DP uses DPL and DPL uses DP _____ Added: trunk/reactos/lib/dplayx/dplayx.xml --- vendor/wine/dlls/dplayx/current/dplayx.xml 2005-11-17 20:11:40 UTC (rev 19302) +++ trunk/reactos/lib/dplayx/dplayx.xml 2005-11-17 20:16:02 UTC (rev 19303) @@ -0,0 +1,33 @@ +<module name="dplayx" type="win32dll" baseaddress="${BASEADDRESS_DPLAYX}" installbase="system32" installname="dplayx.dll" allowwarnings ="true"> + <importlibrary definition="dplayx.spec.def" /> + <include base="dplayx">.</include> + <include base="ReactOS">include/wine</include> + <define name="UNICODE" /> + <define name="_UNICODE" /> + <define name="__REACTOS__" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <define name="WINVER">0x501</define> + <library>wine</library> + <library>uuid</library> + <library>ntdll</library> + <library>kernel32</library> + <library>user32</library> + <library>advapi32</library> + <library>ole32</library> + <library>winmm</library> + <library>dxguid</library> + <file>version.rc</file> + <file>dpclassfactory.c</file> + <file>dplay.c</file> + <file>dplaysp.c</file> + <file>dplayx_global.c</file> + <file>dplayx_main.c</file> + <file>dplayx_messages.c</file> + <file>dplobby.c</file> + <file>lobbysp.c</file> + <file>name_server.c</file> + <file>regsvr.c</file> + <file>dplayx.spec</file> +</module> Property changes on: trunk/reactos/lib/dplayx/dplayx.xml ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/lib/dplayx/dplayx_global.c --- vendor/wine/dlls/dplayx/current/dplayx_global.c 2005-11-17 20:11:40 UTC (rev 19302) +++ trunk/reactos/lib/dplayx/dplayx_global.c 2005-11-17 20:16:02 UTC (rev 19303) @@ -671,20 +671,20 @@ CopyMemory( dest->lpSessionDesc, src->lpSessionDesc, sizeof( DPSESSIONDESC2 ) ); /* Session names may or may not exist */ - if( src->lpSessionDesc->u1.lpszSessionNameA ) + if( src->lpSessionDesc->lpszSessionNameA ) { - strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u1.lpszSessionNameA ); - dest->lpSessionDesc->u1.lpszSessionNameA = (LPSTR)lpStartOfFreeSpace; + strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszSessionNameA ); + dest->lpSessionDesc->lpszSessionNameA = (LPSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += - strlen( (LPSTR)dest->lpSessionDesc->u1.lpszSessionNameA ) + 1; + strlen( (LPSTR)dest->lpSessionDesc->lpszSessionNameA ) + 1; } - if( src->lpSessionDesc->u2.lpszPasswordA ) + if( src->lpSessionDesc->lpszPasswordA ) { - strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPasswordA ); - dest->lpSessionDesc->u2.lpszPasswordA = (LPSTR)lpStartOfFreeSpace; + strcpy( (LPSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszPasswordA ); + dest->lpSessionDesc->lpszPasswordA = (LPSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += - strlen( (LPSTR)dest->lpSessionDesc->u2.lpszPasswordA ) + 1; + strlen( (LPSTR)dest->lpSessionDesc->lpszPasswordA ) + 1; } } @@ -695,20 +695,20 @@ lpStartOfFreeSpace += sizeof( DPNAME ); CopyMemory( dest->lpPlayerName, src->lpPlayerName, sizeof( DPNAME ) ); - if( src->lpPlayerName->u1.lpszShortNameA ) + if( src->lpPlayerName->lpszShortNameA ) { - strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortNameA ); - dest->lpPlayerName->u1.lpszShortNameA = (LPSTR)lpStartOfFreeSpace; + strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszShortNameA ); + dest->lpPlayerName->lpszShortNameA = (LPSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += - strlen( (LPSTR)dest->lpPlayerName->u1.lpszShortNameA ) + 1; + strlen( (LPSTR)dest->lpPlayerName->lpszShortNameA ) + 1; } - if( src->lpPlayerName->u2.lpszLongNameA ) + if( src->lpPlayerName->lpszLongNameA ) { - strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongNameA ); - dest->lpPlayerName->u2.lpszLongNameA = (LPSTR)lpStartOfFreeSpace; + strcpy( (LPSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszLongNameA ); + dest->lpPlayerName->lpszLongNameA = (LPSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += - strlen( (LPSTR)dest->lpPlayerName->u2.lpszLongName ) + 1 ; + strlen( (LPSTR)dest->lpPlayerName->lpszLongName ) + 1 ; } } @@ -793,20 +793,20 @@ CopyMemory( dest->lpSessionDesc, src->lpSessionDesc, sizeof( DPSESSIONDESC2 ) ); /* Session names may or may not exist */ - if( src->lpSessionDesc->u1.lpszSessionName ) + if( src->lpSessionDesc->lpszSessionName ) { - strcpyW( (LPWSTR)lpStartOfFreeSpace, dest->lpSessionDesc->u1.lpszSessionName ); - src->lpSessionDesc->u1.lpszSessionName = (LPWSTR)lpStartOfFreeSpace; + strcpyW( (LPWSTR)lpStartOfFreeSpace, dest->lpSessionDesc->lpszSessionName ); + src->lpSessionDesc->lpszSessionName = (LPWSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += sizeof(WCHAR) * - ( strlenW( (LPWSTR)dest->lpSessionDesc->u1.lpszSessionName ) + 1 ); + ( strlenW( (LPWSTR)dest->lpSessionDesc->lpszSessionName ) + 1 ); } - if( src->lpSessionDesc->u2.lpszPassword ) + if( src->lpSessionDesc->lpszPassword ) { - strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->u2.lpszPassword ); - dest->lpSessionDesc->u2.lpszPassword = (LPWSTR)lpStartOfFreeSpace; + strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpSessionDesc->lpszPassword ); + dest->lpSessionDesc->lpszPassword = (LPWSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += sizeof(WCHAR) * - ( strlenW( (LPWSTR)dest->lpSessionDesc->u2.lpszPassword ) + 1 ); + ( strlenW( (LPWSTR)dest->lpSessionDesc->lpszPassword ) + 1 ); } } @@ -817,20 +817,20 @@ lpStartOfFreeSpace += sizeof( DPNAME ); CopyMemory( dest->lpPlayerName, src->lpPlayerName, sizeof( DPNAME ) ); - if( src->lpPlayerName->u1.lpszShortName ) + if( src->lpPlayerName->lpszShortName ) { - strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u1.lpszShortName ); - dest->lpPlayerName->u1.lpszShortName = (LPWSTR)lpStartOfFreeSpace; + strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszShortName ); + dest->lpPlayerName->lpszShortName = (LPWSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += sizeof(WCHAR) * - ( strlenW( (LPWSTR)dest->lpPlayerName->u1.lpszShortName ) + 1 ); + ( strlenW( (LPWSTR)dest->lpPlayerName->lpszShortName ) + 1 ); } - if( src->lpPlayerName->u2.lpszLongName ) + if( src->lpPlayerName->lpszLongName ) { - strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->u2.lpszLongName ); - dest->lpPlayerName->u2.lpszLongName = (LPWSTR)lpStartOfFreeSpace; + strcpyW( (LPWSTR)lpStartOfFreeSpace, src->lpPlayerName->lpszLongName ); + dest->lpPlayerName->lpszLongName = (LPWSTR)lpStartOfFreeSpace; lpStartOfFreeSpace += sizeof(WCHAR) * - ( strlenW( (LPWSTR)dest->lpPlayerName->u2.lpszLongName ) + 1 ); + ( strlenW( (LPWSTR)dest->lpPlayerName->lpszLongName ) + 1 ); } } @@ -976,14 +976,14 @@ { dwTotalSize += sizeof( DPSESSIONDESC2 ); - if( lpConn->lpSessionDesc->u1.lpszSessionNameA ) + if( lpConn->lpSessionDesc->lpszSessionNameA ) { - dwTotalSize += strlen( lpConn->lpSessionDesc->u1.lpszSessionNameA ) + 1; + dwTotalSize += strlen( lpConn->lpSessionDesc->lpszSessionNameA ) + 1; } - if( lpConn->lpSessionDesc->u2.lpszPasswordA ) + if( lpConn->lpSessionDesc->lpszPasswordA ) { - dwTotalSize += strlen( lpConn->lpSessionDesc->u2.lpszPasswordA ) + 1; + dwTotalSize += strlen( lpConn->lpSessionDesc->lpszPasswordA ) + 1; } } @@ -991,14 +991,14 @@ { dwTotalSize += sizeof( DPNAME ); - if( lpConn->lpPlayerName->u1.lpszShortNameA ) + if( lpConn->lpPlayerName->lpszShortNameA ) { - dwTotalSize += strlen( lpConn->lpPlayerName->u1.lpszShortNameA ) + 1; + dwTotalSize += strlen( lpConn->lpPlayerName->lpszShortNameA ) + 1; } - if( lpConn->lpPlayerName->u2.lpszLongNameA ) + if( lpConn->lpPlayerName->lpszLongNameA ) { - dwTotalSize += strlen( lpConn->lpPlayerName->u2.lpszLongNameA ) + 1; + dwTotalSize += strlen( lpConn->lpPlayerName->lpszLongNameA ) + 1; } } @@ -1023,16 +1023,16 @@ { dwTotalSize += sizeof( DPSESSIONDESC2 ); - if( lpConn->lpSessionDesc->u1.lpszSessionName ) + if( lpConn->lpSessionDesc->lpszSessionName ) { dwTotalSize += sizeof( WCHAR ) * - ( strlenW( lpConn->lpSessionDesc->u1.lpszSessionName ) + 1 ); + ( strlenW( lpConn->lpSessionDesc->lpszSessionName ) + 1 ); } - if( lpConn->lpSessionDesc->u2.lpszPassword ) + if( lpConn->lpSessionDesc->lpszPassword ) { dwTotalSize += sizeof( WCHAR ) * - ( strlenW( lpConn->lpSessionDesc->u2.lpszPassword ) + 1 ); + ( strlenW( lpConn->lpSessionDesc->lpszPassword ) + 1 ); } } @@ -1040,16 +1040,16 @@ { dwTotalSize += sizeof( DPNAME ); - if( lpConn->lpPlayerName->u1.lpszShortName ) + if( lpConn->lpPlayerName->lpszShortName ) { dwTotalSize += sizeof( WCHAR ) * - ( strlenW( lpConn->lpPlayerName->u1.lpszShortName ) + 1 ); + ( strlenW( lpConn->lpPlayerName->lpszShortName ) + 1 ); } - if( lpConn->lpPlayerName->u2.lpszLongName ) + if( lpConn->lpPlayerName->lpszLongName ) { dwTotalSize += sizeof( WCHAR ) * - ( strlenW( lpConn->lpPlayerName->u2.lpszLongName ) + 1 ); + ( strlenW( lpConn->lpPlayerName->lpszLongName ) + 1 ); } } @@ -1076,17 +1076,17 @@ { CopyMemory( lpSessionDest, lpSessionSrc, sizeof( *lpSessionSrc ) ); - if( lpSessionSrc->u1.lpszSessionNameA ) + if( lpSessionSrc->lpszSessionNameA ) { - if ((lpSessionDest->u1.lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, - strlen(lpSessionSrc->u1.lpszSessionNameA)+1 ))) - strcpy( lpSessionDest->u1.lpszSessionNameA, lpSessionSrc->u1.lpszSessionNameA ); + if ((lpSessionDest->lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, + strlen(lpSessionSrc->lpszSessionNameA)+1 ))) + strcpy( lpSessionDest->lpszSessionNameA, lpSessionSrc->lpszSessionNameA ); } - if( lpSessionSrc->u2.lpszPasswordA ) + if( lpSessionSrc->lpszPasswordA ) { - if ((lpSessionDest->u2.lpszPasswordA = HeapAlloc( GetProcessHeap(), 0, - strlen(lpSessionSrc->u2.lpszPasswordA)+1 ))) - strcpy( lpSessionDest->u2.lpszPasswordA, lpSessionSrc->u2.lpszPasswordA ); + if ((lpSessionDest->lpszPasswordA = HeapAlloc( GetProcessHeap(), 0, + strlen(lpSessionSrc->lpszPasswordA)+1 ))) + strcpy( lpSessionDest->lpszPasswordA, lpSessionSrc->lpszPasswordA ); } return TRUE; _____ Modified: trunk/reactos/lib/dplayx/name_server.c --- vendor/wine/dlls/dplayx/current/name_server.c 2005-11-17 20:11:40 UTC (rev 19302) +++ trunk/reactos/lib/dplayx/name_server.c 2005-11-17 20:16:02 UTC (rev 19303) @@ -142,10 +142,10 @@ CopyMemory( lpCacheNode->data, &lpMsg->sd, sizeof( *lpCacheNode->data ) ); len = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)(lpMsg+1), -1, NULL, 0, NULL, NULL ); - if ((lpCacheNode->data->u1.lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, len ))) + if ((lpCacheNode->data->lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, len ))) { WideCharToMultiByte( CP_ACP, 0, (LPWSTR)(lpMsg+1), -1, - lpCacheNode->data->u1.lpszSessionNameA, len, NULL, NULL ); + lpCacheNode->data->lpszSessionNameA, len, NULL, NULL ); } lpCacheNode->dwTime = timeGetTime(); @@ -388,12 +388,12 @@ if (bAnsi) { dwVariableLen = MultiByteToWideChar( CP_ACP, 0, - lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA, + lpDP->dp2->lpSessionDesc->lpszSessionNameA, -1, NULL, 0 ); } else { - dwVariableLen = strlenW( lpDP->dp2->lpSessionDesc->u1.lpszSessionName ) + 1; + dwVariableLen = strlenW( lpDP->dp2->lpSessionDesc->lpszSessionName ) + 1; } dwVariableSize = dwVariableLen * sizeof( WCHAR ); @@ -415,11 +415,11 @@ rmsg->dwUnknown = 0x0000005c; if( bAnsi ) { - MultiByteToWideChar( CP_ACP, 0, lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA, -1, + MultiByteToWideChar( CP_ACP, 0, lpDP->dp2->lpSessionDesc->lpszSessionNameA, -1, (LPWSTR)(rmsg+1), dwVariableLen ); } else { - strcpyW( (LPWSTR)(rmsg+1), lpDP->dp2->lpSessionDesc->u1.lpszSessionName ); + strcpyW( (LPWSTR)(rmsg+1), lpDP->dp2->lpSessionDesc->lpszSessionName ); } }
19 years, 1 month
1
0
0
0
← Newer
1
...
46
47
48
49
50
51
52
...
88
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Results per page:
10
25
50
100
200