ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
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
January 2012
----- 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
19 participants
559 discussions
Start a n
N
ew thread
[ekohl] 54987: [EVENTLOG] - LogfCreate: Use NtCreateFile instead of CreateFile - Implement ElfCreateBackupLogHandle
by ekohl@svn.reactos.org
Author: ekohl Date: Mon Jan 16 23:23:29 2012 New Revision: 54987 URL:
http://svn.reactos.org/svn/reactos?rev=54987&view=rev
Log: [EVENTLOG] - LogfCreate: Use NtCreateFile instead of CreateFile - Implement ElfCreateBackupLogHandle Modified: trunk/reactos/base/services/eventlog/eventlog.c trunk/reactos/base/services/eventlog/eventlog.h trunk/reactos/base/services/eventlog/file.c trunk/reactos/base/services/eventlog/rpc.c Modified: trunk/reactos/base/services/eventlog/eventlog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/eve…
============================================================================== --- trunk/reactos/base/services/eventlog/eventlog.c [iso-8859-1] (original) +++ trunk/reactos/base/services/eventlog/eventlog.c [iso-8859-1] Mon Jan 16 23:23:29 2012 @@ -267,7 +267,9 @@ DWORD MaxValueLen, ValueLen, Type, ExpandedLen; WCHAR *Buf = NULL, *Expanded = NULL; LONG Result; - PLOGFILE pLogf; + PLOGFILE pLogf = NULL; + UNICODE_STRING FileName; + NTSTATUS Status; DPRINT("LoadLogFile: %S\n", LogName); @@ -314,13 +316,21 @@ ExpandEnvironmentStrings(Buf, Expanded, ExpandedLen); + if (!RtlDosPathNameToNtPathName_U(Expanded, &FileName, + NULL, NULL)) + { + DPRINT1("Can't convert path!\n"); + HeapFree(MyHeap, 0, Expanded); + HeapFree(MyHeap, 0, Buf); + return NULL; + } + DPRINT("%S -> %S\n", Buf, Expanded); - pLogf = LogfCreate(LogName, Expanded); - - if (pLogf == NULL) - { - DPRINT1("Failed to create %S!\n", Expanded); + Status = LogfCreate(&pLogf, LogName, &FileName); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create %S! (Status %08lx)\n", Expanded, Status); } HeapFree(MyHeap, 0, Buf); Modified: trunk/reactos/base/services/eventlog/eventlog.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/eve…
============================================================================== --- trunk/reactos/base/services/eventlog/eventlog.h [iso-8859-1] (original) +++ trunk/reactos/base/services/eventlog/eventlog.h [iso-8859-1] Mon Jan 16 23:23:29 2012 @@ -102,12 +102,17 @@ WCHAR szName[1]; } EVENTSOURCE, *PEVENTSOURCE; + +/* Log Handle Flags */ +#define LOG_HANDLE_BACKUP_FILE 1 + typedef struct _LOGHANDLE { LIST_ENTRY LogHandleListEntry; PEVENTSOURCE EventSource; PLOGFILE LogFile; ULONG CurrentRecord; + ULONG Flags; WCHAR szName[1]; } LOGHANDLE, *PLOGHANDLE; @@ -149,8 +154,10 @@ LogfBackupFile(PLOGFILE LogFile, PUNICODE_STRING BackupFileName); -PLOGFILE LogfCreate(WCHAR * LogName, - WCHAR * FileName); +NTSTATUS +LogfCreate(PLOGFILE *Logfile, + WCHAR * LogName, + PUNICODE_STRING FileName); VOID LogfClose(PLOGFILE LogFile); Modified: trunk/reactos/base/services/eventlog/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/fil…
============================================================================== --- trunk/reactos/base/services/eventlog/file.c [iso-8859-1] (original) +++ trunk/reactos/base/services/eventlog/file.c [iso-8859-1] Mon Jan 16 23:23:29 2012 @@ -288,104 +288,127 @@ return TRUE; } -PLOGFILE LogfCreate(WCHAR * LogName, WCHAR * FileName) -{ - PLOGFILE LogFile; + +NTSTATUS +LogfCreate(PLOGFILE *LogFile, + WCHAR * LogName, + PUNICODE_STRING FileName) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + PLOGFILE pLogFile; BOOL bResult, bCreateNew = FALSE; - - LogFile = (LOGFILE *) HeapAlloc(MyHeap, HEAP_ZERO_MEMORY, sizeof(LOGFILE)); - if (!LogFile) + NTSTATUS Status = STATUS_SUCCESS; + + pLogFile = (LOGFILE *) HeapAlloc(MyHeap, HEAP_ZERO_MEMORY, sizeof(LOGFILE)); + if (!pLogFile) { DPRINT1("Can't allocate heap!\n"); - return NULL; - } - - LogFile->hFile = CreateFile(FileName, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, - NULL); - - if (LogFile->hFile == INVALID_HANDLE_VALUE) - { - DPRINT1("Can't create file %S.\n", FileName); - HeapFree(MyHeap, 0, LogFile); - return NULL; - } - - bCreateNew = (GetLastError() == ERROR_ALREADY_EXISTS) ? FALSE : TRUE; - - LogFile->LogName = + return STATUS_NO_MEMORY; + } + + InitializeObjectAttributes(&ObjectAttributes, + FileName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtCreateFile(&pLogFile->hFile, + GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ, + FILE_OPEN_IF, + FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Can't create file %wZ (Status: 0x%08lx)\n", FileName, Status); + goto fail; + } + + bCreateNew = (IoStatusBlock.Information == FILE_CREATED) ? TRUE: FALSE; + + pLogFile->LogName = (WCHAR *) HeapAlloc(MyHeap, HEAP_ZERO_MEMORY, (lstrlenW(LogName) + 1) * sizeof(WCHAR)); - - if (LogFile->LogName) - lstrcpyW(LogFile->LogName, LogName); - else + if (pLogFile->LogName == NULL) { DPRINT1("Can't allocate heap\n"); - HeapFree(MyHeap, 0, LogFile); - return NULL; - } - - LogFile->FileName = + Status = STATUS_NO_MEMORY; + goto fail; + } + + lstrcpyW(pLogFile->LogName, LogName); + + pLogFile->FileName = (WCHAR *) HeapAlloc(MyHeap, HEAP_ZERO_MEMORY, - (lstrlenW(FileName) + 1) * sizeof(WCHAR)); - - if (LogFile->FileName) - lstrcpyW(LogFile->FileName, FileName); - else + (lstrlenW(FileName->Buffer) + 1) * sizeof(WCHAR)); + if (pLogFile->FileName == NULL) { DPRINT1("Can't allocate heap\n"); + Status = STATUS_NO_MEMORY; goto fail; } - LogFile->OffsetInfo = + lstrcpyW(pLogFile->FileName, FileName->Buffer); + + pLogFile->OffsetInfo = (PEVENT_OFFSET_INFO) HeapAlloc(MyHeap, HEAP_ZERO_MEMORY, sizeof(EVENT_OFFSET_INFO) * 64); - - if (!LogFile->OffsetInfo) + if (pLogFile->OffsetInfo == NULL) { DPRINT1("Can't allocate heap\n"); + Status = STATUS_NO_MEMORY; goto fail; } - LogFile->OffsetInfoSize = 64; + pLogFile->OffsetInfoSize = 64; if (bCreateNew) - bResult = LogfInitializeNew(LogFile); + bResult = LogfInitializeNew(pLogFile); else - bResult = LogfInitializeExisting(LogFile); + bResult = LogfInitializeExisting(pLogFile); if (!bResult) + { + Status = STATUS_UNSUCCESSFUL; goto fail; - - RtlInitializeResource(&LogFile->Lock); - - LogfListAddItem(LogFile); - return LogFile; + } + + RtlInitializeResource(&pLogFile->Lock); + + LogfListAddItem(pLogFile); fail: - if (LogFile) - { - if (LogFile->OffsetInfo) - HeapFree(MyHeap, 0, LogFile->OffsetInfo); - - if (LogFile->FileName) - HeapFree(MyHeap, 0, LogFile->FileName); - - if (LogFile->LogName) - HeapFree(MyHeap, 0, LogFile->LogName); - - HeapFree(MyHeap, 0, LogFile); - } - - return NULL; + if (!NT_SUCCESS(Status)) + { + if ((pLogFile->hFile != NULL) && (pLogFile->hFile != INVALID_HANDLE_VALUE)) + CloseHandle(pLogFile->hFile); + + if (pLogFile->OffsetInfo) + HeapFree(MyHeap, 0, pLogFile->OffsetInfo); + + if (pLogFile->FileName) + HeapFree(MyHeap, 0, pLogFile->FileName); + + if (pLogFile->LogName) + HeapFree(MyHeap, 0, pLogFile->LogName); + + HeapFree(MyHeap, 0, pLogFile); + } + else + { + *LogFile = pLogFile; + } + + return Status; } VOID LogfClose(PLOGFILE LogFile) Modified: trunk/reactos/base/services/eventlog/rpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/rpc…
============================================================================== --- trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] (original) +++ trunk/reactos/base/services/eventlog/rpc.c [iso-8859-1] Mon Jan 16 23:23:29 2012 @@ -142,8 +142,48 @@ ElfCreateBackupLogHandle(PLOGHANDLE *LogHandle, PUNICODE_STRING FileName) { + PLOGHANDLE lpLogHandle; + + NTSTATUS Status = STATUS_SUCCESS; + DPRINT("ElfCreateBackupLogHandle(FileName: %wZ)\n", FileName); - return STATUS_NOT_IMPLEMENTED; + + lpLogHandle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LOGHANDLE)); + if (lpLogHandle == NULL) + { + DPRINT1("Failed to allocate Heap!\n"); + return STATUS_NO_MEMORY; + } + + /* Create the log file */ + Status = LogfCreate(&lpLogHandle->LogFile, + NULL, + FileName); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create the log file! (Status 0x%08lx)\n", Status); + goto Done; + } + + /* Set the backup flag */ + lpLogHandle->Flags |= LOG_HANDLE_BACKUP_FILE; + + /* Get the current record */ + lpLogHandle->CurrentRecord = LogfGetOldestRecord(lpLogHandle->LogFile); + +Done: + if (NT_SUCCESS(Status)) + { + /* Append log handle */ + InsertTailList(&LogHandleListHead, &lpLogHandle->LogHandleListEntry); + *LogHandle = lpLogHandle; + } + else + { + HeapFree(GetProcessHeap(), 0, lpLogHandle); + } + + return Status; } @@ -169,6 +209,10 @@ if (!ElfGetLogHandleEntryByHandle(lpLogHandle)) return STATUS_INVALID_HANDLE; + + /* Close the log file if it is a backup file */ + if (lpLogHandle->Flags & LOG_HANDLE_BACKUP_FILE) + LogfClose(lpLogHandle->LogFile); RemoveEntryList(&lpLogHandle->LogHandleListEntry); HeapFree(GetProcessHeap(),0,lpLogHandle);
12 years, 9 months
1
0
0
0
[ion] 54986: [KERNEL32]: Reimplement BasePushProcessParameters for future extensibility, also cleanup some code paths and fix a few bugs. [KERNEL32]: Add some more SXS and CSRSS structures.
by ion@svn.reactos.org
Author: ion Date: Mon Jan 16 21:27:50 2012 New Revision: 54986 URL:
http://svn.reactos.org/svn/reactos?rev=54986&view=rev
Log: [KERNEL32]: Reimplement BasePushProcessParameters for future extensibility, also cleanup some code paths and fix a few bugs. [KERNEL32]: Add some more SXS and CSRSS structures. Modified: trunk/reactos/dll/win32/kernel32/client/proc.c trunk/reactos/dll/win32/kernel32/include/kernel32.h trunk/reactos/include/ndk/rtltypes.h trunk/reactos/include/reactos/subsys/csrss/csrss.h Modified: trunk/reactos/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Mon Jan 16 21:27:50 2012 @@ -774,57 +774,33 @@ } } -VOID -WINAPI -BasepCopyHandles(IN PRTL_USER_PROCESS_PARAMETERS Params, - IN PRTL_USER_PROCESS_PARAMETERS PebParams, - IN BOOL InheritHandles) -{ - DPRINT("BasepCopyHandles %p %p, %d\n", Params, PebParams, InheritHandles); - - /* Copy the handle if we are inheriting or if it's a console handle */ - if ((InheritHandles) || (IsConsoleHandle(PebParams->StandardInput))) - { - Params->StandardInput = PebParams->StandardInput; - } - - if ((InheritHandles) || (IsConsoleHandle(PebParams->StandardOutput))) - { - Params->StandardOutput = PebParams->StandardOutput; - } - - if ((InheritHandles) || (IsConsoleHandle(PebParams->StandardError))) - { - Params->StandardError = PebParams->StandardError; - } -} - -NTSTATUS -WINAPI -BasePushProcessParameters(IN HANDLE ProcessHandle, - IN PPEB Peb, - IN LPWSTR ApplicationPathName, +BOOLEAN +WINAPI +BasePushProcessParameters(IN ULONG ParameterFlags, + IN HANDLE ProcessHandle, + IN PPEB RemotePeb, + IN LPCWSTR ApplicationPathName, IN LPWSTR lpCurrentDirectory, IN LPWSTR lpCommandLine, IN LPVOID lpEnvironment, - IN SIZE_T EnvSize, IN LPSTARTUPINFOW StartupInfo, IN DWORD CreationFlags, - IN BOOL InheritHandles) + IN BOOL InheritHandles, + IN ULONG ImageSubsystem, + IN PVOID AppCompatData, + IN ULONG AppCompatDataSize) { WCHAR FullPath[MAX_PATH + 5]; - LPWSTR Remaining; - LPWSTR DllPathString; - PRTL_USER_PROCESS_PARAMETERS ProcessParameters; - PRTL_USER_PROCESS_PARAMETERS RemoteParameters = NULL; + PWCHAR Remaining, DllPathString, ScanChar; + PRTL_USER_PROCESS_PARAMETERS ProcessParameters, RemoteParameters; + PVOID RemoteAppCompatData; UNICODE_STRING DllPath, ImageName, CommandLine, CurrentDirectory; + UNICODE_STRING Desktop, Shell, Runtime, Title; NTSTATUS Status; - PWCHAR ScanChar; ULONG EnviroSize; SIZE_T Size; - UNICODE_STRING Desktop, Shell, Runtime, Title; - PPEB OurPeb = NtCurrentPeb(); - LPVOID Environment = lpEnvironment; + BOOLEAN HavePebLock = FALSE, Result; + PPEB Peb = NtCurrentPeb(); DPRINT("BasePushProcessParameters\n"); /* Get the full path name */ @@ -835,9 +811,14 @@ if ((Size) && (Size <= (MAX_PATH + 4))) { /* Get the DLL Path */ - DllPathString = BaseComputeProcessDllPath(ApplicationPathName, - Environment); - if (!DllPathString) return STATUS_NO_MEMORY; + DllPathString = BaseComputeProcessDllPath((LPWSTR)ApplicationPathName, + lpEnvironment); + if (!DllPathString) + { + /* Fail */ + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } /* Initialize Strings */ RtlInitUnicodeString(&DllPath, DllPathString); @@ -846,14 +827,18 @@ else { /* Get the DLL Path */ - DllPathString = BaseComputeProcessDllPath(FullPath, Environment); - if (!DllPathString) return STATUS_NO_MEMORY; + DllPathString = BaseComputeProcessDllPath(FullPath, lpEnvironment); + if (!DllPathString) + { + /* Fail */ + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } /* Initialize Strings */ RtlInitUnicodeString(&DllPath, DllPathString); RtlInitUnicodeString(&ImageName, FullPath); } - DPRINT("DllPath: %wZ, ImageName: %wZ\n", DllPath, ImageName); /* Initialize Strings */ RtlInitUnicodeString(&CommandLine, lpCommandLine); @@ -889,38 +874,50 @@ Runtime.Buffer = (LPWSTR)StartupInfo->lpReserved2; Runtime.MaximumLength = Runtime.Length = StartupInfo->cbReserved2; + /* Enforce no app compat data if the pointer was NULL */ + if (!AppCompatData) AppCompatDataSize = 0; + /* Create the Parameter Block */ - DPRINT("Creating Process Parameters: %wZ %wZ %wZ %wZ %wZ %wZ %wZ\n", - &ImageName, &DllPath, &CommandLine, &Desktop, &Title, &Shell, - &Runtime); + ProcessParameters = NULL; Status = RtlCreateProcessParameters(&ProcessParameters, &ImageName, &DllPath, lpCurrentDirectory ? &CurrentDirectory : NULL, &CommandLine, - Environment, + lpEnvironment, &Title, &Desktop, &Shell, &Runtime); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create process parameters!\n"); - return Status; - } + if (!NT_SUCCESS(Status)) goto FailPath; /* Clear the current directory handle if not inheriting */ if (!InheritHandles) ProcessParameters->CurrentDirectory.Handle = NULL; + /* Check if the user passed in an environment */ + if (lpEnvironment) + { + /* We should've made it part of the parameters block, enforce this */ + ASSERT(ProcessParameters->Environment == lpEnvironment); + lpEnvironment = ProcessParameters->Environment; + } + else + { + /* The user did not, so use the one from the current PEB */ + HavePebLock = TRUE; + RtlAcquirePebLock(); + lpEnvironment = Peb->ProcessParameters->Environment; + } + /* Save pointer and start lookup */ - Environment = ScanChar = ProcessParameters->Environment; - if (Environment) + ScanChar = lpEnvironment; + if (lpEnvironment) { /* Find the environment size */ - while (*ScanChar) ScanChar += wcslen(ScanChar) + 1; - EnviroSize = (ULONG_PTR)ScanChar - (ULONG_PTR)Environment; - DPRINT("EnvironmentSize %ld\n", EnviroSize); + while ((ScanChar[0]) || (ScanChar[1])) ++ScanChar; + ScanChar += (2 * sizeof(UNICODE_NULL)); + EnviroSize = (ULONG_PTR)ScanChar - (ULONG_PTR)lpEnvironment; /* Allocate and Initialize new Environment Block */ Size = EnviroSize; @@ -931,23 +928,25 @@ &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to allocate Environment Block\n"); - return Status; - } + if (!NT_SUCCESS(Status)) goto FailPath; /* Write the Environment Block */ Status = ZwWriteVirtualMemory(ProcessHandle, ProcessParameters->Environment, - Environment, + lpEnvironment, EnviroSize, NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to write Environment Block\n"); - return Status; - } + + /* No longer need the PEB lock anymore */ + if (HavePebLock) + { + /* Release it */ + RtlReleasePebLock(); + HavePebLock = FALSE; + } + + /* Check if the write failed */ + if (!NT_SUCCESS(Status)) goto FailPath; } /* Write new parameters */ @@ -965,7 +964,6 @@ if (StartupInfo->dwFlags & (STARTF_USESTDHANDLES | STARTF_USEHOTKEY | STARTF_SHELLPRIVATE)) { - DPRINT("Using Standard Handles\n"); ProcessParameters->StandardInput = StartupInfo->hStdInput; ProcessParameters->StandardOutput = StartupInfo->hStdOutput; ProcessParameters->StandardError = StartupInfo->hStdError; @@ -987,17 +985,28 @@ else { /* Inherit our Console Handle */ - ProcessParameters->ConsoleHandle = OurPeb->ProcessParameters->ConsoleHandle; - - /* Is the shell trampling on our Handles? */ + ProcessParameters->ConsoleHandle = Peb->ProcessParameters->ConsoleHandle; + + /* Make sure that the shell isn't trampling on our handles first */ if (!(StartupInfo->dwFlags & (STARTF_USESTDHANDLES | STARTF_USEHOTKEY | STARTF_SHELLPRIVATE))) { - /* Use handles from PEB, if inheriting or they are console */ - DPRINT("Copying handles from parent\n"); - BasepCopyHandles(ProcessParameters, - OurPeb->ProcessParameters, - InheritHandles); + /* Copy the handle if we are inheriting or if it's a console handle */ + if ((InheritHandles) || + (IsConsoleHandle(Peb->ProcessParameters->StandardInput))) + { + ProcessParameters->StandardInput = Peb->ProcessParameters->StandardInput; + } + if ((InheritHandles) || + (IsConsoleHandle(Peb->ProcessParameters->StandardOutput))) + { + ProcessParameters->StandardOutput = Peb->ProcessParameters->StandardOutput; + } + if ((InheritHandles) || + (IsConsoleHandle(Peb->ProcessParameters->StandardError))) + { + ProcessParameters->StandardError = Peb->ProcessParameters->StandardError; + } } } @@ -1009,30 +1018,27 @@ } /* See if the first 1MB should be reserved */ - if ((ULONG_PTR)ApplicationPathName & 1) + if (ParameterFlags & 1) { ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB; } /* See if the first 16MB should be reserved */ - if ((ULONG_PTR)ApplicationPathName & 2) + if (ParameterFlags & 2) { ProcessParameters->Flags |= RTL_USER_PROCESS_PARAMETERS_RESERVE_16MB; } /* Allocate memory for the parameter block */ Size = ProcessParameters->Length; + RemoteParameters = NULL; Status = NtAllocateVirtualMemory(ProcessHandle, (PVOID*)&RemoteParameters, 0, &Size, MEM_COMMIT, PAGE_READWRITE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to allocate Parameters Block\n"); - return Status; - } + if (!NT_SUCCESS(Status)) goto FailPath; /* Set the allocated size */ ProcessParameters->MaximumLength = Size; @@ -1053,33 +1059,71 @@ ProcessParameters, ProcessParameters->Length, NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to write Parameters Block\n"); - return Status; - } + if (!NT_SUCCESS(Status)) goto FailPath; /* Write the PEB Pointer */ Status = NtWriteVirtualMemory(ProcessHandle, - &Peb->ProcessParameters, + &RemotePeb->ProcessParameters, &RemoteParameters, sizeof(PVOID), NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to write Parameters Block\n"); - return Status; - } - - /* FIXME: Write Peb->ImageSubSystem */ - - + if (!NT_SUCCESS(Status)) goto FailPath; + + /* Check if there's any app compat data to write */ + RemoteAppCompatData = NULL; + if (AppCompatData) + { + /* Allocate some space for the application compatibility data */ + Size = AppCompatDataSize; + Status = NtAllocateVirtualMemory(ProcessHandle, + &RemoteAppCompatData, + 0, + &Size, + MEM_COMMIT, + PAGE_READWRITE); + if (!NT_SUCCESS(Status)) goto FailPath; + + /* Write the application compatibility data */ + Status = NtWriteVirtualMemory(ProcessHandle, + RemoteAppCompatData, + AppCompatData, + AppCompatDataSize, + NULL); + if (!NT_SUCCESS(Status)) goto FailPath; + } + + /* Write the PEB Pointer to the app compat data (might be NULL) */ + Status = NtWriteVirtualMemory(ProcessHandle, + &RemotePeb->pShimData, + &RemoteAppCompatData, + sizeof(PVOID), + NULL); + if (!NT_SUCCESS(Status)) goto FailPath; + + /* Now write Peb->ImageSubSystem */ + if (ImageSubsystem) + { + NtWriteVirtualMemory(ProcessHandle, + &RemotePeb->ImageSubsystem, + &ImageSubsystem, + sizeof(ImageSubsystem), + NULL); + } + + /* Success path */ + Result = TRUE; + +Quickie: /* Cleanup */ + if (HavePebLock) RtlReleasePebLock(); RtlFreeHeap(RtlGetProcessHeap(), 0, DllPath.Buffer); - RtlDestroyProcessParameters(ProcessParameters); - - DPRINT("Completed\n"); - return STATUS_SUCCESS; + if (ProcessParameters) RtlDestroyProcessParameters(ProcessParameters); + return Result; +FailPath: + DPRINT1("Failure to create proecss parameters: %lx\n", Status); + BaseSetLastNTError(Status); + Result = FALSE; + goto Quickie; } VOID @@ -3058,29 +3102,26 @@ /* Create Process Environment */ RemotePeb = ProcessBasicInfo.PebBaseAddress; - Status = BasePushProcessParameters(hProcess, - RemotePeb, - (LPWSTR)lpApplicationName, - CurrentDirectory, - (QuotesNeeded || CmdLineIsAppName || Escape) ? - QuotedCmdLine : lpCommandLine, - lpEnvironment, - EnvSize, - &StartupInfo, - dwCreationFlags, - bInheritHandles); + Ret = BasePushProcessParameters(0, + hProcess, + RemotePeb, + (LPWSTR)lpApplicationName, + CurrentDirectory, + (QuotesNeeded || CmdLineIsAppName || Escape) ? + QuotedCmdLine : lpCommandLine, + lpEnvironment, + &StartupInfo, + dwCreationFlags, + bInheritHandles, + 0, + NULL, + 0); + if (!Ret) goto Cleanup; /* Cleanup Environment */ if (lpEnvironment && !(dwCreationFlags & CREATE_UNICODE_ENVIRONMENT)) { RtlDestroyEnvironment(lpEnvironment); - } - - if (!NT_SUCCESS(Status)) - { - DPRINT1("Could not initialize Process Environment\n"); - BaseSetLastNTError(Status); - goto Cleanup; } /* Close the section */ Modified: trunk/reactos/dll/win32/kernel32/include/kernel32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
============================================================================== --- trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Mon Jan 16 21:27:50 2012 @@ -450,6 +450,19 @@ LARGE_INTEGER ViewBase; } BASE_MSG_SXS_HANDLES, *PBASE_MSG_SXS_HANDLES; +typedef struct _SXS_WIN32_NT_PATH_PAIR +{ + PUNICODE_STRING Win32; + PUNICODE_STRING Nt; +} SXS_WIN32_NT_PATH_PAIR, *PSXS_WIN32_NT_PATH_PAIR; + +typedef struct _SXS_OVERRIDE_MANIFEST +{ + PCWCH Name; + PVOID Address; + ULONG Size; +} SXS_OVERRIDE_MANIFEST, *PSXS_OVERRIDE_MANIFEST; + NTSTATUS NTAPI BasepConfigureAppCertDlls( @@ -464,6 +477,15 @@ extern LIST_ENTRY BasepAppCertDllsList; extern RTL_CRITICAL_SECTION gcsAppCert; +BOOL +WINAPI +BaseUpdateVDMEntry( + IN ULONG UpdateIndex, + IN OUT PHANDLE WaitHandle, + IN ULONG IndexInfo, + IN ULONG BinaryType +); + VOID WINAPI BaseMarkFileForDelete( @@ -471,3 +493,10 @@ IN ULONG FileAttributes ); +/* FIXME: This is EXPORTED! It should go in an external kernel32.h header */ +VOID +WINAPI +BasepFreeAppCompatData( + IN PVOID AppCompatData, + IN PVOID AppCompatSxsData +); Modified: trunk/reactos/include/ndk/rtltypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtltypes.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtltypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/rtltypes.h [iso-8859-1] Mon Jan 16 21:27:50 2012 @@ -1380,6 +1380,26 @@ PVOID *Trace; } RTL_TRACE_BLOCK, *PRTL_TRACE_BLOCK; +// +// Auto-Managed Rtl* String Buffer +// +typedef struct _RTL_BUFFER +{ + PUCHAR Buffer; + PUCHAR StaticBuffer; + SIZE_T Size; + SIZE_T StaticSize; + SIZE_T ReservedForAllocatedSize; + PVOID ReservedForIMalloc; +} RTL_BUFFER, *PRTL_BUFFER; + +typedef struct _RTL_UNICODE_STRING_BUFFER +{ + UNICODE_STRING String; + RTL_BUFFER ByteBuffer; + WCHAR MinimumStaticBufferForTerminalNul; +} RTL_UNICODE_STRING_BUFFER, *PRTL_UNICODE_STRING_BUFFER; + #ifndef NTOS_MODE_USER // Modified: trunk/reactos/include/reactos/subsys/csrss/csrss.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/csr…
============================================================================== --- trunk/reactos/include/reactos/subsys/csrss/csrss.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/csrss/csrss.h [iso-8859-1] Mon Jan 16 21:27:50 2012 @@ -31,11 +31,46 @@ ULONG Dummy; } CSRSS_CONNECT_PROCESS, *PCSRSS_CONNECT_PROCESS; -typedef struct -{ - HANDLE NewProcessId; - ULONG Flags; - BOOL bInheritHandles; +typedef struct _BASE_SXS_CREATEPROCESS_MSG +{ + ULONG Flags; + ULONG ProcessParameterFlags; + HANDLE FileHandle; + UNICODE_STRING SxsWin32ExePath; + UNICODE_STRING SxsNtExePath; + SIZE_T OverrideManifestOffset; + ULONG OverrideManifestSize; + SIZE_T OverridePolicyOffset; + ULONG OverridePolicySize; + PVOID PEManifestAddress; + ULONG PEManifestSize; + UNICODE_STRING CultureFallbacks; + ULONG Unknown[7]; + UNICODE_STRING AssemblyName; +} BASE_SXS_CREATEPROCESS_MSG, *PBASE_SXS_CREATEPROCESS_MSG; + +typedef struct +{ + // + // NT-type structure (BASE_CREATEPROCESS_MSG) + // + HANDLE ProcessHandle; + HANDLE ThreadHandle; + CLIENT_ID ClientId; + ULONG CreationFlags; + ULONG VdmBinaryType; + ULONG VdmTask; + HANDLE hVDM; + BASE_SXS_CREATEPROCESS_MSG Sxs; + PVOID PebAddressNative; + ULONG PebAddressWow64; + USHORT ProcessorArchitecture; + // + // ReactOS Data + // + HANDLE NewProcessId; + ULONG Flags; + BOOL bInheritHandles; } CSRSS_CREATE_PROCESS, *PCSRSS_CREATE_PROCESS; typedef struct @@ -547,6 +582,38 @@ HANDLE hParent; ULONG ExitCode; } CSRSS_GET_VDM_EXIT_CODE, *PCSRSS_GET_VDM_EXIT_CODE; + +typedef struct +{ + ULONG iTask; + HANDLE ConsoleHandle; + ULONG BinaryType; + HANDLE WaitObjectForParent; + HANDLE StdIn; + HANDLE StdOut; + HANDLE StdErr; + ULONG CodePage; + ULONG dwCreationFlags; + PCHAR CmdLine; + PCHAR appName; + PCHAR PifFile; + PCHAR CurDirectory; + PCHAR Env; + ULONG EnvLen; + PVOID StartupInfo; + PCHAR Desktop; + ULONG DesktopLen; + PCHAR Title; + ULONG TitleLen; + PCHAR Reserved; + ULONG ReservedLen; + USHORT CmdLen; + USHORT AppLen; + USHORT PifLen; + USHORT CurDirectoryLen; + USHORT CurDrive; + USHORT VDMState; +} CSRSS_CHECK_VDM, *PCSRSS_CHECK_VDM; #define CSR_API_MESSAGE_HEADER_SIZE(Type) (FIELD_OFFSET(CSR_API_MESSAGE, Data) + sizeof(Type)) #define CSRSS_MAX_WRITE_CONSOLE (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE)) @@ -632,6 +699,7 @@ #define SOUND_SENTRY (0x50) #define UPDATE_VDM_ENTRY (0x51) #define GET_VDM_EXIT_CODE (0x52) +#define CHECK_VDM (0x53) /* Keep in sync with definition below. */ #define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS)) @@ -718,6 +786,7 @@ CSRSS_SOUND_SENTRY SoundSentryRequest; CSRSS_UPDATE_VDM_ENTRY UpdateVdmEntry; CSRSS_GET_VDM_EXIT_CODE GetVdmExitCode; + CSRSS_CHECK_VDM CheckVdm; } Data; } CSR_API_MESSAGE, *PCSR_API_MESSAGE;
12 years, 9 months
1
0
0
0
[rharabien] 54985: [SHELL32] - Load shell extensions from Directory key only for file system directories. Fixes New menu being added to special folders context menu (for example My Computer or Cont...
by rharabien@svn.reactos.org
Author: rharabien Date: Mon Jan 16 19:54:24 2012 New Revision: 54985 URL:
http://svn.reactos.org/svn/reactos?rev=54985&view=rev
Log: [SHELL32] - Load shell extensions from Directory key only for file system directories. Fixes New menu being added to special folders context menu (for example My Computer or Control Panel) - Load shell extensions from AllFilesystemObjects only for files and directories - Hardcode special folders attributes in proper place Modified: trunk/reactos/dll/win32/shell32/defcontextmenu.cpp trunk/reactos/dll/win32/shell32/folders/desktop.cpp trunk/reactos/dll/win32/shell32/folders/mycomp.cpp trunk/reactos/dll/win32/shell32/newmenu.cpp trunk/reactos/dll/win32/shell32/shlfolder.cpp Modified: trunk/reactos/dll/win32/shell32/defcontextmenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/defconte…
============================================================================== --- trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] Mon Jan 16 19:54:24 2012 @@ -144,7 +144,7 @@ if (!pdcm->cidl) { - /* Init pidlFolder only if is background context menu. See IShellExtInit::Initialize */ + /* Init pidlFolder only if it is background context menu. See IShellExtInit::Initialize */ if (pdcm->pidlFolder) m_pidlFolder = ILClone(pdcm->pidlFolder); else @@ -513,7 +513,7 @@ TRACE("BuildBackgroundContextMenu entered\n"); - if (!_ILIsDesktop(m_Dcm.pidlFolder)) + if (!_ILIsDesktop(m_pidlFolder)) { WCHAR wszBuf[MAX_PATH]; @@ -552,18 +552,24 @@ DisablePasteOptions(hMenu); } - /* Load context menu handlers */ - HKEY hKey; - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory\\Background", 0, KEY_READ, &hKey) == ERROR_SUCCESS) - { - EnumerateDynamicContextHandlerForKey(hKey); - RegCloseKey(hKey); - } - - if (InsertMenuItemsOfDynamicContextMenuExtension(hMenu, GetMenuItemCount(hMenu) - 1, iIdCmdFirst, iIdCmdLast)) - { - /* seperate dynamic context menu items */ - _InsertMenuItemW(hMenu, GetMenuItemCount(hMenu) - 1, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED); + /* Directory is progid of filesystem folders only */ + LPITEMIDLIST pidlFolderLast = ILFindLastID(m_pidlFolder); + if (_ILIsDesktop(pidlFolderLast) || _ILIsDrive(pidlFolderLast) || _ILIsFolder(pidlFolderLast)) + { + /* Load context menu handlers */ + TRACE("Add background handlers: %p\n", m_pidlFolder); + HKEY hKey; + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory\\Background", 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + EnumerateDynamicContextHandlerForKey(hKey); + RegCloseKey(hKey); + } + + if (InsertMenuItemsOfDynamicContextMenuExtension(hMenu, GetMenuItemCount(hMenu) - 1, iIdCmdFirst, iIdCmdLast)) + { + /* seperate dynamic context menu items */ + _InsertMenuItemW(hMenu, GetMenuItemCount(hMenu) - 1, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED); + } } return iIdCmdLast; @@ -795,24 +801,30 @@ rfg = 0; } - if ((rfg & SFGAO_FOLDER) || _ILIsControlPanel(m_Dcm.apidl[0])) + if (rfg & SFGAO_FOLDER) { /* add the default verbs open / explore */ AddStaticEntryForFileClass(L"Folder"); - AddStaticEntryForFileClass(L"Directory"); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Folder", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { EnumerateDynamicContextHandlerForKey(hKey); RegCloseKey(hKey); } - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory", 0, KEY_READ, &hKey) == ERROR_SUCCESS) - { - EnumerateDynamicContextHandlerForKey(hKey); - RegCloseKey(hKey); - } - } - - if (rfg & SFGAO_FILESYSTEM) + + /* Directory is only loaded for real filesystem directories */ + if (_ILIsFolder(m_Dcm.apidl[0])) + { + AddStaticEntryForFileClass(L"Directory"); + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory", 0, KEY_READ, &hKey) == ERROR_SUCCESS) + { + EnumerateDynamicContextHandlerForKey(hKey); + RegCloseKey(hKey); + } + } + } + + /* AllFilesystemObjects class is loaded only for files and directories */ + if (_ILIsFolder(m_Dcm.apidl[0]) || _ILIsValue(m_Dcm.apidl[0])) { if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"AllFilesystemObjects", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { Modified: trunk/reactos/dll/win32/shell32/folders/desktop.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/desktop.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/desktop.cpp [iso-8859-1] Mon Jan 16 19:54:24 2012 @@ -540,17 +540,18 @@ { HRESULT hr = S_OK; static const DWORD dwDesktopAttributes = - SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | - SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER; + SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | + SFGAO_STORAGEANCESTOR | SFGAO_HASPROPSHEET | SFGAO_STORAGE | SFGAO_CANLINK; static const DWORD dwMyComputerAttributes = - SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | - SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER; + SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | + SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK; + static DWORD dwMyNetPlacesAttributes = + SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | + SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK; TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0); - if (!rgfInOut) - return E_INVALIDARG; if (cidl && !apidl) return E_INVALIDARG; @@ -558,23 +559,21 @@ *rgfInOut = ~0; if(cidl == 0) - { *rgfInOut &= dwDesktopAttributes; - } else { - while (cidl > 0 && *apidl) + /* TODO: always add SFGAO_CANLINK */ + for (UINT i = 0; i < cidl; ++i) { pdump(*apidl); if (_ILIsDesktop(*apidl)) *rgfInOut &= dwDesktopAttributes; - else if (_ILIsMyComputer(*apidl)) + else if (_ILIsMyComputer(apidl[i])) *rgfInOut &= dwMyComputerAttributes; + else if (_ILIsNetHood(apidl[i])) + *rgfInOut &= dwMyNetPlacesAttributes; else - SHELL32_GetItemAttributes((IShellFolder *)this, *apidl, rgfInOut); - - apidl++; - cidl--; + SHELL32_GetItemAttributes((IShellFolder *)this, apidl[i], rgfInOut); } } /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */ Modified: trunk/reactos/dll/win32/shell32/folders/mycomp.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
============================================================================== --- trunk/reactos/dll/win32/shell32/folders/mycomp.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/mycomp.cpp [iso-8859-1] Mon Jan 16 19:54:24 2012 @@ -365,39 +365,48 @@ */ HRESULT WINAPI CDrivesFolder::GetAttributesOf(UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut) { - HRESULT hr = S_OK; static const DWORD dwComputerAttributes = - SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR | SFGAO_CANCOPY | - SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE; + SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | + SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK; + static const DWORD dwControlPanelAttributes = + SFGAO_HASSUBFOLDER | SFGAO_FOLDER | SFGAO_CANLINK; + static const DWORD dwDriveAttributes = + SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | + SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANRENAME | SFGAO_CANLINK; TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0); - if (!rgfInOut) - return E_INVALIDARG; if (cidl && !apidl) return E_INVALIDARG; if (*rgfInOut == 0) *rgfInOut = ~0; + /* FIXME: always add SFGAO_CANLINK */ if(cidl == 0) *rgfInOut &= dwComputerAttributes; else { - while (cidl > 0 && *apidl) + for (UINT i = 0; i < cidl; ++i) { - pdump (*apidl); - SHELL32_GetItemAttributes (this, *apidl, rgfInOut); - apidl++; - cidl--; + if (_ILIsDrive(apidl[i])) + *rgfInOut &= dwDriveAttributes; + else if (_ILIsControlPanel(apidl[i])) + *rgfInOut &= dwControlPanelAttributes; + else + { + pdump(apidl[i]); + SHELL32_GetItemAttributes(this, apidl[i], rgfInOut); + } } } + /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */ *rgfInOut &= ~SFGAO_VALIDATE; TRACE ("-- result=0x%08x\n", *rgfInOut); - return hr; + return S_OK; } /************************************************************************** Modified: trunk/reactos/dll/win32/shell32/newmenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/newmenu.…
============================================================================== --- trunk/reactos/dll/win32/shell32/newmenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/newmenu.cpp [iso-8859-1] Mon Jan 16 19:54:24 2012 @@ -643,6 +643,7 @@ CNewMenu::Initialize(LPCITEMIDLIST pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) { + /* Load folder and shortcut icons */ HICON hIcon = (HICON)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IDI_SHELL_FOLDER), IMAGE_ICON, 0, 0, LR_SHARED); m_hbmFolder = hIcon ? IconToBitmap(hIcon) : NULL; hIcon = (HICON)LoadImage(shell32_hInstance, MAKEINTRESOURCE(IDI_SHELL_SHORTCUT), IMAGE_ICON, 0, 0, LR_SHARED); Modified: trunk/reactos/dll/win32/shell32/shlfolder.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfolde…
============================================================================== --- trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] Mon Jan 16 19:54:24 2012 @@ -397,17 +397,7 @@ dwAttributes = *pdwAttributes; - /* Attributes of some special folders are hardcoded */ - if (_ILIsDrive(pidl)) - *pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR| - SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME; - else if (_ILIsMyComputer(pidl) || _ILIsNetHood(pidl)) - *pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR| - SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANDELETE| - SFGAO_CANRENAME|SFGAO_CANLINK; - else if (_ILIsControlPanel(pidl)) - *pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_CANLINK; - else if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes)) + if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes)) *pdwAttributes = dwAttributes; else if (_ILGetDataPointer(pidl)) {
12 years, 9 months
1
0
0
0
[iut2011] 54984: [MMC] Fix wrong IDs due to code generation error
by iut2011@svn.reactos.org
Author: iut2011 Date: Mon Jan 16 11:01:37 2012 New Revision: 54984 URL:
http://svn.reactos.org/svn/reactos?rev=54984&view=rev
Log: [MMC] Fix wrong IDs due to code generation error Modified: branches/iut-mmc/lib/sdk/mmc/mmciid.c Modified: branches/iut-mmc/lib/sdk/mmc/mmciid.c URL:
http://svn.reactos.org/svn/reactos/branches/iut-mmc/lib/sdk/mmc/mmciid.c?re…
============================================================================== --- branches/iut-mmc/lib/sdk/mmc/mmciid.c [iso-8859-1] (original) +++ branches/iut-mmc/lib/sdk/mmc/mmciid.c [iso-8859-1] Mon Jan 16 11:01:37 2012 @@ -21,97 +21,97 @@ #include "windef.h" #include "initguid.h" -DEFINE_GUID(CLSID_Application, 0x49b2791a, 0xb1ae, 0x4c90, 0x9b, 0x8e ,0xe8, 0x60, 0x60, 0xba, 0x7, 0xf8); -DEFINE_GUID(CLSID_ConsolePower, 0xf0285374, 0xdff1, 0x11d3, 0xb4, 0x33 ,00, 0xc0, 0xc0, 0x4f, 0x8e, 0xcd); -DEFINE_GUID(CLSID_ExecutivePlatform, 0xb3fd5602, 0xeb0f, 0x415e, 0x9f, 0x32 ,0x75, 0xda, 0xda, 0x39, 0x1d, 0x6b); -DEFINE_GUID(CLSID_FrameworkSnapInFactory, 0xd5ab5662, 0x131d, 0x453d, 0x88, 0xc8 ,0x9b, 0xba, 0xba, 0x87, 0x50, 0x2a); -DEFINE_GUID(CLSID_MMCVersionInfo, 0xd6fedb1d, 0xcf21, 0x4bd9, 0xaf, 0x3b ,0xc5, 0x46, 0x46, 0x8e, 0x9c, 0x66); -DEFINE_GUID(CLSID_SnapInFailureReporter, 0x4a65d267, 0x1539, 0x4bd1, 0x92, 0x1d ,0x1c, 0x49, 0x49, 0xb3, 0xe5, 0x8e); -DEFINE_GUID(CLSID_WaitDialog, 0x2d11cf10, 0x4fe0, 0x45b2, 0x88, 0xdf ,0x6f, 0xfb, 0xfb, 0xf9, 0x2b, 0xe9); -DEFINE_GUID(DIID_AppEvents, 0xfc7a4252, 0x78ac, 0x4532, 0x8c, 0x5a ,0x56, 0x3c, 0x3c, 0xfe, 0x13, 0x88); -DEFINE_GUID(IID_Column, 0xfd1c5f63, 0x2b16, 0x4d06, 0x9a, 0xb3 ,0xf4, 0x53, 0x53, 0x50, 0xb9, 0x40); -DEFINE_GUID(IID_Columns, 0x383d4d97, 0xfc44, 0x478b, 0xb1, 0x39 ,0x63, 0x23, 0x23, 0xdc, 0x48, 0x61); -DEFINE_GUID(IID_ContextMenu, 0xdab39ce0, 0x25e6, 0x4e07, 0x83, 0x62 ,0xba, 0x9c, 0x9c, 0x95, 0x70, 0x65); -DEFINE_GUID(IID_Document, 0x225120d6, 0x1e0f, 0x40a3, 0x93, 0xfe ,0x10, 0x79, 0x79, 0xe6, 0xa8, 0x1); -DEFINE_GUID(IID_Extension, 0xad4d6ca6, 0x912f, 0x409b, 0xa2, 0x6e ,0x7f, 0xd2, 0xd2, 0x34, 0xae, 0xf5); -DEFINE_GUID(IID_Extensions, 0x82dbea43, 0x8ca4, 0x44bc, 0xa2, 0xca ,0xd1, 0x87, 0x87, 0x41, 0x5, 0x9e); -DEFINE_GUID(IID_Frame, 0xe5e2d970, 0x5bb3, 0x4306, 0x88, 0x4 ,0xb0, 0x96, 0x96, 0x8a, 0x31, 0xc8); -DEFINE_GUID(IID_IActionsPane, 0xd55cd1d0, 0x1b5, 0x4842, 0xb3, 0x44 ,0xd6, 0x1, 0x1, 0x56, 0x4e, 0xa2); -DEFINE_GUID(IID_IColumnData, 0x547c1354, 0x24d, 0x11d3, 0xa7, 0x7 ,00, 0xc0, 0xc0, 0x4f, 0x8e, 0xf4); -DEFINE_GUID(IID_IComponent, 0x43136eb2, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 0xaa, 00, 0xa8, 00); -DEFINE_GUID(IID_IComponent2, 0x79a2d615, 0x4a10, 0x4ed4, 0x8c, 0x65 ,0x86, 0x33, 0x33, 0xf9, 0x33, 0x50); -DEFINE_GUID(IID_IComponentData, 0x955ab28a, 0x5218, 0x11d0, 0xa9, 0x85 ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xd5); -DEFINE_GUID(IID_IComponentData2, 0xcca0f2d2, 0x82de, 0x41b5, 0xbf, 0x47 ,0x3b, 0x20, 0x20, 0x76, 0x27, 0x3d); -DEFINE_GUID(IID_IComponentPrivate, 0x734cf88d, 0x4250, 0x470e, 0xba, 0x34 ,0x93, 0xd9, 0xd9, 0x56, 0x12, 0x4f); -DEFINE_GUID(IID_IConsole, 0x43136eb1, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 0xaa, 00, 0xa8, 00); -DEFINE_GUID(IID_IConsole2, 0x103d842a, 0xaa63, 0x11d1, 0xa7, 0xe1 ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xd5); -DEFINE_GUID(IID_IConsole3, 0x4f85efdb, 0xd0e1, 0x498c, 0x8d, 0x4a ,0xd0, 0x10, 0x10, 0xdf, 0xdd, 0x40); -DEFINE_GUID(IID_IConsole4, 0x25f01e57, 0x83c8, 0x4be0, 0xbe, 0x9c ,0xeb, 0x32, 0x32, 0x12, 0xe3, 0xac); -DEFINE_GUID(IID_IConsoleNameSpace, 0xbedeb620, 0xf24d, 0x11cf, 0x8a, 0xfc ,00, 0xaa, 0xaa, 00, 0x3c, 0xa9); -DEFINE_GUID(IID_IConsoleNameSpace2, 0x255f18cc, 0x65db, 0x11d1, 0xa7, 0xdc ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xd5); -DEFINE_GUID(IID_IConsolePower, 0x1cfbdd0e, 0x62ca, 0x49ce, 0xa3, 0xaf ,0xdb, 0xb2, 0xb2, 0xde, 0x61, 0xb0); -DEFINE_GUID(IID_IConsolePowerSink, 0x3333759f, 0xfe4f, 0x4975, 0xb1, 0x43 ,0xfe, 0xc0, 0xc0, 0xa5, 0xdd, 0x6d); -DEFINE_GUID(IID_IConsoleVerb, 0xe49f7a60, 0x74af, 0x11d0, 0xa2, 0x86 ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xfe); -DEFINE_GUID(IID_IContextMenuCallback, 0x43136eb7, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 0xaa, 00, 0xa8, 00); -DEFINE_GUID(IID_IContextMenuCallback2, 0xe178bc0e, 0x2ed0, 0x4b5e, 0x80, 0x97 ,0x42, 0xc9, 0xc9, 0x8, 0x7e, 0x8b); -DEFINE_GUID(IID_IContextMenuProvider, 0x43136eb6, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 0xaa, 00, 0xa8, 00); -DEFINE_GUID(IID_IControlbar, 0x69fb811e, 0x6c1c, 0x11d0, 0xa2, 0xcb ,00, 0xc0, 0xc0, 0x4f, 0xd9, 0x9); -DEFINE_GUID(IID_ICustomInitializationWizard, 0x15363ca4, 0xe235, 0x44f2, 0x87, 0x8c ,0xc5, 0xe6, 0xe6, 0x5b, 0xc3, 0x42); -DEFINE_GUID(IID_IDisplayHelp, 0xcc593830, 0xb926, 0x11d1, 0x80, 0x63 ,00, 00, 00, 0xf8, 0x75, 0xa9); -DEFINE_GUID(IID_IEnumTASK, 0x338698b1, 0x5a02, 0x11d1, 0x9f, 0xec ,00, 0x60, 0x60, 0x8, 0x32, 0xdb); -DEFINE_GUID(IID_IExecutivePlatform, 0x8d0203ce, 0xd4f9, 0x4641, 0x95, 0x58 ,0xd9, 0xb1, 0xb1, 0xc1, 0x8f, 0xa9); -DEFINE_GUID(IID_IExtendActionsPane, 0xc60ce72c, 0xe13b, 0x4775, 0xbc, 0x1d ,0xc8, 0x33, 0x33, 0xf6, 0xea, 0x1e); -DEFINE_GUID(IID_IExtendContextMenu, 0x4f3b7a4f, 0xcfac, 0x11cf, 0xb8, 0xe3 ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xd5); -DEFINE_GUID(IID_IExtendControlbar, 0x49506520, 0x6f40, 0x11d0, 0xa9, 0x8b ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xd5); -DEFINE_GUID(IID_IExtendPropertySheet, 0x85de64dc, 0xef21, 0x11cf, 0xa2, 0x85 ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xdb); -DEFINE_GUID(IID_IExtendPropertySheet2, 0xb7a87232, 0x4a51, 0x11d1, 0xa7, 0xea ,00, 0xc0, 0xc0, 0x4f, 0xd9, 0x9); -DEFINE_GUID(IID_IExtendPropertySheetPrivate, 0x27aea402, 0x2c17, 0x4a18, 0xb0, 0x17 ,0xe5, 0xa6, 0xa6, 0xea, 0x63, 0xc6); -DEFINE_GUID(IID_IExtendTaskPad, 0x8dee6511, 0x554d, 0x11d1, 0x9f, 0xea ,00, 0x60, 0x60, 0x8, 0x32, 0xdb); -DEFINE_GUID(IID_IExtendView, 0x89995cee, 0xd2ed, 0x4c0e, 0xae, 0x5e ,0xdf, 0x7e, 0x7e, 0x76, 0xf3, 0xfa); -DEFINE_GUID(IID_IFormHost, 0xb5f3b64d, 0xb22e, 0x4ea4, 0x9b, 0x98 ,0x53, 0x1, 0x1, 0x6f, 0x1a, 0x7a); -DEFINE_GUID(IID_IFormViewAccessibility, 0xe693927, 0xc23f, 0x41b0, 0x95, 0x19 ,0xd9, 0x30, 0x30, 0x57, 0x25, 0x47); -DEFINE_GUID(IID_IHeaderCtrl, 0x43136eb3, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 0xaa, 00, 0xa8, 00); -DEFINE_GUID(IID_IHeaderCtrl2, 0x9757abb8, 0x1b32, 0x11d1, 0xa7, 0xce ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xd5); -DEFINE_GUID(IID_IImageList, 0x43136eb8, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 0xaa, 00, 0xa8, 00); -DEFINE_GUID(IID_IMMCVersionInfo, 0xa8d2c5fe, 0xcdcb, 0x4b9d, 0xbd, 0xe5 ,0xa2, 0x73, 0x73, 0x43, 0xff, 0x54); +DEFINE_GUID(CLSID_Application, 0x49b2791a, 0xb1ae, 0x4c90, 0x9b, 0x8e ,0xe8, 0x60, 0xba, 0x7, 0xf8, 0x89); +DEFINE_GUID(CLSID_ConsolePower, 0xf0285374, 0xdff1, 0x11d3, 0xb4, 0x33 ,00, 0xc0, 0x4f, 0x8e, 0xcd, 0x78); +DEFINE_GUID(CLSID_ExecutivePlatform, 0xb3fd5602, 0xeb0f, 0x415e, 0x9f, 0x32 ,0x75, 0xda, 0x39, 0x1d, 0x6b, 0xf9); +DEFINE_GUID(CLSID_FrameworkSnapInFactory, 0xd5ab5662, 0x131d, 0x453d, 0x88, 0xc8 ,0x9b, 0xba, 0x87, 0x50, 0x2a, 0xde); +DEFINE_GUID(CLSID_MMCVersionInfo, 0xd6fedb1d, 0xcf21, 0x4bd9, 0xaf, 0x3b ,0xc5, 0x46, 0x8e, 0x9c, 0x66, 0x84); +DEFINE_GUID(CLSID_SnapInFailureReporter, 0x4a65d267, 0x1539, 0x4bd1, 0x92, 0x1d ,0x1c, 0x49, 0xb3, 0xe5, 0x8e, 0xb7); +DEFINE_GUID(CLSID_WaitDialog, 0x2d11cf10, 0x4fe0, 0x45b2, 0x88, 0xdf ,0x6f, 0xfb, 0xf9, 0x2b, 0xe9, 0xab); +DEFINE_GUID(DIID_AppEvents, 0xfc7a4252, 0x78ac, 0x4532, 0x8c, 0x5a ,0x56, 0x3c, 0xfe, 0x13, 0x88, 0x63); +DEFINE_GUID(IID_Column, 0xfd1c5f63, 0x2b16, 0x4d06, 0x9a, 0xb3 ,0xf4, 0x53, 0x50, 0xb9, 0x40, 0xab); +DEFINE_GUID(IID_Columns, 0x383d4d97, 0xfc44, 0x478b, 0xb1, 0x39 ,0x63, 0x23, 0xdc, 0x48, 0x61, 0x1c); +DEFINE_GUID(IID_ContextMenu, 0xdab39ce0, 0x25e6, 0x4e07, 0x83, 0x62 ,0xba, 0x9c, 0x95, 0x70, 0x65, 0x45); +DEFINE_GUID(IID_Document, 0x225120d6, 0x1e0f, 0x40a3, 0x93, 0xfe ,0x10, 0x79, 0xe6, 0xa8, 0x1, 0x7b); +DEFINE_GUID(IID_Extension, 0xad4d6ca6, 0x912f, 0x409b, 0xa2, 0x6e ,0x7f, 0xd2, 0x34, 0xae, 0xf5, 0x42); +DEFINE_GUID(IID_Extensions, 0x82dbea43, 0x8ca4, 0x44bc, 0xa2, 0xca ,0xd1, 0x87, 0x41, 0x5, 0x9e, 0xc8); +DEFINE_GUID(IID_Frame, 0xe5e2d970, 0x5bb3, 0x4306, 0x88, 0x4 ,0xb0, 0x96, 0x8a, 0x31, 0xc8, 0xe6); +DEFINE_GUID(IID_IActionsPane, 0xd55cd1d0, 0x1b5, 0x4842, 0xb3, 0x44 ,0xd6, 0x1, 0x56, 0x4e, 0xa2, 0xf5); +DEFINE_GUID(IID_IColumnData, 0x547c1354, 0x24d, 0x11d3, 0xa7, 0x7 ,00, 0xc0, 0x4f, 0x8e, 0xf4, 0xcb); +DEFINE_GUID(IID_IComponent, 0x43136eb2, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 00, 0xa8, 00, 0x33); +DEFINE_GUID(IID_IComponent2, 0x79a2d615, 0x4a10, 0x4ed4, 0x8c, 0x65 ,0x86, 0x33, 0xf9, 0x33, 0x50, 0x95); +DEFINE_GUID(IID_IComponentData, 0x955ab28a, 0x5218, 0x11d0, 0xa9, 0x85 ,00, 0xc0, 0x4f, 0xd8, 0xd5, 0x65); +DEFINE_GUID(IID_IComponentData2, 0xcca0f2d2, 0x82de, 0x41b5, 0xbf, 0x47 ,0x3b, 0x20, 0x76, 0x27, 0x3d, 0x5c); +DEFINE_GUID(IID_IComponentPrivate, 0x734cf88d, 0x4250, 0x470e, 0xba, 0x34 ,0x93, 0xd9, 0x56, 0x12, 0x4f, 0x3e); +DEFINE_GUID(IID_IConsole, 0x43136eb1, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 00, 0xa8, 00, 0x33); +DEFINE_GUID(IID_IConsole2, 0x103d842a, 0xaa63, 0x11d1, 0xa7, 0xe1 ,00, 0xc0, 0x4f, 0xd8, 0xd5, 0x65); +DEFINE_GUID(IID_IConsole3, 0x4f85efdb, 0xd0e1, 0x498c, 0x8d, 0x4a ,0xd0, 0x10, 0xdf, 0xdd, 0x40, 0x4f); +DEFINE_GUID(IID_IConsole4, 0x25f01e57, 0x83c8, 0x4be0, 0xbe, 0x9c ,0xeb, 0x32, 0x12, 0xe3, 0xac, 0xe7); +DEFINE_GUID(IID_IConsoleNameSpace, 0xbedeb620, 0xf24d, 0x11cf, 0x8a, 0xfc ,00, 0xaa, 00, 0x3c, 0xa9, 0xf6); +DEFINE_GUID(IID_IConsoleNameSpace2, 0x255f18cc, 0x65db, 0x11d1, 0xa7, 0xdc ,00, 0xc0, 0x4f, 0xd8, 0xd5, 0x65); +DEFINE_GUID(IID_IConsolePower, 0x1cfbdd0e, 0x62ca, 0x49ce, 0xa3, 0xaf ,0xdb, 0xb2, 0xde, 0x61, 0xb0, 0x68); +DEFINE_GUID(IID_IConsolePowerSink, 0x3333759f, 0xfe4f, 0x4975, 0xb1, 0x43 ,0xfe, 0xc0, 0xa5, 0xdd, 0x6d, 0x65); +DEFINE_GUID(IID_IConsoleVerb, 0xe49f7a60, 0x74af, 0x11d0, 0xa2, 0x86 ,00, 0xc0, 0x4f, 0xd8, 0xfe, 0x93); +DEFINE_GUID(IID_IContextMenuCallback, 0x43136eb7, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 00, 0xa8, 00, 0x33); +DEFINE_GUID(IID_IContextMenuCallback2, 0xe178bc0e, 0x2ed0, 0x4b5e, 0x80, 0x97 ,0x42, 0xc9, 0x8, 0x7e, 0x8b, 0x33); +DEFINE_GUID(IID_IContextMenuProvider, 0x43136eb6, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 00, 0xa8, 00, 0x33); +DEFINE_GUID(IID_IControlbar, 0x69fb811e, 0x6c1c, 0x11d0, 0xa2, 0xcb ,00, 0xc0, 0x4f, 0xd9, 0x9, 0xdd); +DEFINE_GUID(IID_ICustomInitializationWizard, 0x15363ca4, 0xe235, 0x44f2, 0x87, 0x8c ,0xc5, 0xe6, 0x5b, 0xc3, 0x42, 0x8a); +DEFINE_GUID(IID_IDisplayHelp, 0xcc593830, 0xb926, 0x11d1, 0x80, 0x63 ,00, 00, 0xf8, 0x75, 0xa9, 0xce); +DEFINE_GUID(IID_IEnumTASK, 0x338698b1, 0x5a02, 0x11d1, 0x9f, 0xec ,00, 0x60, 0x8, 0x32, 0xdb, 0x4a); +DEFINE_GUID(IID_IExecutivePlatform, 0x8d0203ce, 0xd4f9, 0x4641, 0x95, 0x58 ,0xd9, 0xb1, 0xc1, 0x8f, 0xa9, 0xa5); +DEFINE_GUID(IID_IExtendActionsPane, 0xc60ce72c, 0xe13b, 0x4775, 0xbc, 0x1d ,0xc8, 0x33, 0xf6, 0xea, 0x1e, 0xef); +DEFINE_GUID(IID_IExtendContextMenu, 0x4f3b7a4f, 0xcfac, 0x11cf, 0xb8, 0xe3 ,00, 0xc0, 0x4f, 0xd8, 0xd5, 0xb0); +DEFINE_GUID(IID_IExtendControlbar, 0x49506520, 0x6f40, 0x11d0, 0xa9, 0x8b ,00, 0xc0, 0x4f, 0xd8, 0xd5, 0x65); +DEFINE_GUID(IID_IExtendPropertySheet, 0x85de64dc, 0xef21, 0x11cf, 0xa2, 0x85 ,00, 0xc0, 0x4f, 0xd8, 0xdb, 0xe6); +DEFINE_GUID(IID_IExtendPropertySheet2, 0xb7a87232, 0x4a51, 0x11d1, 0xa7, 0xea ,00, 0xc0, 0x4f, 0xd9, 0x9, 0xdd); +DEFINE_GUID(IID_IExtendPropertySheetPrivate, 0x27aea402, 0x2c17, 0x4a18, 0xb0, 0x17 ,0xe5, 0xa6, 0xea, 0x63, 0xc6, 0x88); +DEFINE_GUID(IID_IExtendTaskPad, 0x8dee6511, 0x554d, 0x11d1, 0x9f, 0xea ,00, 0x60, 0x8, 0x32, 0xdb, 0x4a); +DEFINE_GUID(IID_IExtendView, 0x89995cee, 0xd2ed, 0x4c0e, 0xae, 0x5e ,0xdf, 0x7e, 0x76, 0xf3, 0xfa, 0x53); +DEFINE_GUID(IID_IFormHost, 0xb5f3b64d, 0xb22e, 0x4ea4, 0x9b, 0x98 ,0x53, 0x1, 0x6f, 0x1a, 0x7a, 0xae); +DEFINE_GUID(IID_IFormViewAccessibility, 0xe693927, 0xc23f, 0x41b0, 0x95, 0x19 ,0xd9, 0x30, 0x57, 0x25, 0x47, 0xb2); +DEFINE_GUID(IID_IHeaderCtrl, 0x43136eb3, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 00, 0xa8, 00, 0x33); +DEFINE_GUID(IID_IHeaderCtrl2, 0x9757abb8, 0x1b32, 0x11d1, 0xa7, 0xce ,00, 0xc0, 0x4f, 0xd8, 0xd5, 0x65); +DEFINE_GUID(IID_IImageList, 0x43136eb8, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 00, 0xa8, 00, 0x33); +DEFINE_GUID(IID_IMMCVersionInfo, 0xa8d2c5fe, 0xcdcb, 0x4b9d, 0xbd, 0xe5 ,0xa2, 0x73, 0x43, 0xff, 0x54, 0xbc); DEFINE_GUID(IID_IMenuButton, 0x951ed750, 0xd080, 0x11d0, 0xb1, 0x97 ,00, 00, 00, 00, 00, 00); -DEFINE_GUID(IID_IMessageView, 0x80f94174, 0xfccc, 0x11d2, 0xb9, 0x91 ,00, 0xc0, 0xc0, 0x4f, 0x8e, 0xcd); -DEFINE_GUID(IID_INodeProperties, 0x15bc4d24, 0xa522, 0x4406, 0xaa, 0x55 ,0x7, 0x49, 0x49, 0x53, 0x7a, 0x68); -DEFINE_GUID(IID_IPropertySheetCallback, 0x85de64dd, 0xef21, 0x11cf, 0xa2, 0x85 ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xdb); -DEFINE_GUID(IID_IPropertySheetProvider, 0x85de64de, 0xef21, 0x11cf, 0xa2, 0x85 ,00, 0xc0, 0xc0, 0x4f, 0xd8, 0xdb); -DEFINE_GUID(IID_IReportSnapInFailure, 0x1fed3df6, 0x2c3f, 0x461a, 0xba, 0x20 ,0x4b, 0x1d, 0x1d, 0xf6, 0x56, 0x9a); -DEFINE_GUID(IID_IRequiredExtensions, 0x72782d7a, 0xa4a0, 0x11d1, 0xaf, 0xf ,00, 0xc0, 0xc0, 0x4f, 0xb6, 0xdd); -DEFINE_GUID(IID_IResultData, 0x31da5fa0, 0xe0eb, 0x11cf, 0x9f, 0x21 ,00, 0xaa, 0xaa, 00, 0x3c, 0xa9); -DEFINE_GUID(IID_IResultData2, 0xf36e0eb, 0xa7f1, 0x4a81, 0xbe, 0x5a ,0x92, 0x47, 0x47, 0xf7, 0xde, 0x4b); -DEFINE_GUID(IID_IResultData3, 0xaef53ae7, 0x99ae, 0x48b4, 0xa7, 0x80 ,0x26, 0x81, 0x81, 0xcf, 0x40, 0x57); -DEFINE_GUID(IID_IResultDataCompare, 0xe8315a52, 0x7a1a, 0x11d0, 0xa2, 0xd2 ,00, 0xc0, 0xc0, 0x4f, 0xd9, 0x9); -DEFINE_GUID(IID_IResultDataCompareEx, 0x96933476, 0x251, 0x11d3, 0xae, 0xb0 ,00, 0xc0, 0xc0, 0x4f, 0x8e, 0xcd); -DEFINE_GUID(IID_IResultOwnerData, 0x9cb396d8, 0xea83, 0x11d0, 0xae, 0xf1 ,00, 0xc0, 0xc0, 0x4f, 0xb6, 0xdd); -DEFINE_GUID(IID_ISnapInConsoleStatus, 0xfb59d905, 0x555b, 0x4892, 0xac, 0xd1 ,0xbd, 0xb, 0xb, 0x3d, 0xea, 0x73); -DEFINE_GUID(IID_ISnapInFactory, 0x1546faac, 0x79a6, 0x4403, 0x9f, 0xe2 ,0x86, 0x1b, 0x1b, 0x9c, 0x88, 0x45); -DEFINE_GUID(IID_ISnapinAbout, 0x1245208c, 0xa151, 0x11d0, 0xa7, 0xd7 ,00, 0xc0, 0xc0, 0x4f, 0xd9, 0x9); -DEFINE_GUID(IID_ISnapinHelp, 0xa6b15ace, 0xdf59, 0x11d0, 0xa7, 0xdd ,00, 0xc0, 0xc0, 0x4f, 0xd9, 0x9); -DEFINE_GUID(IID_ISnapinHelp2, 0x4861a010, 0x20f9, 0x11d2, 0xa5, 0x10 ,00, 0xc0, 0xc0, 0x4f, 0xb6, 0xdd); -DEFINE_GUID(IID_ISnapinProperties, 0xf7889da9, 0x4a02, 0x4837, 0xbf, 0x89 ,0x1a, 0x6f, 0x6f, 0x2a, 0x2, 0x10); -DEFINE_GUID(IID_ISnapinPropertiesCallback, 0xa50fa2e5, 0x7e61, 0x45eb, 0xa8, 0xd4 ,0x9a, 0x7, 0x7, 0xb3, 0xe8, 0x51); -DEFINE_GUID(IID_IStringTable, 0xde40b7a4, 0xf65, 0x11d2, 0x8e, 0x25 ,00, 0xc0, 0xc0, 0x4f, 0x8e, 0xcd); -DEFINE_GUID(IID_IToolbar, 0x43136eb9, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 0xaa, 00, 0xa8, 00); -DEFINE_GUID(IID_IViewExtensionCallback, 0x34dd928a, 0x7599, 0x41e5, 0x9f, 0x5e ,0xd6, 0xbc, 0xbc, 0x30, 0x62, 0xc2); -DEFINE_GUID(IID_IWaitCursor, 0x7dfcf9be, 0x9a2b, 0x4e32, 0x9e, 0x3e ,0x96, 0x20, 0x20, 0x66, 0x17, 0xb5); -DEFINE_GUID(IID_IWaitDialog, 0x92b4ff02, 0x8e4, 0x40e5, 0xa5, 0xa6 ,0x62, 0x4f, 0x4f, 0x89, 0x70, 0xc1); -DEFINE_GUID(IID_IWaitDialogCancelCallback, 0xbfd57ccb, 0x78f2, 0x4ab8, 0x91, 0x73 ,0x41, 0x54, 0x54, 0xf, 0x51, 0xa3); -DEFINE_GUID(IID_MenuItem, 0x178fad1, 0xb361, 0x4b27, 0x96, 0xad ,0x67, 0xc5, 0xc5, 0x7e, 0xbf, 0x2e); -DEFINE_GUID(IID_Node, 0xf81ed800, 0x7839, 0x4447, 0x94, 0x5d ,0x8e, 0x15, 0x15, 0xda, 0x59, 0xca); -DEFINE_GUID(IID_Nodes, 0x313b01df, 0xb22f, 0x4d42, 0xb1, 0xb8 ,0x48, 0x3c, 0x3c, 0xdc, 0xf5, 0x1d); -DEFINE_GUID(IID_Properties, 0x2886abc2, 0xa425, 0x42b2, 0x91, 0xc6 ,0xe2, 0x5c, 0x5c, 0xe, 0x4, 0x58); -DEFINE_GUID(IID_Property, 0x4600c3a5, 0xe301, 0x41d8, 0xb6, 0xd0 ,0xef, 0x2e, 0x2e, 0x42, 0x12, 0xe0); -DEFINE_GUID(IID_ScopeNamespace, 0xebbb48dc, 0x1a3b, 0x4d86, 0xb7, 0x86 ,0xc2, 0x1b, 0x1b, 0x28, 0x38, 0x90); -DEFINE_GUID(IID_SnapIn, 0x3be910f6, 0x3459, 0x49c6, 0xa1, 0xbb ,0x41, 0xe6, 0xe6, 0xbe, 0x9d, 0xf3); -DEFINE_GUID(IID_SnapIns, 0x2ef3de1d, 0xb12a, 0x49d1, 0x92, 0xc5 ,0xb, 00, 00, 0x79, 0x87, 0x68); -DEFINE_GUID(IID_View, 0x6efc2da2, 0xb38c, 0x457e, 0x9a, 0xbb ,0xed, 0x2d, 0x2d, 0x18, 0x9b, 0x8c); -DEFINE_GUID(IID_Views, 0xd6b8c29d, 0xa1ff, 0x4d72, 0xaa, 0xb0 ,0xe3, 0x81, 0x81, 0xe9, 0xb9, 0x33); -DEFINE_GUID(IID__AppEvents, 0xde46cbdd, 0x53f5, 0x4635, 0xaf, 0x54 ,0x4f, 0xe7, 0xe7, 0x1e, 0x92, 0x3d); -DEFINE_GUID(IID__Application, 0xa3afb9cc, 0xb653, 0x4741, 0x86, 0xab ,0xf0, 0x47, 0x47, 0xe, 0xc1, 0x38); -DEFINE_GUID(IID__EventConnector, 0xc0bccd30, 0xde44, 0x4528, 0x84, 0x3 ,0xa0, 0x5a, 0x5a, 0x6a, 0x1c, 0xc8); -DEFINE_GUID(LIBID_MMC20, 0x8e80422b, 0xcac4, 0x472b, 0xb2, 0x72 ,0x96, 0x35, 0x35, 0xf1, 0xdf, 0xef); -DEFINE_GUID(LIBID_MMCVersionLib, 0x9eecdd85, 0xb715, 0x4188, 0x8a, 0x72 ,0x61, 0x15, 0x15, 0x9a, 0xbd, 0xb8); +DEFINE_GUID(IID_IMessageView, 0x80f94174, 0xfccc, 0x11d2, 0xb9, 0x91 ,00, 0xc0, 0x4f, 0x8e, 0xcd, 0x78); +DEFINE_GUID(IID_INodeProperties, 0x15bc4d24, 0xa522, 0x4406, 0xaa, 0x55 ,0x7, 0x49, 0x53, 0x7a, 0x68, 0x65); +DEFINE_GUID(IID_IPropertySheetCallback, 0x85de64dd, 0xef21, 0x11cf, 0xa2, 0x85 ,00, 0xc0, 0x4f, 0xd8, 0xdb, 0xe6); +DEFINE_GUID(IID_IPropertySheetProvider, 0x85de64de, 0xef21, 0x11cf, 0xa2, 0x85 ,00, 0xc0, 0x4f, 0xd8, 0xdb, 0xe6); +DEFINE_GUID(IID_IReportSnapInFailure, 0x1fed3df6, 0x2c3f, 0x461a, 0xba, 0x20 ,0x4b, 0x1d, 0xf6, 0x56, 0x9a, 0x9b); +DEFINE_GUID(IID_IRequiredExtensions, 0x72782d7a, 0xa4a0, 0x11d1, 0xaf, 0xf ,00, 0xc0, 0x4f, 0xb6, 0xdd, 0x2c); +DEFINE_GUID(IID_IResultData, 0x31da5fa0, 0xe0eb, 0x11cf, 0x9f, 0x21 ,00, 0xaa, 00, 0x3c, 0xa9, 0xf6); +DEFINE_GUID(IID_IResultData2, 0xf36e0eb, 0xa7f1, 0x4a81, 0xbe, 0x5a ,0x92, 0x47, 0xf7, 0xde, 0x4b, 0x1b); +DEFINE_GUID(IID_IResultData3, 0xaef53ae7, 0x99ae, 0x48b4, 0xa7, 0x80 ,0x26, 0x81, 0xcf, 0x40, 0x57, 0x30); +DEFINE_GUID(IID_IResultDataCompare, 0xe8315a52, 0x7a1a, 0x11d0, 0xa2, 0xd2 ,00, 0xc0, 0x4f, 0xd9, 0x9, 0xdd); +DEFINE_GUID(IID_IResultDataCompareEx, 0x96933476, 0x251, 0x11d3, 0xae, 0xb0 ,00, 0xc0, 0x4f, 0x8e, 0xcd, 0x78); +DEFINE_GUID(IID_IResultOwnerData, 0x9cb396d8, 0xea83, 0x11d0, 0xae, 0xf1 ,00, 0xc0, 0x4f, 0xb6, 0xdd, 0x2c); +DEFINE_GUID(IID_ISnapInConsoleStatus, 0xfb59d905, 0x555b, 0x4892, 0xac, 0xd1 ,0xbd, 0xb, 0x3d, 0xea, 0x73, 0xc5); +DEFINE_GUID(IID_ISnapInFactory, 0x1546faac, 0x79a6, 0x4403, 0x9f, 0xe2 ,0x86, 0x1b, 0x9c, 0x88, 0x45, 0x93); +DEFINE_GUID(IID_ISnapinAbout, 0x1245208c, 0xa151, 0x11d0, 0xa7, 0xd7 ,00, 0xc0, 0x4f, 0xd9, 0x9, 0xdd); +DEFINE_GUID(IID_ISnapinHelp, 0xa6b15ace, 0xdf59, 0x11d0, 0xa7, 0xdd ,00, 0xc0, 0x4f, 0xd9, 0x9, 0xdd); +DEFINE_GUID(IID_ISnapinHelp2, 0x4861a010, 0x20f9, 0x11d2, 0xa5, 0x10 ,00, 0xc0, 0x4f, 0xb6, 0xdd, 0x2c); +DEFINE_GUID(IID_ISnapinProperties, 0xf7889da9, 0x4a02, 0x4837, 0xbf, 0x89 ,0x1a, 0x6f, 0x2a, 0x2, 0x10, 0x10); +DEFINE_GUID(IID_ISnapinPropertiesCallback, 0xa50fa2e5, 0x7e61, 0x45eb, 0xa8, 0xd4 ,0x9a, 0x7, 0xb3, 0xe8, 0x51, 0xa8); +DEFINE_GUID(IID_IStringTable, 0xde40b7a4, 0xf65, 0x11d2, 0x8e, 0x25 ,00, 0xc0, 0x4f, 0x8e, 0xcd, 0x78); +DEFINE_GUID(IID_IToolbar, 0x43136eb9, 0xd36c, 0x11cf, 0xad, 0xbc ,00, 0xaa, 00, 0xa8, 00, 0x33); +DEFINE_GUID(IID_IViewExtensionCallback, 0x34dd928a, 0x7599, 0x41e5, 0x9f, 0x5e ,0xd6, 0xbc, 0x30, 0x62, 0xc2, 0xda); +DEFINE_GUID(IID_IWaitCursor, 0x7dfcf9be, 0x9a2b, 0x4e32, 0x9e, 0x3e ,0x96, 0x20, 0x66, 0x17, 0xb5, 0xed); +DEFINE_GUID(IID_IWaitDialog, 0x92b4ff02, 0x8e4, 0x40e5, 0xa5, 0xa6 ,0x62, 0x4f, 0x89, 0x70, 0xc1, 0x16); +DEFINE_GUID(IID_IWaitDialogCancelCallback, 0xbfd57ccb, 0x78f2, 0x4ab8, 0x91, 0x73 ,0x41, 0x54, 0xf, 0x51, 0xa3, 0x9d); +DEFINE_GUID(IID_MenuItem, 0x178fad1, 0xb361, 0x4b27, 0x96, 0xad ,0x67, 0xc5, 0x7e, 0xbf, 0x2e, 0x1d); +DEFINE_GUID(IID_Node, 0xf81ed800, 0x7839, 0x4447, 0x94, 0x5d ,0x8e, 0x15, 0xda, 0x59, 0xca, 0x55); +DEFINE_GUID(IID_Nodes, 0x313b01df, 0xb22f, 0x4d42, 0xb1, 0xb8 ,0x48, 0x3c, 0xdc, 0xf5, 0x1d, 0x35); +DEFINE_GUID(IID_Properties, 0x2886abc2, 0xa425, 0x42b2, 0x91, 0xc6 ,0xe2, 0x5c, 0xe, 0x4, 0x58, 0x1c); +DEFINE_GUID(IID_Property, 0x4600c3a5, 0xe301, 0x41d8, 0xb6, 0xd0 ,0xef, 0x2e, 0x42, 0x12, 0xe0, 0xca); +DEFINE_GUID(IID_ScopeNamespace, 0xebbb48dc, 0x1a3b, 0x4d86, 0xb7, 0x86 ,0xc2, 0x1b, 0x28, 0x38, 0x90, 0x12); +DEFINE_GUID(IID_SnapIn, 0x3be910f6, 0x3459, 0x49c6, 0xa1, 0xbb ,0x41, 0xe6, 0xbe, 0x9d, 0xf3, 0xea); +DEFINE_GUID(IID_SnapIns, 0x2ef3de1d, 0xb12a, 0x49d1, 0x92, 0xc5 ,0xb, 00, 0x79, 0x87, 0x68, 0xf1); +DEFINE_GUID(IID_View, 0x6efc2da2, 0xb38c, 0x457e, 0x9a, 0xbb ,0xed, 0x2d, 0x18, 0x9b, 0x8c, 0x38); +DEFINE_GUID(IID_Views, 0xd6b8c29d, 0xa1ff, 0x4d72, 0xaa, 0xb0 ,0xe3, 0x81, 0xe9, 0xb9, 0x33, 0x8d); +DEFINE_GUID(IID__AppEvents, 0xde46cbdd, 0x53f5, 0x4635, 0xaf, 0x54 ,0x4f, 0xe7, 0x1e, 0x92, 0x3d, 0x3f); +DEFINE_GUID(IID__Application, 0xa3afb9cc, 0xb653, 0x4741, 0x86, 0xab ,0xf0, 0x47, 0xe, 0xc1, 0x38, 0x4c); +DEFINE_GUID(IID__EventConnector, 0xc0bccd30, 0xde44, 0x4528, 0x84, 0x3 ,0xa0, 0x5a, 0x6a, 0x1c, 0xc8, 0xea); +DEFINE_GUID(LIBID_MMC20, 0x8e80422b, 0xcac4, 0x472b, 0xb2, 0x72 ,0x96, 0x35, 0xf1, 0xdf, 0xef, 0x3b); +DEFINE_GUID(LIBID_MMCVersionLib, 0x9eecdd85, 0xb715, 0x4188, 0x8a, 0x72 ,0x61, 0x15, 0x9a, 0xbd, 0xb8, 0xc4);
12 years, 9 months
1
0
0
0
[akhaldi] 54983: [DDK] * Add fltuser.h
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jan 15 20:29:11 2012 New Revision: 54983 URL:
http://svn.reactos.org/svn/reactos?rev=54983&view=rev
Log: [DDK] * Add fltuser.h Added: trunk/reactos/include/ddk/fltuser.h (with props) Added: trunk/reactos/include/ddk/fltuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/fltuser.h?rev=…
============================================================================== --- trunk/reactos/include/ddk/fltuser.h (added) +++ trunk/reactos/include/ddk/fltuser.h [iso-8859-1] Sun Jan 15 20:29:11 2012 @@ -1,0 +1,298 @@ +/* + * fltuser.h + * + * This file is part of the ReactOS DDK package. + * + * Contributors: + * Amine Khaldi (amine.khaldi(a)reactos.org) + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ +#pragma once + +#ifndef __FLTUSER_H__ +#define __FLTUSER_H__ + +#define FLT_MGR_BASELINE (((OSVER(NTDDI_VERSION) == NTDDI_WIN2K) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WIN2KSP4))) || \ + ((OSVER(NTDDI_VERSION) == NTDDI_WINXP) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WINXPSP2))) || \ + ((OSVER(NTDDI_VERSION) == NTDDI_WS03) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WS03SP1))) || \ + (NTDDI_VERSION >= NTDDI_VISTA)) + +#define FLT_MGR_AFTER_XPSP2 (((OSVER(NTDDI_VERSION) == NTDDI_WIN2K) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WIN2KSP4))) || \ + ((OSVER(NTDDI_VERSION) == NTDDI_WINXP) && (SPVER(NTDDI_VERSION) > SPVER(NTDDI_WINXPSP2))) || \ + ((OSVER(NTDDI_VERSION) == NTDDI_WS03) && (SPVER(NTDDI_VERSION) >= SPVER(NTDDI_WS03SP1))) || \ + (NTDDI_VERSION >= NTDDI_VISTA)) + +#define FLT_MGR_LONGHORN (NTDDI_VERSION >= NTDDI_VISTA) +#define FLT_MGR_WIN7 (NTDDI_VERSION >= NTDDI_WIN7) + +#include <fltuserstructures.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if FLT_MGR_BASELINE + +#if FLT_MGR_LONGHORN +#define FLT_ASSERT(_e) NT_ASSERT(_e) +#define FLT_ASSERTMSG(_m, _e) NT_ASSERTMSG(_m, _e) +#else +#define FLT_ASSERT(_e) ASSERT(_e) +#define FLT_ASSERTMSG(_m, _e) ASSERTMSG(_m, _e) +#endif /* FLT_MGR_LONGHORN */ + +_Must_inspect_result_ +HRESULT +WINAPI +FilterLoad( + _In_ LPCWSTR lpFilterName); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterUnload( + _In_ LPCWSTR lpFilterName); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterCreate( + _In_ LPCWSTR lpFilterName, + _Outptr_ HFILTER *hFilter); + +HRESULT +WINAPI +FilterClose( + _In_ HFILTER hFilter); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterInstanceCreate( + _In_ LPCWSTR lpFilterName, + _In_ LPCWSTR lpVolumeName, + _In_opt_ LPCWSTR lpInstanceName, + _Outptr_ HFILTER_INSTANCE *hInstance); + +HRESULT +WINAPI +FilterInstanceClose( + _In_ HFILTER_INSTANCE hInstance); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterAttach( + _In_ LPCWSTR lpFilterName, + _In_ LPCWSTR lpVolumeName, + _In_opt_ LPCWSTR lpInstanceName , + _In_opt_ DWORD dwCreatedInstanceNameLength , + _Out_writes_bytes_opt_(dwCreatedInstanceNameLength) LPWSTR lpCreatedInstanceName); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterAttachAtAltitude( + _In_ LPCWSTR lpFilterName, + _In_ LPCWSTR lpVolumeName, + _In_ LPCWSTR lpAltitude, + _In_opt_ LPCWSTR lpInstanceName , + _In_opt_ DWORD dwCreatedInstanceNameLength , + _Out_writes_bytes_opt_(dwCreatedInstanceNameLength) LPWSTR lpCreatedInstanceName); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterDetach( + _In_ LPCWSTR lpFilterName, + _In_ LPCWSTR lpVolumeName, + _In_opt_ LPCWSTR lpInstanceName); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterFindFirst( + _In_ FILTER_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned, + _Out_ LPHANDLE lpFilterFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterFindNext( + _In_ HANDLE hFilterFind, + _In_ FILTER_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterFindClose( + _In_ HANDLE hFilterFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterVolumeFindFirst( + _In_ FILTER_VOLUME_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned, + _Out_ PHANDLE lpVolumeFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterVolumeFindNext( + _In_ HANDLE hVolumeFind, + _In_ FILTER_VOLUME_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned); + +HRESULT +WINAPI +FilterVolumeFindClose( + _In_ HANDLE hVolumeFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterInstanceFindFirst( + _In_ LPCWSTR lpFilterName, + _In_ INSTANCE_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned, + _Out_ LPHANDLE lpFilterInstanceFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterInstanceFindNext( + _In_ HANDLE hFilterInstanceFind, + _In_ INSTANCE_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterInstanceFindClose( + _In_ HANDLE hFilterInstanceFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterVolumeInstanceFindFirst( + _In_ LPCWSTR lpVolumeName, + _In_ INSTANCE_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned, + _Out_ LPHANDLE lpVolumeInstanceFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterVolumeInstanceFindNext( + _In_ HANDLE hVolumeInstanceFind, + _In_ INSTANCE_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned); + +HRESULT +WINAPI +FilterVolumeInstanceFindClose( + _In_ HANDLE hVolumeInstanceFind); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterGetInformation( + _In_ HFILTER hFilter, + _In_ FILTER_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterInstanceGetInformation( + _In_ HFILTER_INSTANCE hInstance, + _In_ INSTANCE_INFORMATION_CLASS dwInformationClass, + _Out_writes_bytes_to_(dwBufferSize,*lpBytesReturned) LPVOID lpBuffer, + _In_ DWORD dwBufferSize, + _Out_ LPDWORD lpBytesReturned); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterConnectCommunicationPort( + _In_ LPCWSTR lpPortName, + _In_ DWORD dwOptions, + _In_reads_bytes_opt_(wSizeOfContext) LPCVOID lpContext, + _In_ WORD wSizeOfContext, + _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes , + _Outptr_ HANDLE *hPort); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterSendMessage( + _In_ HANDLE hPort, + _In_reads_bytes_opt_(dwInBufferSize) LPVOID lpInBuffer, + _In_ DWORD dwInBufferSize, + _Out_writes_bytes_to_opt_(dwOutBufferSize,*lpBytesReturned) LPVOID lpOutBuffer, + _In_ DWORD dwOutBufferSize, + _Out_ LPDWORD lpBytesReturned); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterGetMessage( + _In_ HANDLE hPort, + _Out_writes_bytes_(dwMessageBufferSize) PFILTER_MESSAGE_HEADER lpMessageBuffer, + _In_ DWORD dwMessageBufferSize, + _Inout_ LPOVERLAPPED lpOverlapped); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterReplyMessage( + _In_ HANDLE hPort, + _In_reads_bytes_(dwReplyBufferSize) PFILTER_REPLY_HEADER lpReplyBuffer, + _In_ DWORD dwReplyBufferSize); + +_Must_inspect_result_ +HRESULT +WINAPI +FilterGetDosName( + _In_ LPCWSTR lpVolumeName, + _Out_writes_(dwDosNameBufferSize) LPWSTR lpDosName, + _In_ DWORD dwDosNameBufferSize); + +#endif /* FLT_MGR_BASELINE */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __FLTUSER_H__ */ Propchange: trunk/reactos/include/ddk/fltuser.h ------------------------------------------------------------------------------ svn:eol-style = native
12 years, 9 months
1
0
0
0
[akhaldi] 54982: [PORTCLS] * Fix a bug which closed an already invalid handle. * Allow only general registry keys to be deleted. * Do not close a key twice in the error case.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jan 15 20:27:15 2012 New Revision: 54982 URL:
http://svn.reactos.org/svn/reactos?rev=54982&view=rev
Log: [PORTCLS] * Fix a bug which closed an already invalid handle. * Allow only general registry keys to be deleted. * Do not close a key twice in the error case. Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp [iso-8859-1] Sun Jan 15 20:27:15 2012 @@ -31,20 +31,24 @@ } IMP_IRegistryKey; - CRegistryKey(IUnknown * OuterUnknown, HANDLE hKey) : m_hKey(hKey){} + CRegistryKey(IUnknown * OuterUnknown, HANDLE hKey, BOOL CanDelete) : m_hKey(hKey), m_Deleted(FALSE), m_CanDelete(CanDelete), m_Ref(0){} virtual ~CRegistryKey(); protected: HANDLE m_hKey; BOOL m_Deleted; + BOOL m_CanDelete; LONG m_Ref; }; CRegistryKey::~CRegistryKey() { - if (m_hKey) + if (!m_Deleted) + { + // close key only when has not been deleted yet ZwClose(m_hKey); + } } @@ -83,13 +87,22 @@ if (m_Deleted) { - return STATUS_INVALID_HANDLE; - } - + // key already deleted + return STATUS_INVALID_HANDLE; + } + + if (!m_CanDelete) + { + // only general keys can be deleted + return STATUS_ACCESS_DENIED; + } + + // delete key Status = ZwDeleteKey(m_hKey); if (NT_SUCCESS(Status)) { m_Deleted = TRUE; + m_hKey = NULL; } return Status; } @@ -164,7 +177,7 @@ return Status; } - RegistryKey = new(NonPagedPool, TAG_PORTCLASS)CRegistryKey(OuterUnknown, hKey); + RegistryKey = new(NonPagedPool, TAG_PORTCLASS)CRegistryKey(OuterUnknown, hKey, TRUE); if (!RegistryKey) return STATUS_INSUFFICIENT_RESOURCES; @@ -172,7 +185,6 @@ if (!NT_SUCCESS(Status)) { - ZwClose(hKey); delete RegistryKey; return Status; } @@ -278,6 +290,7 @@ PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor; ISubdevice * Device; PSYMBOLICLINK_ENTRY SymEntry; + BOOL CanDelete = FALSE; DPRINT("PcNewRegistryKey entered\n"); @@ -304,6 +317,9 @@ } // try to create the key Status = ZwCreateKey(&hHandle, DesiredAccess, ObjectAttributes, 0, NULL, CreateOptions, Disposition); + + // key can be deleted + CanDelete = TRUE; } else if (RegistryKeyType == DeviceRegistryKey || RegistryKeyType == DriverRegistryKey || @@ -374,7 +390,7 @@ } // allocate new registry key object - RegistryKey = new(NonPagedPool, TAG_PORTCLASS)CRegistryKey(OuterUnknown, hHandle); + RegistryKey = new(NonPagedPool, TAG_PORTCLASS)CRegistryKey(OuterUnknown, hHandle, CanDelete); if (!RegistryKey) { // not enough memory @@ -394,4 +410,3 @@ DPRINT("PcNewRegistryKey result %p\n", *OutRegistryKey); return STATUS_SUCCESS; } -
12 years, 9 months
1
0
0
0
[cgutman] 54981: - Merge r54980 from wlan-bringup
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Jan 15 19:53:52 2012 New Revision: 54981 URL:
http://svn.reactos.org/svn/reactos?rev=54981&view=rev
Log: - Merge r54980 from wlan-bringup Modified: trunk/reactos/ (props changed) trunk/reactos/dll/win32/netcfgx/CMakeLists.txt trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild trunk/reactos/dll/win32/netcfgx/precomp.h trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c Propchange: trunk/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sun Jan 15 19:53:52 2012 @@ -10,4 +10,4 @@ /branches/ros-amd64-bringup/reactos:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882 /branches/shell32_new-bringup:51893-53652,53661,53700 /branches/tcp-rewrite-branch:48720,48840-48841,49424-49426,49454 -/branches/wlan-bringup:54895-54896,54899,54912-54913,54915-54916,54929-54930,54932-54934,54939,54941-54942,54944-54947 +/branches/wlan-bringup:54895-54896,54899,54912-54913,54915-54916,54929-54930,54932-54934,54939,54941-54942,54944-54947,54980 Modified: trunk/reactos/dll/win32/netcfgx/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/CMakeLis…
============================================================================== --- trunk/reactos/dll/win32/netcfgx/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netcfgx/CMakeLists.txt [iso-8859-1] Sun Jan 15 19:53:52 2012 @@ -22,6 +22,6 @@ uuid wine) -add_importlibs(netcfgx rpcrt4 setupapi advapi32 iphlpapi ole32 user32 comctl32 ws2_32 msvcrt kernel32 ntdll) +add_importlibs(netcfgx rpcrt4 setupapi advapi32 iphlpapi dhcpcsvc ole32 user32 comctl32 ws2_32 msvcrt kernel32 ntdll) add_pch(netcfgx precomp.h) add_cd_file(TARGET netcfgx DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/netcfgx.…
============================================================================== --- trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netcfgx/netcfgx.rbuild [iso-8859-1] Sun Jan 15 19:53:52 2012 @@ -8,7 +8,7 @@ <library>advapi32</library> <library>uuid</library> <library>iphlpapi</library> - <library>iphlpapi</library> + <library>dhcpcsvc</library> <library>wine</library> <library>ole32</library> <library>user32</library> Modified: trunk/reactos/dll/win32/netcfgx/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/precomp.…
============================================================================== --- trunk/reactos/dll/win32/netcfgx/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netcfgx/precomp.h [iso-8859-1] Sun Jan 15 19:53:52 2012 @@ -14,6 +14,8 @@ #include <setupapi.h> #include <stdio.h> #include <iphlpapi.h> +#include <dhcpcsdk.h> +#include <dhcpcapi.h> #include <olectl.h> #include <netcfgn.h> #include "resource.h" Modified: trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netcfgx/tcpipcon…
============================================================================== --- trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] Sun Jan 15 19:53:52 2012 @@ -3117,6 +3117,7 @@ WCHAR szBuffer[200]; TcpipSettings * pCurrentConfig, *pOldConfig; ULONG NTEInstance; + DWORD DhcpApiVersion; TcpipConfNotifyImpl * This = impl_from_INetCfgComponentControl(iface); @@ -3197,39 +3198,74 @@ RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", 2 * sizeof(WCHAR)); if (!pOldConfig->DhcpEnabled) { + /* Delete this adapter's current IP address */ DeleteIPAddress(pOldConfig->Ip->NTEContext); - //FIXME - // start dhcp client service for the adapter + + /* Delete all default routes for this adapter */ + dwSize = 0; + if (GetIpForwardTable(NULL, &dwSize, FALSE) == ERROR_INSUFFICIENT_BUFFER) + { + DWORD Index; + PMIB_IPFORWARDTABLE pIpForwardTable = (PMIB_IPFORWARDTABLE)CoTaskMemAlloc(dwSize); + if (pIpForwardTable) + { + if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR) + { + for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++) + { + if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index && + pIpForwardTable->table[Index].dwForwardDest == 0) + { + DeleteIpForwardEntry(&pIpForwardTable->table[Index]); + } + } + } + CoTaskMemFree(pIpForwardTable); + } + } } } else { - if (!pOldConfig->DhcpEnabled) - { + /* Open the DHCP API if DHCP is enabled */ + if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR) + { + /* We have to tell DHCP about this */ + DhcpStaticRefreshParams(pCurrentConfig->Index, + htonl(pCurrentConfig->Ip->IpAddress), + htonl(pCurrentConfig->Ip->u.Subnetmask)); + + /* Close the API */ + DhcpCApiCleanup(); + } + else + { + /* Delete this adapter's current static IP address */ DeleteIPAddress(pOldConfig->Ip->NTEContext); - //TODO - //delete multiple ip addresses when required - } - - //TODO - // add multiple ip addresses when required - if (AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress), htonl(pCurrentConfig->Ip->u.Subnetmask), pCurrentConfig->Index, &pCurrentConfig->Ip->NTEContext, &NTEInstance) == NO_ERROR) - { - pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE); - if(pStr) - { - RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); - CoTaskMemFree(pStr); - } - - pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE); - if(pStr) - { - RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); - CoTaskMemFree(pStr); - } - } - + + /* Add the static IP address via the standard IPHLPAPI function */ + AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress), + htonl(pCurrentConfig->Ip->u.Subnetmask), + pCurrentConfig->Index, + &pCurrentConfig->Ip->NTEContext, + &NTEInstance); + } + + pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE); + if(pStr) + { + RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); + CoTaskMemFree(pStr); + } + + pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE); + if(pStr) + { + RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); + CoTaskMemFree(pStr); + } + + /* Delete all default routes for this adapter */ dwSize = 0; if (GetIpForwardTable(NULL, &dwSize, FALSE) == ERROR_INSUFFICIENT_BUFFER) {
12 years, 9 months
1
0
0
0
[cgutman] 54980: [NETCFGX] - Notify the DHCP service when a static IP address is assigned to an adapter
by cgutman@svn.reactos.org
Author: cgutman Date: Sun Jan 15 19:46:14 2012 New Revision: 54980 URL:
http://svn.reactos.org/svn/reactos?rev=54980&view=rev
Log: [NETCFGX] - Notify the DHCP service when a static IP address is assigned to an adapter Modified: branches/wlan-bringup/dll/win32/netcfgx/CMakeLists.txt branches/wlan-bringup/dll/win32/netcfgx/netcfgx.rbuild branches/wlan-bringup/dll/win32/netcfgx/precomp.h branches/wlan-bringup/dll/win32/netcfgx/tcpipconf_notify.c Modified: branches/wlan-bringup/dll/win32/netcfgx/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/wlan-bringup/dll/win32/netcfgx/…
============================================================================== --- branches/wlan-bringup/dll/win32/netcfgx/CMakeLists.txt [iso-8859-1] (original) +++ branches/wlan-bringup/dll/win32/netcfgx/CMakeLists.txt [iso-8859-1] Sun Jan 15 19:46:14 2012 @@ -22,6 +22,6 @@ uuid wine) -add_importlibs(netcfgx rpcrt4 setupapi advapi32 iphlpapi ole32 user32 comctl32 ws2_32 msvcrt kernel32 ntdll) +add_importlibs(netcfgx rpcrt4 setupapi advapi32 iphlpapi dhcpcsvc ole32 user32 comctl32 ws2_32 msvcrt kernel32 ntdll) add_pch(netcfgx precomp.h) add_cd_file(TARGET netcfgx DESTINATION reactos/system32 FOR all) Modified: branches/wlan-bringup/dll/win32/netcfgx/netcfgx.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/wlan-bringup/dll/win32/netcfgx/…
============================================================================== --- branches/wlan-bringup/dll/win32/netcfgx/netcfgx.rbuild [iso-8859-1] (original) +++ branches/wlan-bringup/dll/win32/netcfgx/netcfgx.rbuild [iso-8859-1] Sun Jan 15 19:46:14 2012 @@ -8,7 +8,7 @@ <library>advapi32</library> <library>uuid</library> <library>iphlpapi</library> - <library>iphlpapi</library> + <library>dhcpcsvc</library> <library>wine</library> <library>ole32</library> <library>user32</library> Modified: branches/wlan-bringup/dll/win32/netcfgx/precomp.h URL:
http://svn.reactos.org/svn/reactos/branches/wlan-bringup/dll/win32/netcfgx/…
============================================================================== --- branches/wlan-bringup/dll/win32/netcfgx/precomp.h [iso-8859-1] (original) +++ branches/wlan-bringup/dll/win32/netcfgx/precomp.h [iso-8859-1] Sun Jan 15 19:46:14 2012 @@ -14,6 +14,8 @@ #include <setupapi.h> #include <stdio.h> #include <iphlpapi.h> +#include <dhcpcsdk.h> +#include <dhcpcapi.h> #include <olectl.h> #include <netcfgn.h> #include "resource.h" Modified: branches/wlan-bringup/dll/win32/netcfgx/tcpipconf_notify.c URL:
http://svn.reactos.org/svn/reactos/branches/wlan-bringup/dll/win32/netcfgx/…
============================================================================== --- branches/wlan-bringup/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] (original) +++ branches/wlan-bringup/dll/win32/netcfgx/tcpipconf_notify.c [iso-8859-1] Sun Jan 15 19:46:14 2012 @@ -3117,6 +3117,7 @@ WCHAR szBuffer[200]; TcpipSettings * pCurrentConfig, *pOldConfig; ULONG NTEInstance; + DWORD DhcpApiVersion; TcpipConfNotifyImpl * This = impl_from_INetCfgComponentControl(iface); @@ -3197,39 +3198,74 @@ RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", 2 * sizeof(WCHAR)); if (!pOldConfig->DhcpEnabled) { + /* Delete this adapter's current IP address */ DeleteIPAddress(pOldConfig->Ip->NTEContext); - //FIXME - // start dhcp client service for the adapter + + /* Delete all default routes for this adapter */ + dwSize = 0; + if (GetIpForwardTable(NULL, &dwSize, FALSE) == ERROR_INSUFFICIENT_BUFFER) + { + DWORD Index; + PMIB_IPFORWARDTABLE pIpForwardTable = (PMIB_IPFORWARDTABLE)CoTaskMemAlloc(dwSize); + if (pIpForwardTable) + { + if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR) + { + for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++) + { + if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index && + pIpForwardTable->table[Index].dwForwardDest == 0) + { + DeleteIpForwardEntry(&pIpForwardTable->table[Index]); + } + } + } + CoTaskMemFree(pIpForwardTable); + } + } } } else { - if (!pOldConfig->DhcpEnabled) - { + /* Open the DHCP API if DHCP is enabled */ + if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR) + { + /* We have to tell DHCP about this */ + DhcpStaticRefreshParams(pCurrentConfig->Index, + htonl(pCurrentConfig->Ip->IpAddress), + htonl(pCurrentConfig->Ip->u.Subnetmask)); + + /* Close the API */ + DhcpCApiCleanup(); + } + else + { + /* Delete this adapter's current static IP address */ DeleteIPAddress(pOldConfig->Ip->NTEContext); - //TODO - //delete multiple ip addresses when required - } - - //TODO - // add multiple ip addresses when required - if (AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress), htonl(pCurrentConfig->Ip->u.Subnetmask), pCurrentConfig->Index, &pCurrentConfig->Ip->NTEContext, &NTEInstance) == NO_ERROR) - { - pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE); - if(pStr) - { - RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); - CoTaskMemFree(pStr); - } - - pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE); - if(pStr) - { - RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); - CoTaskMemFree(pStr); - } - } - + + /* Add the static IP address via the standard IPHLPAPI function */ + AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress), + htonl(pCurrentConfig->Ip->u.Subnetmask), + pCurrentConfig->Index, + &pCurrentConfig->Ip->NTEContext, + &NTEInstance); + } + + pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE); + if(pStr) + { + RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); + CoTaskMemFree(pStr); + } + + pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE); + if(pStr) + { + RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize); + CoTaskMemFree(pStr); + } + + /* Delete all default routes for this adapter */ dwSize = 0; if (GetIpForwardTable(NULL, &dwSize, FALSE) == ERROR_INSUFFICIENT_BUFFER) {
12 years, 9 months
1
0
0
0
[rharabien] 54979: [SHELL32] - Improve code readability in defcontextmenu.cpp - Fix few leaks - Properly handle reference count when creating objects
by rharabien@svn.reactos.org
Author: rharabien Date: Sun Jan 15 19:45:02 2012 New Revision: 54979 URL:
http://svn.reactos.org/svn/reactos?rev=54979&view=rev
Log: [SHELL32] - Improve code readability in defcontextmenu.cpp - Fix few leaks - Properly handle reference count when creating objects Modified: trunk/reactos/dll/win32/shell32/defcontextmenu.cpp trunk/reactos/dll/win32/shell32/drive.cpp trunk/reactos/dll/win32/shell32/fprop.cpp Modified: trunk/reactos/dll/win32/shell32/defcontextmenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/defconte…
============================================================================== --- trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] Sun Jan 15 19:45:02 2012 @@ -24,15 +24,15 @@ UINT iIdCmdFirst; UINT NumIds; CLSID ClassID; - IContextMenu *CMenu; - struct _DynamicShellEntry_ *Next; + IContextMenu *pCM; + struct _DynamicShellEntry_ *pNext; } DynamicShellEntry, *PDynamicShellEntry; typedef struct _StaticShellEntry_ { LPWSTR szVerb; LPWSTR szClass; - struct _StaticShellEntry_ *Next; + struct _StaticShellEntry_ *pNext; } StaticShellEntry, *PStaticShellEntry; class CDefaultContextMenu : @@ -51,15 +51,15 @@ UINT m_iIdSCMFirst; /* first static used id */ UINT m_iIdSCMLast; /* last static used id */ - void AddStaticEntry(const WCHAR *szVerb, const WCHAR *szClass); - void AddStaticEntryForKey(HKEY hKey, const WCHAR *szClass); - void AddStaticEntryForFileClass(const WCHAR *szExt); - BOOL IsShellExtensionAlreadyLoaded(const CLSID *szClass); - HRESULT LoadDynamicContextMenuHandler(HKEY hKey, const CLSID *szClass, BOOL bExternalInit); - UINT EnumerateDynamicContextHandlerForKey(HKEY hRootKey); - UINT InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast); + void AddStaticEntry(LPCWSTR pwszVerb, LPCWSTR pwszClass); + void AddStaticEntryForKey(HKEY hKey, LPCWSTR pwszClass); + void AddStaticEntryForFileClass(LPCWSTR pwszExt); + BOOL IsShellExtensionAlreadyLoaded(const CLSID *pclsid); + HRESULT LoadDynamicContextMenuHandler(HKEY hKey, const CLSID *pclsid); + BOOL EnumerateDynamicContextHandlerForKey(HKEY hRootKey); + UINT InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, UINT IndexMenu, UINT idCmdFirst, UINT idCmdLast); UINT BuildBackgroundContextMenu(HMENU hMenu, UINT iIdCmdFirst, UINT iIdCmdLast, UINT uFlags); - UINT AddStaticContextMenusToMenu(HMENU hMenu, UINT indexMenu); + UINT AddStaticContextMenusToMenu(HMENU hMenu, UINT IndexMenu); UINT BuildShellItemContextMenu(HMENU hMenu, UINT iIdCmdFirst, UINT iIdCmdLast, UINT uFlags); HRESULT DoPaste(LPCMINVOKECOMMANDINFO lpcmi); HRESULT DoOpenOrExplore(LPCMINVOKECOMMANDINFO lpcmi); @@ -107,28 +107,25 @@ CDefaultContextMenu::~CDefaultContextMenu() { - PDynamicShellEntry dEntry, dNext; - PStaticShellEntry sEntry, sNext; - /* Free dynamic shell extension entries */ - dEntry = m_pDynamicEntries; - while (dEntry) - { - dNext = dEntry->Next; - dEntry->CMenu->Release(); - HeapFree(GetProcessHeap(), 0, dEntry); - dEntry = dNext; + PDynamicShellEntry pDynamicEntry = m_pDynamicEntries, pNextDynamic; + while (pDynamicEntry) + { + pNextDynamic = pDynamicEntry->pNext; + pDynamicEntry->pCM->Release(); + HeapFree(GetProcessHeap(), 0, pDynamicEntry); + pDynamicEntry = pNextDynamic; } /* Free static shell extension entries */ - sEntry = m_pStaticEntries; - while (sEntry) - { - sNext = sEntry->Next; - HeapFree(GetProcessHeap(), 0, sEntry->szClass); - HeapFree(GetProcessHeap(), 0, sEntry->szVerb); - HeapFree(GetProcessHeap(), 0, sEntry); - sEntry = sNext; + PStaticShellEntry pStaticEntry = m_pStaticEntries, pNextStatic; + while (pStaticEntry) + { + pNextStatic = pStaticEntry->pNext; + HeapFree(GetProcessHeap(), 0, pStaticEntry->szClass); + HeapFree(GetProcessHeap(), 0, pStaticEntry->szVerb); + HeapFree(GetProcessHeap(), 0, pStaticEntry); + pStaticEntry = pNextStatic; } if (m_pidlFolder) @@ -170,67 +167,60 @@ void CDefaultContextMenu::AddStaticEntry(const WCHAR *szVerb, const WCHAR *szClass) { - PStaticShellEntry curEntry; - PStaticShellEntry lastEntry = NULL; - - curEntry = m_pStaticEntries; - while(curEntry) - { - if (!wcsicmp(curEntry->szVerb, szVerb)) + PStaticShellEntry pEntry = m_pStaticEntries, pLastEntry = NULL; + while(pEntry) + { + if (!wcsicmp(pEntry->szVerb, szVerb)) { /* entry already exists */ return; } - lastEntry = curEntry; - curEntry = curEntry->Next; + pLastEntry = pEntry; + pEntry = pEntry->pNext; } TRACE("adding verb %s szClass %s\n", debugstr_w(szVerb), debugstr_w(szClass)); - curEntry = (StaticShellEntry *)HeapAlloc(GetProcessHeap(), 0, sizeof(StaticShellEntry)); - if (curEntry) - { - curEntry->Next = NULL; - curEntry->szVerb = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(szVerb) + 1) * sizeof(WCHAR)); - if (curEntry->szVerb) - wcscpy(curEntry->szVerb, szVerb); - curEntry->szClass = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(szClass) + 1) * sizeof(WCHAR)); - if (curEntry->szClass) - wcscpy(curEntry->szClass, szClass); + pEntry = (StaticShellEntry *)HeapAlloc(GetProcessHeap(), 0, sizeof(StaticShellEntry)); + if (pEntry) + { + pEntry->pNext = NULL; + pEntry->szVerb = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(szVerb) + 1) * sizeof(WCHAR)); + if (pEntry->szVerb) + wcscpy(pEntry->szVerb, szVerb); + pEntry->szClass = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, (wcslen(szClass) + 1) * sizeof(WCHAR)); + if (pEntry->szClass) + wcscpy(pEntry->szClass, szClass); } if (!wcsicmp(szVerb, L"open")) { /* open verb is always inserted in front */ - curEntry->Next = m_pStaticEntries; - m_pStaticEntries = curEntry; - } - else if (lastEntry) - lastEntry->Next = curEntry; + pEntry->pNext = m_pStaticEntries; + m_pStaticEntries = pEntry; + } + else if (pLastEntry) + pLastEntry->pNext = pEntry; else - m_pStaticEntries = curEntry; + m_pStaticEntries = pEntry; } void CDefaultContextMenu::AddStaticEntryForKey(HKEY hKey, const WCHAR *pwszClass) { - LONG result; - DWORD dwIndex; WCHAR wszName[40]; - DWORD dwSize; + DWORD cchName, dwIndex = 0; TRACE("AddStaticEntryForKey %x %ls\n", hKey, pwszClass); - dwIndex = 0; - do - { - dwSize = sizeof(wszName) / sizeof(WCHAR); - result = RegEnumKeyExW(hKey, dwIndex, wszName, &dwSize, NULL, NULL, NULL, NULL); - if (result == ERROR_SUCCESS) - AddStaticEntry(wszName, pwszClass); - - dwIndex++; - } while(result == ERROR_SUCCESS); + while(TRUE) + { + cchName = _countof(wszName); + if (RegEnumKeyExW(hKey, dwIndex++, wszName, &cchName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + break; + + AddStaticEntry(wszName, pwszClass); + } } void @@ -303,28 +293,28 @@ BOOL HasClipboardData() { - BOOL ret = FALSE; - IDataObject * pda; - - if(SUCCEEDED(OleGetClipboard(&pda))) + BOOL bRet = FALSE; + IDataObject *pDataObj; + + if(SUCCEEDED(OleGetClipboard(&pDataObj))) { STGMEDIUM medium; FORMATETC formatetc; - TRACE("pda=%p\n", pda); + TRACE("pDataObj=%p\n", pDataObj); /* Set the FORMATETC structure*/ InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_SHELLIDLIST), TYMED_HGLOBAL); - if(SUCCEEDED(pda->GetData(&formatetc, &medium))) - { - ret = TRUE; + if(SUCCEEDED(pDataObj->GetData(&formatetc, &medium))) + { + bRet = TRUE; ReleaseStgMedium(&medium); } - pda->Release(); - } - - return ret; + pDataObj->Release(); + } + + return bRet; } static @@ -342,188 +332,173 @@ } BOOL -CDefaultContextMenu::IsShellExtensionAlreadyLoaded(const CLSID * szClass) -{ - PDynamicShellEntry curEntry = m_pDynamicEntries; - - while(curEntry) - { - if (!memcmp(&curEntry->ClassID, szClass, sizeof(CLSID))) +CDefaultContextMenu::IsShellExtensionAlreadyLoaded(const CLSID *pclsid) +{ + PDynamicShellEntry pEntry = m_pDynamicEntries; + + while (pEntry) + { + if (!memcmp(&pEntry->ClassID, pclsid, sizeof(CLSID))) return TRUE; - curEntry = curEntry->Next; - } + pEntry = pEntry->pNext; + } + return FALSE; } - -HRESULT -CDefaultContextMenu::LoadDynamicContextMenuHandler(HKEY hKey, const CLSID *pClass, BOOL bExternalInit) +HRESULT +CDefaultContextMenu::LoadDynamicContextMenuHandler(HKEY hKey, const CLSID *pclsid) { HRESULT hr; - IContextMenu *cmobj; - IShellExtInit *shext; - PDynamicShellEntry curEntry; - LPOLESTR pstr; - - StringFromCLSID(*pClass, &pstr); - - TRACE("LoadDynamicContextMenuHandler entered with This %p hKey %p pClass %s bExternalInit %u\n", this, hKey, wine_dbgstr_guid(pClass), bExternalInit); - - if (IsShellExtensionAlreadyLoaded(pClass)) + + TRACE("LoadDynamicContextMenuHandler entered with This %p hKey %p pclsid %s\n", this, hKey, wine_dbgstr_guid(pclsid)); + + if (IsShellExtensionAlreadyLoaded(pclsid)) return S_OK; - hr = SHCoCreateInstance(NULL, pClass, NULL, IID_IContextMenu, (void**)&cmobj); + IContextMenu *pcm; + hr = SHCoCreateInstance(NULL, pclsid, NULL, IID_IContextMenu, (void**)&pcm); if (hr != S_OK) { ERR("SHCoCreateInstance failed %x\n", GetLastError()); return hr; } - if (bExternalInit) - { - hr = cmobj->QueryInterface(IID_IShellExtInit, (void**)&shext); - if (hr != S_OK) - { - ERR("Failed to query for interface IID_IShellExtInit hr %x pClass %s\n", hr, wine_dbgstr_guid(pClass)); - cmobj->Release(); - return hr; - } - - hr = shext->Initialize(m_pidlFolder, m_pDataObj, hKey); - shext->Release(); - if (hr != S_OK) - { - TRACE("Failed to initialize shell extension error %x pClass %s\n", hr, wine_dbgstr_guid(pClass)); - cmobj->Release(); - return hr; - } - } - - curEntry = (DynamicShellEntry *)HeapAlloc(GetProcessHeap(), 0, sizeof(DynamicShellEntry)); - if(!curEntry) - { - cmobj->Release(); + IShellExtInit *pExtInit; + hr = pcm->QueryInterface(IID_IShellExtInit, (void**)&pExtInit); + if (hr != S_OK) + { + ERR("Failed to query for interface IID_IShellExtInit hr %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid)); + pcm->Release(); + return hr; + } + + hr = pExtInit->Initialize(m_pidlFolder, m_pDataObj, hKey); + pExtInit->Release(); + if (hr != S_OK) + { + TRACE("Failed to initialize shell extension error %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid)); + pcm->Release(); + return hr; + } + + PDynamicShellEntry pEntry = (DynamicShellEntry *)HeapAlloc(GetProcessHeap(), 0, sizeof(DynamicShellEntry)); + if (!pEntry) + { + pcm->Release(); return E_OUTOFMEMORY; } - curEntry->iIdCmdFirst = 0; - curEntry->Next = NULL; - curEntry->NumIds = 0; - curEntry->CMenu = cmobj; - memcpy(&curEntry->ClassID, pClass, sizeof(CLSID)); + pEntry->iIdCmdFirst = 0; + pEntry->pNext = NULL; + pEntry->NumIds = 0; + pEntry->pCM = pcm; + memcpy(&pEntry->ClassID, pclsid, sizeof(CLSID)); if (m_pDynamicEntries) { - PDynamicShellEntry pEntry = m_pDynamicEntries; - - while (pEntry->Next) - pEntry = pEntry->Next; - - pEntry->Next = curEntry; + PDynamicShellEntry pLastEntry = m_pDynamicEntries; + + while (pLastEntry->pNext) + pLastEntry = pLastEntry->pNext; + + pLastEntry->pNext = pEntry; } else - m_pDynamicEntries = curEntry; - - return hr; -} - -UINT + m_pDynamicEntries = pEntry; + + return S_OK; +} + +BOOL CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(HKEY hRootKey) { - WCHAR szKey[MAX_PATH] = {0}; - WCHAR szName[MAX_PATH] = {0}; - DWORD dwIndex, dwName; - LONG res; - HRESULT hResult; - UINT index; - CLSID clsid; + + WCHAR wszName[MAX_PATH], wszBuf[MAX_PATH], *pwszClsid; + DWORD cchName; + HRESULT hr; HKEY hKey; if (RegOpenKeyExW(hRootKey, L"shellex\\ContextMenuHandlers", 0, KEY_READ, &hKey) != ERROR_SUCCESS) { - TRACE("RegOpenKeyExW failed for key %s\n", debugstr_w(szKey)); - return 0; - } - - dwIndex = 0; - index = 0; - do - { - dwName = MAX_PATH; - res = RegEnumKeyExW(hKey, dwIndex, szName, &dwName, NULL, NULL, NULL, NULL); - if (res == ERROR_SUCCESS) - { - hResult = CLSIDFromString(szName, &clsid); - if (hResult != S_OK) + TRACE("RegOpenKeyExW failed\n"); + return FALSE; + } + + DWORD dwIndex = 0; + while (TRUE) + { + cchName = _countof(wszName); + if (RegEnumKeyExW(hKey, dwIndex++, wszName, &cchName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) + break; + + /* Key name or key value is CLSID */ + CLSID clsid; + hr = CLSIDFromString(wszName, &clsid); + if (hr == S_OK) + pwszClsid = wszName; + else + { + DWORD cchBuf = _countof(wszBuf); + if (RegGetValueW(hKey, wszName, NULL, RRF_RT_REG_SZ, NULL, wszBuf, &cchBuf) == ERROR_SUCCESS) + hr = CLSIDFromString(wszBuf, &clsid); + pwszClsid = wszBuf; + } + if (SUCCEEDED(hr)) + { + if (m_bGroupPolicyActive) { - dwName = MAX_PATH; - if (RegGetValueW(hKey, szName, NULL, RRF_RT_REG_SZ, NULL, szKey, &dwName) == ERROR_SUCCESS) + if (RegGetValueW(HKEY_LOCAL_MACHINE, + L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", + pwszClsid, + RRF_RT_REG_SZ, + NULL, + NULL, + NULL) == ERROR_SUCCESS) { - hResult = CLSIDFromString(szKey, &clsid); + LoadDynamicContextMenuHandler(hKey, &clsid); } } - if (SUCCEEDED(hResult)) - { - if (m_bGroupPolicyActive) - { - if (RegGetValueW(HKEY_LOCAL_MACHINE, - L"Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", - szKey, - RRF_RT_REG_SZ, - NULL, - NULL, - &dwName) == ERROR_SUCCESS) - { - LoadDynamicContextMenuHandler(hKey, &clsid, TRUE); - } - } - else - { - LoadDynamicContextMenuHandler(hKey, &clsid, TRUE); - } - } - } - dwIndex++; - } while(res == ERROR_SUCCESS); + else + LoadDynamicContextMenuHandler(hKey, &clsid); + } + } RegCloseKey(hKey); - return index; + return TRUE; } UINT -CDefaultContextMenu::InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast) -{ - PDynamicShellEntry curEntry; - HRESULT hResult; - +CDefaultContextMenu::InsertMenuItemsOfDynamicContextMenuExtension(HMENU hMenu, UINT IndexMenu, UINT idCmdFirst, UINT idCmdLast) +{ if (!m_pDynamicEntries) { m_iIdSHEFirst = 0; m_iIdSHELast = 0; - return indexMenu; - } - - curEntry = m_pDynamicEntries; + return IndexMenu; + } + + PDynamicShellEntry pEntry = m_pDynamicEntries; idCmdFirst = 0x5000; idCmdLast = 0x6000; m_iIdSHEFirst = idCmdFirst; do { - hResult = curEntry->CMenu->QueryContextMenu(hMenu, indexMenu++, idCmdFirst, idCmdLast, CMF_NORMAL); - if (SUCCEEDED(hResult)) - { - curEntry->iIdCmdFirst = idCmdFirst; - curEntry->NumIds = LOWORD(hResult); - indexMenu += curEntry->NumIds; - idCmdFirst += curEntry->NumIds + 0x10; - } - TRACE("curEntry %p hresult %x contextmenu %p cmdfirst %x num ids %x\n", curEntry, hResult, curEntry->CMenu, curEntry->iIdCmdFirst, curEntry->NumIds); - curEntry = curEntry->Next; - } while(curEntry); + HRESULT hr = pEntry->pCM->QueryContextMenu(hMenu, IndexMenu++, idCmdFirst, idCmdLast, CMF_NORMAL); + if (SUCCEEDED(hr)) + { + pEntry->iIdCmdFirst = idCmdFirst; + pEntry->NumIds = LOWORD(hr); + IndexMenu += pEntry->NumIds; + idCmdFirst += pEntry->NumIds + 0x10; + } + TRACE("pEntry %p hr %x contextmenu %p cmdfirst %x num ids %x\n", pEntry, hr, pEntry->pCM, pEntry->iIdCmdFirst, pEntry->NumIds); + pEntry = pEntry->pNext; + } while (pEntry); m_iIdSHELast = idCmdFirst; TRACE("SH_LoadContextMenuHandlers first %x last %x\n", m_iIdSHEFirst, m_iIdSHELast); - return indexMenu; + return IndexMenu; } UINT @@ -533,45 +508,41 @@ UINT iIdCmdLast, UINT uFlags) { - MENUITEMINFOW mii; - WCHAR szBuffer[MAX_PATH]; - UINT indexMenu = 0; + UINT IndexMenu = 0; HMENU hSubMenu; - HKEY hKey; - - ZeroMemory(&mii, sizeof(mii)); TRACE("BuildBackgroundContextMenu entered\n"); if (!_ILIsDesktop(m_Dcm.pidlFolder)) { + WCHAR wszBuf[MAX_PATH]; + /* view option is only available in browsing mode */ - hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001"); - if (hSubMenu) - { - szBuffer[0] = 0; - LoadStringW(shell32_hInstance, FCIDM_SHVIEW_VIEW, szBuffer, MAX_PATH); - szBuffer[MAX_PATH-1] = 0; - - TRACE("szBuffer %s\n", debugstr_w(szBuffer)); - + hSubMenu = LoadMenuW(shell32_hInstance, L"MENU_001"); + if (hSubMenu && LoadStringW(shell32_hInstance, FCIDM_SHVIEW_VIEW, wszBuf, _countof(wszBuf))) + { + TRACE("wszBuf %s\n", debugstr_w(wszBuf)); + + MENUITEMINFOW mii; + ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); mii.fMask = MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU | MIIM_ID; mii.fType = MFT_STRING; mii.wID = iIdCmdFirst++; - mii.dwTypeData = szBuffer; - mii.cch = wcslen( mii.dwTypeData ); + mii.dwTypeData = wszBuf; + mii.cch = wcslen(mii.dwTypeData); mii.fState = MFS_ENABLED; mii.hSubMenu = hSubMenu; - InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); + InsertMenuItemW(hMenu, IndexMenu++, TRUE, &mii); DestroyMenu(hSubMenu); } } + hSubMenu = LoadMenuW(shell32_hInstance, L"MENU_002"); if (hSubMenu) { /* merge general background context menu in */ - iIdCmdFirst = Shell_MergeMenus(hMenu, GetSubMenu(hSubMenu, 0), indexMenu, 0, 0xFFFF, MM_DONTREMOVESEPS | MM_SUBMENUSHAVEIDS) + 1; + iIdCmdFirst = Shell_MergeMenus(hMenu, GetSubMenu(hSubMenu, 0), IndexMenu, 0, 0xFFFF, MM_DONTREMOVESEPS | MM_SUBMENUSHAVEIDS) + 1; DestroyMenu(hSubMenu); } @@ -582,6 +553,7 @@ } /* Load context menu handlers */ + HKEY hKey; if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory\\Background", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { EnumerateDynamicContextHandlerForKey(hKey); @@ -600,92 +572,88 @@ UINT CDefaultContextMenu::AddStaticContextMenusToMenu( HMENU hMenu, - UINT indexMenu) + UINT IndexMenu) { MENUITEMINFOW mii; UINT idResource; - PStaticShellEntry curEntry; - WCHAR szVerb[40]; - DWORD dwSize; + WCHAR wszVerb[40]; UINT fState; - UINT Length; mii.cbSize = sizeof(mii); mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE | MIIM_DATA; mii.fType = MFT_STRING; - mii.fState = MFS_ENABLED; mii.wID = 0x4000; mii.dwTypeData = NULL; m_iIdSCMFirst = mii.wID; - curEntry = m_pStaticEntries; - - while(curEntry) + PStaticShellEntry pEntry = m_pStaticEntries; + + while (pEntry) { fState = MFS_ENABLED; mii.dwTypeData = NULL; - if (!wcsicmp(curEntry->szVerb, L"open")) + if (!wcsicmp(pEntry->szVerb, L"open")) { fState |= MFS_DEFAULT; idResource = IDS_OPEN_VERB; } - else if (!wcsicmp(curEntry->szVerb, L"explore")) + else if (!wcsicmp(pEntry->szVerb, L"explore")) idResource = IDS_EXPLORE_VERB; - else if (!wcsicmp(curEntry->szVerb, L"runas")) + else if (!wcsicmp(pEntry->szVerb, L"runas")) idResource = IDS_RUNAS_VERB; - else if (!wcsicmp(curEntry->szVerb, L"edit")) + else if (!wcsicmp(pEntry->szVerb, L"edit")) idResource = IDS_EDIT_VERB; - else if (!wcsicmp(curEntry->szVerb, L"find")) + else if (!wcsicmp(pEntry->szVerb, L"find")) idResource = IDS_FIND_VERB; - else if (!wcsicmp(curEntry->szVerb, L"print")) + else if (!wcsicmp(pEntry->szVerb, L"print")) idResource = IDS_PRINT_VERB; - else if (!wcsicmp(curEntry->szVerb, L"printto")) - { - curEntry = curEntry->Next; + else if (!wcsicmp(pEntry->szVerb, L"printto")) + { + pEntry = pEntry->pNext; continue; } else idResource = 0; + /* By default use verb for menu item name */ + mii.dwTypeData = pEntry->szVerb; + if (idResource > 0) { - if (LoadStringW(shell32_hInstance, idResource, szVerb, sizeof(szVerb) / sizeof(WCHAR))) - mii.dwTypeData = szVerb; /* use translated verb */ + if (LoadStringW(shell32_hInstance, idResource, wszVerb, _countof(wszVerb))) + mii.dwTypeData = wszVerb; /* use translated verb */ else - ERR("Failed to load string, defaulting to NULL value for mii.dwTypeData\n"); + ERR("Failed to load string\n"); } else { WCHAR wszKey[256]; - Length = wcslen(curEntry->szClass) + wcslen(curEntry->szVerb) + 8; - if (Length < sizeof(wszKey) / sizeof(WCHAR)) + HRESULT hr = StringCbPrintfW(wszKey, sizeof(wszKey), L"%s\\shell\\%s", pEntry->szClass, pEntry->szVerb); + + if (SUCCEEDED(hr)) { - wcscpy(wszKey, curEntry->szClass); - wcscat(wszKey, L"\\shell\\"); - wcscat(wszKey, curEntry->szVerb); - dwSize = sizeof(szVerb); - - if (RegGetValueW(HKEY_CLASSES_ROOT, wszKey, NULL, RRF_RT_REG_SZ, NULL, szVerb, &dwSize) == ERROR_SUCCESS) - mii.dwTypeData = szVerb; /* use description for the menu entry */ - else - mii.dwTypeData = curEntry->szVerb; /* use verb for the menu entry */ + DWORD cbVerb = sizeof(wszVerb); + + if (RegGetValueW(HKEY_CLASSES_ROOT, wszKey, NULL, RRF_RT_REG_SZ, NULL, wszVerb, &cbVerb) == ERROR_SUCCESS) + mii.dwTypeData = wszVerb; /* use description for the menu entry */ } } mii.cch = wcslen(mii.dwTypeData); mii.fState = fState; - InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); + InsertMenuItemW(hMenu, IndexMenu++, TRUE, &mii); mii.wID++; - curEntry = curEntry->Next; - } + pEntry = pEntry->pNext; + } + m_iIdSCMLast = mii.wID - 1; - return indexMenu; + return IndexMenu; } void WINAPI _InsertMenuItemW( - HMENU hmenu, + HMENU hMenu, UINT indexMenu, BOOL fByPosition, UINT wID, @@ -694,24 +662,19 @@ UINT fState) { MENUITEMINFOW mii; - WCHAR szText[100]; + WCHAR wszText[100]; ZeroMemory(&mii, sizeof(mii)); mii.cbSize = sizeof(mii); if (fType == MFT_SEPARATOR) - { mii.fMask = MIIM_ID | MIIM_TYPE; - } else if (fType == MFT_STRING) { mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; if ((ULONG_PTR)HIWORD((ULONG_PTR)dwTypeData) == 0) { - if (LoadStringW(shell32_hInstance, LOWORD((ULONG_PTR)dwTypeData), szText, sizeof(szText) / sizeof(WCHAR))) - { - szText[(sizeof(szText)/sizeof(WCHAR))-1] = 0; - mii.dwTypeData = szText; - } + if (LoadStringW(shell32_hInstance, LOWORD((ULONG_PTR)dwTypeData), wszText, _countof(wszText))) + mii.dwTypeData = wszText; else { ERR("failed to load string %p\n", dwTypeData); @@ -719,15 +682,13 @@ } } else - { - mii.dwTypeData = (LPWSTR) dwTypeData; - } + mii.dwTypeData = (LPWSTR)dwTypeData; mii.fState = fState; } mii.wID = wID; mii.fType = fType; - InsertMenuItemW( hmenu, indexMenu, fByPosition, &mii); + InsertMenuItemW(hMenu, indexMenu, fByPosition, &mii); } UINT @@ -737,53 +698,50 @@ UINT iIdCmdLast, UINT uFlags) { - WCHAR szPath[MAX_PATH]; - WCHAR szTemp[40]; HKEY hKey; - UINT indexMenu; - SFGAOF rfg; HRESULT hr; - BOOL bAddSep = FALSE; - GUID * guid; - BOOL bClipboardData; - STRRET strFile; - LPWSTR pOffset; - DWORD dwSize; TRACE("BuildShellItemContextMenu entered\n"); ASSERT(m_Dcm.cidl >= 1); + STRRET strFile; hr = m_Dcm.psf->GetDisplayNameOf(m_Dcm.apidl[0], SHGDN_FORPARSING, &strFile); if (hr == S_OK) { - hr = StrRetToBufW(&strFile, m_Dcm.apidl[0], szPath, MAX_PATH); + WCHAR wszPath[MAX_PATH]; + hr = StrRetToBufW(&strFile, m_Dcm.apidl[0], wszPath, _countof(wszPath)); if (hr == S_OK) { - pOffset = wcsrchr(szPath, L'.'); - if (pOffset) + LPCWSTR pwszExt = PathFindExtensionW(wszPath); + if (pwszExt[0]) { /* enumerate dynamic/static for a given file class */ - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, pOffset, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, pwszExt, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { /* add static verbs */ - AddStaticEntryForFileClass(pOffset); + AddStaticEntryForFileClass(pwszExt); + /* load dynamic extensions from file extension key */ EnumerateDynamicContextHandlerForKey(hKey); RegCloseKey(hKey); } - dwSize = sizeof(szTemp); - if (RegGetValueW(HKEY_CLASSES_ROOT, pOffset, NULL, RRF_RT_REG_SZ, NULL, szTemp, &dwSize) == ERROR_SUCCESS) + + WCHAR wszTemp[40]; + DWORD dwSize = sizeof(wszTemp); + if (RegGetValueW(HKEY_CLASSES_ROOT, pwszExt, NULL, RRF_RT_REG_SZ, NULL, wszTemp, &dwSize) == ERROR_SUCCESS) { - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hKey) == ERROR_SUCCESS) + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, wszTemp, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { /* add static verbs from progid key */ - AddStaticEntryForFileClass(szTemp); + AddStaticEntryForFileClass(wszTemp); + /* load dynamic extensions from progid key */ EnumerateDynamicContextHandlerForKey(hKey); RegCloseKey(hKey); } } } + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"*", 0, KEY_READ, &hKey) == ERROR_SUCCESS) { /* load default extensions */ @@ -795,14 +753,14 @@ else ERR("GetDisplayNameOf failed: %x\n", hr); - guid = _ILGetGUIDPointer(m_Dcm.apidl[0]); - if (guid) + GUID *pGuid = _ILGetGUIDPointer(m_Dcm.apidl[0]); + if (pGuid) { LPOLESTR pwszCLSID; WCHAR buffer[60]; wcscpy(buffer, L"CLSID\\"); - hr = StringFromCLSID(*guid, &pwszCLSID); + hr = StringFromCLSID(*pGuid, &pwszCLSID); if (hr == S_OK) { wcscpy(&buffer[6], pwszCLSID); @@ -829,7 +787,7 @@ } /* add static actions */ - rfg = SFGAO_BROWSABLE | SFGAO_CANCOPY | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANDELETE | SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER; + SFGAOF rfg = SFGAO_BROWSABLE | SFGAO_CANCOPY | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANDELETE | SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER; hr = m_Dcm.psf->GetAttributesOf(m_Dcm.cidl, m_Dcm.apidl, &rfg); if (FAILED(hr)) { @@ -865,31 +823,32 @@ } /* add static context menu handlers */ - indexMenu = AddStaticContextMenusToMenu(hMenu, 0); + UINT IndexMenu = AddStaticContextMenusToMenu(hMenu, 0); + /* now process dynamic context menu handlers */ - indexMenu = InsertMenuItemsOfDynamicContextMenuExtension(hMenu, indexMenu, iIdCmdFirst, iIdCmdLast); - TRACE("indexMenu %d\n", indexMenu); + BOOL bAddSep = FALSE; + IndexMenu = InsertMenuItemsOfDynamicContextMenuExtension(hMenu, IndexMenu, iIdCmdFirst, iIdCmdLast); + TRACE("IndexMenu %d\n", IndexMenu); if (_ILIsDrive(m_Dcm.apidl[0])) { /* The 'Format' option must be always available, - * thus it is not registered as a static shell extension - */ - _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); - _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0x7ABC, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED); + * thus it is not registered as a static shell extension */ + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0x7ABC, MFT_STRING, MAKEINTRESOURCEW(IDS_FORMATDRIVE), MFS_ENABLED); bAddSep = TRUE; } - bClipboardData = (HasClipboardData() && (rfg & SFGAO_FILESYSTEM)); + BOOL bClipboardData = (HasClipboardData() && (rfg & SFGAO_FILESYSTEM)); if (rfg & (SFGAO_CANCOPY | SFGAO_CANMOVE) || bClipboardData) { - _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); if (rfg & SFGAO_CANMOVE) - _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, MAKEINTRESOURCEW(IDS_CUT), MFS_ENABLED); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, MAKEINTRESOURCEW(IDS_CUT), MFS_ENABLED); if (rfg & SFGAO_CANCOPY) - _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, MAKEINTRESOURCEW(IDS_COPY), MFS_ENABLED); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, MAKEINTRESOURCEW(IDS_COPY), MFS_ENABLED); if (bClipboardData) - _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_INSERT, MFT_STRING, MAKEINTRESOURCEW(IDS_INSERT), MFS_ENABLED); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, FCIDM_SHVIEW_INSERT, MFT_STRING, MAKEINTRESOURCEW(IDS_INSERT), MFS_ENABLED); bAddSep = TRUE; } @@ -897,8 +856,8 @@ if (rfg & SFGAO_CANLINK) { bAddSep = FALSE; - _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); - _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_CREATELINK, MFT_STRING, MAKEINTRESOURCEW(IDS_CREATELINK), MFS_ENABLED); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, FCIDM_SHVIEW_CREATELINK, MFT_STRING, MAKEINTRESOURCEW(IDS_CREATELINK), MFS_ENABLED); } if (rfg & SFGAO_CANDELETE) @@ -906,25 +865,25 @@ if (bAddSep) { bAddSep = FALSE; - _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); - } - _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_DELETE, MFT_STRING, MAKEINTRESOURCEW(IDS_DELETE), MFS_ENABLED); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); + } + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, FCIDM_SHVIEW_DELETE, MFT_STRING, MAKEINTRESOURCEW(IDS_DELETE), MFS_ENABLED); } if (rfg & SFGAO_CANRENAME) { if (bAddSep) { - _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); - } - _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_RENAME, MFT_STRING, MAKEINTRESOURCEW(IDS_RENAME), MFS_ENABLED); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); + } + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, FCIDM_SHVIEW_RENAME, MFT_STRING, MAKEINTRESOURCEW(IDS_RENAME), MFS_ENABLED); bAddSep = TRUE; } if (rfg & SFGAO_HASPROPSHEET) { - _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); - _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_PROPERTIES, MFT_STRING, MAKEINTRESOURCEW(IDS_PROPERTIES), MFS_ENABLED); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); + _InsertMenuItemW(hMenu, IndexMenu++, TRUE, FCIDM_SHVIEW_PROPERTIES, MFT_STRING, MAKEINTRESOURCEW(IDS_PROPERTIES), MFS_ENABLED); } return iIdCmdLast; @@ -933,16 +892,16 @@ HRESULT WINAPI CDefaultContextMenu::QueryContextMenu( - HMENU hmenu, - UINT indexMenu, + HMENU hMenu, + UINT IndexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) { if (m_Dcm.cidl) - idCmdFirst = BuildShellItemContextMenu(hmenu, idCmdFirst, idCmdLast, uFlags); + idCmdFirst = BuildShellItemContextMenu(hMenu, idCmdFirst, idCmdLast, uFlags); else - idCmdFirst = BuildBackgroundContextMenu(hmenu, idCmdFirst, idCmdLast, uFlags); + idCmdFirst = BuildBackgroundContextMenu(hMenu, idCmdFirst, idCmdLast, uFlags); return S_OK; } @@ -951,28 +910,25 @@ HRESULT NotifyShellViewWindow(LPCMINVOKECOMMANDINFO lpcmi, BOOL bRefresh) { - LPSHELLBROWSER lpSB; + /* Note: CWM_GETISHELLBROWSER returns not referenced object */ + LPSHELLBROWSER lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0); + if (!lpSB) + return E_FAIL; + LPSHELLVIEW lpSV = NULL; - HWND hwndSV = NULL; - - if((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0))) - { - if(SUCCEEDED(lpSB->QueryActiveShellView(&lpSV))) - { - lpSV->GetWindow(&hwndSV); - } - } + if (FAILED(lpSB->QueryActiveShellView(&lpSV))) + return E_FAIL; if (LOWORD(lpcmi->lpVerb) == FCIDM_SHVIEW_REFRESH || bRefresh) - { - if (lpSV) - lpSV->Refresh(); - - return S_OK; - } - - SendMessageW(hwndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0), 0); - + lpSV->Refresh(); + else + { + HWND hwndSV = NULL; + if (SUCCEEDED(lpSV->GetWindow(&hwndSV))) + SendMessageW(hwndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0), 0); + } + + lpSV->Release(); return S_OK; } @@ -980,19 +936,14 @@ CDefaultContextMenu::DoPaste( LPCMINVOKECOMMANDINFO lpcmi) { - IDataObject * pda; + HRESULT hr; + + IDataObject *pda; + if (OleGetClipboard(&pda) != S_OK) + return E_FAIL; + STGMEDIUM medium; FORMATETC formatetc; - LPITEMIDLIST * apidl; - LPITEMIDLIST pidl; - IShellFolder *psfFrom = NULL, *psfDesktop, *psfTarget = NULL; - LPIDA lpcida; - ISFHelper *psfhlpdst, *psfhlpsrc; - HRESULT hr; - - if (OleGetClipboard(&pda) != S_OK) - return E_FAIL; - InitFormatEtc(formatetc, RegisterClipboardFormatW(CFSTR_SHELLIDLIST), TYMED_HGLOBAL); hr = pda->GetData(&formatetc, &medium); @@ -1003,7 +954,7 @@ } /* lock the handle */ - lpcida = (LPIDA)GlobalLock(medium.hGlobal); + LPIDA lpcida = (LPIDA)GlobalLock(medium.hGlobal); if (!lpcida) { ReleaseStgMedium(&medium); @@ -1012,11 +963,13 @@ } /* convert the data into pidl */ - apidl = _ILCopyCidaToaPidl(&pidl, lpcida); + LPITEMIDLIST pidl; + LPITEMIDLIST *apidl = _ILCopyCidaToaPidl(&pidl, lpcida); if (!apidl) return E_FAIL; + IShellFolder *psfDesktop; if (FAILED(SHGetDesktopFolder(&psfDesktop))) { SHFree(pidl); @@ -1026,6 +979,8 @@ return E_FAIL; } + /* Find source folder */ + IShellFolder *psfFrom = NULL; if (_ILIsDesktop(pidl)) { /* use desktop shellfolder */ @@ -1044,6 +999,8 @@ return E_FAIL; } + /* Find target folder */ + IShellFolder *psfTarget = NULL; if (m_Dcm.cidl) { psfDesktop->Release(); @@ -1092,6 +1049,7 @@ } /* get source and destination shellfolder */ + ISFHelper *psfhlpdst; if (FAILED(psfTarget->QueryInterface(IID_ISFHelper, (LPVOID*)&psfhlpdst))) { ERR("no IID_ISFHelper for destination\n"); @@ -1106,6 +1064,7 @@ return E_FAIL; } + ISFHelper *psfhlpsrc; if (FAILED(psfFrom->QueryInterface(IID_ISFHelper, (LPVOID*)&psfhlpsrc))) { ERR("no IID_ISFHelper for source\n"); @@ -1146,42 +1105,30 @@ } BOOL -GetUniqueFileName(LPWSTR szBasePath, LPWSTR szExt, LPWSTR szTarget, BOOL bShortcut) -{ - UINT RetryCount = 0, Length; - WCHAR szLnk[40]; - HANDLE hFile; +GetUniqueFileName(LPWSTR pwszBasePath, LPCWSTR pwszExt, LPWSTR pwszTarget, BOOL bShortcut) +{ + WCHAR wszLink[40]; if (!bShortcut) - Length = LoadStringW(shell32_hInstance, IDS_LNK_FILE, szLnk, sizeof(szLnk) / sizeof(WCHAR)); - - do + { + if (!LoadStringW(shell32_hInstance, IDS_LNK_FILE, wszLink, _countof(wszLink))) + wszLink[0] = L'\0'; + } + + if (!bShortcut) + swprintf(pwszTarget, L"%s%s%s", wszLink, pwszBasePath, pwszExt); + else + swprintf(pwszTarget, L"%s%s", pwszBasePath, pwszExt); + + for (UINT i = 2; PathFileExistsW(pwszTarget); ++i) { if (!bShortcut) - { - if (RetryCount) - swprintf(szTarget, L"%s%s(%u).%s", szLnk, szBasePath, RetryCount, szExt); - else - swprintf(szTarget, L"%s%s.%s", szLnk, szBasePath, szExt); - } + swprintf(pwszTarget, L"%s%s (%u)%s", wszLink, pwszBasePath, i, pwszExt); else - { - if (RetryCount) - swprintf(szTarget, L"%s(%u).%s", szBasePath, RetryCount, szExt); - else - swprintf(szTarget, L"%s.%s", szBasePath, szExt); - } - - hFile = CreateFileW(szTarget, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile != INVALID_HANDLE_VALUE) - { - CloseHandle(hFile); - return TRUE; - } - - } while(RetryCount++ < 100); - - return FALSE; + swprintf(pwszTarget, L"%s (%u)%s", pwszBasePath, i, pwszExt); + } + + return TRUE; } @@ -1189,16 +1136,10 @@ CDefaultContextMenu::DoCreateLink( LPCMINVOKECOMMANDINFO lpcmi) { - WCHAR szPath[MAX_PATH]; - WCHAR szTarget[MAX_PATH] = {0}; - WCHAR szDirPath[MAX_PATH]; - LPWSTR pszFile; + WCHAR wszTarget[MAX_PATH]; + IPersistFile *ppf; + HRESULT hr; STRRET strFile; - LPWSTR pszExt; - HRESULT hr; - IShellLinkW * nLink; - IPersistFile * ipf; - static WCHAR szLnk[] = L"lnk"; if (m_Dcm.psf->GetDisplayNameOf(m_Dcm.apidl[0], SHGDN_FORPARSING, &strFile) != S_OK) { @@ -1206,47 +1147,50 @@ return E_FAIL; } - if (StrRetToBufW(&strFile, m_Dcm.apidl[0], szPath, MAX_PATH) != S_OK) - return E_FAIL; - - pszExt = wcsrchr(szPath, L'.'); - - if (pszExt && !wcsicmp(pszExt + 1, szLnk)) - { - if (!GetUniqueFileName(szPath, pszExt + 1, szTarget, TRUE)) + WCHAR wszPath[MAX_PATH]; + if (StrRetToBufW(&strFile, m_Dcm.apidl[0], wszPath, _countof(wszPath)) != S_OK) + return E_FAIL; + + LPWSTR pwszExt = PathFindExtensionW(wszPath); + + if (!wcsicmp(pwszExt, L".lnk")) + { + if (!GetUniqueFileName(wszPath, pwszExt, wszTarget, TRUE)) return E_FAIL; - hr = IShellLink_ConstructFromFile(NULL, IID_IPersistFile, m_Dcm.apidl[0], (LPVOID*)&ipf); + hr = IShellLink_ConstructFromFile(NULL, IID_IPersistFile, m_Dcm.apidl[0], (LPVOID*)&ppf); if (hr != S_OK) return hr; - hr = ipf->Save(szTarget, FALSE); - ipf->Release(); + hr = ppf->Save(wszTarget, FALSE); + ppf->Release(); NotifyShellViewWindow(lpcmi, TRUE); return hr; } else { - if (!GetUniqueFileName(szPath, szLnk, szTarget, TRUE)) + if (!GetUniqueFileName(wszPath, L".lnk", wszTarget, TRUE)) return E_FAIL; - hr = CShellLink::_CreatorClass::CreateInstance(NULL, IID_IShellLinkW, (void**)&nLink); + IShellLinkW *pLink; + hr = CShellLink::_CreatorClass::CreateInstance(NULL, IID_IShellLinkW, (void**)&pLink); if (hr != S_OK) return hr; - GetFullPathName(szPath, MAX_PATH, szDirPath, &pszFile); - if (pszFile) pszFile[0] = 0; - - if (SUCCEEDED(nLink->SetPath(szPath)) && - SUCCEEDED(nLink->SetWorkingDirectory(szDirPath))) - { - if (SUCCEEDED(nLink->QueryInterface(IID_IPersistFile, (LPVOID*)&ipf))) + WCHAR szDirPath[MAX_PATH], *pwszFile; + GetFullPathName(wszPath, MAX_PATH, szDirPath, &pwszFile); + if (pwszFile) pwszFile[0] = 0; + + if (SUCCEEDED(pLink->SetPath(wszPath)) && + SUCCEEDED(pLink->SetWorkingDirectory(szDirPath))) + { + if (SUCCEEDED(pLink->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf))) { - hr = ipf->Save(szTarget, TRUE); - ipf->Release(); + hr = ppf->Save(wszTarget, TRUE); + ppf->Release(); } } - nLink->Release(); + pLink->Release(); NotifyShellViewWindow(lpcmi, TRUE); return hr; } @@ -1256,24 +1200,16 @@ CDefaultContextMenu::DoDelete( LPCMINVOKECOMMANDINFO lpcmi) { - HRESULT hr; STRRET strTemp; - WCHAR szPath[MAX_PATH]; - LPWSTR wszPath, wszPos; - SHFILEOPSTRUCTW op; - int ret; - LPSHELLBROWSER lpSB; - HWND hwnd; - - - hr = m_Dcm.psf->GetDisplayNameOf(m_Dcm.apidl[0], SHGDN_FORPARSING, &strTemp); + HRESULT hr = m_Dcm.psf->GetDisplayNameOf(m_Dcm.apidl[0], SHGDN_FORPARSING, &strTemp); if(hr != S_OK) { ERR("IShellFolder_GetDisplayNameOf failed with %x\n", hr); return hr; } - ZeroMemory(szPath, sizeof(szPath)); - hr = StrRetToBufW(&strTemp, m_Dcm.apidl[0], szPath, MAX_PATH); + + WCHAR wszPath[MAX_PATH]; + hr = StrRetToBufW(&strTemp, m_Dcm.apidl[0], wszPath, _countof(wszPath)); if (hr != S_OK) { ERR("StrRetToBufW failed with %x\n", hr); @@ -1281,43 +1217,45 @@ } /* Only keep the base path */ - wszPos = strrchrW(szPath, '\\'); - if (wszPos != NULL) - { - *(wszPos + 1) = '\0'; - } - - wszPath = BuildPathsList(szPath, m_Dcm.cidl, m_Dcm.apidl); - - ZeroMemory(&op, sizeof(op)); - op.hwnd = GetActiveWindow(); - op.wFunc = FO_DELETE; - op.pFrom = wszPath; - op.fFlags = FOF_ALLOWUNDO; - ret = SHFileOperationW(&op); - - if (ret) - { - ERR("SHFileOperation failed with 0x%x for %s\n", GetLastError(), debugstr_w(wszPath)); + LPWSTR pwszFilename = PathFindFileNameW(wszPath); + *pwszFilename = L'\0'; + + /* Build paths list */ + LPWSTR pwszPaths = BuildPathsList(wszPath, m_Dcm.cidl, m_Dcm.apidl); + if (!pwszPaths) + return E_FAIL; + + /* Delete them */ + SHFILEOPSTRUCTW FileOp; + ZeroMemory(&FileOp, sizeof(FileOp)); + FileOp.hwnd = GetActiveWindow(); + FileOp.wFunc = FO_DELETE; + FileOp.pFrom = pwszPaths; + FileOp.fFlags = FOF_ALLOWUNDO; + + if (SHFileOperationW(&FileOp) != 0) + { + ERR("SHFileOperation failed with 0x%x for %s\n", GetLastError(), debugstr_w(pwszPaths)); return S_OK; } - /* get the active IShellView */ - if ((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0))) - { - /* is the treeview focused */ + /* Get the active IShellView */ + LPSHELLBROWSER lpSB = (LPSHELLBROWSER)SendMessageW(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0); + if (lpSB) + { + /* Is the treeview focused */ + HWND hwnd; if (SUCCEEDED(lpSB->GetControlWindow(FCW_TREE, &hwnd))) { + /* Remove selected items from treeview */ HTREEITEM hItem = TreeView_GetSelection(hwnd); if (hItem) - { (void)TreeView_DeleteItem(hwnd, hItem); - } } } NotifyShellViewWindow(lpcmi, TRUE); - HeapFree(GetProcessHeap(), 0, wszPath); + HeapFree(GetProcessHeap(), 0, pwszPaths); return S_OK; } @@ -1327,8 +1265,6 @@ LPCMINVOKECOMMANDINFO lpcmi, BOOL bCopy) { - LPSHELLBROWSER lpSB; - LPSHELLVIEW lpSV; LPDATAOBJECT pDataObj; HRESULT hr; @@ -1339,79 +1275,78 @@ return hr; } - lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0); + /* Note: CWM_GETISHELLBROWSER returns not referenced object */ + LPSHELLBROWSER lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0); if (!lpSB) { - TRACE("failed to get shellbrowser\n"); - return E_FAIL; - } - + ERR("failed to get shellbrowser\n"); + return E_FAIL; + } + + LPSHELLVIEW lpSV; hr = lpSB->QueryActiveShellView(&lpSV); if (FAILED(hr)) { - TRACE("failed to query the active shellview\n"); + ERR("failed to query the active shellview\n"); return hr; } hr = lpSV->GetItemObject(SVGIO_SELECTION, IID_IDataObject, (LPVOID*)&pDataObj); + if (SUCCEEDED(hr)) + { + hr = OleSetClipboard(pDataObj); + if (FAILED(hr)) + ERR("OleSetClipboard failed"); + pDataObj->Release(); + } else + ERR("failed to get item object\n"); + + lpSV->Release(); + return hr; +} + +HRESULT +CDefaultContextMenu::DoRename( + LPCMINVOKECOMMANDINFO lpcmi) +{ + /* get the active IShellView. Note: CWM_GETISHELLBROWSER returns not referenced object */ + LPSHELLBROWSER lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0); + if (!lpSB) + { + ERR("CWM_GETISHELLBROWSER failed\n"); + return E_FAIL; + } + + /* is the treeview focused */ + HWND hwnd; + if (SUCCEEDED(lpSB->GetControlWindow(FCW_TREE, &hwnd))) + { + HTREEITEM hItem = TreeView_GetSelection(hwnd); + if (hItem) + (void)TreeView_EditLabel(hwnd, hItem); + } + + LPSHELLVIEW lpSV; + HRESULT hr = lpSB->QueryActiveShellView(&lpSV); if (FAILED(hr)) { - TRACE("failed to get item object\n"); + ERR("CWM_GETISHELLBROWSER failed\n"); return hr; } - hr = OleSetClipboard(pDataObj); - if (FAILED(hr)) - { - WARN("OleSetClipboard failed"); - } - pDataObj->Release(); + lpSV->SelectItem(m_Dcm.apidl[0], + SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT); lpSV->Release(); return S_OK; } HRESULT -CDefaultContextMenu::DoRename( - LPCMINVOKECOMMANDINFO lpcmi) -{ - LPSHELLBROWSER lpSB; - LPSHELLVIEW lpSV; - HWND hwnd; - - /* get the active IShellView */ - if ((lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER, 0, 0))) - { - /* is the treeview focused */ - if (SUCCEEDED(lpSB->GetControlWindow(FCW_TREE, &hwnd))) - { - HTREEITEM hItem = TreeView_GetSelection(hwnd); - if (hItem) - { - (void)TreeView_EditLabel(hwnd, hItem); - } - } - - if(SUCCEEDED(lpSB->QueryActiveShellView(&lpSV))) - { - lpSV->SelectItem(m_Dcm.apidl[0], - SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT); - lpSV->Release(); - return S_OK; - } - } - return E_FAIL; -} - -HRESULT CDefaultContextMenu::DoProperties( LPCMINVOKECOMMANDINFO lpcmi) { - WCHAR wszBuf[MAX_PATH]; - STRRET strFile; - const ITEMIDLIST *pidlParent, *pidlChild; HRESULT hr = S_OK; - - pidlParent = m_Dcm.pidlFolder; + const ITEMIDLIST *pidlParent = m_Dcm.pidlFolder, *pidlChild; + if (!pidlParent) { IPersistFolder2 *pf; @@ -1448,6 +1383,7 @@ } else if (_ILIsDrive(pidlChild)) { + WCHAR wszBuf[MAX_PATH]; ILGetDisplayName(pidlChild, wszBuf); if (!SH_ShowDriveProperties(wszBuf, pidlParent, &pidlChild)) hr = E_FAIL; @@ -1471,9 +1407,11 @@ if (m_Dcm.cidl > 1) WARN("SHMultiFileProperties is not yet implemented\n"); + STRRET strFile; hr = m_Dcm.psf->GetDisplayNameOf(pidlChild, SHGDN_FORPARSING, &strFile); if (SUCCEEDED(hr)) { + WCHAR wszBuf[MAX_PATH]; hr = StrRetToBufW(&strFile, pidlChild, wszBuf, _countof(wszBuf)); if (SUCCEEDED(hr)) hr = SH_ShowPropertiesDialog(wszBuf, pidlParent, &pidlChild); @@ -1497,15 +1435,15 @@ CDefaultContextMenu::DoFormat( LPCMINVOKECOMMANDINFO lpcmi) { - char sDrive[5] = {0}; - - if (!_ILGetDrive(m_Dcm.apidl[0], sDrive, sizeof(sDrive))) + char szDrive[8] = {0}; + + if (!_ILGetDrive(m_Dcm.apidl[0], szDrive, sizeof(szDrive))) { ERR("pidl is not a drive\n"); return E_FAIL; } - SHFormatDrive(lpcmi->hwnd, sDrive[0] - 'A', SHFMT_ID_DEFAULT, 0); + SHFormatDrive(lpcmi->hwnd, szDrive[0] - 'A', SHFMT_ID_DEFAULT, 0); return S_OK; } @@ -1513,22 +1451,22 @@ CDefaultContextMenu::DoDynamicShellExtensions( LPCMINVOKECOMMANDINFO lpcmi) { - UINT verb = LOWORD(lpcmi->lpVerb); - PDynamicShellEntry pCurrent = m_pDynamicEntries; + UINT idCmd = LOWORD(lpcmi->lpVerb); + PDynamicShellEntry pEntry = m_pDynamicEntries; TRACE("verb %p first %x last %x", lpcmi->lpVerb, m_iIdSHEFirst, m_iIdSHELast); - while(pCurrent && verb > pCurrent->iIdCmdFirst + pCurrent->NumIds) - pCurrent = pCurrent->Next; - - if (!pCurrent) - return E_FAIL; - - if (verb >= pCurrent->iIdCmdFirst && verb <= pCurrent->iIdCmdFirst + pCurrent->NumIds) + while(pEntry && idCmd > pEntry->iIdCmdFirst + pEntry->NumIds) + pEntry = pEntry->pNext; + + if (!pEntry) + return E_FAIL; + + if (idCmd >= pEntry->iIdCmdFirst && idCmd <= pEntry->iIdCmdFirst + pEntry->NumIds) { /* invoke the dynamic context menu */ - lpcmi->lpVerb = MAKEINTRESOURCEA(verb - pCurrent->iIdCmdFirst); - return pCurrent->CMenu->InvokeCommand(lpcmi); + lpcmi->lpVerb = MAKEINTRESOURCEA(idCmd - pEntry->iIdCmdFirst); + return pEntry->pCM->InvokeCommand(lpcmi); } return E_FAIL; @@ -1539,20 +1477,17 @@ CDefaultContextMenu::DoStaticShellExtensions( LPCMINVOKECOMMANDINFO lpcmi) { + PStaticShellEntry pEntry = m_pStaticEntries; + INT iCmd = LOWORD(lpcmi->lpVerb) - m_iIdSCMFirst; + HRESULT hr; + + while (pEntry && (iCmd--) > 0) + pEntry = pEntry->pNext; + + if (iCmd > 0) + return E_FAIL; + STRRET strFile; - WCHAR szPath[MAX_PATH]; - WCHAR szDir[MAX_PATH]; - SHELLEXECUTEINFOW sei; - PStaticShellEntry pCurrent = m_pStaticEntries; - int verb = LOWORD(lpcmi->lpVerb) - m_iIdSCMFirst; - HRESULT hr; - - while(pCurrent && verb-- > 0) - pCurrent = pCurrent->Next; - - if (verb > 0) - return E_FAIL; - hr = m_Dcm.psf->GetDisplayNameOf(m_Dcm.apidl[0], SHGDN_FORPARSING, &strFile); if (hr != S_OK) { @@ -1560,22 +1495,25 @@ return hr; } - hr = StrRetToBufW(&strFile, m_Dcm.apidl[0], szPath, MAX_PATH); + WCHAR wszPath[MAX_PATH]; + hr = StrRetToBufW(&strFile, m_Dcm.apidl[0], wszPath, MAX_PATH); if (hr != S_OK) return hr; - wcscpy(szDir, szPath); - PathRemoveFileSpec(szDir); - + WCHAR wszDir[MAX_PATH]; + wcscpy(wszDir, wszPath); + PathRemoveFileSpec(wszDir); + + SHELLEXECUTEINFOW sei; ZeroMemory(&sei, sizeof(sei)); sei.cbSize = sizeof(sei); sei.fMask = SEE_MASK_CLASSNAME; - sei.lpClass = pCurrent->szClass; + sei.lpClass = pEntry->szClass; sei.hwnd = lpcmi->hwnd; sei.nShow = SW_SHOWNORMAL; - sei.lpVerb = pCurrent->szVerb; - sei.lpFile = szPath; - sei.lpDirectory = szDir; + sei.lpVerb = pEntry->szVerb; + sei.lpFile = wszPath; + sei.lpDirectory = wszDir; ShellExecuteExW(&sei); return S_OK; } @@ -1623,17 +1561,13 @@ if (m_iIdSHEFirst && m_iIdSHELast) { if (LOWORD(lpcmi->lpVerb) >= m_iIdSHEFirst && LOWORD(lpcmi->lpVerb) <= m_iIdSHELast) - { return DoDynamicShellExtensions(lpcmi); - } } if (m_iIdSCMFirst && m_iIdSCMLast) { if (LOWORD(lpcmi->lpVerb) >= m_iIdSCMFirst && LOWORD(lpcmi->lpVerb) <= m_iIdSCMLast) - { return DoStaticShellExtensions(lpcmi); - } } FIXME("Unhandled Verb %xl\n", LOWORD(lpcmi->lpVerb)); @@ -1669,27 +1603,34 @@ REFIID riid, void **ppv) { - CComObject<CDefaultContextMenu> *theContextMenu; - CComPtr<IUnknown> result; - HRESULT hResult; - if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY (theContextMenu = new CComObject<CDefaultContextMenu>); - if (theContextMenu == NULL) - return E_OUTOFMEMORY; - hResult = theContextMenu->QueryInterface(riid, (void **)&result); - if (FAILED(hResult)) - { - delete theContextMenu; - return hResult; - } - hResult = theContextMenu->Initialize(pdcm); - if (FAILED(hResult)) - return hResult; - *ppv = result.Detach(); - TRACE("This(%p)(%x) cidl %u\n", *ppv, hResult, pdcm->cidl); + + CComObject<CDefaultContextMenu> *pCM; + HRESULT hr = CComObject<CDefaultContextMenu>::CreateInstance(&pCM); + if (FAILED(hr)) + return hr; + pCM->AddRef(); // CreateInstance returns object with 0 ref count */ + + CComPtr<IUnknown> pResult; + hr = pCM->QueryInterface(riid, (void **)&pResult); + if (FAILED(hr)) + { + pCM->Release(); + return hr; + } + + hr = pCM->Initialize(pdcm); + if (FAILED(hr)) + { + pCM->Release(); + return hr; + } + + *ppv = pResult.Detach(); + pCM->Release(); + TRACE("This(%p) cidl %u\n", *ppv, pdcm->cidl); return S_OK; } @@ -1705,10 +1646,8 @@ REFIID riid, void **ppv) { - HRESULT hr = E_FAIL; - *ppv = NULL; - hr = IDefaultContextMenu_Constructor(pdcm, riid, ppv); + HRESULT hr = IDefaultContextMenu_Constructor(pdcm, riid, ppv); if (FAILED(hr)) ERR("IDefaultContextMenu_Constructor failed: %x\n", hr); TRACE("pcm %p hr %x\n", pdcm, hr); @@ -1734,8 +1673,6 @@ IContextMenu **ppcm) { DEFCONTEXTMENU pdcm; - HRESULT hr; - pdcm.hwnd = hwnd; pdcm.pcmcb = NULL; pdcm.pidlFolder = pidlFolder; @@ -1746,7 +1683,7 @@ pdcm.cKeys = nKeys; pdcm.aKeys = ahkeyClsKeys; - hr = SHCreateDefaultContextMenu(&pdcm, IID_IContextMenu, (void**)ppcm); + HRESULT hr = SHCreateDefaultContextMenu(&pdcm, IID_IContextMenu, (void**)ppcm); return hr; } Modified: trunk/reactos/dll/win32/shell32/drive.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/drive.cp…
============================================================================== --- trunk/reactos/dll/win32/shell32/drive.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/drive.cpp [iso-8859-1] Sun Jan 15 19:45:02 2012 @@ -123,11 +123,9 @@ { HPSXA hpsx = NULL; HPROPSHEETPAGE hpsp[MAX_PROPERTY_SHEET_PAGE]; - WCHAR wszName[256]; PROPSHEETHEADERW psh; - HRESULT hr; CComObject<CDrvDefExt> *pDrvDefExt = NULL; - + ZeroMemory(&psh, sizeof(PROPSHEETHEADERW)); psh.dwSize = sizeof(PROPSHEETHEADERW); psh.dwFlags = 0; // FIXME: make it modeless @@ -135,6 +133,7 @@ psh.nStartPage = 0; psh.phpage = hpsp; + WCHAR wszName[256]; if (GetVolumeInformationW(pwszDrive, wszName, sizeof(wszName) / sizeof(WCHAR), NULL, NULL, NULL, NULL, 0)) { psh.pszCaption = wszName; @@ -148,13 +147,14 @@ } CComPtr<IDataObject> pDataObj; - hr = SHCreateDataObject(pidlFolder, 1, apidl, NULL, IID_IDataObject, (LPVOID *)&pDataObj); + HRESULT hr = SHCreateDataObject(pidlFolder, 1, apidl, NULL, IID_IDataObject, (LPVOID *)&pDataObj); if (SUCCEEDED(hr)) { - ATLTRY(pDrvDefExt = new CComObject<CDrvDefExt>); - if (pDrvDefExt) - { + hr = CComObject<CDrvDefExt>::CreateInstance(&pDrvDefExt); + if (SUCCEEDED(hr)) + { + pDrvDefExt->AddRef(); // CreateInstance returns object with 0 ref count hr = pDrvDefExt->Initialize(pidlFolder, pDataObj, NULL); if (SUCCEEDED(hr)) { Modified: trunk/reactos/dll/win32/shell32/fprop.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/fprop.cp…
============================================================================== --- trunk/reactos/dll/win32/shell32/fprop.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/fprop.cpp [iso-8859-1] Sun Jan 15 19:45:02 2012 @@ -97,8 +97,6 @@ BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *apidl) { - HRESULT hr; - HPROPSHEETPAGE hppages[MAX_PROPERTY_SHEET_PAGE]; HPSXA hpsxa[3] = {NULL, NULL, NULL}; CComObject<CFileDefExt> *pFileDefExt = NULL; @@ -107,6 +105,7 @@ if (pwszPath == NULL || !wcslen(pwszPath)) return FALSE; + HPROPSHEETPAGE hppages[MAX_PROPERTY_SHEET_PAGE]; memset(hppages, 0x0, sizeof(HPROPSHEETPAGE) * MAX_PROPERTY_SHEET_PAGE); /* Make a copy of path */ @@ -129,13 +128,14 @@ Header.pszCaption = PathFindFileNameW(wszPath); CComPtr<IDataObject> pDataObj; - hr = SHCreateDataObject(pidlFolder, 1, apidl, NULL, IID_IDataObject, (LPVOID *)&pDataObj); + HRESULT hr = SHCreateDataObject(pidlFolder, 1, apidl, NULL, IID_IDataObject, (LPVOID *)&pDataObj); if (SUCCEEDED(hr)) { - ATLTRY(pFileDefExt = new CComObject<CFileDefExt>); - if (pFileDefExt) + hr = CComObject<CFileDefExt>::CreateInstance(&pFileDefExt); + if (SUCCEEDED(hr)) { + pFileDefExt->AddRef(); // CreateInstance returns object with 0 ref count hr = pFileDefExt->Initialize(pidlFolder, pDataObj, NULL); if (SUCCEEDED(hr)) {
12 years, 9 months
1
0
0
0
[akhaldi] 54978: [DDK] * Don't include wdm.h twice in portcls.h.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jan 15 19:10:19 2012 New Revision: 54978 URL:
http://svn.reactos.org/svn/reactos?rev=54978&view=rev
Log: [DDK] * Don't include wdm.h twice in portcls.h. Modified: trunk/reactos/include/ddk/portcls.h Modified: trunk/reactos/include/ddk/portcls.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/portcls.h?rev=…
============================================================================== --- trunk/reactos/include/ddk/portcls.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/portcls.h [iso-8859-1] Sun Jan 15 19:10:19 2012 @@ -143,14 +143,6 @@ #include <ks.h> #include <ksmedia.h> #include <drmk.h> - -#ifdef __cplusplus -extern "C" { -#include <wdm.h> -} -#else -#include <wdm.h> -#endif #ifndef PC_NO_IMPORTS #define PORTCLASSAPI EXTERN_C __declspec(dllimport)
12 years, 9 months
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
56
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
Results per page:
10
25
50
100
200