mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
some code reformatting of slayer.dll and make it build again
svn path=/trunk/; revision=18128
This commit is contained in:
parent
116b8b7916
commit
1d982cb8e9
5 changed files with 963 additions and 745 deletions
|
@ -227,6 +227,9 @@
|
|||
<directory name="shell32">
|
||||
<xi:include href="shell32/shell32.xml" />
|
||||
</directory>
|
||||
<directory name="shellext">
|
||||
<xi:include href="shellext/directory.xml" />
|
||||
</directory>
|
||||
<directory name="shfolder">
|
||||
<xi:include href="shfolder/shfolder.xml" />
|
||||
</directory>
|
||||
|
|
3
reactos/lib/shellext/directory.xml
Normal file
3
reactos/lib/shellext/directory.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<directory name="slayer">
|
||||
<xi:include href="slayer/slayer.xml" />
|
||||
</directory>
|
|
@ -1,4 +1,3 @@
|
|||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
||||
#define INITGUID
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
@ -7,7 +6,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <objbase.h>
|
||||
#include <basetyps.h>
|
||||
#include <unknwn.h>
|
||||
#include "resource.h"
|
||||
#include "slayer.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* ReactOS Compatibility Layer Shell Extension
|
||||
* Copyright (C) 2004 ReactOS Team
|
||||
* Copyright (C) 2004 - 2005 ReactOS Team
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -25,14 +25,14 @@
|
|||
* UPDATE HISTORY:
|
||||
* 09/25/2004 Created
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include <precomp.h>
|
||||
|
||||
HINSTANCE hInstance = NULL;
|
||||
LONG dllrefs = 0;
|
||||
|
||||
/* FIXME - they should be exported somewhere instead of defined here... */
|
||||
DEFINE_SHLGUID(IID_IPropSheetPage, 0x000214F6L, 0, 0);
|
||||
DEFINE_SHLGUID(IID_IShellPropSheetExt, 0x000214E9L, 0, 0);
|
||||
DEFINE_GUID(IID_IClassFactory, 0x00000001, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46);
|
||||
DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46);
|
||||
|
||||
static ifaceICompatibilityPageVbtl efvt =
|
||||
{
|
||||
|
@ -76,7 +76,9 @@ ClearCItemList(LPCOMPATIBILITYPAGE info)
|
|||
item = next)
|
||||
{
|
||||
next = item->next;
|
||||
HeapFree(GetProcessHeap(), 0, item);
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
item);
|
||||
}
|
||||
|
||||
info->CSelectedItem = NULL;
|
||||
|
@ -85,7 +87,10 @@ ClearCItemList(LPCOMPATIBILITYPAGE info)
|
|||
}
|
||||
|
||||
static BOOL
|
||||
ReadDWORDFlag(HKEY hk, LPTSTR szValueName, LPDWORD lpOutValue, DWORD dwDefault)
|
||||
ReadDWORDFlag(HKEY hk,
|
||||
LPTSTR szValueName,
|
||||
LPDWORD lpOutValue,
|
||||
DWORD dwDefault)
|
||||
{
|
||||
DWORD dwType, dwSize = sizeof(DWORD);
|
||||
LONG e = RegQueryValueEx(hk,
|
||||
|
@ -106,7 +111,8 @@ ReadDWORDFlag(HKEY hk, LPTSTR szValueName, LPDWORD lpOutValue, DWORD dwDefault)
|
|||
}
|
||||
|
||||
static BOOL
|
||||
LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info, LPTSTR szValueName)
|
||||
LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info,
|
||||
LPTSTR szValueName)
|
||||
{
|
||||
LONG e;
|
||||
HKEY hk;
|
||||
|
@ -119,17 +125,21 @@ LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info, LPTSTR szValueName)
|
|||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szStr);
|
||||
|
||||
e = RegQueryValueEx(hk,
|
||||
szValueName,
|
||||
0,
|
||||
&dwType,
|
||||
(LPBYTE)szStr,
|
||||
&dwSize);
|
||||
|
||||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
/* FIXME - make sure the string is NULL-terminated! */
|
||||
TCHAR *c;
|
||||
for(c = szStr; *c != TEXT('\0'); c++)
|
||||
for (c = szStr;
|
||||
*c != TEXT('\0');
|
||||
c++)
|
||||
{
|
||||
/* only the first word represents the compatibility mode */
|
||||
/* FIXME - parse all words! */
|
||||
|
@ -145,7 +155,9 @@ LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info, LPTSTR szValueName)
|
|||
{
|
||||
PCITEM item;
|
||||
|
||||
for(item = info->CItems; item != NULL; item = item->next)
|
||||
for (item = info->CItems;
|
||||
item != NULL;
|
||||
item = item->next)
|
||||
{
|
||||
if (!_tcsicmp(szStr, item->szKeyName))
|
||||
{
|
||||
|
@ -174,6 +186,7 @@ LoadCompatibilityModes(LPCOMPATIBILITYPAGE info)
|
|||
e = RegOpenKey(HKEY_CURRENT_USER,
|
||||
TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"),
|
||||
&hk);
|
||||
|
||||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD i;
|
||||
|
@ -186,6 +199,7 @@ LoadCompatibilityModes(LPCOMPATIBILITYPAGE info)
|
|||
e = RegOpenKey(hk,
|
||||
szKey,
|
||||
&hk2);
|
||||
|
||||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
DWORD dwType;
|
||||
|
@ -196,11 +210,14 @@ LoadCompatibilityModes(LPCOMPATIBILITYPAGE info)
|
|||
&dwType,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
if (e != ERROR_SUCCESS || (e == ERROR_SUCCESS && dwType == REG_SZ))
|
||||
{
|
||||
PCITEM item;
|
||||
|
||||
item = HeapAlloc(GetProcessHeap(), 0, sizeof(CITEM));
|
||||
item = HeapAlloc(GetProcessHeap(),
|
||||
0,
|
||||
sizeof(CITEM));
|
||||
if (item != NULL)
|
||||
{
|
||||
DWORD cdb = sizeof(item->szName);
|
||||
|
@ -218,21 +235,41 @@ LoadCompatibilityModes(LPCOMPATIBILITYPAGE info)
|
|||
{
|
||||
item->szName[(sizeof(item->szName) / sizeof(item->szName[0])) - 1] = TEXT('\0');
|
||||
}
|
||||
|
||||
if (e != ERROR_SUCCESS ||
|
||||
cdb < sizeof(item->szName[0]))
|
||||
{
|
||||
_tcscpy(item->szName, szKey);
|
||||
e = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
_tcscpy(item->szKeyName, szKey);
|
||||
info->nItems++;
|
||||
|
||||
ReadDWORDFlag(hk2, TEXT("MajorVersion"), &item->MajorVersion, 0);
|
||||
ReadDWORDFlag(hk2, TEXT("MinorVersion"), &item->MinorVersion, 0);
|
||||
ReadDWORDFlag(hk2, TEXT("BuildNumber"), &item->BuildNumber, 0);
|
||||
ReadDWORDFlag(hk2, TEXT("PlatformId"), &item->PlatformId, 0);
|
||||
ReadDWORDFlag(hk2, TEXT("SPMajorVersion"), &item->SPMajorVersion, 0);
|
||||
ReadDWORDFlag(hk2, TEXT("SPMinorVersion"), &item->SPMinorVersion, 0);
|
||||
ReadDWORDFlag(hk2,
|
||||
TEXT("MajorVersion"),
|
||||
&item->MajorVersion,
|
||||
0);
|
||||
ReadDWORDFlag(hk2,
|
||||
TEXT("MinorVersion"),
|
||||
&item->MinorVersion,
|
||||
0);
|
||||
ReadDWORDFlag(hk2,
|
||||
TEXT("BuildNumber"),
|
||||
&item->BuildNumber,
|
||||
0);
|
||||
ReadDWORDFlag(hk2,
|
||||
TEXT("PlatformId"),
|
||||
&item->PlatformId,
|
||||
0);
|
||||
ReadDWORDFlag(hk2,
|
||||
TEXT("SPMajorVersion"),
|
||||
&item->SPMajorVersion,
|
||||
0);
|
||||
ReadDWORDFlag(hk2,
|
||||
TEXT("SPMinorVersion"),
|
||||
&item->SPMinorVersion,
|
||||
0);
|
||||
|
||||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
|
@ -249,7 +286,9 @@ LoadCompatibilityModes(LPCOMPATIBILITYPAGE info)
|
|||
}
|
||||
else
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, item);
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -271,20 +310,36 @@ LoadCompatibilityModes(LPCOMPATIBILITYPAGE info)
|
|||
}
|
||||
|
||||
static VOID
|
||||
FillComboBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, HWND hwndDlg, HWND hCombo, BOOL bSelectItem, BOOL bDisableControlsIfEmpty)
|
||||
FillComboBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info,
|
||||
HWND hwndDlg,
|
||||
HWND hCombo,
|
||||
BOOL bSelectItem,
|
||||
BOOL bDisableControlsIfEmpty)
|
||||
{
|
||||
PCITEM item;
|
||||
int i = 0;
|
||||
BOOL sel = FALSE;
|
||||
|
||||
SendMessage(hCombo, CB_RESETCONTENT, 0, 0);
|
||||
SendMessage(hCombo,
|
||||
CB_RESETCONTENT,
|
||||
0,
|
||||
0);
|
||||
|
||||
for(item = info->CItems; item != NULL; item = item->next)
|
||||
for (item = info->CItems;
|
||||
item != NULL;
|
||||
item = item->next)
|
||||
{
|
||||
int iIndex = (int)SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)item->szName);
|
||||
int iIndex = (int)SendMessage(hCombo,
|
||||
CB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)item->szName);
|
||||
|
||||
if (item == info->CSelectedItem && bSelectItem)
|
||||
{
|
||||
SendMessage(hCombo, CB_SETCURSEL, (WPARAM)iIndex, 0);
|
||||
SendMessage(hCombo,
|
||||
CB_SETCURSEL,
|
||||
(WPARAM)iIndex,
|
||||
0);
|
||||
sel = TRUE;
|
||||
}
|
||||
i++;
|
||||
|
@ -293,31 +348,55 @@ FillComboBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, HWND hwndDlg, HWND
|
|||
if (!sel && bSelectItem && i > 0)
|
||||
{
|
||||
/* select the first item */
|
||||
SendMessage(hCombo, CB_SETCURSEL, 0, 0);
|
||||
SendMessage(hCombo,
|
||||
CB_SETCURSEL,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
if (bDisableControlsIfEmpty)
|
||||
{
|
||||
BOOL enable = (i > 0);
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_COMPATGROUP), enable);
|
||||
EnableWindow(hCombo, (enable && sel));
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDC_CHKRUNCOMPATIBILITY), enable);
|
||||
CheckDlgButton(hwndDlg, IDC_CHKRUNCOMPATIBILITY, ((enable && sel) ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
EnableWindow(GetDlgItem(hwndDlg,
|
||||
IDC_COMPATGROUP),
|
||||
enable);
|
||||
|
||||
EnableWindow(hCombo,
|
||||
(enable && sel));
|
||||
|
||||
EnableWindow(GetDlgItem(hwndDlg,
|
||||
IDC_CHKRUNCOMPATIBILITY),
|
||||
enable);
|
||||
|
||||
CheckDlgButton(hwndDlg,
|
||||
IDC_CHKRUNCOMPATIBILITY,
|
||||
((enable && sel) ? BST_CHECKED : BST_UNCHECKED));
|
||||
}
|
||||
}
|
||||
|
||||
static VOID
|
||||
FillEditListBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, HWND hwndDlg, HWND hListBox, BOOL bDisableControlsIfEmpty)
|
||||
FillEditListBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info,
|
||||
HWND hwndDlg,
|
||||
HWND hListBox,
|
||||
BOOL bDisableControlsIfEmpty)
|
||||
{
|
||||
PCITEM item;
|
||||
int i = 0;
|
||||
int i;
|
||||
|
||||
SendMessage(hListBox, LB_RESETCONTENT, 0, 0);
|
||||
SendMessage(hListBox,
|
||||
LB_RESETCONTENT,
|
||||
0,
|
||||
0);
|
||||
|
||||
for(item = info->CItems; item != NULL; item = item->next)
|
||||
for (item = info->CItems, i = 0;
|
||||
item != NULL;
|
||||
item = item->next, i++)
|
||||
{
|
||||
SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)item->szName);
|
||||
i++;
|
||||
SendMessage(hListBox,
|
||||
LB_ADDSTRING,
|
||||
0,
|
||||
(LPARAM)item->szName);
|
||||
}
|
||||
|
||||
if (bDisableControlsIfEmpty)
|
||||
|
@ -325,8 +404,11 @@ FillEditListBoxWithCompatibilityModes(LPCOMPATIBILITYPAGE info, HWND hwndDlg, HW
|
|||
}
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
EditCompatibilityModesProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
static INT_PTR CALLBACK
|
||||
EditCompatibilityModesProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
LPCOMPATIBILITYPAGE this;
|
||||
|
||||
|
@ -337,58 +419,87 @@ EditCompatibilityModesProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
EndDialog(hwndDlg,
|
||||
IDOK);
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hwndDlg, IDCANCEL);
|
||||
EndDialog(hwndDlg,
|
||||
IDCANCEL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
{
|
||||
EndDialog(hwndDlg, IDCANCEL);
|
||||
EndDialog(hwndDlg,
|
||||
IDCANCEL);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HWND hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE);
|
||||
HWND hList = GetDlgItem(hwndDlg,
|
||||
IDC_COMPATIBILITYMODE);
|
||||
|
||||
this = (LPCOMPATIBILITYPAGE)lParam;
|
||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)this);
|
||||
FillEditListBoxWithCompatibilityModes(this, hwndDlg, hList, FALSE);
|
||||
SetWindowLongPtr(hwndDlg,
|
||||
GWLP_USERDATA,
|
||||
(LONG_PTR)this);
|
||||
|
||||
FillEditListBoxWithCompatibilityModes(this,
|
||||
hwndDlg,
|
||||
hList,
|
||||
FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static VOID
|
||||
InitializePage(LPCOMPATIBILITYPAGE this, HWND hwndDlg)
|
||||
InitializePage(LPCOMPATIBILITYPAGE this,
|
||||
HWND hwndDlg)
|
||||
{
|
||||
HWND hList;
|
||||
|
||||
LoadCompatibilityModes(this);
|
||||
|
||||
/* initialize the controls */
|
||||
hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE);
|
||||
LoadAndParseAppCompatibilityFlags(this, this->szFile);
|
||||
FillComboBoxWithCompatibilityModes(this, hwndDlg, hList, TRUE, TRUE);
|
||||
hList = GetDlgItem(hwndDlg,
|
||||
IDC_COMPATIBILITYMODE);
|
||||
|
||||
LoadAndParseAppCompatibilityFlags(this,
|
||||
this->szFile);
|
||||
FillComboBoxWithCompatibilityModes(this,
|
||||
hwndDlg,
|
||||
hList,
|
||||
TRUE,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
static VOID
|
||||
ReportPropertyChange(LPCOMPATIBILITYPAGE this, HWND hwndDlg)
|
||||
ReportPropertyChange(LPCOMPATIBILITYPAGE this,
|
||||
HWND hwndDlg)
|
||||
{
|
||||
this->Changed = TRUE;
|
||||
SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0);
|
||||
|
||||
SendMessage(GetParent(hwndDlg),
|
||||
PSM_CHANGED,
|
||||
(WPARAM)hwndDlg,
|
||||
0);
|
||||
}
|
||||
|
||||
static BOOL
|
||||
ComposeFlags(LPCOMPATIBILITYPAGE this, LPTSTR szFlags)
|
||||
ComposeFlags(LPCOMPATIBILITYPAGE this,
|
||||
LPTSTR szFlags)
|
||||
{
|
||||
if (this->CSelectedItem != NULL)
|
||||
{
|
||||
_tcscpy(szFlags, this->CSelectedItem->szKeyName);
|
||||
_tcscpy(szFlags,
|
||||
this->CSelectedItem->szKeyName);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -396,24 +507,32 @@ ComposeFlags(LPCOMPATIBILITYPAGE this, LPTSTR szFlags)
|
|||
}
|
||||
|
||||
static BOOL
|
||||
ApplySettings(LPCOMPATIBILITYPAGE this, HWND hwndDlg)
|
||||
ApplySettings(LPCOMPATIBILITYPAGE this,
|
||||
HWND hwndDlg)
|
||||
{
|
||||
HKEY hk;
|
||||
LONG e;
|
||||
TCHAR szFlags[256];
|
||||
BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED;
|
||||
BOOL enabled = IsDlgButtonChecked(hwndDlg,
|
||||
IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
HWND hCombo = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE);
|
||||
int index = (int)SendMessage(hCombo, CB_GETCURSEL, 0, 0);
|
||||
HWND hCombo = GetDlgItem(hwndDlg,
|
||||
IDC_COMPATIBILITYMODE);
|
||||
int index = (int)SendMessage(hCombo,
|
||||
CB_GETCURSEL,
|
||||
0,
|
||||
0);
|
||||
if (index >= 0)
|
||||
{
|
||||
int i;
|
||||
PCITEM sel = this->CItems;
|
||||
|
||||
/* map the index to a CITEM structure */
|
||||
for(i = index; i > 0 && sel != NULL; i--)
|
||||
for(i = index;
|
||||
i > 0 && sel != NULL;
|
||||
i--)
|
||||
{
|
||||
sel = sel->next;
|
||||
}
|
||||
|
@ -433,11 +552,13 @@ ApplySettings(LPCOMPATIBILITYPAGE this, HWND hwndDlg)
|
|||
if (!enabled)
|
||||
{
|
||||
/* FIXME - only delete if nothing else is selected! */
|
||||
e = RegDeleteValue(hk, this->szFile);
|
||||
e = RegDeleteValue(hk,
|
||||
this->szFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ComposeFlags(this, szFlags))
|
||||
if (ComposeFlags(this,
|
||||
szFlags))
|
||||
{
|
||||
e = RegSetValueEx(hk,
|
||||
this->szFile,
|
||||
|
@ -448,7 +569,8 @@ ApplySettings(LPCOMPATIBILITYPAGE this, HWND hwndDlg)
|
|||
}
|
||||
else
|
||||
{
|
||||
e = RegDeleteValue(hk, this->szFile);
|
||||
e = RegDeleteValue(hk,
|
||||
this->szFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,10 +581,14 @@ ApplySettings(LPCOMPATIBILITYPAGE this, HWND hwndDlg)
|
|||
return (e == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK
|
||||
CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
static INT_PTR CALLBACK
|
||||
CompatibilityPageProc(HWND hwndDlg,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
LPCOMPATIBILITYPAGE this = (LPCOMPATIBILITYPAGE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
|
||||
LPCOMPATIBILITYPAGE this = (LPCOMPATIBILITYPAGE)GetWindowLongPtr(hwndDlg,
|
||||
GWLP_USERDATA);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
|
@ -470,7 +596,8 @@ CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMPATIBILITYMODE)
|
||||
{
|
||||
ReportPropertyChange(this, hwndDlg);
|
||||
ReportPropertyChange(this,
|
||||
hwndDlg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -478,18 +605,25 @@ CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
case IDC_CHKRUNCOMPATIBILITY:
|
||||
{
|
||||
HWND hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE);
|
||||
HWND hList = GetDlgItem(hwndDlg,
|
||||
IDC_COMPATIBILITYMODE);
|
||||
|
||||
if (hList != NULL)
|
||||
{
|
||||
EnableWindow(hList, IsDlgButtonChecked(hwndDlg, IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED);
|
||||
EnableWindow(hList,
|
||||
IsDlgButtonChecked(hwndDlg,
|
||||
IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED);
|
||||
}
|
||||
/* fall through */
|
||||
}
|
||||
|
||||
case IDC_CHKRUNIN256COLORS:
|
||||
case IDC_CHKRUNIN640480RES:
|
||||
case IDC_CHKDISABLEVISUALTHEMES:
|
||||
ReportPropertyChange(this, hwndDlg);
|
||||
ReportPropertyChange(this,
|
||||
hwndDlg);
|
||||
break;
|
||||
|
||||
case IDC_EDITCOMPATIBILITYMODES:
|
||||
{
|
||||
if (DialogBoxParam(hInstance,
|
||||
|
@ -498,7 +632,8 @@ CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
EditCompatibilityModesProc,
|
||||
(LPARAM)this) == IDOK)
|
||||
{
|
||||
InitializePage(this, hwndDlg);
|
||||
InitializePage(this,
|
||||
hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -515,7 +650,8 @@ CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case PSN_APPLY:
|
||||
if (this->Changed)
|
||||
{
|
||||
return ApplySettings(this, hwndDlg);
|
||||
return ApplySettings(this,
|
||||
hwndDlg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -526,9 +662,12 @@ CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
LPPROPSHEETPAGE psp = (LPPROPSHEETPAGE)lParam;
|
||||
this = (LPCOMPATIBILITYPAGE)psp->lParam;
|
||||
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)this);
|
||||
SetWindowLongPtr(hwndDlg,
|
||||
GWLP_USERDATA,
|
||||
(LONG_PTR)this);
|
||||
|
||||
InitializePage(this, hwndDlg);
|
||||
InitializePage(this,
|
||||
hwndDlg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -536,8 +675,10 @@ CompatibilityPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
UINT CALLBACK
|
||||
CompatibilityPageCallback(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp)
|
||||
static UINT CALLBACK
|
||||
CompatibilityPageCallback(HWND hwnd,
|
||||
UINT uMsg,
|
||||
LPPROPSHEETPAGE ppsp)
|
||||
{
|
||||
LPCOMPATIBILITYPAGE this = (LPCOMPATIBILITYPAGE)ppsp->lParam;
|
||||
|
||||
|
@ -560,7 +701,9 @@ ICompatibilityPage_fnConstructor(VOID)
|
|||
{
|
||||
LPCOMPATIBILITYPAGE cp;
|
||||
|
||||
cp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(COMPATIBILITYPAGE));
|
||||
cp = HeapAlloc(GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
sizeof(COMPATIBILITYPAGE));
|
||||
if (cp != NULL)
|
||||
{
|
||||
cp->lpVtbl = &efvt;
|
||||
|
@ -573,30 +716,36 @@ ICompatibilityPage_fnConstructor(VOID)
|
|||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE
|
||||
ICompatibilityPage_fnQueryInterface(LPCOMPATIBILITYPAGE this, REFIID iid, PVOID *pvObject)
|
||||
ICompatibilityPage_fnQueryInterface(LPCOMPATIBILITYPAGE this,
|
||||
REFIID iid,
|
||||
PVOID *pvObject)
|
||||
{
|
||||
if(IsEqualIID(iid, &IID_IShellPropSheetExt))
|
||||
if (IsEqualIID(iid,
|
||||
&IID_IShellPropSheetExt))
|
||||
{
|
||||
this->lpVtbl->fn.IShellPropSheetExt = efvtIShellPropSheetExt;
|
||||
ICompatibilityPage_fnAddRef(this);
|
||||
*pvObject = this;
|
||||
return S_OK;
|
||||
}
|
||||
else if(IsEqualIID(iid, &IID_IShellExtInit))
|
||||
else if (IsEqualIID(iid,
|
||||
&IID_IShellExtInit))
|
||||
{
|
||||
this->lpVtbl->fn.IShellExtInit = efvtIShellExtInit;
|
||||
ICompatibilityPage_fnAddRef(this);
|
||||
*pvObject = this;
|
||||
return S_OK;
|
||||
}
|
||||
else if(IsEqualIID(iid, &IID_IClassFactory))
|
||||
else if (IsEqualIID(iid,
|
||||
&IID_IClassFactory))
|
||||
{
|
||||
this->lpVtbl->fn.IClassFactory = efvtIClassFactory;
|
||||
ICompatibilityPage_fnAddRef(this);
|
||||
*pvObject = this;
|
||||
return S_OK;
|
||||
}
|
||||
else if(IsEqualIID(iid, &IID_IUnknown))
|
||||
else if (IsEqualIID(iid,
|
||||
&IID_IUnknown))
|
||||
{
|
||||
ICompatibilityPage_fnAddRef(this);
|
||||
*pvObject = this;
|
||||
|
@ -621,20 +770,22 @@ ICompatibilityPage_fnRelease(LPCOMPATIBILITYPAGE this)
|
|||
rfc = (ULONG)InterlockedDecrement(&this->ref);
|
||||
if (rfc == 0)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, this);
|
||||
HeapFree(GetProcessHeap(),
|
||||
0,
|
||||
this);
|
||||
InterlockedDecrement(&dllrefs);
|
||||
}
|
||||
return rfc;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE
|
||||
ICompatibilityPage_fnAddPages(LPCOMPATIBILITYPAGE this, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
|
||||
ICompatibilityPage_fnAddPages(LPCOMPATIBILITYPAGE this,
|
||||
LPFNADDPROPSHEETPAGE lpfnAddPage,
|
||||
LPARAM lParam)
|
||||
{
|
||||
PROPSHEETPAGE psp;
|
||||
PROPSHEETPAGE psp = {0};
|
||||
HPROPSHEETPAGE hPage;
|
||||
|
||||
ZeroMemory(&psp, sizeof(psp));
|
||||
|
||||
psp.dwSize = sizeof(psp);
|
||||
psp.dwFlags = PSP_DEFAULT | PSP_USECALLBACK;
|
||||
psp.hInstance = hInstance;
|
||||
|
@ -647,7 +798,8 @@ ICompatibilityPage_fnAddPages(LPCOMPATIBILITYPAGE this, LPFNADDPROPSHEETPAGE lpf
|
|||
|
||||
if (hPage != NULL)
|
||||
{
|
||||
if(!lpfnAddPage(hPage, lParam))
|
||||
if (!lpfnAddPage(hPage,
|
||||
lParam))
|
||||
{
|
||||
DestroyPropertySheetPage(hPage);
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -661,7 +813,10 @@ ICompatibilityPage_fnAddPages(LPCOMPATIBILITYPAGE this, LPFNADDPROPSHEETPAGE lpf
|
|||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE
|
||||
ICompatibilityPage_fnReplacePage(LPCOMPATIBILITYPAGE this, UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplacePage, LPARAM lParam)
|
||||
ICompatibilityPage_fnReplacePage(LPCOMPATIBILITYPAGE this,
|
||||
UINT uPageID,
|
||||
LPFNADDPROPSHEETPAGE lpfnReplacePage,
|
||||
LPARAM lParam)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
@ -686,13 +841,20 @@ ICompatibilityPage_fnInitialize(LPCOMPATIBILITYPAGE this,
|
|||
fetc.lindex = -1;
|
||||
fetc.tymed = TYMED_HGLOBAL;
|
||||
|
||||
if(SUCCEEDED(pdtobj->lpVtbl->GetData(pdtobj, &fetc, &smdm)))
|
||||
if (SUCCEEDED(pdtobj->lpVtbl->GetData(pdtobj,
|
||||
&fetc,
|
||||
&smdm)))
|
||||
{
|
||||
UINT nFiles = DragQueryFile(smdm.hGlobal, 0xFFFFFFFF, this->szFile, sizeof(this->szFile) / sizeof(this->szFile[0]));
|
||||
UINT nFiles = DragQueryFile(smdm.hGlobal,
|
||||
0xFFFFFFFF,
|
||||
this->szFile,
|
||||
sizeof(this->szFile) / sizeof(this->szFile[0]));
|
||||
if (nFiles == 1)
|
||||
{
|
||||
/* FIXME - support editing of multiple files later */
|
||||
DragQueryFile(smdm.hGlobal, 0, this->szFile, sizeof(this->szFile) / sizeof(this->szFile[0]));
|
||||
DragQueryFile(smdm.hGlobal,
|
||||
0, this->szFile,
|
||||
sizeof(this->szFile) / sizeof(this->szFile[0]));
|
||||
ReleaseStgMedium(&smdm);
|
||||
|
||||
return S_OK;
|
||||
|
@ -711,7 +873,8 @@ ICompatibilityPage_fnCreateInstance(LPCOMPATIBILITYPAGE this,
|
|||
LPCOMPATIBILITYPAGE cp;
|
||||
|
||||
if (pUnkOuter != NULL &&
|
||||
!IsEqualIID(riid, &IID_IUnknown))
|
||||
!IsEqualIID(riid,
|
||||
&IID_IUnknown))
|
||||
{
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
}
|
||||
|
@ -719,7 +882,9 @@ ICompatibilityPage_fnCreateInstance(LPCOMPATIBILITYPAGE this,
|
|||
cp = ICompatibilityPage_fnConstructor();
|
||||
if (cp != NULL)
|
||||
{
|
||||
HRESULT ret = ICompatibilityPage_fnQueryInterface(cp, riid, ppvObject);
|
||||
HRESULT ret = ICompatibilityPage_fnQueryInterface(cp,
|
||||
riid,
|
||||
ppvObject);
|
||||
ICompatibilityPage_fnRelease(cp);
|
||||
return ret;
|
||||
}
|
||||
|
@ -748,19 +913,24 @@ ICompatibilityPage_fnLockServer(LPCOMPATIBILITYPAGE this,
|
|||
******************************************************************************/
|
||||
|
||||
HRESULT STDCALL
|
||||
DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
|
||||
DllGetClassObject(REFCLSID rclsid,
|
||||
REFIID iid,
|
||||
LPVOID *ppv)
|
||||
{
|
||||
if (ppv == NULL)
|
||||
{
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if(IsEqualCLSID(&CLSID_ICompatibilityPage, rclsid))
|
||||
if (IsEqualCLSID(&CLSID_ICompatibilityPage,
|
||||
rclsid))
|
||||
{
|
||||
LPCOMPATIBILITYPAGE iface = ICompatibilityPage_fnConstructor();
|
||||
if (iface != NULL)
|
||||
{
|
||||
HRESULT ret = ICompatibilityPage_fnQueryInterface(iface, iid, ppv);
|
||||
HRESULT ret = ICompatibilityPage_fnQueryInterface(iface,
|
||||
iid,
|
||||
ppv);
|
||||
ICompatibilityPage_fnRelease(iface);
|
||||
return ret;
|
||||
}
|
||||
|
@ -781,7 +951,10 @@ UnregisterPropSheetHandler(LPTSTR szType)
|
|||
{
|
||||
TCHAR szKey[255];
|
||||
|
||||
_stprintf(szKey, TEXT("%s\\shellex\\PropertySheetHandlers\\Compatibility Property Page"), szType);
|
||||
_stprintf(szKey,
|
||||
TEXT("%s\\shellex\\PropertySheetHandlers\\Compatibility Property Page"),
|
||||
szType);
|
||||
|
||||
return RegDeleteKey(HKEY_CLASSES_ROOT,
|
||||
szKey);
|
||||
}
|
||||
|
@ -793,13 +966,17 @@ DllUnregisterServer(VOID)
|
|||
HKEY hk;
|
||||
WCHAR szGuid[40];
|
||||
|
||||
StringFromGUID2(&CLSID_ICompatibilityPage, szGuid, sizeof(szGuid) / sizeof(szGuid[0]));
|
||||
StringFromGUID2(&CLSID_ICompatibilityPage,
|
||||
szGuid,
|
||||
sizeof(szGuid) / sizeof(szGuid[0]));
|
||||
|
||||
e = RegOpenKey(HKEY_LOCAL_MACHINE,
|
||||
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),
|
||||
&hk);
|
||||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
e = RegDeleteValueW(hk, szGuid);
|
||||
e = RegDeleteValueW(hk,
|
||||
szGuid);
|
||||
RegCloseKey(hk);
|
||||
}
|
||||
|
||||
|
@ -816,7 +993,10 @@ DllUnregisterServer(VOID)
|
|||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
TCHAR szInprocKey[255];
|
||||
_stprintf(szInprocKey, TEXT("%ws\\InprocServer32"), szGuid);
|
||||
|
||||
_stprintf(szInprocKey,
|
||||
TEXT("%ws\\InprocServer32"),
|
||||
szGuid);
|
||||
|
||||
e = RegDeleteKey(hk,
|
||||
szInprocKey);
|
||||
|
@ -833,13 +1013,17 @@ DllUnregisterServer(VOID)
|
|||
}
|
||||
|
||||
static int
|
||||
RegisterPropSheetHandler(LPTSTR szType, LPWSTR szGuid)
|
||||
RegisterPropSheetHandler(LPTSTR szType,
|
||||
LPWSTR szGuid)
|
||||
{
|
||||
TCHAR szKey[255];
|
||||
HKEY hk;
|
||||
int e;
|
||||
|
||||
_stprintf(szKey, TEXT("%s\\shellex\\PropertySheetHandlers\\Compatibility Property Page"), szType);
|
||||
_stprintf(szKey,
|
||||
TEXT("%s\\shellex\\PropertySheetHandlers\\Compatibility Property Page"),
|
||||
szType);
|
||||
|
||||
e = RegCreateKey(HKEY_CLASSES_ROOT,
|
||||
szKey,
|
||||
&hk);
|
||||
|
@ -867,7 +1051,9 @@ DllRegisterServer(VOID)
|
|||
TCHAR szModule[MAX_PATH + 1];
|
||||
int lnszDescription;
|
||||
|
||||
if(!GetModuleFileName(hInstance, szModule, sizeof(szModule) / sizeof(szModule[0])))
|
||||
if(!GetModuleFileName(hInstance,
|
||||
szModule,
|
||||
sizeof(szModule) / sizeof(szModule[0])))
|
||||
{
|
||||
return E_ACCESSDENIED;
|
||||
}
|
||||
|
@ -875,10 +1061,14 @@ DllRegisterServer(VOID)
|
|||
/* unregister first */
|
||||
DllUnregisterServer();
|
||||
|
||||
lnszDescription = LoadStringW(hInstance, IDS_DESCRIPTION, szDescription, sizeof(szDescription) / sizeof(szDescription[0]));
|
||||
lnszDescription = LoadStringW(hInstance,
|
||||
IDS_DESCRIPTION,
|
||||
szDescription, sizeof(szDescription) / sizeof(szDescription[0]));
|
||||
if (lnszDescription > 0)
|
||||
{
|
||||
StringFromGUID2(&CLSID_ICompatibilityPage, szGuid, sizeof(szGuid) / sizeof(szGuid[0]));
|
||||
StringFromGUID2(&CLSID_ICompatibilityPage,
|
||||
szGuid,
|
||||
sizeof(szGuid) / sizeof(szGuid[0]));
|
||||
|
||||
e = RegOpenKey(HKEY_LOCAL_MACHINE,
|
||||
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),
|
||||
|
@ -897,7 +1087,10 @@ DllRegisterServer(VOID)
|
|||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
TCHAR szInprocKey[255];
|
||||
_stprintf(szInprocKey, TEXT("CLSID\\%ws\\InprocServer32"), szGuid);
|
||||
|
||||
_stprintf(szInprocKey,
|
||||
TEXT("CLSID\\%ws\\InprocServer32"),
|
||||
szGuid);
|
||||
|
||||
e = RegCreateKey(HKEY_CLASSES_ROOT,
|
||||
szInprocKey,
|
||||
|
@ -912,7 +1105,8 @@ DllRegisterServer(VOID)
|
|||
(_tcslen(szModule) + 1) * sizeof(TCHAR));
|
||||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
const LPTSTR szApartment = TEXT("Apartment");
|
||||
const TCHAR szApartment[] = TEXT("Apartment");
|
||||
|
||||
e = RegSetValueEx(hk,
|
||||
TEXT("ThreadingModel"),
|
||||
0,
|
||||
|
@ -927,7 +1121,8 @@ DllRegisterServer(VOID)
|
|||
|
||||
if (e == ERROR_SUCCESS)
|
||||
{
|
||||
e = RegisterPropSheetHandler(TEXT("exefile"), szGuid);
|
||||
e = RegisterPropSheetHandler(TEXT("exefile"),
|
||||
szGuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,6 +1141,7 @@ DllMain(HINSTANCE hinstDLL,
|
|||
DisableThreadLibraryCalls(hInstance);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
18
reactos/lib/shellext/slayer/slayer.xml
Normal file
18
reactos/lib/shellext/slayer/slayer.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<module name="slayer" type="win32dll" baseaddress="${BASEADDRESS_SLAYER}" installbase="system32" installname="slayer.dll">
|
||||
<importlibrary definition="slayer.def" />
|
||||
<include base="slayer">.</include>
|
||||
<define name="UNICODE" />
|
||||
<define name="_UNICODE" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x601</define>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>comctl32</library>
|
||||
<library>advapi32</library>
|
||||
<library>ole32</library>
|
||||
<library>shell32</library>
|
||||
<file>slayer.c</file>
|
||||
<file>slayer.rc</file>
|
||||
<pch>precomp.h</pch>
|
||||
</module>
|
Loading…
Reference in a new issue