mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
* finished reading console options.c
* thnx for everyone helping with this commit (you know who you are) svn path=/trunk/; revision=22699
This commit is contained in:
parent
e7fdae5613
commit
cbfccc50b9
3 changed files with 57 additions and 29 deletions
|
@ -154,6 +154,13 @@ DllMain(
|
||||||
LPVOID lpvReserved)
|
LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(lpvReserved)
|
UNREFERENCED_PARAMETER(lpvReserved)
|
||||||
|
|
||||||
|
/* initialize global struct */
|
||||||
|
memset(&g_ConsoleInfo, 0x0, sizeof(ConsoleInfo));
|
||||||
|
g_ConsoleInfo.InsertMode = TRUE;
|
||||||
|
g_ConsoleInfo.HistoryBufferSize = 50;
|
||||||
|
g_ConsoleInfo.NumberOfHistoryBuffers = 5;
|
||||||
|
|
||||||
switch(dwReason)
|
switch(dwReason)
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
|
|
|
@ -20,6 +20,7 @@ typedef struct
|
||||||
|
|
||||||
typedef struct TAGConsoleInfo
|
typedef struct TAGConsoleInfo
|
||||||
{
|
{
|
||||||
|
LPSTR szProcessName;
|
||||||
DWORD CursorSize;
|
DWORD CursorSize;
|
||||||
DWORD NumberOfHistoryBuffers;
|
DWORD NumberOfHistoryBuffers;
|
||||||
DWORD HistoryBufferSize;
|
DWORD HistoryBufferSize;
|
||||||
|
|
|
@ -42,9 +42,9 @@ BOOL InitializeOptionsFromReg(TCHAR * Path)
|
||||||
DWORD dwNumSubKeys = 0;
|
DWORD dwNumSubKeys = 0;
|
||||||
DWORD dwIndex;
|
DWORD dwIndex;
|
||||||
DWORD dwValueName;
|
DWORD dwValueName;
|
||||||
DWORD dwBufferSize;
|
DWORD dwValue;
|
||||||
TCHAR szValueName[MAX_PATH];
|
TCHAR szValueName[MAX_PATH];
|
||||||
BYTE szBuffer[MAX_PATH];
|
DWORD Value;
|
||||||
|
|
||||||
if ( RegOpenCurrentUser(KEY_READ, &hKey) != ERROR_SUCCESS )
|
if ( RegOpenCurrentUser(KEY_READ, &hKey) != ERROR_SUCCESS )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -60,49 +60,42 @@ BOOL InitializeOptionsFromReg(TCHAR * Path)
|
||||||
|
|
||||||
for (dwIndex = 0; dwIndex < dwNumSubKeys; dwIndex++)
|
for (dwIndex = 0; dwIndex < dwNumSubKeys; dwIndex++)
|
||||||
{
|
{
|
||||||
dwBufferSize = MAX_PATH;
|
dwValue = sizeof(Value);
|
||||||
dwValueName = MAX_PATH;
|
dwValueName = MAX_PATH;
|
||||||
|
|
||||||
if ( RegEnumValue(hSubKey, dwIndex, szValueName, &dwValueName, NULL, NULL, szBuffer, &dwBufferSize) != ERROR_SUCCESS)
|
if ( RegEnumValue(hSubKey, dwIndex, szValueName, &dwValueName, NULL, NULL, (BYTE*)&Value, &dwValue) != ERROR_SUCCESS)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( !_tcscmp(szValueName, _T("CursorSize")) )
|
if ( !_tcscmp(szValueName, _T("CursorSize")) )
|
||||||
{
|
{
|
||||||
int val = _ttoi((TCHAR*)szBuffer);
|
if ( Value == 0x32)
|
||||||
if ( val == 0x32)
|
g_ConsoleInfo.CursorSize = Value;
|
||||||
g_ConsoleInfo.CursorSize = val;
|
else if ( Value == 0x64 )
|
||||||
else if ( val == 0x64 )
|
g_ConsoleInfo.CursorSize = Value;
|
||||||
g_ConsoleInfo.CursorSize = val;
|
|
||||||
}
|
}
|
||||||
else if ( !_tcscmp(szValueName, _T("NumberOfHistoryBuffers")) )
|
else if ( !_tcscmp(szValueName, _T("NumberOfHistoryBuffers")) )
|
||||||
{
|
{
|
||||||
int val = _ttoi((TCHAR*)szBuffer);
|
g_ConsoleInfo.NumberOfHistoryBuffers = Value;
|
||||||
g_ConsoleInfo.NumberOfHistoryBuffers = val;
|
|
||||||
}
|
}
|
||||||
else if ( !_tcscmp(szValueName, _T("HistoryBufferSize")) )
|
else if ( !_tcscmp(szValueName, _T("HistoryBufferSize")) )
|
||||||
{
|
{
|
||||||
int val = _ttoi((TCHAR*)szBuffer);
|
g_ConsoleInfo.HistoryBufferSize = Value;
|
||||||
g_ConsoleInfo.HistoryBufferSize = val;
|
|
||||||
}
|
}
|
||||||
else if ( !_tcscmp(szValueName, _T("HistoryNoDup")) )
|
else if ( !_tcscmp(szValueName, _T("HistoryNoDup")) )
|
||||||
{
|
{
|
||||||
int val = _ttoi((TCHAR*)szBuffer);
|
g_ConsoleInfo.HistoryNoDup = Value;
|
||||||
g_ConsoleInfo.HistoryNoDup = val;
|
|
||||||
}
|
}
|
||||||
else if ( !_tcscmp(szValueName, _T("FullScreen")) )
|
else if ( !_tcscmp(szValueName, _T("FullScreen")) )
|
||||||
{
|
{
|
||||||
int val = _ttoi((TCHAR*)szBuffer);
|
g_ConsoleInfo.FullScreen = Value;
|
||||||
g_ConsoleInfo.FullScreen = val;
|
|
||||||
}
|
}
|
||||||
else if ( !_tcscmp(szValueName, _T("QuickEdit")) )
|
else if ( !_tcscmp(szValueName, _T("QuickEdit")) )
|
||||||
{
|
{
|
||||||
int val = _ttoi((TCHAR*)szBuffer);
|
g_ConsoleInfo.QuickEdit = Value;
|
||||||
g_ConsoleInfo.QuickEdit = val;
|
|
||||||
}
|
}
|
||||||
else if ( !_tcscmp(szValueName, _T("InsertMode")) )
|
else if ( !_tcscmp(szValueName, _T("InsertMode")) )
|
||||||
{
|
{
|
||||||
int val = _ttoi((TCHAR*)szBuffer);
|
g_ConsoleInfo.InsertMode = Value;
|
||||||
g_ConsoleInfo.InsertMode = val;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,23 +197,50 @@ UpdateDialogElements(HWND hwndDlg)
|
||||||
BOOLEAN InitializeOptionsDialog(HWND hwndDlg)
|
BOOLEAN InitializeOptionsDialog(HWND hwndDlg)
|
||||||
{
|
{
|
||||||
STARTUPINFO StartupInfo;
|
STARTUPINFO StartupInfo;
|
||||||
|
TCHAR szBuffer[MAX_PATH];
|
||||||
GetStartupInfo(&StartupInfo);
|
GetStartupInfo(&StartupInfo);
|
||||||
|
TCHAR * ptr;
|
||||||
|
DWORD length;
|
||||||
|
|
||||||
if ( StartupInfo.lpTitle )
|
if ( StartupInfo.lpTitle )
|
||||||
{
|
{
|
||||||
if ( InitializeOptionsFromReg(StartupInfo.lpTitle) )
|
if ( !GetWindowsDirectory(szBuffer, MAX_PATH) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
length = _tcslen(szBuffer);
|
||||||
|
if ( !_tcsncmp(szBuffer, StartupInfo.lpTitle, length) )
|
||||||
{
|
{
|
||||||
UpdateDialogElements(hwndDlg);
|
// Windows XP SP2 uses unexpanded environment vars to get path
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
//TODO
|
|
||||||
//
|
|
||||||
// Windows XP uses unexpanded environment vars to get path
|
|
||||||
// i.e. c:\windows\system32\cmd.exe
|
// i.e. c:\windows\system32\cmd.exe
|
||||||
// becomes
|
// becomes
|
||||||
// %SystemRoot%_system32_cmd.exe
|
// %SystemRoot%_system32_cmd.exe
|
||||||
|
|
||||||
|
_tcscpy(szBuffer, _T("\%SystemRoot\%"));
|
||||||
|
_tcsncpy(&szBuffer[12], &StartupInfo.lpTitle[length], _tcslen(StartupInfo.lpTitle) - length + 1);
|
||||||
|
|
||||||
|
ptr = &szBuffer[12];
|
||||||
|
while( (ptr = _tcsstr(ptr, _T("\\"))) )
|
||||||
|
ptr[0] = _T('_');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( InitializeOptionsFromReg(szBuffer) )
|
||||||
|
{
|
||||||
|
UpdateDialogElements(hwndDlg);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
UpdateDialogElements(hwndDlg);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( InitializeOptionsFromReg( _T("Console")) )
|
||||||
|
{
|
||||||
|
UpdateDialogElements(hwndDlg);
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue