some code reformatting of slayer.dll and make it build again Modified: trunk/reactos/lib/directory.xml Added: trunk/reactos/lib/shellext/directory.xml Modified: trunk/reactos/lib/shellext/slayer/precomp.h Modified: trunk/reactos/lib/shellext/slayer/slayer.c Added: trunk/reactos/lib/shellext/slayer/slayer.xml _____
Modified: trunk/reactos/lib/directory.xml --- trunk/reactos/lib/directory.xml 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/directory.xml 2005-09-27 20:22:25 UTC (rev 18128) @@ -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> _____
Added: trunk/reactos/lib/shellext/directory.xml --- trunk/reactos/lib/shellext/directory.xml 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/shellext/directory.xml 2005-09-27 20:22:25 UTC (rev 18128) @@ -0,0 +1,3 @@
+<directory name="slayer"> + <xi:include href="slayer/slayer.xml" /> +</directory> \ No newline at end of file Property changes on: trunk/reactos/lib/shellext/directory.xml ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/reactos/lib/shellext/slayer ___________________________________________________________________ Name: svn:ignore - *.coff *.dll *.gch *.d *.a *.o *.sym *.map *.tmp + *.coff *.dll *.gch *.d *.a *.o *.sym *.map *.tmp GNUmakefile _____
Modified: trunk/reactos/lib/shellext/slayer/precomp.h --- trunk/reactos/lib/shellext/slayer/precomp.h 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/shellext/slayer/precomp.h 2005-09-27 20:22:25 UTC (rev 18128) @@ -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" _____
Modified: trunk/reactos/lib/shellext/slayer/slayer.c --- trunk/reactos/lib/shellext/slayer/slayer.c 2005-09-27 18:19:59 UTC (rev 18127) +++ trunk/reactos/lib/shellext/slayer/slayer.c 2005-09-27 20:22:25 UTC (rev 18128) @@ -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,41 +25,41 @@ * 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 = { - /* IUnknown methods */ - ICompatibilityPage_fnQueryInterface, - ICompatibilityPage_fnAddRef, - ICompatibilityPage_fnRelease, + /* IUnknown methods */ + ICompatibilityPage_fnQueryInterface, + ICompatibilityPage_fnAddRef, + ICompatibilityPage_fnRelease, };
static ifaceIShellPropSheetExtVbtl efvtIShellPropSheetExt = { - /* IShellPropSheetExt */ - ICompatibilityPage_fnAddPages, - ICompatibilityPage_fnReplacePage, + /* IShellPropSheetExt */ + ICompatibilityPage_fnAddPages, + ICompatibilityPage_fnReplacePage, };
static ifaceIShellExtInitVbtl efvtIShellExtInit = { - /* IShellExtInit */ - ICompatibilityPage_fnInitialize, + /* IShellExtInit */ + ICompatibilityPage_fnInitialize, };
static ifaceIClassFactoryVbtl efvtIClassFactory = { - /* IClassFactory */ - ICompatibilityPage_fnCreateInstance, - ICompatibilityPage_fnLockServer, + /* IClassFactory */ + ICompatibilityPage_fnCreateInstance, + ICompatibilityPage_fnLockServer, };
/*********************************************************************** ******* @@ -69,601 +69,756 @@ static VOID ClearCItemList(LPCOMPATIBILITYPAGE info) { - PCITEM item, next; + PCITEM item, next;
- for(item = info->CItems; - item != NULL; - item = next) - { - next = item->next; - HeapFree(GetProcessHeap(), 0, item); - } + for (item = info->CItems; + item != NULL; + item = next) + { + next = item->next; + HeapFree(GetProcessHeap(), + 0, + item); + }
- info->CSelectedItem = NULL; - info->CItems = NULL; - info->nItems = 0; + info->CSelectedItem = NULL; + info->CItems = NULL; + info->nItems = 0; }
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, - szValueName, - 0, - &dwType, - (LPBYTE)lpOutValue, - &dwSize); + DWORD dwType, dwSize = sizeof(DWORD); + LONG e = RegQueryValueEx(hk, + szValueName, + 0, + &dwType, + (LPBYTE)lpOutValue, + &dwSize);
- if(e != ERROR_SUCCESS || dwSize != sizeof(DWORD)) - { - *lpOutValue = dwDefault; + if (e != ERROR_SUCCESS || dwSize != sizeof(DWORD)) + { + *lpOutValue = dwDefault;
- return TRUE; - } + return TRUE; + }
- return FALSE; + return FALSE; }
static BOOL -LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info, LPTSTR szValueName) +LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info, + LPTSTR szValueName) { - LONG e; - HKEY hk; - DWORD dwType, dwSize; - TCHAR szStr[256]; - - e = RegOpenKey(HKEY_CURRENT_USER, - TEXT("SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"), - &hk); - if(e == ERROR_SUCCESS) - { - dwSize = sizeof(szStr); - e = RegQueryValueEx(hk, - szValueName, - 0, - &dwType, - (LPBYTE)szStr, - &dwSize); - if(e == ERROR_SUCCESS) + LONG e; + HKEY hk; + DWORD dwType, dwSize; + TCHAR szStr[256]; + + e = RegOpenKey(HKEY_CURRENT_USER, + TEXT("SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"), + &hk); + if (e == ERROR_SUCCESS) { - /* FIXME - make sure the string is NULL-terminated! */ - TCHAR *c; - for(c = szStr; *c != TEXT('\0'); c++) - { - /* only the first word represents the compatibility mode */ - /* FIXME - parse all words! */ - if(*c == TEXT(' ')) + dwSize = sizeof(szStr); + + e = RegQueryValueEx(hk, + szValueName, + 0, + &dwType, + (LPBYTE)szStr, + &dwSize); + + if (e == ERROR_SUCCESS) { - *c = TEXT('\0'); - break; + /* FIXME - make sure the string is NULL-terminated! */ + TCHAR *c; + for (c = szStr; + *c != TEXT('\0'); + c++) + { + /* only the first word represents the compatibility mode */ + /* FIXME - parse all words! */ + if (*c == TEXT(' ')) + { + *c = TEXT('\0'); + break; + } + } + + info->CSelectedItem = NULL; + if (_tcslen(szStr) > 0) + { + PCITEM item; + + for (item = info->CItems; + item != NULL; + item = item->next) + { + if (!_tcsicmp(szStr, item->szKeyName)) + { + info->CSelectedItem = item; + break; + } + } + } } - } - - info->CSelectedItem = NULL; - if(_tcslen(szStr) > 0) - { - PCITEM item; - - for(item = info->CItems; item != NULL; item = item->next) - { - if(!_tcsicmp(szStr, item->szKeyName)) - { - info->CSelectedItem = item; - break; - } - } - } + RegCloseKey(hk); } - RegCloseKey(hk); - }
- return FALSE; + return FALSE; }
static BOOL LoadCompatibilityModes(LPCOMPATIBILITYPAGE info) { - BOOL Ret; - LONG e; - HKEY hk, hk2; - TCHAR szKey[256]; + BOOL Ret; + LONG e; + HKEY hk, hk2; + TCHAR szKey[256];
- ClearCItemList(info); - - e = RegOpenKey(HKEY_CURRENT_USER, - TEXT("SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"), - &hk); - if(e == ERROR_SUCCESS) - { - DWORD i; - PCITEM lastitem = NULL; - - for(i = 0; - (RegEnumKey(hk, i,szKey, sizeof(szKey) / sizeof(szKey[0])) == ERROR_SUCCESS); - i++) + ClearCItemList(info); + + e = RegOpenKey(HKEY_CURRENT_USER, + TEXT("SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"), + &hk); + + if (e == ERROR_SUCCESS) { - e = RegOpenKey(hk, - szKey, - &hk2); - if(e == ERROR_SUCCESS) - { - DWORD dwType; - - e = RegQueryValueEx(hk2, - NULL, - 0, - &dwType, - NULL, - NULL); - if(e != ERROR_SUCCESS || (e == ERROR_SUCCESS && dwType == REG_SZ)) + DWORD i; + PCITEM lastitem = NULL; + + for(i = 0; + (RegEnumKey(hk, i,szKey, sizeof(szKey) / sizeof(szKey[0])) == ERROR_SUCCESS); + i++) { - PCITEM item; - - item = HeapAlloc(GetProcessHeap(), 0, sizeof(CITEM)); - if(item != NULL) - { - DWORD cdb = sizeof(item->szName); - - /* description */ - e = RegQueryValueEx(hk2, - NULL, - 0, - NULL, - (LPBYTE)item->szName, - &cdb); + e = RegOpenKey(hk, + szKey, + &hk2);
- /* make sure it is null-terminated */ - if(cdb > sizeof(item->szName) - sizeof(item->szName[0])) + if (e == ERROR_SUCCESS) { - item->szName[(sizeof(item->szName) / sizeof(item->szName[0])) - 1] = TEXT('\0'); + DWORD dwType; + + e = RegQueryValueEx(hk2, + NULL, + 0, + &dwType, + NULL, + NULL); + + if (e != ERROR_SUCCESS || (e == ERROR_SUCCESS && dwType == REG_SZ)) + { + PCITEM item; + + item = HeapAlloc(GetProcessHeap(), + 0, + sizeof(CITEM)); + if (item != NULL) + { + DWORD cdb = sizeof(item->szName); + + /* description */ + e = RegQueryValueEx(hk2, + NULL, + 0, + NULL, + (LPBYTE)item->szName, + &cdb); + + /* make sure it is null-terminated */ + if (cdb > sizeof(item->szName) - sizeof(item->szName[0])) + { + 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); + + if (e == ERROR_SUCCESS) + { + item->next = NULL; + if (lastitem != NULL) + { + lastitem->next = item; + } + else + { + info->CItems = item; + } + lastitem = item; + } + else + { + HeapFree(GetProcessHeap(), + 0, + item); + } + } + } + + RegCloseKey(hk2); } - 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); - - if(e == ERROR_SUCCESS) + if (e != ERROR_SUCCESS) { - item->next = NULL; - if(lastitem != NULL) - { - lastitem->next = item; - } - else - { - info->CItems = item; - } - lastitem = item; + e = ERROR_SUCCESS; } - else - { - HeapFree(GetProcessHeap(), 0, item); - } - } } - - RegCloseKey(hk2); - } - - if(e != ERROR_SUCCESS) - { - e = ERROR_SUCCESS; - } + RegCloseKey(hk); } - RegCloseKey(hk); - } - - Ret = ((e == ERROR_SUCCESS || e == ERROR_NO_MORE_ITEMS) ? TRUE : FALSE); - - return Ret; + + Ret = ((e == ERROR_SUCCESS || e == ERROR_NO_MORE_ITEMS) ? TRUE : FALSE); + + return Ret; }
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; + 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) + { + int iIndex = (int)SendMessage(hCombo, + CB_ADDSTRING, + 0, + (LPARAM)item->szName); + + if (item == info->CSelectedItem && bSelectItem) + { + SendMessage(hCombo, + CB_SETCURSEL, + (WPARAM)iIndex, + 0); + sel = TRUE; + } + i++; + }
- for(item = info->CItems; item != NULL; item = item->next) - { - int iIndex = (int)SendMessage(hCombo, CB_ADDSTRING, 0, (LPARAM)item->szName); - if(item == info->CSelectedItem && bSelectItem) + if (!sel && bSelectItem && i > 0) { - SendMessage(hCombo, CB_SETCURSEL, (WPARAM)iIndex, 0); - sel = TRUE; + /* select the first item */ + SendMessage(hCombo, + CB_SETCURSEL, + 0, + 0); } - i++; - } - - if(!sel && bSelectItem && i > 0) - { - /* select the first item */ - 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)); - } + + 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)); + } }
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; + PCITEM item; + int i;
- SendMessage(hListBox, LB_RESETCONTENT, 0, 0); + SendMessage(hListBox, + LB_RESETCONTENT, + 0, + 0);
- for(item = info->CItems; item != NULL; item = item->next) - { - SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)item->szName); - i++; - } + for (item = info->CItems, i = 0; + item != NULL; + item = item->next, i++) + { + SendMessage(hListBox, + LB_ADDSTRING, + 0, + (LPARAM)item->szName); + }
- if(bDisableControlsIfEmpty) - { - } + if (bDisableControlsIfEmpty) + { + } }
-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; - - switch(uMsg) - { - case WM_COMMAND: + LPCOMPATIBILITYPAGE this; + + switch (uMsg) { - switch(LOWORD(wParam)) - { - case IDOK: - EndDialog(hwndDlg, IDOK); - break; + case WM_COMMAND: + { + switch(LOWORD(wParam)) + { + case IDOK: + EndDialog(hwndDlg, + IDOK); + break;
- case IDCANCEL: - EndDialog(hwndDlg, IDCANCEL); - break; - } - break; + case IDCANCEL: + EndDialog(hwndDlg, + IDCANCEL); + break; + } + break; + } + + case WM_CLOSE: + { + EndDialog(hwndDlg, + IDCANCEL); + break; + } + + case WM_INITDIALOG: + { + HWND hList = GetDlgItem(hwndDlg, + IDC_COMPATIBILITYMODE); + + this = (LPCOMPATIBILITYPAGE)lParam; + SetWindowLongPtr(hwndDlg, + GWLP_USERDATA, + (LONG_PTR)this); + + FillEditListBoxWithCompatibilityModes(this, + hwndDlg, + hList, + FALSE); + break; + } } - case WM_CLOSE: - { - EndDialog(hwndDlg, IDCANCEL); - break; - } - case WM_INITDIALOG: - { - HWND hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE); - this = (LPCOMPATIBILITYPAGE)lParam; - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)this); - FillEditListBoxWithCompatibilityModes(this, hwndDlg, hList, FALSE); - break; - } - } - return FALSE; + + return FALSE; }
static VOID -InitializePage(LPCOMPATIBILITYPAGE this, HWND hwndDlg) +InitializePage(LPCOMPATIBILITYPAGE this, + HWND hwndDlg) { - HWND hList; - - LoadCompatibilityModes(this); + HWND hList;
- /* initialize the controls */ - hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE); - LoadAndParseAppCompatibilityFlags(this, this->szFile); - FillComboBoxWithCompatibilityModes(this, hwndDlg, hList, TRUE, TRUE); + LoadCompatibilityModes(this); + + /* initialize the controls */ + 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); + this->Changed = TRUE; + + 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); - return TRUE; - } + if (this->CSelectedItem != NULL) + { + _tcscpy(szFlags, + this->CSelectedItem->szKeyName); + return TRUE; + }
- return FALSE; + return FALSE; }
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; + HKEY hk; + LONG e; + TCHAR szFlags[256]; + 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); - if(index >= 0) + if (enabled) { - int i; - PCITEM sel = this->CItems; - - /* map the index to a CITEM structure */ - for(i = index; i > 0 && sel != NULL; i--) - { - sel = sel->next; - } + HWND hCombo = GetDlgItem(hwndDlg, + IDC_COMPATIBILITYMODE); + int index = (int)SendMessage(hCombo, + CB_GETCURSEL, + 0, + 0); + if (index >= 0) + { + int i; + PCITEM sel = this->CItems;
- /* update the CSelectedItem member */ - this->CSelectedItem = sel; + /* map the index to a CITEM structure */ + for(i = index; + i > 0 && sel != NULL; + i--) + { + sel = sel->next; + } + + /* update the CSelectedItem member */ + this->CSelectedItem = sel; + } + else + enabled = FALSE; } - else - enabled = FALSE; - }
- e = RegOpenKey(HKEY_CURRENT_USER, - TEXT("SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"), - &hk); - if(e == ERROR_SUCCESS) - { - if(!enabled) + e = RegOpenKey(HKEY_CURRENT_USER, + TEXT("SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"), + &hk); + if (e == ERROR_SUCCESS) { - /* FIXME - only delete if nothing else is selected! */ - e = RegDeleteValue(hk, this->szFile); + if (!enabled) + { + /* FIXME - only delete if nothing else is selected! */ + e = RegDeleteValue(hk, + this->szFile); + } + else + { + if (ComposeFlags(this, + szFlags)) + { + e = RegSetValueEx(hk, + this->szFile, + 0, + REG_SZ, + (LPBYTE)szFlags, + (_tcslen(szFlags) + 1) * sizeof(TCHAR)); + } + else + { + e = RegDeleteValue(hk, + this->szFile); + } + } + + RegCloseKey(hk); } - else - { - if(ComposeFlags(this, szFlags)) - { - e = RegSetValueEx(hk, - this->szFile, - 0, - REG_SZ, - (LPBYTE)szFlags, - (_tcslen(szFlags) + 1) * sizeof(TCHAR)); - } - else - { - e = RegDeleteValue(hk, this->szFile); - } - }
- RegCloseKey(hk); - } - - this->Changed = FALSE; - return (e == ERROR_SUCCESS); + this->Changed = FALSE; + 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); - - switch(uMsg) - { - case WM_COMMAND: + LPCOMPATIBILITYPAGE this = (LPCOMPATIBILITYPAGE)GetWindowLongPtr(hwndDlg, + GWLP_USERDATA); + + switch (uMsg) { - if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMPATIBILITYMODE) - { - ReportPropertyChange(this, hwndDlg); - } - else - { - switch(LOWORD(wParam)) + case WM_COMMAND: { - case IDC_CHKRUNCOMPATIBILITY: - { - HWND hList = GetDlgItem(hwndDlg, IDC_COMPATIBILITYMODE); - if(hList != NULL) + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMPATIBILITYMODE) { - EnableWindow(hList, IsDlgButtonChecked(hwndDlg, IDC_CHKRUNCOMPATIBILITY) == BST_CHECKED); + ReportPropertyChange(this, + hwndDlg); } - /* fall through */ - } - case IDC_CHKRUNIN256COLORS: - case IDC_CHKRUNIN640480RES: - case IDC_CHKDISABLEVISUALTHEMES: [truncated at 1000 lines; 898 more skipped]