set eol-style:native

svn path=/trunk/; revision=19127
This commit is contained in:
Christoph von Wittich 2005-11-10 23:02:14 +00:00
parent 12c0917529
commit 9178408ba6
2 changed files with 116 additions and 116 deletions

View file

@ -1,112 +1,112 @@
#include <precomp.h>
HWND hStartupPage;
HWND hStartupListCtrl;
HWND hStartupDialog;
void GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName );
INT_PTR CALLBACK
StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LV_COLUMN column;
TCHAR szTemp[256];
DWORD dwStyle;
switch (message) {
case WM_INITDIALOG:
hStartupListCtrl = GetDlgItem(hDlg, IDC_STARTUP_LIST);
hStartupDialog = hDlg;
dwStyle = SendMessage(hStartupListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;
SendMessage(hStartupListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
// Initialize the application page's controls
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_ELEMENT, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
ListView_InsertColumn(hStartupListCtrl, 0, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_CMD, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
ListView_InsertColumn(hStartupListCtrl, 1, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_PATH, szTemp, 256);
column.pszText = szTemp;
column.cx = 250;
ListView_InsertColumn(hStartupListCtrl, 2, &column);
GetAutostartEntriesFromRegistry(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
GetAutostartEntriesFromRegistry(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
//FIXME: What about HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit
//FIXME: Common Startup (startmenu)
return TRUE;
}
return 0;
}
void
GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
{
HKEY hKey;
DWORD Index, dwValues, retVal, dwType;
DWORD dwValueLength, dwDataLength = MAX_VALUE_NAME;
TCHAR Data[MAX_VALUE_NAME];
TCHAR lpValueName[MAX_KEY_LENGTH];
TCHAR Path[MAX_KEY_LENGTH + 5];
LV_ITEM item;
if (RegOpenKeyEx(hRootKey, KeyName, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
for (Index = 0, retVal = ERROR_SUCCESS; Index < dwValues; Index++)
{
dwValueLength = MAX_VALUE_NAME;
dwDataLength = MAX_VALUE_NAME;
retVal = RegEnumValue(hKey, Index, lpValueName, &dwValueLength, NULL, &dwType, (LPBYTE)Data, &dwDataLength);
if (retVal == ERROR_SUCCESS)
{
memset(&item, 0, sizeof(LV_ITEM));
item.mask = LVIF_TEXT;
item.iImage = 0;
item.pszText = lpValueName;
item.iItem = ListView_GetItemCount(hStartupListCtrl);
item.lParam = 0;
ListView_InsertItem(hStartupListCtrl, &item);
if (dwType == REG_SZ)
{
GetLongPathName(Data, Data, sizeof(Data));
item.pszText = Data;
item.iSubItem = 1;
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
}
if (hRootKey == HKEY_LOCAL_MACHINE)
_tcscpy(Path, _T("HKLM\\"));
if (hRootKey == HKEY_CURRENT_USER)
_tcscpy(Path, _T("HKCU\\"));
_tcscat(Path, KeyName);
item.pszText = Path;
item.iSubItem = 2;
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
}
}
}
RegCloseKey(hKey);
}
}
#include <precomp.h>
HWND hStartupPage;
HWND hStartupListCtrl;
HWND hStartupDialog;
void GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName );
INT_PTR CALLBACK
StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
LV_COLUMN column;
TCHAR szTemp[256];
DWORD dwStyle;
switch (message) {
case WM_INITDIALOG:
hStartupListCtrl = GetDlgItem(hDlg, IDC_STARTUP_LIST);
hStartupDialog = hDlg;
dwStyle = SendMessage(hStartupListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;
SendMessage(hStartupListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
// Initialize the application page's controls
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_ELEMENT, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
ListView_InsertColumn(hStartupListCtrl, 0, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_CMD, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
ListView_InsertColumn(hStartupListCtrl, 1, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
LoadString(hInst, IDS_STARTUP_COLUMN_PATH, szTemp, 256);
column.pszText = szTemp;
column.cx = 250;
ListView_InsertColumn(hStartupListCtrl, 2, &column);
GetAutostartEntriesFromRegistry(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
GetAutostartEntriesFromRegistry(HKEY_CURRENT_USER, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"));
//FIXME: What about HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit
//FIXME: Common Startup (startmenu)
return TRUE;
}
return 0;
}
void
GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
{
HKEY hKey;
DWORD Index, dwValues, retVal, dwType;
DWORD dwValueLength, dwDataLength = MAX_VALUE_NAME;
TCHAR Data[MAX_VALUE_NAME];
TCHAR lpValueName[MAX_KEY_LENGTH];
TCHAR Path[MAX_KEY_LENGTH + 5];
LV_ITEM item;
if (RegOpenKeyEx(hRootKey, KeyName, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwValues, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
for (Index = 0, retVal = ERROR_SUCCESS; Index < dwValues; Index++)
{
dwValueLength = MAX_VALUE_NAME;
dwDataLength = MAX_VALUE_NAME;
retVal = RegEnumValue(hKey, Index, lpValueName, &dwValueLength, NULL, &dwType, (LPBYTE)Data, &dwDataLength);
if (retVal == ERROR_SUCCESS)
{
memset(&item, 0, sizeof(LV_ITEM));
item.mask = LVIF_TEXT;
item.iImage = 0;
item.pszText = lpValueName;
item.iItem = ListView_GetItemCount(hStartupListCtrl);
item.lParam = 0;
ListView_InsertItem(hStartupListCtrl, &item);
if (dwType == REG_SZ)
{
GetLongPathName(Data, Data, sizeof(Data));
item.pszText = Data;
item.iSubItem = 1;
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
}
if (hRootKey == HKEY_LOCAL_MACHINE)
_tcscpy(Path, _T("HKLM\\"));
if (hRootKey == HKEY_CURRENT_USER)
_tcscpy(Path, _T("HKCU\\"));
_tcscat(Path, KeyName);
item.pszText = Path;
item.iSubItem = 2;
SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
}
}
}
RegCloseKey(hKey);
}
}

View file

@ -1,4 +1,4 @@
extern HWND hStartupPage;
extern HWND hStartupPageListCtrl;
INT_PTR CALLBACK StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
extern HWND hStartupPage;
extern HWND hStartupPageListCtrl;
INT_PTR CALLBACK StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);