From 4b714650f46f10b96de2fd15b8c47d3d7a24c79f Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Mon, 3 May 2010 19:26:12 +0000 Subject: [PATCH 001/151] [SHELL32] - Show icons / folders from AllUsers\Desktop directory - Fixes bug 4289 svn path=/trunk/; revision=47097 --- reactos/dll/win32/shell32/shfldr_desktop.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/reactos/dll/win32/shell32/shfldr_desktop.c b/reactos/dll/win32/shell32/shfldr_desktop.c index db810ba87c7..cdcae285023 100644 --- a/reactos/dll/win32/shell32/shfldr_desktop.c +++ b/reactos/dll/win32/shell32/shfldr_desktop.c @@ -387,6 +387,9 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags) ret = ret && SHGetSpecialFolderPathW(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE); ret = ret && CreateFolderEnumList(list, szPath, dwFlags); + ret = ret && SHGetSpecialFolderPathW(0, szPath, CSIDL_COMMON_DESKTOPDIRECTORY, FALSE); + ret = ret && CreateFolderEnumList(list, szPath, dwFlags); + return ret; } @@ -739,6 +742,22 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, _ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen); if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags); + + if (GetFileAttributes(pszPath) == INVALID_FILE_ATTRIBUTES) + { + /* file system folder or file rooted at the AllUsers desktop */ + if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) && + (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER)) + { + SHGetSpecialFolderPathW(0, pszPath, CSIDL_COMMON_DESKTOPDIRECTORY, FALSE); + PathAddBackslashW(pszPath); + cLen = wcslen(pszPath); + } + + _ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen); + if (!_ILIsFolder(pidl)) + SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags); + } } } else From c751f4300a7a22f813e48bbead6db8ef97e9e70a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 3 May 2010 22:03:15 +0000 Subject: [PATCH 002/151] [NTOSKRNL] - Fix a typo that results in ISRs being called at an unsafe IRQL (Interrupt->Irql instead of Interrupt->SynchronizeIrql) in certain situations (when Interrupt->Irql < Interrupt->SynchronizeIrql) that can result in ISR synchronization issues svn path=/trunk/; revision=47098 --- reactos/ntoskrnl/ke/i386/irqobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/i386/irqobj.c b/reactos/ntoskrnl/ke/i386/irqobj.c index 10170134d82..fca5bdc4cc5 100644 --- a/reactos/ntoskrnl/ke/i386/irqobj.c +++ b/reactos/ntoskrnl/ke/i386/irqobj.c @@ -251,7 +251,7 @@ KiChainedDispatch(IN PKTRAP_FRAME TrapFrame, if (Interrupt->SynchronizeIrql > Interrupt->Irql) { /* Raise to higher IRQL */ - OldIrql = KfRaiseIrql(Interrupt->Irql); + OldIrql = KfRaiseIrql(Interrupt->SynchronizeIrql); } /* Acquire interrupt lock */ From dbfa8cfb5455ce2727b85bdf50964107e67d4611 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 3 May 2010 22:15:53 +0000 Subject: [PATCH 003/151] [SETUP] - Don't call InitializeProfiles() twice. This is one part of the fix for bug 2972. Patch by Gabriel Ilardi. svn path=/trunk/; revision=47099 --- reactos/base/setup/setup/setup.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/reactos/base/setup/setup/setup.c b/reactos/base/setup/setup/setup.c index 8f9db9b6278..4db7fc46a92 100644 --- a/reactos/base/setup/setup/setup.c +++ b/reactos/base/setup/setup/setup.c @@ -60,9 +60,6 @@ RunNewSetup (HINSTANCE hInstance) HMODULE hDll; PINSTALL_REACTOS InstallReactOS; - /* some dlls (loaded by syssetup) need a valid user profile */ - InitializeProfiles(); - hDll = LoadLibrary (TEXT("syssetup")); if (hDll == NULL) { From 950bbde105850dc0ffebfa1dc3feadb90986323a Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Tue, 4 May 2010 08:28:42 +0000 Subject: [PATCH 004/151] [SHELL32] - Use target path when there is no icon path specified svn path=/trunk/; revision=47100 --- reactos/dll/win32/shell32/shelllink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/dll/win32/shell32/shelllink.c b/reactos/dll/win32/shell32/shelllink.c index 2d9ef1c20ee..b2dd1cb6ff8 100644 --- a/reactos/dll/win32/shell32/shelllink.c +++ b/reactos/dll/win32/shell32/shelllink.c @@ -2672,6 +2672,9 @@ SH_ShellLinkDlgProc( case 14021: if (This->sIcoPath) wcscpy(szBuffer, This->sIcoPath); + else + wcscpy(szBuffer, This->sPath); + IconIndex = This->iIcoNdx; if (PickIconDlg(hwndDlg, szBuffer, MAX_PATH, &IconIndex)) { From 79121ecceaa3b9763596772e7140b89272b11681 Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Tue, 4 May 2010 23:17:30 +0000 Subject: [PATCH 005/151] [NTOSKRNL] In kdbg 'thread list', don't try to read from the kernel stack if there isn't one. (Bug 5318) svn path=/trunk/; revision=47102 --- reactos/ntoskrnl/kdbg/kdb_cli.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/kdbg/kdb_cli.c b/reactos/ntoskrnl/kdbg/kdb_cli.c index 4c469fd3721..5583ecec639 100644 --- a/reactos/ntoskrnl/kdbg/kdb_cli.c +++ b/reactos/ntoskrnl/kdbg/kdb_cli.c @@ -1223,7 +1223,13 @@ KdbpCmdThread( str2 = ""; } - if (Thread->Tcb.TrapFrame) + if (!Thread->Tcb.InitialStack) + { + /* Thread has no kernel stack (probably terminated) */ + Esp = Ebp = NULL; + Eip = 0; + } + else if (Thread->Tcb.TrapFrame) { if (Thread->Tcb.TrapFrame->PreviousPreviousMode == KernelMode) Esp = (PULONG)Thread->Tcb.TrapFrame->TempEsp; From e3ce00b76bb7bd23aa722975f059a2b1299b67c8 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Wed, 5 May 2010 10:08:23 +0000 Subject: [PATCH 006/151] [win32k] -Fix sending WM_KILLFOCUS when we give focus to a window of a different thread Fixes bugs 1546 and 1603 svn path=/trunk/; revision=47103 --- reactos/subsystems/win32/win32k/ntuser/focus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/focus.c b/reactos/subsystems/win32/win32k/ntuser/focus.c index 90702b41c00..9e309ac7dcd 100644 --- a/reactos/subsystems/win32/win32k/ntuser/focus.c +++ b/reactos/subsystems/win32/win32k/ntuser/focus.c @@ -227,6 +227,7 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin if (PrevForegroundQueue != 0) { hWndPrev = PrevForegroundQueue->ActiveWindow; + hWndFocusPrev = PrevForegroundQueue->FocusWindow; } if (hWndPrev == hWnd) @@ -235,9 +236,6 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin return TRUE; } - hWndFocusPrev = (PrevForegroundQueue == FocusWindow->pti->MessageQueue - ? FocusWindow->pti->MessageQueue->FocusWindow : NULL); - /* FIXME: Call hooks. */ co_IntSendDeactivateMessages(hWndPrev, hWnd); From 4b382e58467fdd3cf44d281b1d7721e056a8871e Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 5 May 2010 18:54:36 +0000 Subject: [PATCH 007/151] [FONTVIEW] - Katayama Hirofumi: Redraw the window when string is set. See issue #5357 for more details. svn path=/trunk/; revision=47104 --- reactos/base/applications/fontview/display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/base/applications/fontview/display.c b/reactos/base/applications/fontview/display.c index 7de217d7cbe..1362e4a822a 100644 --- a/reactos/base/applications/fontview/display.c +++ b/reactos/base/applications/fontview/display.c @@ -204,7 +204,7 @@ Display_SetString(HWND hwnd, LPARAM lParam) pData = (DISPLAYDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA); _snwprintf(pData->szString, MAX_STRING, (WCHAR*)lParam); - // FIXME: redraw the window + InvalidateRect(hwnd, NULL, TRUE); return 0; } From 751c365e6e9dfad8624ab0eca279bfe9df7b5937 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 5 May 2010 19:00:13 +0000 Subject: [PATCH 008/151] [MSTSC] - Katayama Hirofumi: Remove temporary tchar.h inclusion and usage of _tcslen (replaced with lstrlen). See issue #5360 for more details. svn path=/trunk/; revision=47105 --- reactos/base/applications/mstsc/win32.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/reactos/base/applications/mstsc/win32.c b/reactos/base/applications/mstsc/win32.c index 56390e09621..c7c4e63361b 100644 --- a/reactos/base/applications/mstsc/win32.c +++ b/reactos/base/applications/mstsc/win32.c @@ -21,13 +21,6 @@ #include /* winsock2.h first */ #include -//FIXME: remove eventually -#ifndef _UNICODE -#define _UNICODE -#endif -#include - - extern char g_username[]; extern char g_hostname[]; extern char g_servername[]; @@ -89,7 +82,7 @@ uni_to_str(char * sizex, TCHAR * size1) int len; int i; - len = _tcslen(size1); + len = lstrlen(size1); for (i = 0; i < len; i++) { sizex[i] = (char)size1[i]; From 51e6829b672e4a8f69a42f4b980b63fe5414ce6f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 5 May 2010 22:30:14 +0000 Subject: [PATCH 009/151] [USERENV] - Create 'Default User' and 'All Users' directories without postfix and append a postfix only if they already exist. - Create the user account directory without a prefix and append a prefix if the directory already exists. - Acquire the restore privilege before unloading a hive and remove it after unloading the hive. Patch is based on Gabriel Ilardi's patch. Fixes bug #2972. svn path=/trunk/; revision=47106 --- reactos/dll/win32/userenv/profile.c | 60 +++++++----- reactos/dll/win32/userenv/setup.c | 146 ++++++++++++++++++---------- 2 files changed, 131 insertions(+), 75 deletions(-) diff --git a/reactos/dll/win32/userenv/profile.c b/reactos/dll/win32/userenv/profile.c index c2de4087c02..9e3f2b19114 100644 --- a/reactos/dll/win32/userenv/profile.c +++ b/reactos/dll/win32/userenv/profile.c @@ -170,10 +170,12 @@ CreateUserProfileW(PSID Sid, WCHAR szProfilesPath[MAX_PATH]; WCHAR szUserProfilePath[MAX_PATH]; WCHAR szDefaultUserPath[MAX_PATH]; + WCHAR szUserProfileName[MAX_PATH]; WCHAR szBuffer[MAX_PATH]; LPWSTR SidString; DWORD dwLength; DWORD dwDisposition; + UINT i; HKEY hKey; LONG Error; @@ -245,14 +247,11 @@ CreateUserProfileW(PSID Sid, RegCloseKey (hKey); + wcscpy(szUserProfileName, lpUserName); + wcscpy(szUserProfilePath, szProfilesPath); wcscat(szUserProfilePath, L"\\"); - wcscat(szUserProfilePath, lpUserName); - if (!AppendSystemPostfix(szUserProfilePath, MAX_PATH)) - { - DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); - return FALSE; - } + wcscat(szUserProfilePath, szUserProfileName); wcscpy(szDefaultUserPath, szProfilesPath); wcscat(szDefaultUserPath, L"\\"); @@ -266,6 +265,24 @@ CreateUserProfileW(PSID Sid, DPRINT1("Error: %lu\n", GetLastError()); return FALSE; } + + for (i = 0; i < 1000; i++) + { + swprintf(szUserProfileName, L"%s.%03u", lpUserName, i); + + wcscpy(szUserProfilePath, szProfilesPath); + wcscat(szUserProfilePath, L"\\"); + wcscat(szUserProfilePath, szUserProfileName); + + if (CreateDirectoryW(szUserProfilePath, NULL)) + break; + + if (GetLastError() != ERROR_ALREADY_EXISTS) + { + DPRINT1("Error: %lu\n", GetLastError()); + return FALSE; + } + } } /* Copy default user directory */ @@ -308,14 +325,7 @@ CreateUserProfileW(PSID Sid, /* Create non-expanded user profile path */ wcscpy(szBuffer, szRawProfilesPath); wcscat(szBuffer, L"\\"); - wcscat(szBuffer, lpUserName); - if (!AppendSystemPostfix(szBuffer, MAX_PATH)) - { - DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); - LocalFree((HLOCAL)SidString); - RegCloseKey (hKey); - return FALSE; - } + wcscat(szBuffer, szUserProfileName); /* Set 'ProfileImagePath' value (non-expanded) */ Error = RegSetValueExW(hKey, @@ -958,16 +968,9 @@ LoadUserProfileW(IN HANDLE hToken, } } + /* Create user hive name */ wcscat(szUserHivePath, L"\\"); wcscat(szUserHivePath, lpProfileInfo->lpUserName); - dwLength = sizeof(szUserHivePath) / sizeof(szUserHivePath[0]); - if (!AppendSystemPostfix(szUserHivePath, dwLength)) - { - DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); - return FALSE; - } - - /* Create user hive name */ wcscat(szUserHivePath, L"\\ntuser.dat"); DPRINT("szUserHivePath: %S\n", szUserHivePath); @@ -1129,8 +1132,21 @@ UnloadUserProfile(HANDLE hToken, DPRINT("SidString: '%wZ'\n", &SidString); + /* Acquire restore privilege */ + if (!AcquireRemoveRestorePrivilege(TRUE)) + { + DPRINT1("AcquireRemoveRestorePrivilege() failed (Error %ld)\n", GetLastError()); + RtlFreeUnicodeString(&SidString); + return FALSE; + } + + /* Unload the hive */ Error = RegUnLoadKeyW(HKEY_USERS, SidString.Buffer); + + /* Remove restore privilege */ + AcquireRemoveRestorePrivilege(FALSE); + if (Error != ERROR_SUCCESS) { DPRINT1("RegUnLoadKeyW() failed (Error %ld)\n", Error); diff --git a/reactos/dll/win32/userenv/setup.c b/reactos/dll/win32/userenv/setup.c index ca422dd5e9f..783d35621c9 100644 --- a/reactos/dll/win32/userenv/setup.c +++ b/reactos/dll/win32/userenv/setup.c @@ -140,22 +140,6 @@ InitializeProfiles(VOID) return FALSE; } - /* Store profiles directory path */ - dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); - Error = RegSetValueExW(hKey, - L"ProfilesDirectory", - 0, - REG_EXPAND_SZ, - (LPBYTE)szBuffer, - dwLength); - if (Error != ERROR_SUCCESS) - { - DPRINT1("Error: %lu\n", Error); - RegCloseKey(hKey); - SetLastError((DWORD)Error); - return FALSE; - } - /* Expand it */ if (!ExpandEnvironmentStringsW(szBuffer, szProfilesPath, @@ -177,15 +161,66 @@ InitializeProfiles(VOID) } } - /* Set 'DefaultUserProfile' value */ - wcscpy(szBuffer, L"Default User"); - if (!AppendSystemPostfix(szBuffer, MAX_PATH)) + /* Store the profiles directory path in the registry */ + dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); + Error = RegSetValueExW(hKey, + L"ProfilesDirectory", + 0, + REG_EXPAND_SZ, + (LPBYTE)szBuffer, + dwLength); + if (Error != ERROR_SUCCESS) { - DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); + DPRINT1("Error: %lu\n", Error); RegCloseKey(hKey); + SetLastError((DWORD)Error); return FALSE; } + /* Set 'DefaultUserProfile' value */ + wcscpy(szBuffer, L"Default User"); + + /* Create Default User profile directory path */ + wcscpy(szProfilePath, szProfilesPath); + wcscat(szProfilePath, L"\\"); + wcscat(szProfilePath, szBuffer); + + /* Attempt default user directory creation */ + if (!CreateDirectoryW (szProfilePath, NULL)) + { + if (GetLastError() != ERROR_ALREADY_EXISTS) + { + DPRINT1("Error: %lu\n", GetLastError()); + RegCloseKey(hKey); + return FALSE; + } + + /* Directory existed, let's try to append the postfix */ + if (!AppendSystemPostfix(szBuffer, MAX_PATH)) + { + DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); + RegCloseKey(hKey); + return FALSE; + } + + /* Create Default User profile directory path again */ + wcscpy(szProfilePath, szProfilesPath); + wcscat(szProfilePath, L"\\"); + wcscat(szProfilePath, szBuffer); + + /* Attempt creation again with appended postfix */ + if (!CreateDirectoryW(szProfilePath, NULL)) + { + if (GetLastError() != ERROR_ALREADY_EXISTS) + { + DPRINT1("Error: %lu\n", GetLastError()); + RegCloseKey(hKey); + return FALSE; + } + } + } + + /* Store the default user profile path in the registry */ dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR); Error = RegSetValueExW(hKey, L"DefaultUserProfile", @@ -203,19 +238,6 @@ InitializeProfiles(VOID) RegCloseKey(hKey); - /* Create 'Default User' profile directory */ - wcscpy(szProfilePath, szProfilesPath); - wcscat(szProfilePath, L"\\"); - wcscat(szProfilePath, szBuffer); - if (!CreateDirectoryW (szProfilePath, NULL)) - { - if (GetLastError() != ERROR_ALREADY_EXISTS) - { - DPRINT1("Error: %lu\n", GetLastError()); - return FALSE; - } - } - /* Set current user profile */ SetEnvironmentVariableW(L"USERPROFILE", szProfilePath); @@ -382,10 +404,41 @@ InitializeProfiles(VOID) /* Set 'AllUsersProfile' value */ wcscpy(szBuffer, L"All Users"); - if (!AppendSystemPostfix(szBuffer, MAX_PATH)) + + /* Create 'All Users' profile directory path */ + wcscpy(szProfilePath, szProfilesPath); + wcscat(szProfilePath, L"\\"); + wcscat(szProfilePath, szBuffer); + + /* Attempt 'All Users' directory creation */ + if (!CreateDirectoryW (szProfilePath, NULL)) { - DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); - return FALSE; + if (GetLastError() != ERROR_ALREADY_EXISTS) + { + DPRINT1("Error: %lu\n", GetLastError()); + return FALSE; + } + + /* Directory existed, let's try to append the postfix */ + if (!AppendSystemPostfix(szBuffer, MAX_PATH)) + { + DPRINT1("AppendSystemPostfix() failed\n", GetLastError()); + return FALSE; + } + + /* Attempt again creation with appended postfix */ + wcscpy(szProfilePath, szProfilesPath); + wcscat(szProfilePath, L"\\"); + wcscat(szProfilePath, szBuffer); + + if (!CreateDirectoryW(szProfilePath, NULL)) + { + if (GetLastError() != ERROR_ALREADY_EXISTS) + { + DPRINT1("Error: %lu\n", GetLastError()); + return FALSE; + } + } } Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE, @@ -407,27 +460,14 @@ InitializeProfiles(VOID) REG_SZ, (LPBYTE)szBuffer, dwLength); - if (Error != ERROR_SUCCESS) - { - DPRINT1("Error: %lu\n", Error); - RegCloseKey(hKey); - SetLastError((DWORD)Error); - return FALSE; - } RegCloseKey(hKey); - /* Create 'All Users' profile directory */ - wcscpy(szProfilePath, szProfilesPath); - wcscat(szProfilePath, L"\\"); - wcscat(szProfilePath, szBuffer); - if (!CreateDirectoryW(szProfilePath, NULL)) + if (Error != ERROR_SUCCESS) { - if (GetLastError() != ERROR_ALREADY_EXISTS) - { - DPRINT1("Error: %lu\n", GetLastError()); - return FALSE; - } + DPRINT1("Error: %lu\n", Error); + SetLastError((DWORD)Error); + return FALSE; } /* Set 'All Users' profile */ From ac293dd5d64a85c5365631b442a7088728a77a97 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 5 May 2010 22:53:01 +0000 Subject: [PATCH 010/151] [FORMATTING] No code changes. svn path=/trunk/; revision=47107 --- reactos/dll/win32/userenv/environment.c | 634 ++++++++++++------------ 1 file changed, 318 insertions(+), 316 deletions(-) diff --git a/reactos/dll/win32/userenv/environment.c b/reactos/dll/win32/userenv/environment.c index 16f1acb4053..16754d46408 100644 --- a/reactos/dll/win32/userenv/environment.c +++ b/reactos/dll/win32/userenv/environment.c @@ -32,394 +32,396 @@ static BOOL -SetUserEnvironmentVariable (LPVOID *Environment, - LPWSTR lpName, - LPWSTR lpValue, - BOOL bExpand) +SetUserEnvironmentVariable(LPVOID *Environment, + LPWSTR lpName, + LPWSTR lpValue, + BOOL bExpand) { - WCHAR ShortName[MAX_PATH]; - UNICODE_STRING Name; - UNICODE_STRING SrcValue; - UNICODE_STRING DstValue; - ULONG Length; - NTSTATUS Status; - PVOID Buffer=NULL; + WCHAR ShortName[MAX_PATH]; + UNICODE_STRING Name; + UNICODE_STRING SrcValue; + UNICODE_STRING DstValue; + ULONG Length; + NTSTATUS Status; + PVOID Buffer = NULL; - if (bExpand) - { - RtlInitUnicodeString(&SrcValue, - lpValue); - - Length = 2 * MAX_PATH * sizeof(WCHAR); - - DstValue.Length = 0; - DstValue.MaximumLength = Length; - DstValue.Buffer = Buffer = LocalAlloc(LPTR, - Length); - - if (DstValue.Buffer == NULL) - { - DPRINT1("LocalAlloc() failed\n"); - return FALSE; - } - - Status = RtlExpandEnvironmentStrings_U((PWSTR)*Environment, - &SrcValue, - &DstValue, - &Length); - if (!NT_SUCCESS(Status)) - { - DPRINT1("RtlExpandEnvironmentStrings_U() failed (Status %lx)\n", Status); - DPRINT1("Length %lu\n", Length); - if (Buffer) LocalFree(Buffer); - return FALSE; - } - } - else - { - RtlInitUnicodeString(&DstValue, - lpValue); - } - - if (!_wcsicmp (lpName, L"temp") || !_wcsicmp (lpName, L"tmp")) - { - if (!GetShortPathNameW(DstValue.Buffer, ShortName, MAX_PATH)) - { - DPRINT1("GetShortPathNameW() failed for %S (Error %lu)\n", DstValue.Buffer, GetLastError()); - if (Buffer) LocalFree(Buffer); - return FALSE; - } - - DPRINT("Buffer: %S\n", ShortName); - RtlInitUnicodeString(&DstValue, - ShortName); - } - - RtlInitUnicodeString(&Name, - lpName); - - DPRINT("Value: %wZ\n", &DstValue); - - Status = RtlSetEnvironmentVariable((PWSTR*)Environment, - &Name, - &DstValue); - - if (Buffer) LocalFree(Buffer); - - if (!NT_SUCCESS(Status)) + if (bExpand) { - DPRINT1("RtlSetEnvironmentVariable() failed (Status %lx)\n", Status); - return FALSE; + RtlInitUnicodeString(&SrcValue, + lpValue); + + Length = 2 * MAX_PATH * sizeof(WCHAR); + + DstValue.Length = 0; + DstValue.MaximumLength = Length; + DstValue.Buffer = Buffer = LocalAlloc(LPTR, + Length); + if (DstValue.Buffer == NULL) + { + DPRINT1("LocalAlloc() failed\n"); + return FALSE; + } + + Status = RtlExpandEnvironmentStrings_U((PWSTR)*Environment, + &SrcValue, + &DstValue, + &Length); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlExpandEnvironmentStrings_U() failed (Status %lx)\n", Status); + DPRINT1("Length %lu\n", Length); + if (Buffer) + LocalFree(Buffer); + return FALSE; + } + } + else + { + RtlInitUnicodeString(&DstValue, + lpValue); } - return TRUE; + if (!_wcsicmp(lpName, L"temp") || !_wcsicmp(lpName, L"tmp")) + { + if (!GetShortPathNameW(DstValue.Buffer, ShortName, MAX_PATH)) + { + DPRINT1("GetShortPathNameW() failed for %S (Error %lu)\n", DstValue.Buffer, GetLastError()); + if (Buffer) + LocalFree(Buffer); + return FALSE; + } + + DPRINT("Buffer: %S\n", ShortName); + RtlInitUnicodeString(&DstValue, + ShortName); + } + + RtlInitUnicodeString(&Name, + lpName); + + DPRINT("Value: %wZ\n", &DstValue); + + Status = RtlSetEnvironmentVariable((PWSTR*)Environment, + &Name, + &DstValue); + + if (Buffer) + LocalFree(Buffer); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlSetEnvironmentVariable() failed (Status %lx)\n", Status); + return FALSE; + } + + return TRUE; } static BOOL -AppendUserEnvironmentVariable (LPVOID *Environment, - LPWSTR lpName, - LPWSTR lpValue) +AppendUserEnvironmentVariable(LPVOID *Environment, + LPWSTR lpName, + LPWSTR lpValue) { - UNICODE_STRING Name; - UNICODE_STRING Value; - NTSTATUS Status; + UNICODE_STRING Name; + UNICODE_STRING Value; + NTSTATUS Status; - RtlInitUnicodeString (&Name, - lpName); + RtlInitUnicodeString(&Name, + lpName); - Value.Length = 0; - Value.MaximumLength = 1024 * sizeof(WCHAR); - Value.Buffer = LocalAlloc (LPTR, - 1024 * sizeof(WCHAR)); - if (Value.Buffer == NULL) + Value.Length = 0; + Value.MaximumLength = 1024 * sizeof(WCHAR); + Value.Buffer = LocalAlloc(LPTR, + 1024 * sizeof(WCHAR)); + if (Value.Buffer == NULL) { - return FALSE; + return FALSE; } - Value.Buffer[0] = UNICODE_NULL; + Value.Buffer[0] = UNICODE_NULL; - Status = RtlQueryEnvironmentVariable_U ((PWSTR)*Environment, - &Name, - &Value); - if (NT_SUCCESS(Status)) + Status = RtlQueryEnvironmentVariable_U((PWSTR)*Environment, + &Name, + &Value); + if (NT_SUCCESS(Status)) { - RtlAppendUnicodeToString (&Value, - L";"); + RtlAppendUnicodeToString(&Value, + L";"); } - RtlAppendUnicodeToString (&Value, - lpValue); + RtlAppendUnicodeToString(&Value, + lpValue); - Status = RtlSetEnvironmentVariable ((PWSTR*)Environment, - &Name, - &Value); - LocalFree (Value.Buffer); - if (!NT_SUCCESS(Status)) + Status = RtlSetEnvironmentVariable((PWSTR*)Environment, + &Name, + &Value); + LocalFree(Value.Buffer); + if (!NT_SUCCESS(Status)) { - DPRINT1 ("RtlSetEnvironmentVariable() failed (Status %lx)\n", Status); - return FALSE; + DPRINT1("RtlSetEnvironmentVariable() failed (Status %lx)\n", Status); + return FALSE; } - return TRUE; + return TRUE; } static HKEY -GetCurrentUserKey (HANDLE hToken) +GetCurrentUserKey(HANDLE hToken) { - UNICODE_STRING SidString; - HKEY hKey; - LONG Error; + UNICODE_STRING SidString; + HKEY hKey; + LONG Error; - if (!GetUserSidFromToken (hToken, - &SidString)) + if (!GetUserSidFromToken(hToken, + &SidString)) { - DPRINT1 ("GetUserSidFromToken() failed\n"); - return NULL; + DPRINT1("GetUserSidFromToken() failed\n"); + return NULL; } - Error = RegOpenKeyExW (HKEY_USERS, - SidString.Buffer, - 0, - MAXIMUM_ALLOWED, - &hKey); - if (Error != ERROR_SUCCESS) + Error = RegOpenKeyExW(HKEY_USERS, + SidString.Buffer, + 0, + MAXIMUM_ALLOWED, + &hKey); + if (Error != ERROR_SUCCESS) { - DPRINT1 ("RegOpenKeyExW() failed (Error %ld)\n", Error); - RtlFreeUnicodeString (&SidString); - SetLastError((DWORD)Error); - return NULL; + DPRINT1("RegOpenKeyExW() failed (Error %ld)\n", Error); + RtlFreeUnicodeString(&SidString); + SetLastError((DWORD)Error); + return NULL; } - RtlFreeUnicodeString (&SidString); + RtlFreeUnicodeString(&SidString); - return hKey; + return hKey; } static BOOL -SetUserEnvironment (LPVOID *lpEnvironment, - HKEY hKey, - LPWSTR lpSubKeyName) +SetUserEnvironment(LPVOID *lpEnvironment, + HKEY hKey, + LPWSTR lpSubKeyName) { - HKEY hEnvKey; - DWORD dwValues; - DWORD dwMaxValueNameLength; - DWORD dwMaxValueDataLength; - DWORD dwValueNameLength; - DWORD dwValueDataLength; - DWORD dwType; - DWORD i; - LPWSTR lpValueName; - LPWSTR lpValueData; - LONG Error; + HKEY hEnvKey; + DWORD dwValues; + DWORD dwMaxValueNameLength; + DWORD dwMaxValueDataLength; + DWORD dwValueNameLength; + DWORD dwValueDataLength; + DWORD dwType; + DWORD i; + LPWSTR lpValueName; + LPWSTR lpValueData; + LONG Error; - Error = RegOpenKeyExW (hKey, - lpSubKeyName, - 0, - KEY_QUERY_VALUE, - &hEnvKey); - if (Error != ERROR_SUCCESS) + Error = RegOpenKeyExW(hKey, + lpSubKeyName, + 0, + KEY_QUERY_VALUE, + &hEnvKey); + if (Error != ERROR_SUCCESS) { - DPRINT1 ("RegOpenKeyExW() failed (Error %ld)\n", Error); - SetLastError((DWORD)Error); - return FALSE; + DPRINT1("RegOpenKeyExW() failed (Error %ld)\n", Error); + SetLastError((DWORD)Error); + return FALSE; } - Error = RegQueryInfoKey (hEnvKey, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - &dwValues, - &dwMaxValueNameLength, - &dwMaxValueDataLength, - NULL, - NULL); - if (Error != ERROR_SUCCESS) + Error = RegQueryInfoKey(hEnvKey, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + &dwValues, + &dwMaxValueNameLength, + &dwMaxValueDataLength, + NULL, + NULL); + if (Error != ERROR_SUCCESS) { - DPRINT1 ("RegQueryInforKey() failed (Error %ld)\n", Error); - RegCloseKey (hEnvKey); - SetLastError((DWORD)Error); - return FALSE; + DPRINT1("RegQueryInforKey() failed (Error %ld)\n", Error); + RegCloseKey(hEnvKey); + SetLastError((DWORD)Error); + return FALSE; } - if (dwValues == 0) + if (dwValues == 0) { - RegCloseKey (hEnvKey); - return TRUE; + RegCloseKey(hEnvKey); + return TRUE; } - /* Allocate buffers */ - lpValueName = LocalAlloc (LPTR, - dwMaxValueNameLength * sizeof(WCHAR)); - if (lpValueName == NULL) + /* Allocate buffers */ + lpValueName = LocalAlloc(LPTR, + dwMaxValueNameLength * sizeof(WCHAR)); + if (lpValueName == NULL) { - RegCloseKey (hEnvKey); - return FALSE; + RegCloseKey(hEnvKey); + return FALSE; } - lpValueData = LocalAlloc (LPTR, - dwMaxValueDataLength); - if (lpValueData == NULL) + lpValueData = LocalAlloc(LPTR, + dwMaxValueDataLength); + if (lpValueData == NULL) { - LocalFree (lpValueName); - RegCloseKey (hEnvKey); - return FALSE; + LocalFree(lpValueName); + RegCloseKey(hEnvKey); + return FALSE; } - /* Enumerate values */ - for (i = 0; i < dwValues; i++) + /* Enumerate values */ + for (i = 0; i < dwValues; i++) { - dwValueNameLength = dwMaxValueNameLength; - dwValueDataLength = dwMaxValueDataLength; - RegEnumValueW (hEnvKey, - i, - lpValueName, - &dwValueNameLength, - NULL, - &dwType, - (LPBYTE)lpValueData, - &dwValueDataLength); + dwValueNameLength = dwMaxValueNameLength; + dwValueDataLength = dwMaxValueDataLength; + RegEnumValueW(hEnvKey, + i, + lpValueName, + &dwValueNameLength, + NULL, + &dwType, + (LPBYTE)lpValueData, + &dwValueDataLength); - if (!_wcsicmp (lpValueName, L"path")) - { - /* Append 'Path' environment variable */ - AppendUserEnvironmentVariable (lpEnvironment, - lpValueName, - lpValueData); - } - else - { - /* Set environment variable */ - SetUserEnvironmentVariable (lpEnvironment, - lpValueName, - lpValueData, - (dwType == REG_EXPAND_SZ)); - } + if (!_wcsicmp (lpValueName, L"path")) + { + /* Append 'Path' environment variable */ + AppendUserEnvironmentVariable(lpEnvironment, + lpValueName, + lpValueData); + } + else + { + /* Set environment variable */ + SetUserEnvironmentVariable(lpEnvironment, + lpValueName, + lpValueData, + (dwType == REG_EXPAND_SZ)); + } } - LocalFree (lpValueData); - LocalFree (lpValueName); - RegCloseKey (hEnvKey); + LocalFree(lpValueData); + LocalFree(lpValueName); + RegCloseKey(hEnvKey); - return TRUE; -} - - -BOOL WINAPI -CreateEnvironmentBlock (LPVOID *lpEnvironment, - HANDLE hToken, - BOOL bInherit) -{ - WCHAR Buffer[MAX_PATH]; - DWORD Length; - HKEY hKeyUser; - NTSTATUS Status; - - DPRINT("CreateEnvironmentBlock() called\n"); - - if (lpEnvironment == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - Status = RtlCreateEnvironment ((BOOLEAN)bInherit, - (PWSTR*)lpEnvironment); - if (!NT_SUCCESS (Status)) - { - DPRINT1 ("RtlCreateEnvironment() failed (Status %lx)\n", Status); - SetLastError (RtlNtStatusToDosError (Status)); - return FALSE; - } - - /* Set 'COMPUTERNAME' variable */ - Length = MAX_PATH; - if (GetComputerNameW (Buffer, - &Length)) - { - SetUserEnvironmentVariable(lpEnvironment, - L"COMPUTERNAME", - Buffer, - FALSE); - } - - if (hToken == NULL) return TRUE; - - hKeyUser = GetCurrentUserKey (hToken); - if (hKeyUser == NULL) - { - DPRINT1 ("GetCurrentUserKey() failed\n"); - RtlDestroyEnvironment (*lpEnvironment); - return FALSE; - } - - /* Set 'ALLUSERSPROFILE' variable */ - Length = MAX_PATH; - if (GetAllUsersProfileDirectoryW (Buffer, - &Length)) - { - SetUserEnvironmentVariable(lpEnvironment, - L"ALLUSERSPROFILE", - Buffer, - FALSE); - } - - /* Set 'USERPROFILE' variable */ - Length = MAX_PATH; - if (GetUserProfileDirectoryW (hToken, - Buffer, - &Length)) - { - SetUserEnvironmentVariable(lpEnvironment, - L"USERPROFILE", - Buffer, - FALSE); - } - - /* FIXME: Set 'USERDOMAIN' variable */ - - Length = MAX_PATH; - if (GetUserNameW(Buffer, - &Length)) - { - SetUserEnvironmentVariable(lpEnvironment, - L"USERNAME", - Buffer, - FALSE); - } - - - - /* Set user environment variables */ - SetUserEnvironment (lpEnvironment, - hKeyUser, - L"Environment"); - - RegCloseKey (hKeyUser); - - return TRUE; } BOOL WINAPI -DestroyEnvironmentBlock (LPVOID lpEnvironment) +CreateEnvironmentBlock(LPVOID *lpEnvironment, + HANDLE hToken, + BOOL bInherit) { - DPRINT ("DestroyEnvironmentBlock() called\n"); + WCHAR Buffer[MAX_PATH]; + DWORD Length; + HKEY hKeyUser; + NTSTATUS Status; - if (lpEnvironment == NULL) + DPRINT("CreateEnvironmentBlock() called\n"); + + if (lpEnvironment == NULL) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; } - RtlDestroyEnvironment (lpEnvironment); + Status = RtlCreateEnvironment((BOOLEAN)bInherit, + (PWSTR*)lpEnvironment); + if (!NT_SUCCESS (Status)) + { + DPRINT1("RtlCreateEnvironment() failed (Status %lx)\n", Status); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } - return TRUE; + /* Set 'COMPUTERNAME' variable */ + Length = MAX_PATH; + if (GetComputerNameW(Buffer, + &Length)) + { + SetUserEnvironmentVariable(lpEnvironment, + L"COMPUTERNAME", + Buffer, + FALSE); + } + + if (hToken == NULL) + return TRUE; + + hKeyUser = GetCurrentUserKey(hToken); + if (hKeyUser == NULL) + { + DPRINT1("GetCurrentUserKey() failed\n"); + RtlDestroyEnvironment(*lpEnvironment); + return FALSE; + } + + /* Set 'ALLUSERSPROFILE' variable */ + Length = MAX_PATH; + if (GetAllUsersProfileDirectoryW(Buffer, + &Length)) + { + SetUserEnvironmentVariable(lpEnvironment, + L"ALLUSERSPROFILE", + Buffer, + FALSE); + } + + /* Set 'USERPROFILE' variable */ + Length = MAX_PATH; + if (GetUserProfileDirectoryW(hToken, + Buffer, + &Length)) + { + SetUserEnvironmentVariable(lpEnvironment, + L"USERPROFILE", + Buffer, + FALSE); + } + + /* FIXME: Set 'USERDOMAIN' variable */ + + Length = MAX_PATH; + if (GetUserNameW(Buffer, + &Length)) + { + SetUserEnvironmentVariable(lpEnvironment, + L"USERNAME", + Buffer, + FALSE); + } + + + + /* Set user environment variables */ + SetUserEnvironment(lpEnvironment, + hKeyUser, + L"Environment"); + + RegCloseKey(hKeyUser); + + return TRUE; +} + + +BOOL WINAPI +DestroyEnvironmentBlock(LPVOID lpEnvironment) +{ + DPRINT("DestroyEnvironmentBlock() called\n"); + + if (lpEnvironment == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + RtlDestroyEnvironment(lpEnvironment); + + return TRUE; } From 8481a4f1b9f093323eca15e748112e5ba42910f9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 5 May 2010 23:06:32 +0000 Subject: [PATCH 011/151] [NTOSKRNL] - Implement Ke386IoSetAccessProcess, Ke386SetIoAccessMap, and Ke386QueryIoAccessMap [NDK] - Add definition of KIO_ACCESS_MAP - Patch by Samuel Serapion - Fixes bug 2641 svn path=/trunk/; revision=47108 --- reactos/include/ndk/i386/ketypes.h | 4 ++ reactos/ntoskrnl/ke/i386/v86vdm.c | 78 ++++++++++++++++++++++++------ 2 files changed, 68 insertions(+), 14 deletions(-) diff --git a/reactos/include/ndk/i386/ketypes.h b/reactos/include/ndk/i386/ketypes.h index f90a39e0a12..0f5557ee1f6 100644 --- a/reactos/include/ndk/i386/ketypes.h +++ b/reactos/include/ndk/i386/ketypes.h @@ -151,6 +151,10 @@ Author: (USHORT)(sizeof(KTSS)) : \ (USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap)) +typedef UCHAR KIO_ACCESS_MAP[IOPM_SIZE]; + +typedef KIO_ACCESS_MAP *PKIO_ACCESS_MAP; + // // Size of the XMM register save area in the FXSAVE format // diff --git a/reactos/ntoskrnl/ke/i386/v86vdm.c b/reactos/ntoskrnl/ke/i386/v86vdm.c index 2d1ff017f14..4903d3ea5f8 100644 --- a/reactos/ntoskrnl/ke/i386/v86vdm.c +++ b/reactos/ntoskrnl/ke/i386/v86vdm.c @@ -659,37 +659,87 @@ Ke386CallBios(IN ULONG Int, } /* - * @unimplemented + * @implemented */ BOOLEAN NTAPI Ke386IoSetAccessProcess(IN PKPROCESS Process, - IN ULONG Flag) + IN ULONG MapNumber) { - UNIMPLEMENTED; - return FALSE; + USHORT MapOffset; + PKPRCB Prcb; + KAFFINITY TargetProcessors; + + if(MapNumber > IOPM_COUNT) + return FALSE; + + MapOffset = KiComputeIopmOffset(MapNumber); + + Process->IopmOffset = MapOffset; + + TargetProcessors = Process->ActiveProcessors; + Prcb = KeGetCurrentPrcb(); + if (TargetProcessors & Prcb->SetMember) + KeGetPcr()->TSS->IoMapBase = MapOffset; + + return TRUE; } /* - * @unimplemented + * @implemented */ BOOLEAN NTAPI -Ke386SetIoAccessMap(IN ULONG Flag, - IN PVOID IopmBuffer) +Ke386SetIoAccessMap(IN ULONG MapNumber, + IN PKIO_ACCESS_MAP IopmBuffer) { - UNIMPLEMENTED; - return FALSE; + PKPROCESS CurrentProcess; + PKPRCB Prcb; + PVOID pt; + + if ((MapNumber > IOPM_COUNT) || (MapNumber == IO_ACCESS_MAP_NONE)) + return FALSE; + + Prcb = KeGetCurrentPrcb(); + + // Copy the IOP map and load the map for the current process. + pt = &(KeGetPcr()->TSS->IoMaps[MapNumber-1].IoMap); + RtlMoveMemory(pt, (PVOID)IopmBuffer, IOPM_SIZE); + CurrentProcess = Prcb->CurrentThread->ApcState.Process; + KeGetPcr()->TSS->IoMapBase = CurrentProcess->IopmOffset; + + return TRUE; } /* - * @unimplemented + * @implemented */ BOOLEAN NTAPI -Ke386QueryIoAccessMap(IN ULONG Flag, - IN PVOID IopmBuffer) +Ke386QueryIoAccessMap(IN ULONG MapNumber, + IN PKIO_ACCESS_MAP IopmBuffer) { - UNIMPLEMENTED; - return FALSE; + ULONG i; + PVOID Map; + PUCHAR p; + + if (MapNumber > IOPM_COUNT) + return FALSE; + + if (MapNumber == IO_ACCESS_MAP_NONE) + { + // no access, simply return a map of all 1s + p = (PUCHAR)IopmBuffer; + for (i = 0; i < IOPM_SIZE; i++) { + p[i] = (UCHAR)-1; + } + } + else + { + // copy the bits + Map = (PVOID)&(KeGetPcr()->TSS->IoMaps[MapNumber-1].IoMap); + RtlMoveMemory((PVOID)IopmBuffer, Map, IOPM_SIZE); + } + + return TRUE; } From a9e356ef1d8cd1fcbaa86ac5b125d59add73c128 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 5 May 2010 23:16:17 +0000 Subject: [PATCH 012/151] [VIDEOPRT] - Also check for the BASEVIDEO option set and return true in that case also - Fixes a bug with boot time (F8) options on my WC svn path=/trunk/; revision=47109 --- reactos/drivers/video/videoprt/videoprt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reactos/drivers/video/videoprt/videoprt.c b/reactos/drivers/video/videoprt/videoprt.c index 33c6fedc7f8..ad22d6a36fb 100644 --- a/reactos/drivers/video/videoprt/videoprt.c +++ b/reactos/drivers/video/videoprt/videoprt.c @@ -1523,8 +1523,9 @@ VideoPortIsNoVesa(VOID) return FALSE; } - /* Check if NOVESA is present in the start options */ - if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA")) + /* Check if NOVESA or BASEVIDEO is present in the start options */ + if (wcsstr((PWCHAR)KeyInfo->Data, L"NOVESA") || + wcsstr((PWCHAR)KeyInfo->Data, L"BASEVIDEO")) { VideoPortDebugPrint(Info, "VESA mode disabled\n"); ExFreePool(KeyInfo); From 6b6c1373416e739b09df0248aeb636c5b8ca3185 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 6 May 2010 01:45:10 +0000 Subject: [PATCH 013/151] [NTOSKRNL] - Don't enable the kernel debugger if the DEBUG option was not set - Fixes displaying the BSOD when not booting in debug mode (broken in r41534) svn path=/trunk/; revision=47110 --- reactos/ntoskrnl/kd/kdinit.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/reactos/ntoskrnl/kd/kdinit.c b/reactos/ntoskrnl/kd/kdinit.c index aae380e922a..6c5f240761b 100644 --- a/reactos/ntoskrnl/kd/kdinit.c +++ b/reactos/ntoskrnl/kd/kdinit.c @@ -171,15 +171,14 @@ KdInitSystem(ULONG BootPhase, { /* Enable on the serial port */ KdDebuggerEnabled = TRUE; + KdDebuggerNotPresent = FALSE; KdpDebugMode.Serial = TRUE; - } #ifdef KDBG - /* Get the KDBG Settings and enable it */ - KdDebuggerEnabled = TRUE; - KdDebuggerNotPresent = FALSE; - KdbpGetCommandLineSettings(LoaderBlock->LoadOptions); + /* Get the KDBG Settings */ + KdbpGetCommandLineSettings(LoaderBlock->LoadOptions); #endif + } /* Get the port and baud rate */ Port = strstr(CommandLine, "DEBUGPORT"); From 50367b3daca6e78bdbd77b331fb8c4faebde66d3 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 6 May 2010 09:44:59 +0000 Subject: [PATCH 014/151] [ADVAPI32] - Katayama Hirofumi: Create GUID instead of hardcoding to 0 every time. See issue #5364 for more details. svn path=/trunk/; revision=47111 --- reactos/dll/win32/advapi32/misc/hwprofiles.c | 24 +++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/reactos/dll/win32/advapi32/misc/hwprofiles.c b/reactos/dll/win32/advapi32/misc/hwprofiles.c index f3ac824710d..6bfc08b0df0 100644 --- a/reactos/dll/win32/advapi32/misc/hwprofiles.c +++ b/reactos/dll/win32/advapi32/misc/hwprofiles.c @@ -1,15 +1,14 @@ -/* $Id$ - * +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries - * FILE: lib/advapi32/misc/hwprofiles.c + * FILE: dll/win32/advapi32/misc/hwprofiles.c * PURPOSE: advapi32.dll Hardware Functions * PROGRAMMER: Steven Edwards - * UPDATE HISTORY: - * 20042502 + * Eric Kohl */ #include +#include #include WINE_DEFAULT_DEBUG_CHANNEL(advapi); @@ -91,6 +90,7 @@ GetCurrentHwProfileW(LPHW_PROFILE_INFOW lpHwProfileInfo) HKEY hProfileKey; DWORD dwLength; DWORD dwConfigId; + UUID uuid; TRACE("GetCurrentHwProfileW() called\n"); @@ -158,9 +158,17 @@ GetCurrentHwProfileW(LPHW_PROFILE_INFOW lpHwProfileInfo) (LPBYTE)&lpHwProfileInfo->szHwProfileGuid, &dwLength)) { - /* FIXME: Create a new GUID */ - wcscpy(lpHwProfileInfo->szHwProfileGuid, - L"{00000000-0000-0000-0000-000000000000}"); + /* Create a new GUID */ + UuidCreate(&uuid); + swprintf( + lpHwProfileInfo->szHwProfileGuid, + L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + uuid.Data1, + uuid.Data2, + uuid.Data3, + uuid.Data4[0], uuid.Data4[1], + uuid.Data4[2], uuid.Data4[3], uuid.Data4[4], uuid.Data4[5], + uuid.Data4[6], uuid.Data4[7]); dwLength = (wcslen(lpHwProfileInfo->szHwProfileGuid) + 1) * sizeof(WCHAR); RegSetValueExW(hProfileKey, From c47421927ed5a696b87dcaa513b4cea2de7063ca Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 6 May 2010 10:09:33 +0000 Subject: [PATCH 015/151] [ADVAPI32] - Katayama Hirofumi: Use a real computer name instead of an empty string when reporting events in ReportEventA and W. See issue #5358 for more details. svn path=/trunk/; revision=47112 --- reactos/dll/win32/advapi32/service/eventlog.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/advapi32/service/eventlog.c b/reactos/dll/win32/advapi32/service/eventlog.c index 8cb4b22664e..b8a35a639b3 100644 --- a/reactos/dll/win32/advapi32/service/eventlog.c +++ b/reactos/dll/win32/advapi32/service/eventlog.c @@ -945,6 +945,8 @@ ReportEventA(IN HANDLE hEventLog, ANSI_STRING *Strings; ANSI_STRING ComputerName; WORD i; + CHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD dwSize; TRACE("%p, %u, %u, %lu, %p, %u, %lu, %p, %p\n", hEventLog, wType, wCategory, dwEventID, lpUserSid, @@ -962,8 +964,9 @@ ReportEventA(IN HANDLE hEventLog, for (i = 0; i < wNumStrings; i++) RtlInitAnsiString(&Strings[i], lpStrings[i]); - /*FIXME: ComputerName */ - RtlInitAnsiString(&ComputerName, ""); + dwSize = MAX_COMPUTERNAME_LENGTH + 1; + GetComputerNameA(szComputerName, &dwSize); + RtlInitAnsiString(&ComputerName, szComputerName); RpcTryExcept { @@ -1029,6 +1032,8 @@ ReportEventW(IN HANDLE hEventLog, UNICODE_STRING *Strings; UNICODE_STRING ComputerName; WORD i; + WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + DWORD dwSize; TRACE("%p, %u, %u, %lu, %p, %u, %lu, %p, %p\n", hEventLog, wType, wCategory, dwEventID, lpUserSid, @@ -1046,8 +1051,9 @@ ReportEventW(IN HANDLE hEventLog, for (i = 0; i < wNumStrings; i++) RtlInitUnicodeString(&Strings[i], lpStrings[i]); - /*FIXME: ComputerName */ - RtlInitUnicodeString(&ComputerName, L""); + dwSize = MAX_COMPUTERNAME_LENGTH + 1; + GetComputerNameW(szComputerName, &dwSize); + RtlInitUnicodeString(&ComputerName, szComputerName); RpcTryExcept { From a2464ecca726930038fbe59f8788960aabea283e Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Thu, 6 May 2010 10:50:26 +0000 Subject: [PATCH 016/151] [KERNEL32] - Code committed in revision 846 was lazily initializing command line options with a first call to GetCommandLine. However, this is not really thread-safe. Move initialization to DLL_PROCESS_ATTACH, where it should actually happen. See issue #5347 for more details. svn path=/trunk/; revision=47113 --- reactos/dll/win32/kernel32/include/kernel32.h | 4 ++++ reactos/dll/win32/kernel32/misc/dllmain.c | 3 +++ reactos/dll/win32/kernel32/process/cmdline.c | 20 +++---------------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/reactos/dll/win32/kernel32/include/kernel32.h b/reactos/dll/win32/kernel32/include/kernel32.h index 60056f111f7..19731210435 100755 --- a/reactos/dll/win32/kernel32/include/kernel32.h +++ b/reactos/dll/win32/kernel32/include/kernel32.h @@ -190,3 +190,7 @@ IntGetCodePageEntry(UINT CodePage); LPWSTR GetDllLoadPath(LPCWSTR lpModule); + +VOID +WINAPI +InitCommandLines(VOID); diff --git a/reactos/dll/win32/kernel32/misc/dllmain.c b/reactos/dll/win32/kernel32/misc/dllmain.c index 02199f9349d..ef47c4d538f 100644 --- a/reactos/dll/win32/kernel32/misc/dllmain.c +++ b/reactos/dll/win32/kernel32/misc/dllmain.c @@ -330,6 +330,9 @@ DllMain(HANDLE hDll, wcscpy(SystemDirectory.Buffer, WindowsDirectory.Buffer); wcscat(SystemDirectory.Buffer, L"\\System32"); + /* Initialize command line */ + InitCommandLines(); + /* Open object base directory */ Status = OpenBaseDirectory(&hBaseDir); if (!NT_SUCCESS(Status)) diff --git a/reactos/dll/win32/kernel32/process/cmdline.c b/reactos/dll/win32/kernel32/process/cmdline.c index 9b84ab92a74..2c2b2421966 100644 --- a/reactos/dll/win32/kernel32/process/cmdline.c +++ b/reactos/dll/win32/kernel32/process/cmdline.c @@ -27,19 +27,17 @@ static BOOL bCommandLineInitialized = FALSE; /* FUNCTIONS ****************************************************************/ -static VOID +WINAPI InitCommandLines(VOID) { PRTL_USER_PROCESS_PARAMETERS Params; - /* FIXME - not thread-safe! */ - - // get command line + /* get command line */ Params = NtCurrentPeb()->ProcessParameters; RtlNormalizeProcessParams (Params); - // initialize command line buffers + /* initialize command line buffers */ CommandLineStringW.Length = Params->CommandLine.Length; CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR); CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(), @@ -80,13 +78,7 @@ LPSTR WINAPI GetCommandLineA(VOID) { - if (bCommandLineInitialized == FALSE) - { - InitCommandLines(); - } - DPRINT("CommandLine \'%s\'\n", CommandLineStringA.Buffer); - return CommandLineStringA.Buffer; } @@ -98,13 +90,7 @@ LPWSTR WINAPI GetCommandLineW(VOID) { - if (bCommandLineInitialized == FALSE) - { - InitCommandLines(); - } - DPRINT("CommandLine \'%S\'\n", CommandLineStringW.Buffer); - return CommandLineStringW.Buffer; } From 3f5ef480695c1f0123703f4a6697b468fe4494af Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 7 May 2010 00:17:04 +0000 Subject: [PATCH 017/151] [USERENV] - Create the environment variables 'ProgramFiles' and 'CommonProgramFiles' from the registry. Fixes bug #4008. See issue #2972 for more details. svn path=/trunk/; revision=47116 --- reactos/dll/win32/userenv/environment.c | 66 ++++++++++++++++++++----- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/reactos/dll/win32/userenv/environment.c b/reactos/dll/win32/userenv/environment.c index 16754d46408..5bb38a6dc73 100644 --- a/reactos/dll/win32/userenv/environment.c +++ b/reactos/dll/win32/userenv/environment.c @@ -317,9 +317,13 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment, BOOL bInherit) { WCHAR Buffer[MAX_PATH]; + WCHAR szValue[1024]; DWORD Length; + DWORD dwType; + HKEY hKey; HKEY hKeyUser; NTSTATUS Status; + LONG lError; DPRINT("CreateEnvironmentBlock() called\n"); @@ -349,17 +353,6 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment, FALSE); } - if (hToken == NULL) - return TRUE; - - hKeyUser = GetCurrentUserKey(hToken); - if (hKeyUser == NULL) - { - DPRINT1("GetCurrentUserKey() failed\n"); - RtlDestroyEnvironment(*lpEnvironment); - return FALSE; - } - /* Set 'ALLUSERSPROFILE' variable */ Length = MAX_PATH; if (GetAllUsersProfileDirectoryW(Buffer, @@ -371,6 +364,57 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment, FALSE); } + lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion", + 0, + KEY_READ, + &hKey); + if (lError == ERROR_SUCCESS) + { + Length = 1024 * sizeof(WCHAR); + lError = RegQueryValueExW(hKey, + L"ProgramFilesDir", + NULL, + &dwType, + (LPBYTE)szValue, + &Length); + if (lError == ERROR_SUCCESS) + { + SetUserEnvironmentVariable(lpEnvironment, + L"ProgramFiles", + szValue, + FALSE); + } + + Length = 1024 * sizeof(WCHAR); + lError = RegQueryValueExW(hKey, + L"CommonFilesDir", + NULL, + &dwType, + (LPBYTE)szValue, + &Length); + if (lError == ERROR_SUCCESS) + { + SetUserEnvironmentVariable(lpEnvironment, + L"CommonProgramFiles", + szValue, + FALSE); + } + + RegCloseKey(hKey); + } + + if (hToken == NULL) + return TRUE; + + hKeyUser = GetCurrentUserKey(hToken); + if (hKeyUser == NULL) + { + DPRINT1("GetCurrentUserKey() failed\n"); + RtlDestroyEnvironment(*lpEnvironment); + return FALSE; + } + /* Set 'USERPROFILE' variable */ Length = MAX_PATH; if (GetUserProfileDirectoryW(hToken, From 4c417355a6b7a26e2554c99c1ad41c7f1df3d121 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 May 2010 01:17:46 +0000 Subject: [PATCH 018/151] Disable GDI batch code for regions. "Fixes" broken drawing for AcrobatReader. Yes, it's a "band aid over a bullet wound". I hope the man with the gun is a surgeon, too. svn path=/trunk/; revision=47121 --- reactos/dll/win32/gdi32/objects/region.c | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/reactos/dll/win32/gdi32/objects/region.c b/reactos/dll/win32/gdi32/objects/region.c index b8d70772dcf..eb6395363e4 100644 --- a/reactos/dll/win32/gdi32/objects/region.c +++ b/reactos/dll/win32/gdi32/objects/region.c @@ -104,6 +104,7 @@ BOOL FASTCALL DeleteRegion( HRGN hRgn ) { +#if 0 PRGN_ATTR Rgn_Attr; if ((GdiGetHandleUserData((HGDIOBJ) hRgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) && @@ -118,6 +119,7 @@ DeleteRegion( HRGN hRgn ) return TRUE; } } +#endif return NtGdiDeleteObjectApp((HGDIOBJ) hRgn); } @@ -199,6 +201,9 @@ CombineRgn(HRGN hDest, INT Complexity; BOOL Ret; +// HACK +return NtGdiCombineRgn(hDest, hSrc1, hSrc2, CombineMode); + Ret = GdiGetHandleUserData((HGDIOBJ) hDest, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr_Dest); Ret = GdiGetHandleUserData((HGDIOBJ) hSrc1, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr_Src1); @@ -436,6 +441,11 @@ CreateRectRgn(int x1, int y1, int x2, int y2) HRGN hrgn; int tmp; +/// <- +//// Remove when Brush/Pen/Rgn Attr is ready! + return NtGdiCreateRectRgn(x1,y1,x2,y2); +//// + /* Normalize points */ tmp = x1; if ( x1 > x2 ) @@ -586,7 +596,7 @@ ExtSelectClipRgn( IN HDC hdc, IN HRGN hrgn, IN INT iMode) { if (pLDC->iType != LDC_EMFLDC || EMFDRV_ExtSelectClipRgn( hdc, )) return NtGdiExtSelectClipRgn(hdc, ); - } +} else SetLastError(ERROR_INVALID_HANDLE); return ERROR; @@ -734,7 +744,7 @@ GetRgnBox(HRGN hrgn, { PRGN_ATTR Rgn_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) + //if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) return NtGdiGetRgnBox(hrgn, prcOut); if (Rgn_Attr->Flags == NULLREGION) @@ -845,7 +855,8 @@ OffsetRgn( HRGN hrgn, PRGN_ATTR pRgn_Attr; int nLeftRect, nTopRect, nRightRect, nBottomRect; - if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) +// HACKFIX +// if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) return NtGdiOffsetRgn(hrgn,nXOffset,nYOffset); if ( pRgn_Attr->Flags == NULLREGION) @@ -898,7 +909,8 @@ PtInRegion(IN HRGN hrgn, { PRGN_ATTR pRgn_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) + // HACKFIX + //if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) return NtGdiPtInRegion(hrgn,x,y); if ( pRgn_Attr->Flags == NULLREGION) @@ -921,7 +933,8 @@ RectInRegion(HRGN hrgn, PRGN_ATTR pRgn_Attr; RECTL rc; - if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) + // HACKFIX + //if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) return NtGdiRectInRegion(hrgn, (LPRECT) prcl); if ( pRgn_Attr->Flags == NULLREGION) @@ -984,7 +997,7 @@ SetRectRgn(HRGN hrgn, { PRGN_ATTR Rgn_Attr; - if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) + //if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) return NtGdiSetRectRgn(hrgn, nLeftRect, nTopRect, nRightRect, nBottomRect); if ((nLeftRect == nRightRect) || (nTopRect == nBottomRect)) From 3c586a19b2b47bea041c23e5c7889b8cee2efa6b Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 8 May 2010 13:07:40 +0000 Subject: [PATCH 019/151] [WINLOGON] Add missing newline to a TRACE message. svn path=/trunk/; revision=47122 --- reactos/base/system/winlogon/winlogon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/base/system/winlogon/winlogon.c b/reactos/base/system/winlogon/winlogon.c index 79535666a82..f711cf38085 100644 --- a/reactos/base/system/winlogon/winlogon.c +++ b/reactos/base/system/winlogon/winlogon.c @@ -69,7 +69,7 @@ PlayLogonSoundThread( if (!hService) { CloseServiceHandle(hSCManager); - TRACE("WL: failed to open sysaudio Status %x", GetLastError()); + TRACE("WL: failed to open sysaudio Status %x\n", GetLastError()); ExitThread(0); } From f0d7ecd148fe96565136ec7f2455502f1a2e948a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 8 May 2010 14:47:42 +0000 Subject: [PATCH 020/151] [PSDK] - Replace WINE's commctrl.h with mingw-w64's commctrl.h - Move WINE-specific hacks to reactos/wine/commctrl.h - Patch by Timo Kreuzer - Fixes bug 4958 svn path=/trunk/; revision=47123 --- .../base/applications/wordpad/wordpad.rbuild | 3 +- reactos/dll/cpl/usrmgr/usrmgr.rbuild | 1 + reactos/dll/win32/comctl32/comctl32.rbuild | 2 + reactos/dll/win32/netcfgx/netcfgx.rbuild | 1 + reactos/dll/win32/netshell/netshell.rbuild | 1 + reactos/dll/win32/user32/user32.rbuild | 1 + reactos/include/psdk/commctrl.h | 9243 ++++++++--------- reactos/include/reactos/wine/commctrl.h | 72 + 8 files changed, 4672 insertions(+), 4652 deletions(-) create mode 100644 reactos/include/reactos/wine/commctrl.h diff --git a/reactos/base/applications/wordpad/wordpad.rbuild b/reactos/base/applications/wordpad/wordpad.rbuild index 6a419cdc4ad..9c21eac69b9 100644 --- a/reactos/base/applications/wordpad/wordpad.rbuild +++ b/reactos/base/applications/wordpad/wordpad.rbuild @@ -2,7 +2,8 @@ . - + include/reactos/wine + comdlg32 shell32 user32 diff --git a/reactos/dll/cpl/usrmgr/usrmgr.rbuild b/reactos/dll/cpl/usrmgr/usrmgr.rbuild index 6b88a4b8103..472bec32e51 100644 --- a/reactos/dll/cpl/usrmgr/usrmgr.rbuild +++ b/reactos/dll/cpl/usrmgr/usrmgr.rbuild @@ -3,6 +3,7 @@ . + include/reactos/wine advapi32 user32 gdi32 diff --git a/reactos/dll/win32/comctl32/comctl32.rbuild b/reactos/dll/win32/comctl32/comctl32.rbuild index 460df46a789..3cc1ce2c0ad 100644 --- a/reactos/dll/win32/comctl32/comctl32.rbuild +++ b/reactos/dll/win32/comctl32/comctl32.rbuild @@ -8,6 +8,8 @@ include/reactos/wine + + 0x600 animate.c comboex.c comctl32undoc.c diff --git a/reactos/dll/win32/netcfgx/netcfgx.rbuild b/reactos/dll/win32/netcfgx/netcfgx.rbuild index f846715255d..1ff2adb7838 100644 --- a/reactos/dll/win32/netcfgx/netcfgx.rbuild +++ b/reactos/dll/win32/netcfgx/netcfgx.rbuild @@ -1,6 +1,7 @@ + 0x0600 ntdll rpcrt4 setupapi diff --git a/reactos/dll/win32/netshell/netshell.rbuild b/reactos/dll/win32/netshell/netshell.rbuild index f76dbdee79c..a5cfbce03a7 100644 --- a/reactos/dll/win32/netshell/netshell.rbuild +++ b/reactos/dll/win32/netshell/netshell.rbuild @@ -3,6 +3,7 @@ . + 0x600 shlwapi shell32 version diff --git a/reactos/dll/win32/user32/user32.rbuild b/reactos/dll/win32/user32/user32.rbuild index e905d747d31..21ee5444b6b 100644 --- a/reactos/dll/win32/user32/user32.rbuild +++ b/reactos/dll/win32/user32/user32.rbuild @@ -3,6 +3,7 @@ . include include/reactos/subsys + include/reactos/wine wine gdi32 advapi32 diff --git a/reactos/include/psdk/commctrl.h b/reactos/include/psdk/commctrl.h index 24b04fdb2e7..9f3366e3474 100644 --- a/reactos/include/psdk/commctrl.h +++ b/reactos/include/psdk/commctrl.h @@ -1,1254 +1,852 @@ -/* - * Common controls definitions - * - * Copyright (C) the Wine project - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ +#ifndef _INC_COMMCTRL +#define _INC_COMMCTRL -#ifndef __WINE_COMMCTRL_H -#define __WINE_COMMCTRL_H +#ifndef _WINRESRC_ +#ifndef _WIN32_IE +#define _WIN32_IE 0x0501 +#else +/* FIXME: This really must be 0x0501 !!! */ +#if (_WIN32_IE < 0x0500) +#error _WIN32_IE setting conflicts +#endif +#endif +#endif -#include +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED +typedef LONG HRESULT; +#endif + +#ifndef NOUSER +#ifndef WINCOMMCTRLAPI +#ifndef _COMCTL32_ +#define WINCOMMCTRLAPI DECLSPEC_IMPORT +#else +#define WINCOMMCTRLAPI +#endif +#endif #ifdef __cplusplus extern "C" { #endif -BOOL WINAPI ShowHideMenuCtl (HWND, UINT_PTR, LPINT); -VOID WINAPI GetEffectiveClientRect (HWND, LPRECT, const INT*); -VOID WINAPI InitCommonControls (VOID); +#include -typedef struct tagINITCOMMONCONTROLSEX { - DWORD dwSize; - DWORD dwICC; -} INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX; - -BOOL WINAPI InitCommonControlsEx (const INITCOMMONCONTROLSEX*); - -LANGID WINAPI GetMUILanguage (VOID); -VOID WINAPI InitMUILanguage (LANGID uiLang); - - -#define COMCTL32_VERSION 5 /* dll version */ - -#ifndef _WIN32_IE -#define _WIN32_IE 0x0400 +#ifndef SNDMSG +#ifdef __cplusplus +#define SNDMSG ::SendMessage +#else +#define SNDMSG SendMessage +#endif #endif -#define ICC_LISTVIEW_CLASSES 0x00000001 /* listview, header */ -#define ICC_TREEVIEW_CLASSES 0x00000002 /* treeview, tooltips */ -#define ICC_BAR_CLASSES 0x00000004 /* toolbar, statusbar, trackbar, tooltips */ -#define ICC_TAB_CLASSES 0x00000008 /* tab, tooltips */ -#define ICC_UPDOWN_CLASS 0x00000010 /* updown */ -#define ICC_PROGRESS_CLASS 0x00000020 /* progress */ -#define ICC_HOTKEY_CLASS 0x00000040 /* hotkey */ -#define ICC_ANIMATE_CLASS 0x00000080 /* animate */ -#define ICC_WIN95_CLASSES 0x000000FF -#define ICC_DATE_CLASSES 0x00000100 /* month picker, date picker, time picker, updown */ -#define ICC_USEREX_CLASSES 0x00000200 /* comboex */ -#define ICC_COOL_CLASSES 0x00000400 /* rebar (coolbar) */ -#define ICC_INTERNET_CLASSES 0x00000800 /* IP address, ... */ -#define ICC_PAGESCROLLER_CLASS 0x00001000 /* page scroller */ -#define ICC_NATIVEFNTCTL_CLASS 0x00002000 /* native font control ???*/ -#define ICC_STANDARD_CLASSES 0x00004000 -#define ICC_LINK_CLASS 0x00008000 + WINCOMMCTRLAPI void WINAPI InitCommonControls(void); + typedef struct tagINITCOMMONCONTROLSEX { + DWORD dwSize; + DWORD dwICC; + } INITCOMMONCONTROLSEX,*LPINITCOMMONCONTROLSEX; +#define ICC_LISTVIEW_CLASSES 0x1 +#define ICC_TREEVIEW_CLASSES 0x2 +#define ICC_BAR_CLASSES 0x4 +#define ICC_TAB_CLASSES 0x8 +#define ICC_UPDOWN_CLASS 0x10 +#define ICC_PROGRESS_CLASS 0x20 +#define ICC_HOTKEY_CLASS 0x40 +#define ICC_ANIMATE_CLASS 0x80 +#define ICC_WIN95_CLASSES 0xff +#define ICC_DATE_CLASSES 0x100 +#define ICC_USEREX_CLASSES 0x200 +#define ICC_COOL_CLASSES 0x400 +#define ICC_INTERNET_CLASSES 0x800 +#define ICC_PAGESCROLLER_CLASS 0x1000 +#define ICC_NATIVEFNTCTL_CLASS 0x2000 +#define ICC_STANDARD_CLASSES 0x4000 +#define ICC_LINK_CLASS 0x8000 + WINCOMMCTRLAPI WINBOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *); -/* common control styles */ -#define CCS_TOP 0x00000001L -#define CCS_NOMOVEY 0x00000002L -#define CCS_BOTTOM 0x00000003L -#define CCS_NORESIZE 0x00000004L -#define CCS_NOPARENTALIGN 0x00000008L -#define CCS_ADJUSTABLE 0x00000020L -#define CCS_NODIVIDER 0x00000040L -#define CCS_VERT 0x00000080L -#define CCS_LEFT (CCS_VERT|CCS_TOP) -#define CCS_RIGHT (CCS_VERT|CCS_BOTTOM) -#define CCS_NOMOVEX (CCS_VERT|CCS_NOMOVEY) +#define ODT_HEADER 100 +#define ODT_TAB 101 +#define ODT_LISTVIEW 102 +#define LVM_FIRST 0x1000 +#define TV_FIRST 0x1100 +#define HDM_FIRST 0x1200 +#define TCM_FIRST 0x1300 -/* common control shared messages */ -#define CCM_FIRST 0x2000 +#define PGM_FIRST 0x1400 +#define ECM_FIRST 0x1500 +#define BCM_FIRST 0x1600 +#define CBM_FIRST 0x1700 +#define CCM_FIRST 0x2000 +#define CCM_LAST (CCM_FIRST+0x200) +#define CCM_SETBKCOLOR (CCM_FIRST+1) +#define CCM_SETCOLORSCHEME (CCM_FIRST+2) +#define CCM_GETCOLORSCHEME (CCM_FIRST+3) +#define CCM_GETDROPTARGET (CCM_FIRST+4) +#define CCM_SETUNICODEFORMAT (CCM_FIRST+5) +#define CCM_GETUNICODEFORMAT (CCM_FIRST+6) -#define CCM_SETBKCOLOR (CCM_FIRST+0x1) /* lParam = bkColor */ -#define CCM_SETCOLORSCHEME (CCM_FIRST+0x2) /* lParam = COLORSCHEME struct ptr */ -#define CCM_GETCOLORSCHEME (CCM_FIRST+0x3) /* lParam = COLORSCHEME struct ptr */ -#define CCM_GETDROPTARGET (CCM_FIRST+0x4) -#define CCM_SETUNICODEFORMAT (CCM_FIRST+0x5) -#define CCM_GETUNICODEFORMAT (CCM_FIRST+0x6) -#define CCM_SETVERSION (CCM_FIRST+0x7) -#define CCM_GETVERSION (CCM_FIRST+0x8) -#define CCM_SETNOTIFYWINDOW (CCM_FIRST+0x9) /* wParam = hwndParent */ -#define CCM_SETWINDOWTHEME (CCM_FIRST+0xb) -#define CCM_DPISCALE (CCM_FIRST+0xc) + typedef struct tagCOLORSCHEME { + DWORD dwSize; + COLORREF clrBtnHighlight; + COLORREF clrBtnShadow; + } COLORSCHEME,*LPCOLORSCHEME; +#define COMCTL32_VERSION 6 -/* common notification codes (WM_NOTIFY)*/ -#define NM_FIRST (0U- 0U) -#define NM_LAST (0U- 99U) -#define NM_OUTOFMEMORY (NM_FIRST-1) -#define NM_CLICK (NM_FIRST-2) -#define NM_DBLCLK (NM_FIRST-3) -#define NM_RETURN (NM_FIRST-4) -#define NM_RCLICK (NM_FIRST-5) -#define NM_RDBLCLK (NM_FIRST-6) -#define NM_SETFOCUS (NM_FIRST-7) -#define NM_KILLFOCUS (NM_FIRST-8) -#define NM_CUSTOMDRAW (NM_FIRST-12) -#define NM_HOVER (NM_FIRST-13) -#define NM_NCHITTEST (NM_FIRST-14) -#define NM_KEYDOWN (NM_FIRST-15) -#define NM_RELEASEDCAPTURE (NM_FIRST-16) -#define NM_SETCURSOR (NM_FIRST-17) -#define NM_CHAR (NM_FIRST-18) -#define NM_TOOLTIPSCREATED (NM_FIRST-19) -#define NM_LDOWN (NM_FIRST-20) -#define NM_RDOWN (NM_FIRST-21) -#define NM_THEMECHANGED (NM_FIRST-22) -#define NM_FONTCHANGED (NM_FIRST-23) -#define NM_CUSTOMTEXT (NM_FIRST-24) -#define NM_TVSTATEIMAGECHANGING (NM_FIRST-24) +#define CCM_SETVERSION (CCM_FIRST+0x7) +#define CCM_GETVERSION (CCM_FIRST+0x8) +#define CCM_SETNOTIFYWINDOW (CCM_FIRST+0x9) +#define CCM_SETWINDOWTHEME (CCM_FIRST+0xb) +#define CCM_DPISCALE (CCM_FIRST+0xc) -#define HANDLE_WM_NOTIFY(hwnd, wParam, lParam, fn) \ - (fn)((hwnd), (int)(wParam), (NMHDR*)(lParam)) -#define FORWARD_WM_NOTIFY(hwnd, idFrom, pnmhdr, fn) \ - (LRESULT)(fn)((hwnd), WM_NOTIFY, (WPARAM)(int)(idFrom), (LPARAM)(NMHDR*)(pnmhdr)) +#define INFOTIPSIZE 1024 +#define HANDLE_WM_NOTIFY(hwnd,wParam,lParam,fn) (fn)((hwnd),(int)(wParam),(NMHDR *)(lParam)) +#define FORWARD_WM_NOTIFY(hwnd,idFrom,pnmhdr,fn) (LRESULT)(fn)((hwnd),WM_NOTIFY,(WPARAM)(int)(idFrom),(LPARAM)(NMHDR *)(pnmhdr)) -/* callback constants */ -#define LPSTR_TEXTCALLBACKA ((LPSTR)-1L) -#define LPSTR_TEXTCALLBACKW ((LPWSTR)-1L) -#define LPSTR_TEXTCALLBACK WINELIB_NAME_AW(LPSTR_TEXTCALLBACK) +#define NM_OUTOFMEMORY (NM_FIRST-1) +#define NM_CLICK (NM_FIRST-2) +#define NM_DBLCLK (NM_FIRST-3) +#define NM_RETURN (NM_FIRST-4) +#define NM_RCLICK (NM_FIRST-5) +#define NM_RDBLCLK (NM_FIRST-6) +#define NM_SETFOCUS (NM_FIRST-7) +#define NM_KILLFOCUS (NM_FIRST-8) +#define NM_CUSTOMDRAW (NM_FIRST-12) +#define NM_HOVER (NM_FIRST-13) +#define NM_NCHITTEST (NM_FIRST-14) +#define NM_KEYDOWN (NM_FIRST-15) +#define NM_RELEASEDCAPTURE (NM_FIRST-16) +#define NM_SETCURSOR (NM_FIRST-17) +#define NM_CHAR (NM_FIRST-18) +#define NM_TOOLTIPSCREATED (NM_FIRST-19) +#define NM_LDOWN (NM_FIRST-20) +#define NM_RDOWN (NM_FIRST-21) +#define NM_THEMECHANGED (NM_FIRST-22) -#define I_IMAGECALLBACK (-1) -#define I_IMAGENONE (-2) -#define I_INDENTCALLBACK (-1) -#define I_CHILDRENCALLBACK (-1) -#define I_GROUPIDCALLBACK (-1) -#define I_GROUPIDNONE (-2) -#define I_COLUMNSCALLBACK ((UINT)-1) +#ifndef CCSIZEOF_STRUCT +#define CCSIZEOF_STRUCT(structname,member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0))))+sizeof(((structname*)0)->member)) +#endif -/* owner drawn types */ -#define ODT_HEADER 100 -#define ODT_TAB 101 -#define ODT_LISTVIEW 102 - -/* common notification structures */ -typedef struct tagNMTOOLTIPSCREATED -{ - NMHDR hdr; + typedef struct tagNMTOOLTIPSCREATED { + NMHDR hdr; HWND hwndToolTips; -} NMTOOLTIPSCREATED, *LPNMTOOLTIPSCREATED; + } NMTOOLTIPSCREATED,*LPNMTOOLTIPSCREATED; -typedef struct tagNMMOUSE -{ - NMHDR hdr; - DWORD_PTR dwItemSpec; - DWORD_PTR dwItemData; - POINT pt; - DWORD dwHitInfo; /* info where on item or control the mouse is */ -} NMMOUSE, *LPNMMOUSE; + typedef struct tagNMMOUSE { + NMHDR hdr; + DWORD_PTR dwItemSpec; + DWORD_PTR dwItemData; + POINT pt; + LPARAM dwHitInfo; + } NMMOUSE,*LPNMMOUSE; -typedef struct tagNMOBJECTNOTIFY -{ - NMHDR hdr; - int iItem; + typedef NMMOUSE NMCLICK; + typedef LPNMMOUSE LPNMCLICK; + + typedef struct tagNMOBJECTNOTIFY { + NMHDR hdr; + int iItem; #ifdef __IID_DEFINED__ const IID *piid; #else const void *piid; #endif - void *pObject; + void *pObject; HRESULT hResult; - DWORD dwFlags; -} NMOBJECTNOTIFY, *LPNMOBJECTNOTIFY; + DWORD dwFlags; + } NMOBJECTNOTIFY,*LPNMOBJECTNOTIFY; -typedef struct tagNMKEY -{ - NMHDR hdr; - UINT nVKey; - UINT uFlags; -} NMKEY, *LPNMKEY; + typedef struct tagNMKEY { + NMHDR hdr; + UINT nVKey; + UINT uFlags; + } NMKEY,*LPNMKEY; -typedef struct tagNMCHAR -{ - NMHDR hdr; - UINT ch; - DWORD dwItemPrev; /* Item previously selected */ - DWORD dwItemNext; /* Item to be selected */ -} NMCHAR, *LPNMCHAR; + typedef struct tagNMCHAR { + NMHDR hdr; + UINT ch; + DWORD dwItemPrev; + DWORD dwItemNext; + } NMCHAR,*LPNMCHAR; -#ifndef CCSIZEOF_STRUCT -#define CCSIZEOF_STRUCT(name, member) \ - (((INT)((LPBYTE)(&((name*)0)->member)-((LPBYTE)((name*)0))))+ \ - sizeof(((name*)0)->member)) +#define NM_FIRST (0U- 0U) +#define NM_LAST (0U- 99U) + +#define LVN_FIRST (0U-100U) +#define LVN_LAST (0U-199U) + +#define HDN_FIRST (0U-300U) +#define HDN_LAST (0U-399U) + +#define TVN_FIRST (0U-400U) +#define TVN_LAST (0U-499U) + +#define TTN_FIRST (0U-520U) +#define TTN_LAST (0U-549U) + +#define TCN_FIRST (0U-550U) +#define TCN_LAST (0U-580U) + +#ifndef CDN_FIRST +#define CDN_FIRST (0U-601U) +#define CDN_LAST (0U-699U) #endif +#define TBN_FIRST (0U-700U) +#define TBN_LAST (0U-720U) -/* This is only for Winelib applications. DON't use it wine itself!!! */ -#ifndef SNDMSG -#ifdef __cplusplus -#define SNDMSG ::SendMessage -#else /* __cplusplus */ -#define SNDMSG SendMessage -#endif /* __cplusplus */ -#endif /* SNDMSG */ +#define UDN_FIRST (0U-721) +#define UDN_LAST (0U-740) +#define MCN_FIRST (0U-750U) +#define MCN_LAST (0U-759U) +#define DTN_FIRST (0U-760U) +#define DTN_LAST (0U-799U) +#define CBEN_FIRST (0U-800U) +#define CBEN_LAST (0U-830U) +#define RBN_FIRST (0U-831U) +#define RBN_LAST (0U-859U) -#ifdef __cplusplus -#define SNDMSGA ::SendMessageA -#define SNDMSGW ::SendMessageW -#else -#define SNDMSGA SendMessageA -#define SNDMSGW SendMessageW +#define IPN_FIRST (0U-860U) +#define IPN_LAST (0U-879U) +#define SBN_FIRST (0U-880U) +#define SBN_LAST (0U-899U) +#define PGN_FIRST (0U-900U) +#define PGN_LAST (0U-950U) + +#ifndef WMN_FIRST +#define WMN_FIRST (0U-1000U) +#define WMN_LAST (0U-1200U) #endif -/* Custom Draw messages */ +#define BCN_FIRST (0U-1250U) +#define BCN_LAST (0U-1350U) -#define CDRF_DODEFAULT 0x0 -#define CDRF_NEWFONT 0x00000002 -#define CDRF_SKIPDEFAULT 0x00000004 -#define CDRF_NOTIFYPOSTPAINT 0x00000010 -#define CDRF_NOTIFYITEMDRAW 0x00000020 -#define CDRF_NOTIFYSUBITEMDRAW 0x00000020 -#define CDRF_NOTIFYPOSTERASE 0x00000040 -#define CDRF_NOTIFYITEMERASE 0x00000080 /* obsolete ??? */ +#define MSGF_COMMCTRL_BEGINDRAG 0x4200 +#define MSGF_COMMCTRL_SIZEHEADER 0x4201 +#define MSGF_COMMCTRL_DRAGSELECT 0x4202 +#define MSGF_COMMCTRL_TOOLBARCUST 0x4203 +#define CDRF_DODEFAULT 0x0 +#define CDRF_NEWFONT 0x2 +#define CDRF_SKIPDEFAULT 0x4 -/* drawstage flags */ +#define CDRF_NOTIFYPOSTPAINT 0x10 +#define CDRF_NOTIFYITEMDRAW 0x20 +#define CDRF_NOTIFYSUBITEMDRAW 0x20 +#define CDRF_NOTIFYPOSTERASE 0x40 -#define CDDS_PREPAINT 1 -#define CDDS_POSTPAINT 2 -#define CDDS_PREERASE 3 -#define CDDS_POSTERASE 4 +#define CDDS_PREPAINT 0x1 +#define CDDS_POSTPAINT 0x2 +#define CDDS_PREERASE 0x3 +#define CDDS_POSTERASE 0x4 +#define CDDS_ITEM 0x10000 +#define CDDS_ITEMPREPAINT (CDDS_ITEM | CDDS_PREPAINT) +#define CDDS_ITEMPOSTPAINT (CDDS_ITEM | CDDS_POSTPAINT) +#define CDDS_ITEMPREERASE (CDDS_ITEM | CDDS_PREERASE) +#define CDDS_ITEMPOSTERASE (CDDS_ITEM | CDDS_POSTERASE) +#define CDDS_SUBITEM 0x20000 -#define CDDS_ITEM 0x00010000 -#define CDDS_ITEMPREPAINT (CDDS_ITEM | CDDS_PREPAINT) -#define CDDS_ITEMPOSTPAINT (CDDS_ITEM | CDDS_POSTPAINT) -#define CDDS_ITEMPREERASE (CDDS_ITEM | CDDS_PREERASE) -#define CDDS_ITEMPOSTERASE (CDDS_ITEM | CDDS_POSTERASE) -#define CDDS_SUBITEM 0x00020000 +#define CDIS_SELECTED 0x1 +#define CDIS_GRAYED 0x2 +#define CDIS_DISABLED 0x4 +#define CDIS_CHECKED 0x8 +#define CDIS_FOCUS 0x10 +#define CDIS_DEFAULT 0x20 +#define CDIS_HOT 0x40 +#define CDIS_MARKED 0x80 +#define CDIS_INDETERMINATE 0x100 +#define CDIS_SHOWKEYBOARDCUES 0x200 -/* itemState flags */ + typedef struct tagNMCUSTOMDRAWINFO { + NMHDR hdr; + DWORD dwDrawStage; + HDC hdc; + RECT rc; + DWORD_PTR dwItemSpec; + UINT uItemState; + LPARAM lItemlParam; + } NMCUSTOMDRAW,*LPNMCUSTOMDRAW; -#define CDIS_SELECTED 0x0001 -#define CDIS_GRAYED 0x0002 -#define CDIS_DISABLED 0x0004 -#define CDIS_CHECKED 0x0008 -#define CDIS_FOCUS 0x0010 -#define CDIS_DEFAULT 0x0020 -#define CDIS_HOT 0x0040 -#define CDIS_MARKED 0x0080 -#define CDIS_INDETERMINATE 0x0100 -#define CDIS_SHOWKEYBOARDCUES 0x0200 -#define CDIS_NEARHOT 0x0400 -#define CDIS_OTHERSIDEHOT 0x0800 -#define CDIS_DROPHILITED 0x1000 - - -typedef struct tagNMCUSTOMDRAWINFO -{ - NMHDR hdr; - DWORD dwDrawStage; - HDC hdc; - RECT rc; - DWORD_PTR dwItemSpec; - UINT uItemState; - LPARAM lItemlParam; -} NMCUSTOMDRAW, *LPNMCUSTOMDRAW; - -typedef struct tagNMTTCUSTOMDRAW -{ + typedef struct tagNMTTCUSTOMDRAW { NMCUSTOMDRAW nmcd; - UINT uDrawFlags; -} NMTTCUSTOMDRAW, *LPNMTTCUSTOMDRAW; + UINT uDrawFlags; + } NMTTCUSTOMDRAW,*LPNMTTCUSTOMDRAW; +#ifndef NOIMAGEAPIS +#define CLR_NONE 0xffffffffL +#define CLR_DEFAULT 0xFF000000L - -/* StatusWindow */ - -#define STATUSCLASSNAMEA "msctls_statusbar32" -#if defined(__GNUC__) -# define STATUSCLASSNAMEW (const WCHAR []){ 'm','s','c','t','l','s','_', \ - 's','t','a','t','u','s','b','a','r','3','2',0 } -#elif defined(_MSC_VER) -# define STATUSCLASSNAMEW L"msctls_statusbar32" -#else -static const WCHAR STATUSCLASSNAMEW[] = { 'm','s','c','t','l','s','_', - 's','t','a','t','u','s','b','a','r','3','2',0 }; +#ifndef HIMAGELIST + struct _IMAGELIST; + typedef struct _IMAGELIST *HIMAGELIST; #endif -#define STATUSCLASSNAME WINELIB_NAME_AW(STATUSCLASSNAME) -#define SBT_NOBORDERS 0x0100 -#define SBT_POPOUT 0x0200 -#define SBT_RTLREADING 0x0400 /* not supported */ -#define SBT_TOOLTIPS 0x0800 -#define SBT_OWNERDRAW 0x1000 +#ifndef IMAGELISTDRAWPARAMS + typedef struct _IMAGELISTDRAWPARAMS { + DWORD cbSize; + HIMAGELIST himl; + int i; + HDC hdcDst; + int x; + int y; + int cx; + int cy; + int xBitmap; + int yBitmap; + COLORREF rgbBk; + COLORREF rgbFg; + UINT fStyle; + DWORD dwRop; + DWORD fState; + DWORD Frame; + COLORREF crEffect; + } IMAGELISTDRAWPARAMS,*LPIMAGELISTDRAWPARAMS; -#define SBARS_SIZEGRIP 0x0100 - -#define SB_SIMPLEID 0x00ff - -#define SB_SETTEXTA (WM_USER+1) -#define SB_SETTEXTW (WM_USER+11) -#define SB_SETTEXT WINELIB_NAME_AW(SB_SETTEXT) -#define SB_GETTEXTA (WM_USER+2) -#define SB_GETTEXTW (WM_USER+13) -#define SB_GETTEXT WINELIB_NAME_AW(SB_GETTEXT) -#define SB_GETTEXTLENGTHA (WM_USER+3) -#define SB_GETTEXTLENGTHW (WM_USER+12) -#define SB_GETTEXTLENGTH WINELIB_NAME_AW(SB_GETTEXTLENGTH) -#define SB_SETPARTS (WM_USER+4) -#define SB_SETBORDERS (WM_USER+5) -#define SB_GETPARTS (WM_USER+6) -#define SB_GETBORDERS (WM_USER+7) -#define SB_SETMINHEIGHT (WM_USER+8) -#define SB_SIMPLE (WM_USER+9) -#define SB_GETRECT (WM_USER+10) -#define SB_ISSIMPLE (WM_USER+14) -#define SB_SETICON (WM_USER+15) -#define SB_SETTIPTEXTA (WM_USER+16) -#define SB_SETTIPTEXTW (WM_USER+17) -#define SB_SETTIPTEXT WINELIB_NAME_AW(SB_SETTIPTEXT) -#define SB_GETTIPTEXTA (WM_USER+18) -#define SB_GETTIPTEXTW (WM_USER+19) -#define SB_GETTIPTEXT WINELIB_NAME_AW(SB_GETTIPTEXT) -#define SB_GETICON (WM_USER+20) -#define SB_SETBKCOLOR CCM_SETBKCOLOR /* lParam = bkColor */ -#define SB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define SB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT - -#define SBN_FIRST (0U-880U) -#define SBN_LAST (0U-899U) -#define SBN_SIMPLEMODECHANGE (SBN_FIRST-0) - -HWND WINAPI CreateStatusWindowA (LONG, LPCSTR, HWND, UINT); -HWND WINAPI CreateStatusWindowW (LONG, LPCWSTR, HWND, UINT); -#define CreateStatusWindow WINELIB_NAME_AW(CreateStatusWindow) -VOID WINAPI DrawStatusTextA (HDC, LPCRECT, LPCSTR, UINT); -VOID WINAPI DrawStatusTextW (HDC, LPCRECT, LPCWSTR, UINT); -#define DrawStatusText WINELIB_NAME_AW(DrawStatusText) -VOID WINAPI MenuHelp (UINT, WPARAM, LPARAM, HMENU, - HINSTANCE, HWND, UINT*); - -typedef struct tagCOLORSCHEME -{ - DWORD dwSize; - COLORREF clrBtnHighlight; /* highlight color */ - COLORREF clrBtnShadow; /* shadow color */ -} COLORSCHEME, *LPCOLORSCHEME; - -/************************************************************************** - * Drag List control - */ - -typedef struct tagDRAGLISTINFO -{ - UINT uNotification; - HWND hWnd; - POINT ptCursor; -} DRAGLISTINFO, *LPDRAGLISTINFO; - -#define DL_BEGINDRAG (WM_USER+133) -#define DL_DRAGGING (WM_USER+134) -#define DL_DROPPED (WM_USER+135) -#define DL_CANCELDRAG (WM_USER+136) - -#define DL_CURSORSET 0 -#define DL_STOPCURSOR 1 -#define DL_COPYCURSOR 2 -#define DL_MOVECURSOR 3 - -#define DRAGLISTMSGSTRINGA "commctrl_DragListMsg" -#if defined(__GNUC__) -# define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \ - '_','D','r','a','g','L','i','s','t','M','s','g',0 } -#elif defined(_MSC_VER) -# define DRAGLISTMSGSTRINGW L"commctrl_DragListMsg" -#else -static const WCHAR DRAGLISTMSGSTRINGW[] = { 'c','o','m','m','c','t','r','l', - '_','D','r','a','g','L','i','s','t','M','s','g',0 }; +#define IMAGELISTDRAWPARAMS_V3_SIZE CCSIZEOF_STRUCT(IMAGELISTDRAWPARAMS,dwRop) #endif -#define DRAGLISTMSGSTRING WINELIB_NAME_AW(DRAGLISTMSGSTRING) -BOOL WINAPI MakeDragList (HWND); -VOID WINAPI DrawInsert (HWND, HWND, INT); -INT WINAPI LBItemFromPt (HWND, POINT, BOOL); - - -/* UpDown */ - -#define UPDOWN_CLASSA "msctls_updown32" -# define UPDOWN_CLASSW L"msctls_updown32" -#define UPDOWN_CLASS WINELIB_NAME_AW(UPDOWN_CLASS) - -typedef struct _UDACCEL -{ - UINT nSec; - UINT nInc; -} UDACCEL, *LPUDACCEL; - -#define UD_MAXVAL 0x7fff -#define UD_MINVAL 0x8001 - -#define UDS_WRAP 0x0001 -#define UDS_SETBUDDYINT 0x0002 -#define UDS_ALIGNRIGHT 0x0004 -#define UDS_ALIGNLEFT 0x0008 -#define UDS_AUTOBUDDY 0x0010 -#define UDS_ARROWKEYS 0x0020 -#define UDS_HORZ 0x0040 -#define UDS_NOTHOUSANDS 0x0080 -#define UDS_HOTTRACK 0x0100 - -#define UDN_FIRST (0U-721) -#define UDN_LAST (0U-740) -#define UDN_DELTAPOS (UDN_FIRST-1) - -#define UDM_SETRANGE (WM_USER+101) -#define UDM_GETRANGE (WM_USER+102) -#define UDM_SETPOS (WM_USER+103) -#define UDM_GETPOS (WM_USER+104) -#define UDM_SETBUDDY (WM_USER+105) -#define UDM_GETBUDDY (WM_USER+106) -#define UDM_SETACCEL (WM_USER+107) -#define UDM_GETACCEL (WM_USER+108) -#define UDM_SETBASE (WM_USER+109) -#define UDM_GETBASE (WM_USER+110) -#define UDM_SETRANGE32 (WM_USER+111) -#define UDM_GETRANGE32 (WM_USER+112) -#define UDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define UDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define UDM_SETPOS32 (WM_USER+113) -#define UDM_GETPOS32 (WM_USER+114) - - -#define NMUPDOWN NM_UPDOWN -#define LPNMUPDOWN LPNM_UPDOWN - -typedef struct tagNM_UPDOWN -{ - NMHDR hdr; - int iPos; - int iDelta; -} NM_UPDOWN, *LPNM_UPDOWN; - -HWND WINAPI CreateUpDownControl (DWORD, INT, INT, INT, INT, - HWND, INT, HINSTANCE, HWND, - INT, INT, INT); - -/* Progress Bar */ - -#define PROGRESS_CLASSA "msctls_progress32" -# define PROGRESS_CLASSW L"msctls_progress32" -#define PROGRESS_CLASS WINELIB_NAME_AW(PROGRESS_CLASS) - -#define PBM_SETRANGE (WM_USER+1) -#define PBM_SETPOS (WM_USER+2) -#define PBM_DELTAPOS (WM_USER+3) -#define PBM_SETSTEP (WM_USER+4) -#define PBM_STEPIT (WM_USER+5) -#define PBM_SETRANGE32 (WM_USER+6) -#define PBM_GETRANGE (WM_USER+7) -#define PBM_GETPOS (WM_USER+8) -#define PBM_SETBARCOLOR (WM_USER+9) -#define PBM_SETMARQUEE (WM_USER+10) -#define PBM_GETBKCOLOR (WM_USER+14) -#define PBM_GETBARCOLOR (WM_USER+15) -#define PBM_SETBKCOLOR CCM_SETBKCOLOR - -#define PBS_SMOOTH 0x01 -#define PBS_VERTICAL 0x04 -#define PBS_MARQUEE 0x08 - -typedef struct -{ - INT iLow; - INT iHigh; -} PBRANGE, *PPBRANGE; - - -/* ImageList */ - -struct _IMAGELIST; -typedef struct _IMAGELIST *HIMAGELIST; - -#define CLR_NONE 0xFFFFFFFF -#define CLR_DEFAULT 0xFF000000 -#define CLR_HILIGHT CLR_DEFAULT - -#define ILC_MASK 0x0001 -#define ILC_COLOR 0x0000 -#define ILC_COLORDDB 0x00FE -#define ILC_COLOR4 0x0004 -#define ILC_COLOR8 0x0008 -#define ILC_COLOR16 0x0010 -#define ILC_COLOR24 0x0018 -#define ILC_COLOR32 0x0020 -#define ILC_PALETTE 0x0800 /* no longer supported by M$ */ -#define ILC_MIRROR 0x2000 +#define ILC_MASK 0x1 +#define ILC_COLOR 0x0 +#define ILC_COLORDDB 0xfe +#define ILC_COLOR4 0x4 +#define ILC_COLOR8 0x8 +#define ILC_COLOR16 0x10 +#define ILC_COLOR24 0x18 +#define ILC_COLOR32 0x20 +#define ILC_PALETTE 0x800 +#define ILC_MIRROR 0x2000 #define ILC_PERITEMMIRROR 0x8000 -#define ILD_NORMAL 0x0000 -#define ILD_TRANSPARENT 0x0001 -#define ILD_BLEND25 0x0002 -#define ILD_BLEND50 0x0004 -#define ILD_MASK 0x0010 -#define ILD_IMAGE 0x0020 -#define ILD_ROP 0x0040 -#define ILD_OVERLAYMASK 0x0F00 + WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Create(int cx,int cy,UINT flags,int cInitial,int cGrow); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_Destroy(HIMAGELIST himl); + WINCOMMCTRLAPI int WINAPI ImageList_GetImageCount(HIMAGELIST himl); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_SetImageCount(HIMAGELIST himl,UINT uNewCount); + WINCOMMCTRLAPI int WINAPI ImageList_Add(HIMAGELIST himl,HBITMAP hbmImage,HBITMAP hbmMask); + WINCOMMCTRLAPI int WINAPI ImageList_ReplaceIcon(HIMAGELIST himl,int i,HICON hicon); + WINCOMMCTRLAPI COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl,COLORREF clrBk); + WINCOMMCTRLAPI COLORREF WINAPI ImageList_GetBkColor(HIMAGELIST himl); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_SetOverlayImage(HIMAGELIST himl,int iImage,int iOverlay); +#define ImageList_AddIcon(himl,hicon) ImageList_ReplaceIcon(himl,-1,hicon) + +#define ILD_NORMAL 0x0 +#define ILD_TRANSPARENT 0x1 +#define ILD_MASK 0x10 +#define ILD_IMAGE 0x20 +#define ILD_ROP 0x40 +#define ILD_BLEND25 0x2 +#define ILD_BLEND50 0x4 +#define ILD_OVERLAYMASK 0xf00 +#define INDEXTOOVERLAYMASK(i) ((i) << 8) #define ILD_PRESERVEALPHA 0x1000 -#define ILD_SCALE 0x2000 -#define ILD_DPISCALE 0x4000 -#define ILD_ASYNC 0x8000 +#define ILD_SCALE 0x2000 +#define ILD_DPISCALE 0x4000 -#define ILD_SELECTED ILD_BLEND50 -#define ILD_FOCUS ILD_BLEND25 -#define ILD_BLEND ILD_BLEND50 +#define ILD_SELECTED ILD_BLEND50 +#define ILD_FOCUS ILD_BLEND25 +#define ILD_BLEND ILD_BLEND50 +#define CLR_HILIGHT CLR_DEFAULT -#define INDEXTOOVERLAYMASK(i) ((i)<<8) -#define INDEXTOSTATEIMAGEMASK(i) ((i)<<12) +#define ILS_NORMAL 0x0 +#define ILS_GLOW 0x1 +#define ILS_SHADOW 0x2 +#define ILS_SATURATE 0x4 +#define ILS_ALPHA 0x8 -#define ILCF_MOVE (0x00000000) -#define ILCF_SWAP (0x00000001) + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_Draw(HIMAGELIST himl,int i,HDC hdcDst,int x,int y,UINT fStyle); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_Replace(HIMAGELIST himl,int i,HBITMAP hbmImage,HBITMAP hbmMask); + WINCOMMCTRLAPI int WINAPI ImageList_AddMasked(HIMAGELIST himl,HBITMAP hbmImage,COLORREF crMask); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_DrawEx(HIMAGELIST himl,int i,HDC hdcDst,int x,int y,int dx,int dy,COLORREF rgbBk,COLORREF rgbFg,UINT fStyle); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS *pimldp); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_Remove(HIMAGELIST himl,int i); + WINCOMMCTRLAPI HICON WINAPI ImageList_GetIcon(HIMAGELIST himl,int i,UINT flags); + WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_LoadImageA(HINSTANCE hi,LPCSTR lpbmp,int cx,int cGrow,COLORREF crMask,UINT uType,UINT uFlags); + WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE hi,LPCWSTR lpbmp,int cx,int cGrow,COLORREF crMask,UINT uType,UINT uFlags); -#define ILGT_NORMAL 0x0000 -#define ILGT_ASYNC 0x0001 +#ifdef UNICODE +#define ImageList_LoadImage ImageList_LoadImageW +#else +#define ImageList_LoadImage ImageList_LoadImageA +#endif -#define ILS_NORMAL 0x0000 -#define ILS_GLOW 0x0001 -#define ILS_SHADOW 0x0002 -#define ILS_SATURATE 0x0004 -#define ILS_ALPHA 0x0008 - -typedef struct _IMAGEINFO -{ - HBITMAP hbmImage; - HBITMAP hbmMask; - INT Unused1; - INT Unused2; - RECT rcImage; -} IMAGEINFO, *LPIMAGEINFO; - - -typedef struct _IMAGELISTDRAWPARAMS -{ - DWORD cbSize; - HIMAGELIST himl; - INT i; - HDC hdcDst; - INT x; - INT y; - INT cx; - INT cy; - INT xBitmap; /* x offest from the upperleft of bitmap */ - INT yBitmap; /* y offset from the upperleft of bitmap */ - COLORREF rgbBk; - COLORREF rgbFg; - UINT fStyle; - DWORD dwRop; - DWORD fState; - DWORD Frame; - DWORD crEffect; -} IMAGELISTDRAWPARAMS, *LPIMAGELISTDRAWPARAMS; - - -HRESULT WINAPI HIMAGELIST_QueryInterface(HIMAGELIST,REFIID,void **); -INT WINAPI ImageList_Add(HIMAGELIST,HBITMAP,HBITMAP); -INT WINAPI ImageList_AddMasked(HIMAGELIST,HBITMAP,COLORREF); -BOOL WINAPI ImageList_BeginDrag(HIMAGELIST,INT,INT,INT); -BOOL WINAPI ImageList_Copy(HIMAGELIST,INT,HIMAGELIST,INT,UINT); -HIMAGELIST WINAPI ImageList_Create(INT,INT,UINT,INT,INT); -BOOL WINAPI ImageList_Destroy(HIMAGELIST); -BOOL WINAPI ImageList_DragEnter(HWND,INT,INT); -BOOL WINAPI ImageList_DragLeave(HWND); -BOOL WINAPI ImageList_DragMove(INT,INT); -BOOL WINAPI ImageList_DragShowNolock (BOOL); -BOOL WINAPI ImageList_Draw(HIMAGELIST,INT,HDC,INT,INT,UINT); -BOOL WINAPI ImageList_DrawEx(HIMAGELIST,INT,HDC,INT,INT,INT, - INT,COLORREF,COLORREF,UINT); -BOOL WINAPI ImageList_DrawIndirect(IMAGELISTDRAWPARAMS*); -HIMAGELIST WINAPI ImageList_Duplicate(HIMAGELIST); -VOID WINAPI ImageList_EndDrag(VOID); -COLORREF WINAPI ImageList_GetBkColor(HIMAGELIST); -HIMAGELIST WINAPI ImageList_GetDragImage(POINT*,POINT*); -HICON WINAPI ImageList_GetIcon(HIMAGELIST,INT,UINT); -BOOL WINAPI ImageList_GetIconSize(HIMAGELIST,INT*,INT*); -INT WINAPI ImageList_GetImageCount(HIMAGELIST); -BOOL WINAPI ImageList_GetImageInfo(HIMAGELIST,INT,IMAGEINFO*); -BOOL WINAPI ImageList_GetImageRect(HIMAGELIST,INT,LPRECT); -HIMAGELIST WINAPI ImageList_LoadImageA(HINSTANCE,LPCSTR,INT,INT, - COLORREF,UINT,UINT); -HIMAGELIST WINAPI ImageList_LoadImageW(HINSTANCE,LPCWSTR,INT,INT, - COLORREF,UINT,UINT); -#define ImageList_LoadImage WINELIB_NAME_AW(ImageList_LoadImage) -HIMAGELIST WINAPI ImageList_Merge(HIMAGELIST,INT,HIMAGELIST,INT,INT,INT); -BOOL WINAPI ImageList_Remove(HIMAGELIST,INT); -BOOL WINAPI ImageList_Replace(HIMAGELIST,INT,HBITMAP,HBITMAP); -INT WINAPI ImageList_ReplaceIcon(HIMAGELIST,INT,HICON); -COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST,COLORREF); -BOOL WINAPI ImageList_SetDragCursorImage(HIMAGELIST,INT,INT,INT); - -BOOL WINAPI ImageList_SetIconSize(HIMAGELIST,INT,INT); -BOOL WINAPI ImageList_SetImageCount(HIMAGELIST,UINT); -BOOL WINAPI ImageList_SetOverlayImage(HIMAGELIST,INT,INT); +#define ILCF_MOVE 0x0 +#define ILCF_SWAP 0x1 + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_Copy(HIMAGELIST himlDst,int iDst,HIMAGELIST himlSrc,int iSrc,UINT uFlags); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack,int iTrack,int dxHotspot,int dyHotspot); + WINCOMMCTRLAPI void WINAPI ImageList_EndDrag(); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_DragEnter(HWND hwndLock,int x,int y); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_DragLeave(HWND hwndLock); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_DragMove(int x,int y); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_SetDragCursorImage(HIMAGELIST himlDrag,int iDrag,int dxHotspot,int dyHotspot); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_DragShowNolock(WINBOOL fShow); + WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_GetDragImage(POINT *ppt,POINT *pptHotspot); +#define ImageList_RemoveAll(himl) ImageList_Remove(himl,-1) +#define ImageList_ExtractIcon(hi,himl,i) ImageList_GetIcon(himl,i,0) +#define ImageList_LoadBitmap(hi,lpbmp,cx,cGrow,crMask) ImageList_LoadImage(hi,lpbmp,cx,cGrow,crMask,IMAGE_BITMAP,0) #ifdef __IStream_INTERFACE_DEFINED__ -HIMAGELIST WINAPI ImageList_Read(LPSTREAM); -BOOL WINAPI ImageList_Write(HIMAGELIST, LPSTREAM); + WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_Write(HIMAGELIST himl,LPSTREAM pstm); +#define ILP_NORMAL 0 +#define ILP_DOWNLEVEL 1 + WINCOMMCTRLAPI HRESULT WINAPI ImageList_ReadEx(DWORD dwFlags,LPSTREAM pstm,REFIID riid,PVOID *ppv); + WINCOMMCTRLAPI HRESULT WINAPI ImageList_WriteEx(HIMAGELIST himl,DWORD dwFlags,LPSTREAM pstm); #endif -#define ImageList_AddIcon(himl,hicon) ImageList_ReplaceIcon(himl,-1,hicon) -#define ImageList_ExtractIcon(hi,himl,i) ImageList_GetIcon(himl,i,0) -#define ImageList_LoadBitmap(hi,lpbmp,cx,cGrow,crMask) \ - ImageList_LoadImage(hi,lpbmp,cx,cGrow,crMask,IMAGE_BITMAP,0) -#define ImageList_RemoveAll(himl) ImageList_Remove(himl,-1) - - -#ifndef WM_MOUSEHOVER -#define WM_MOUSEHOVER 0x02A1 -#define WM_MOUSELEAVE 0x02A3 +#ifndef IMAGEINFO + typedef struct _IMAGEINFO { + HBITMAP hbmImage; + HBITMAP hbmMask; + int Unused1; + int Unused2; + RECT rcImage; + } IMAGEINFO,*LPIMAGEINFO; #endif -#ifndef TME_HOVER - -#define TME_HOVER 0x00000001 -#define TME_LEAVE 0x00000002 -#define TME_NONCLIENT 0x00000010 -#define TME_QUERY 0x40000000 -#define TME_CANCEL 0x80000000 - - -#define HOVER_DEFAULT 0xFFFFFFFF - -typedef struct tagTRACKMOUSEEVENT { - DWORD cbSize; - DWORD dwFlags; - HWND hwndTrack; - DWORD dwHoverTime; -} TRACKMOUSEEVENT, *LPTRACKMOUSEEVENT; - + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl,int *cx,int *cy); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_SetIconSize(HIMAGELIST himl,int cx,int cy); + WINCOMMCTRLAPI WINBOOL WINAPI ImageList_GetImageInfo(HIMAGELIST himl,int i,IMAGEINFO *pImageInfo); + WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Merge(HIMAGELIST himl1,int i1,HIMAGELIST himl2,int i2,int dx,int dy); + WINCOMMCTRLAPI HIMAGELIST WINAPI ImageList_Duplicate(HIMAGELIST himl); #endif -BOOL WINAPI _TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack); +#ifndef NOHEADER -/* Flat Scrollbar control */ +#define WC_HEADERA "SysHeader32" +#define WC_HEADERW L"SysHeader32" -#define FLATSB_CLASSA "flatsb_class32" -#if defined(__GNUC__) -# define FLATSB_CLASSW (const WCHAR []){ 'f','l','a','t','s','b','_', \ - 'c','l','a','s','s','3','2',0 } -#elif defined(_MSC_VER) -# define FLATSB_CLASSW L"flatsb_class32" +#ifdef UNICODE +#define WC_HEADER WC_HEADERW #else -static const WCHAR FLATSB_CLASSW[] = { 'f','l','a','t','s','b','_', - 'c','l','a','s','s','3','2',0 }; +#define WC_HEADER WC_HEADERA #endif -#define FLATSB_CLASS WINELIB_NAME_AW(FLATSB_CLASS) -#define WSB_PROP_CYVSCROLL 0x00000001L -#define WSB_PROP_CXHSCROLL 0x00000002L -#define WSB_PROP_CYHSCROLL 0x00000004L -#define WSB_PROP_CXVSCROLL 0x00000008L -#define WSB_PROP_CXHTHUMB 0x00000010L -#define WSB_PROP_CYVTHUMB 0x00000020L -#define WSB_PROP_VBKGCOLOR 0x00000040L -#define WSB_PROP_HBKGCOLOR 0x00000080L -#define WSB_PROP_VSTYLE 0x00000100L -#define WSB_PROP_HSTYLE 0x00000200L -#define WSB_PROP_WINSTYLE 0x00000400L -#define WSB_PROP_PALETTE 0x00000800L -#define WSB_PROP_MASK 0x00000FFFL +#define HDS_HORZ 0x0 +#define HDS_BUTTONS 0x2 +#define HDS_HOTTRACK 0x4 +#define HDS_HIDDEN 0x8 +#define HDS_DRAGDROP 0x40 +#define HDS_FULLDRAG 0x80 +#define HDS_FILTERBAR 0x100 +#define HDS_FLAT 0x200 +#if (_WIN32_WINNT >= 0x0600) +#define HDS_CHECKBOXES 0x400 +#define HDS_NOSIZING 0x800 +#define HDS_OVERFLOW 0x1000 +#endif -#define FSB_REGULAR_MODE 0 -#define FSB_ENCARTA_MODE 1 -#define FSB_FLAT_MODE 2 +#define HDFT_ISSTRING 0x0 +#define HDFT_ISNUMBER 0x1 +#define HDFT_HASNOVALUE 0x8000 -BOOL WINAPI FlatSB_EnableScrollBar(HWND, INT, UINT); -BOOL WINAPI FlatSB_ShowScrollBar(HWND, INT, BOOL); -BOOL WINAPI FlatSB_GetScrollRange(HWND, INT, LPINT, LPINT); -BOOL WINAPI FlatSB_GetScrollInfo(HWND, INT, LPSCROLLINFO); -INT WINAPI FlatSB_GetScrollPos(HWND, INT); -BOOL WINAPI FlatSB_GetScrollProp(HWND, INT, LPINT); -INT WINAPI FlatSB_SetScrollPos(HWND, INT, INT, BOOL); -INT WINAPI FlatSB_SetScrollInfo(HWND, INT, LPSCROLLINFO, BOOL); -INT WINAPI FlatSB_SetScrollRange(HWND, INT, INT, INT, BOOL); -BOOL WINAPI FlatSB_SetScrollProp(HWND, UINT, INT, BOOL); -BOOL WINAPI InitializeFlatSB(HWND); -HRESULT WINAPI UninitializeFlatSB(HWND); +#ifdef UNICODE +#define HD_TEXTFILTER HD_TEXTFILTERW +#define HDTEXTFILTER HD_TEXTFILTERW +#define LPHD_TEXTFILTER LPHD_TEXTFILTERW +#define LPHDTEXTFILTER LPHD_TEXTFILTERW +#else +#define HD_TEXTFILTER HD_TEXTFILTERA +#define HDTEXTFILTER HD_TEXTFILTERA +#define LPHD_TEXTFILTER LPHD_TEXTFILTERA +#define LPHDTEXTFILTER LPHD_TEXTFILTERA +#endif -/* Subclassing stuff */ -typedef LRESULT (CALLBACK *SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM, UINT_PTR, DWORD_PTR); -BOOL WINAPI SetWindowSubclass(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR); -BOOL WINAPI GetWindowSubclass(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR*); -BOOL WINAPI RemoveWindowSubclass(HWND, SUBCLASSPROC, UINT_PTR); -LRESULT WINAPI DefSubclassProc(HWND, UINT, WPARAM, LPARAM); - -int WINAPI DrawShadowText(HDC, LPCWSTR, UINT, RECT*, DWORD, COLORREF, COLORREF, int, int); - -/* Header control */ - -#define WC_HEADERA "SysHeader32" -# define WC_HEADERW L"SysHeader32" -#define WC_HEADER WINELIB_NAME_AW(WC_HEADER) - -#define HDS_HORZ 0x0000 -#define HDS_BUTTONS 0x0002 -#define HDS_HOTTRACK 0x0004 -#define HDS_HIDDEN 0x0008 -#define HDS_DRAGDROP 0x0040 -#define HDS_FULLDRAG 0x0080 -#define HDS_FILTERBAR 0x0100 -#define HDS_FLAT 0x0200 -#define HDS_CHECKBOXES 0x0400 -#define HDS_NOSIZING 0x0800 -#define HDS_OVERFLOW 0x1000 - -#define HDI_WIDTH 0x0001 -#define HDI_HEIGHT HDI_WIDTH -#define HDI_TEXT 0x0002 -#define HDI_FORMAT 0x0004 -#define HDI_LPARAM 0x0008 -#define HDI_BITMAP 0x0010 -#define HDI_IMAGE 0x0020 -#define HDI_DI_SETITEM 0x0040 -#define HDI_ORDER 0x0080 -#define HDI_FILTER 0x0100 -#define HDI_STATE 0x0200 - -#define HDIS_FOCUSED 0x00000001 - -#define HDF_LEFT 0x0000 -#define HDF_RIGHT 0x0001 -#define HDF_CENTER 0x0002 -#define HDF_JUSTIFYMASK 0x0003 -#define HDF_RTLREADING 0x0004 -#define HDF_CHECKBOX 0x0040 -#define HDF_CHECKED 0x0080 -#define HDF_FIXEDWIDTH 0x0100 -#define HDF_SORTDOWN 0x0200 -#define HDF_SORTUP 0x0400 -#define HDF_IMAGE 0x0800 -#define HDF_BITMAP_ON_RIGHT 0x1000 -#define HDF_BITMAP 0x2000 -#define HDF_STRING 0x4000 -#define HDF_OWNERDRAW 0x8000 -#define HDF_SPLITBUTTON 0x1000000 - -#define HHT_NOWHERE 0x0001 -#define HHT_ONHEADER 0x0002 -#define HHT_ONDIVIDER 0x0004 -#define HHT_ONDIVOPEN 0x0008 -#define HHT_ONFILTER 0x0010 -#define HHT_ONFILTERBUTTON 0x0020 -#define HHT_ABOVE 0x0100 -#define HHT_BELOW 0x0200 -#define HHT_TORIGHT 0x0400 -#define HHT_TOLEFT 0x0800 -#define HHT_ONITEMSTATEICON 0x1000 -#define HHT_ONDROPDOWN 0x2000 -#define HHT_ONOVERFLOW 0x4000 - -#define HDM_FIRST 0x1200 -#define HDM_GETITEMCOUNT (HDM_FIRST+0) -#define HDM_INSERTITEMA (HDM_FIRST+1) -#define HDM_INSERTITEMW (HDM_FIRST+10) -#define HDM_INSERTITEM WINELIB_NAME_AW(HDM_INSERTITEM) -#define HDM_DELETEITEM (HDM_FIRST+2) -#define HDM_GETITEMA (HDM_FIRST+3) -#define HDM_GETITEMW (HDM_FIRST+11) -#define HDM_GETITEM WINELIB_NAME_AW(HDM_GETITEM) -#define HDM_SETITEMA (HDM_FIRST+4) -#define HDM_SETITEMW (HDM_FIRST+12) -#define HDM_SETITEM WINELIB_NAME_AW(HDM_SETITEM) -#define HDM_LAYOUT (HDM_FIRST+5) -#define HDM_HITTEST (HDM_FIRST+6) -#define HDM_GETITEMRECT (HDM_FIRST+7) -#define HDM_SETIMAGELIST (HDM_FIRST+8) -#define HDM_GETIMAGELIST (HDM_FIRST+9) - -#define HDM_ORDERTOINDEX (HDM_FIRST+15) -#define HDM_CREATEDRAGIMAGE (HDM_FIRST+16) -#define HDM_GETORDERARRAY (HDM_FIRST+17) -#define HDM_SETORDERARRAY (HDM_FIRST+18) -#define HDM_SETHOTDIVIDER (HDM_FIRST+19) -#define HDM_SETBITMAPMARGIN (HDM_FIRST+20) -#define HDM_GETBITMAPMARGIN (HDM_FIRST+21) -#define HDM_SETFILTERCHANGETIMEOUT (HDM_FIRST+22) -#define HDM_EDITFILTER (HDM_FIRST+23) -#define HDM_CLEARFILTER (HDM_FIRST+24) -#define HDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define HDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT - -#define HDN_FIRST (0U-300U) -#define HDN_LAST (0U-399U) -#define HDN_ITEMCHANGINGA (HDN_FIRST-0) -#define HDN_ITEMCHANGINGW (HDN_FIRST-20) -#define HDN_ITEMCHANGING WINELIB_NAME_AW(HDN_ITEMCHANGING) -#define HDN_ITEMCHANGEDA (HDN_FIRST-1) -#define HDN_ITEMCHANGEDW (HDN_FIRST-21) -#define HDN_ITEMCHANGED WINELIB_NAME_AW(HDN_ITEMCHANGED) -#define HDN_ITEMCLICKA (HDN_FIRST-2) -#define HDN_ITEMCLICKW (HDN_FIRST-22) -#define HDN_ITEMCLICK WINELIB_NAME_AW(HDN_ITEMCLICK) -#define HDN_ITEMDBLCLICKA (HDN_FIRST-3) -#define HDN_ITEMDBLCLICKW (HDN_FIRST-23) -#define HDN_ITEMDBLCLICK WINELIB_NAME_AW(HDN_ITEMDBLCLICK) -#define HDN_DIVIDERDBLCLICKA (HDN_FIRST-5) -#define HDN_DIVIDERDBLCLICKW (HDN_FIRST-25) -#define HDN_DIVIDERDBLCLICK WINELIB_NAME_AW(HDN_DIVIDERDBLCLICK) -#define HDN_BEGINTRACKA (HDN_FIRST-6) -#define HDN_BEGINTRACKW (HDN_FIRST-26) -#define HDN_BEGINTRACK WINELIB_NAME_AW(HDN_BEGINTRACK) -#define HDN_ENDTRACKA (HDN_FIRST-7) -#define HDN_ENDTRACKW (HDN_FIRST-27) -#define HDN_ENDTRACK WINELIB_NAME_AW(HDN_ENDTRACK) -#define HDN_TRACKA (HDN_FIRST-8) -#define HDN_TRACKW (HDN_FIRST-28) -#define HDN_TRACK WINELIB_NAME_AW(HDN_TRACK) -#define HDN_GETDISPINFOA (HDN_FIRST-9) -#define HDN_GETDISPINFOW (HDN_FIRST-29) -#define HDN_GETDISPINFO WINELIB_NAME_AW(HDN_GETDISPINFO) -#define HDN_BEGINDRAG (HDN_FIRST-10) -#define HDN_ENDDRAG (HDN_FIRST-11) -#define HDN_FILTERCHANGE (HDN_FIRST-12) -#define HDN_FILTERBTNCLICK (HDN_FIRST-13) -#define HDN_BEGINFILTEREDIT (HDN_FIRST-14) -#define HDN_ENDFILTEREDIT (HDN_FIRST-15) -#define HDN_ITEMSTATEICONCLICK (HDN_FIRST-16) -#define HDN_ITEMKEYDOWN (HDN_FIRST-17) - -typedef struct _HD_LAYOUT -{ - RECT *prc; - WINDOWPOS *pwpos; -} HDLAYOUT, *LPHDLAYOUT; - -#define HD_LAYOUT HDLAYOUT - -typedef struct _HD_ITEMA -{ - UINT mask; - INT cxy; - LPSTR pszText; - HBITMAP hbm; - INT cchTextMax; - INT fmt; - LPARAM lParam; - /* (_WIN32_IE >= 0x0300) */ - INT iImage; - INT iOrder; - /* (_WIN32_IE >= 0x0500) */ - UINT type; - LPVOID pvFilter; - /* (_WIN32_WINNT >= 0x0600) */ - UINT state; -} HDITEMA, *LPHDITEMA; - -typedef struct _HD_ITEMW -{ - UINT mask; - INT cxy; - LPWSTR pszText; - HBITMAP hbm; - INT cchTextMax; - INT fmt; - LPARAM lParam; - /* (_WIN32_IE >= 0x0300) */ - INT iImage; - INT iOrder; - /* (_WIN32_IE >= 0x0500) */ - UINT type; - LPVOID pvFilter; - /* (_WIN32_WINNT >= 0x0600) */ - UINT state; -} HDITEMW, *LPHDITEMW; - -#define HDITEM WINELIB_NAME_AW(HDITEM) -#define LPHDITEM WINELIB_NAME_AW(LPHDITEM) -#define HD_ITEM HDITEM - -#define HDITEM_V1_SIZEA CCSIZEOF_STRUCT(HDITEMA, lParam) -#define HDITEM_V1_SIZEW CCSIZEOF_STRUCT(HDITEMW, lParam) -#define HDITEM_V1_SIZE WINELIB_NAME_AW(HDITEM_V1_SIZE) - -#define HDFT_ISSTRING 0x0000 -#define HDFT_ISNUMBER 0x0001 -#define HDFT_HASNOVALUE 0x8000 - -typedef struct _HD_TEXTFILTERA -{ + typedef struct _HD_TEXTFILTERA { LPSTR pszText; INT cchTextMax; -} HD_TEXTFILTERA, *LPHD_TEXTFILTERA; + } HD_TEXTFILTERA,*LPHD_TEXTFILTERA; -typedef struct _HD_TEXTFILTERW -{ + typedef struct _HD_TEXTFILTERW { LPWSTR pszText; INT cchTextMax; -} HD_TEXTFILTERW, *LPHD_TEXTFILTERW; + } HD_TEXTFILTERW,*LPHD_TEXTFILTERW; -#define HD_TEXTFILTER WINELIB_NAME_AW(HD_TEXTFILTER) -#define HDTEXTFILTER WINELIB_NAME_AW(HD_TEXTFILTER) -#define LPHD_TEXTFILTER WINELIB_NAME_AW(LPHD_TEXTFILTER) -#define LPHDTEXTFILTER WINELIB_NAME_AW(LPHD_TEXTFILTER) +#define HD_ITEMA HDITEMA +#define HD_ITEMW HDITEMW +#define HD_ITEM HDITEM -typedef struct _HD_HITTESTINFO -{ + typedef struct _HD_ITEMA { + UINT mask; + int cxy; + LPSTR pszText; + HBITMAP hbm; + int cchTextMax; + int fmt; + LPARAM lParam; + int iImage; + int iOrder; + UINT type; + void *pvFilter; + } HDITEMA,*LPHDITEMA; + +#define HDITEMA_V1_SIZE CCSIZEOF_STRUCT(HDITEMA,lParam) +#define HDITEMW_V1_SIZE CCSIZEOF_STRUCT(HDITEMW,lParam) + + typedef struct _HD_ITEMW { + UINT mask; + int cxy; + LPWSTR pszText; + HBITMAP hbm; + int cchTextMax; + int fmt; + LPARAM lParam; + int iImage; + int iOrder; + UINT type; + void *pvFilter; + } HDITEMW,*LPHDITEMW; + +#ifdef UNICODE +#define HDITEM HDITEMW +#define LPHDITEM LPHDITEMW +#define HDITEM_V1_SIZE HDITEMW_V1_SIZE +#else +#define HDITEM HDITEMA +#define LPHDITEM LPHDITEMA +#define HDITEM_V1_SIZE HDITEMA_V1_SIZE +#endif + +#define HDI_WIDTH 0x1 +#define HDI_HEIGHT HDI_WIDTH +#define HDI_TEXT 0x2 +#define HDI_FORMAT 0x4 +#define HDI_LPARAM 0x8 +#define HDI_BITMAP 0x10 +#define HDI_IMAGE 0x20 +#define HDI_DI_SETITEM 0x40 +#define HDI_ORDER 0x80 +#define HDI_FILTER 0x100 + +#define HDF_LEFT 0x0 +#define HDF_RIGHT 0x1 +#define HDF_CENTER 0x2 +#define HDF_JUSTIFYMASK 0x3 +#define HDF_RTLREADING 0x4 + +#define HDF_OWNERDRAW 0x8000 +#define HDF_STRING 0x4000 +#define HDF_BITMAP 0x2000 +#define HDF_BITMAP_ON_RIGHT 0x1000 +#define HDF_IMAGE 0x800 +#define HDF_SORTUP 0x400 +#define HDF_SORTDOWN 0x200 +#if (_WIN32_WINNT >= 0x0600) +#define HDF_CHECKBOX 0x40 +#define HDF_CHECKED 0x80 +#define HDF_FIXEDWIDTH 0x100 +#define HDF_SPLITBUTTON 0x1000000 +#endif + +#define HDM_GETITEMCOUNT (HDM_FIRST+0) +#define Header_GetItemCount(hwndHD) (int)SNDMSG((hwndHD),HDM_GETITEMCOUNT,0,0L) + +#define HDM_INSERTITEMA (HDM_FIRST+1) +#define HDM_INSERTITEMW (HDM_FIRST+10) + +#ifdef UNICODE +#define HDM_INSERTITEM HDM_INSERTITEMW +#else +#define HDM_INSERTITEM HDM_INSERTITEMA +#endif + +#define Header_InsertItem(hwndHD,i,phdi) (int)SNDMSG((hwndHD),HDM_INSERTITEM,(WPARAM)(int)(i),(LPARAM)(const HD_ITEM *)(phdi)) + +#define HDM_DELETEITEM (HDM_FIRST+2) +#define Header_DeleteItem(hwndHD,i) (WINBOOL)SNDMSG((hwndHD),HDM_DELETEITEM,(WPARAM)(int)(i),0L) + +#define HDM_GETITEMA (HDM_FIRST+3) +#define HDM_GETITEMW (HDM_FIRST+11) + +#ifdef UNICODE +#define HDM_GETITEM HDM_GETITEMW +#else +#define HDM_GETITEM HDM_GETITEMA +#endif + +#define Header_GetItem(hwndHD,i,phdi) (WINBOOL)SNDMSG((hwndHD),HDM_GETITEM,(WPARAM)(int)(i),(LPARAM)(HD_ITEM *)(phdi)) + +#define HDM_SETITEMA (HDM_FIRST+4) +#define HDM_SETITEMW (HDM_FIRST+12) + +#ifdef UNICODE +#define HDM_SETITEM HDM_SETITEMW +#else +#define HDM_SETITEM HDM_SETITEMA +#endif + +#define Header_SetItem(hwndHD,i,phdi) (WINBOOL)SNDMSG((hwndHD),HDM_SETITEM,(WPARAM)(int)(i),(LPARAM)(const HD_ITEM *)(phdi)) + +#define HD_LAYOUT HDLAYOUT + + typedef struct _HD_LAYOUT { + RECT *prc; + WINDOWPOS *pwpos; + } HDLAYOUT,*LPHDLAYOUT; + +#define HDM_LAYOUT (HDM_FIRST+5) +#define Header_Layout(hwndHD,playout) (WINBOOL)SNDMSG((hwndHD),HDM_LAYOUT,0,(LPARAM)(HD_LAYOUT *)(playout)) + +#define HHT_NOWHERE 0x1 +#define HHT_ONHEADER 0x2 +#define HHT_ONDIVIDER 0x4 +#define HHT_ONDIVOPEN 0x8 +#define HHT_ONFILTER 0x10 +#define HHT_ONFILTERBUTTON 0x20 +#define HHT_ABOVE 0x100 +#define HHT_BELOW 0x200 +#define HHT_TORIGHT 0x400 +#define HHT_TOLEFT 0x800 + +#define HD_HITTESTINFO HDHITTESTINFO + + typedef struct _HD_HITTESTINFO { POINT pt; - UINT flags; - INT iItem; -} HDHITTESTINFO, *LPHDHITTESTINFO; + UINT flags; + int iItem; + } HDHITTESTINFO,*LPHDHITTESTINFO; -#define HD_HITTESTINFO HDHITTESTINFO +#define HDM_HITTEST (HDM_FIRST+6) -typedef struct tagNMHEADERA -{ - NMHDR hdr; - INT iItem; - INT iButton; +#define HDM_GETITEMRECT (HDM_FIRST+7) +#define Header_GetItemRect(hwnd,iItem,lprc) (WINBOOL)SNDMSG((hwnd),HDM_GETITEMRECT,(WPARAM)(iItem),(LPARAM)(lprc)) + +#define HDM_SETIMAGELIST (HDM_FIRST+8) +#define Header_SetImageList(hwnd,himl) (HIMAGELIST)SNDMSG((hwnd),HDM_SETIMAGELIST,0,(LPARAM)(himl)) + +#define HDM_GETIMAGELIST (HDM_FIRST+9) +#define Header_GetImageList(hwnd) (HIMAGELIST)SNDMSG((hwnd),HDM_GETIMAGELIST,0,0) + +#define HDM_ORDERTOINDEX (HDM_FIRST+15) +#define Header_OrderToIndex(hwnd,i) (int)SNDMSG((hwnd),HDM_ORDERTOINDEX,(WPARAM)(i),0) + +#define HDM_CREATEDRAGIMAGE (HDM_FIRST+16) +#define Header_CreateDragImage(hwnd,i) (HIMAGELIST)SNDMSG((hwnd),HDM_CREATEDRAGIMAGE,(WPARAM)(i),0) + +#define HDM_GETORDERARRAY (HDM_FIRST+17) +#define Header_GetOrderArray(hwnd,iCount,lpi) (WINBOOL)SNDMSG((hwnd),HDM_GETORDERARRAY,(WPARAM)(iCount),(LPARAM)(lpi)) + +#define HDM_SETORDERARRAY (HDM_FIRST+18) +#define Header_SetOrderArray(hwnd,iCount,lpi) (WINBOOL)SNDMSG((hwnd),HDM_SETORDERARRAY,(WPARAM)(iCount),(LPARAM)(lpi)) + +#define HDM_SETHOTDIVIDER (HDM_FIRST+19) +#define Header_SetHotDivider(hwnd,fPos,dw) (int)SNDMSG((hwnd),HDM_SETHOTDIVIDER,(WPARAM)(fPos),(LPARAM)(dw)) + +#define HDM_SETBITMAPMARGIN (HDM_FIRST+20) +#define Header_SetBitmapMargin(hwnd,iWidth) (int)SNDMSG((hwnd),HDM_SETBITMAPMARGIN,(WPARAM)(iWidth),0) + +#define HDM_GETBITMAPMARGIN (HDM_FIRST+21) +#define Header_GetBitmapMargin(hwnd) (int)SNDMSG((hwnd),HDM_GETBITMAPMARGIN,0,0) + +#define HDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define Header_SetUnicodeFormat(hwnd,fUnicode) (WINBOOL)SNDMSG((hwnd),HDM_SETUNICODEFORMAT,(WPARAM)(fUnicode),0) + +#define HDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define Header_GetUnicodeFormat(hwnd) (WINBOOL)SNDMSG((hwnd),HDM_GETUNICODEFORMAT,0,0) + +#define HDM_SETFILTERCHANGETIMEOUT (HDM_FIRST+22) +#define Header_SetFilterChangeTimeout(hwnd,i) (int)SNDMSG((hwnd),HDM_SETFILTERCHANGETIMEOUT,0,(LPARAM)(i)) + +#define HDM_EDITFILTER (HDM_FIRST+23) +#define Header_EditFilter(hwnd,i,fDiscardChanges) (int)SNDMSG((hwnd),HDM_EDITFILTER,(WPARAM)(i),MAKELPARAM(fDiscardChanges,0)) + +#define HDM_CLEARFILTER (HDM_FIRST+24) +#define Header_ClearFilter(hwnd,i) (int)SNDMSG((hwnd),HDM_CLEARFILTER,(WPARAM)(i),0) +#define Header_ClearAllFilters(hwnd) (int)SNDMSG((hwnd),HDM_CLEARFILTER,(WPARAM)-1,0) + +#define HDN_ITEMCHANGINGA (HDN_FIRST-0) +#define HDN_ITEMCHANGINGW (HDN_FIRST-20) +#define HDN_ITEMCHANGEDA (HDN_FIRST-1) +#define HDN_ITEMCHANGEDW (HDN_FIRST-21) +#define HDN_ITEMCLICKA (HDN_FIRST-2) +#define HDN_ITEMCLICKW (HDN_FIRST-22) +#define HDN_ITEMDBLCLICKA (HDN_FIRST-3) +#define HDN_ITEMDBLCLICKW (HDN_FIRST-23) +#define HDN_DIVIDERDBLCLICKA (HDN_FIRST-5) +#define HDN_DIVIDERDBLCLICKW (HDN_FIRST-25) +#define HDN_BEGINTRACKA (HDN_FIRST-6) +#define HDN_BEGINTRACKW (HDN_FIRST-26) +#define HDN_ENDTRACKA (HDN_FIRST-7) +#define HDN_ENDTRACKW (HDN_FIRST-27) +#define HDN_TRACKA (HDN_FIRST-8) +#define HDN_TRACKW (HDN_FIRST-28) +#define HDN_GETDISPINFOA (HDN_FIRST-9) +#define HDN_GETDISPINFOW (HDN_FIRST-29) +#define HDN_BEGINDRAG (HDN_FIRST-10) +#define HDN_ENDDRAG (HDN_FIRST-11) +#define HDN_FILTERCHANGE (HDN_FIRST-12) +#define HDN_FILTERBTNCLICK (HDN_FIRST-13) + +#ifdef UNICODE +#define HDN_ITEMCHANGING HDN_ITEMCHANGINGW +#define HDN_ITEMCHANGED HDN_ITEMCHANGEDW +#define HDN_ITEMCLICK HDN_ITEMCLICKW +#define HDN_ITEMDBLCLICK HDN_ITEMDBLCLICKW +#define HDN_DIVIDERDBLCLICK HDN_DIVIDERDBLCLICKW +#define HDN_BEGINTRACK HDN_BEGINTRACKW +#define HDN_ENDTRACK HDN_ENDTRACKW +#define HDN_TRACK HDN_TRACKW +#define HDN_GETDISPINFO HDN_GETDISPINFOW +#else +#define HDN_ITEMCHANGING HDN_ITEMCHANGINGA +#define HDN_ITEMCHANGED HDN_ITEMCHANGEDA +#define HDN_ITEMCLICK HDN_ITEMCLICKA +#define HDN_ITEMDBLCLICK HDN_ITEMDBLCLICKA +#define HDN_DIVIDERDBLCLICK HDN_DIVIDERDBLCLICKA +#define HDN_BEGINTRACK HDN_BEGINTRACKA +#define HDN_ENDTRACK HDN_ENDTRACKA +#define HDN_TRACK HDN_TRACKA +#define HDN_GETDISPINFO HDN_GETDISPINFOA +#endif + +#define HD_NOTIFYA NMHEADERA +#define HD_NOTIFYW NMHEADERW +#define HD_NOTIFY NMHEADER + + typedef struct tagNMHEADERA { + NMHDR hdr; + int iItem; + int iButton; HDITEMA *pitem; -} NMHEADERA, *LPNMHEADERA; + } NMHEADERA,*LPNMHEADERA; -typedef struct tagNMHEADERW -{ - NMHDR hdr; - INT iItem; - INT iButton; + typedef struct tagNMHEADERW { + NMHDR hdr; + int iItem; + int iButton; HDITEMW *pitem; -} NMHEADERW, *LPNMHEADERW; + } NMHEADERW,*LPNMHEADERW; -#define NMHEADER WINELIB_NAME_AW(NMHEADER) -#define LPNMHEADER WINELIB_NAME_AW(LPNMHEADER) -#define HD_NOTIFY NMHEADER +#ifdef UNICODE +#define NMHEADER NMHEADERW +#define LPNMHEADER LPNMHEADERW +#else +#define NMHEADER NMHEADERA +#define LPNMHEADER LPNMHEADERA +#endif -typedef struct tagNMHDDISPINFOA -{ - NMHDR hdr; - INT iItem; - UINT mask; - LPSTR pszText; - INT cchTextMax; - INT iImage; - LPARAM lParam; -} NMHDDISPINFOA, *LPNMHDDISPINFOA; + typedef struct tagNMHDDISPINFOW { + NMHDR hdr; + int iItem; + UINT mask; + LPWSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; + } NMHDDISPINFOW,*LPNMHDDISPINFOW; -typedef struct tagNMHDDISPINFOW -{ - NMHDR hdr; - INT iItem; - UINT mask; - LPWSTR pszText; - INT cchTextMax; - INT iImage; - LPARAM lParam; -} NMHDDISPINFOW, *LPNMHDDISPINFOW; + typedef struct tagNMHDDISPINFOA { + NMHDR hdr; + int iItem; + UINT mask; + LPSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; + } NMHDDISPINFOA,*LPNMHDDISPINFOA; -#define NMHDDISPINFO WINELIB_NAME_AW(NMHDDISPINFO) -#define LPNMHDDISPINFO WINELIB_NAME_AW(LPNMHDDISPINFO) +#ifdef UNICODE +#define NMHDDISPINFO NMHDDISPINFOW +#define LPNMHDDISPINFO LPNMHDDISPINFOW +#else +#define NMHDDISPINFO NMHDDISPINFOA +#define LPNMHDDISPINFO LPNMHDDISPINFOA +#endif -typedef struct tagNMHDFILTERBTNCLICK -{ + typedef struct tagNMHDFILTERBTNCLICK { NMHDR hdr; INT iItem; RECT rc; -} NMHDFILTERBTNCLICK, *LPNMHDFILTERBTNCLICK; + } NMHDFILTERBTNCLICK,*LPNMHDFILTERBTNCLICK; +#endif -#define Header_GetItemCount(hwndHD) \ - (INT)SNDMSG((hwndHD),HDM_GETITEMCOUNT,0,0L) -#define Header_InsertItemA(hwndHD,i,phdi) \ - (INT)SNDMSGA((hwndHD),HDM_INSERTITEMA,(WPARAM)(INT)(i),(LPARAM)(const HDITEMA*)(phdi)) -#define Header_InsertItemW(hwndHD,i,phdi) \ - (INT)SNDMSGW((hwndHD),HDM_INSERTITEMW,(WPARAM)(INT)(i),(LPARAM)(const HDITEMW*)(phdi)) -#define Header_InsertItem WINELIB_NAME_AW(Header_InsertItem) -#define Header_DeleteItem(hwndHD,i) \ - (BOOL)SNDMSG((hwndHD),HDM_DELETEITEM,(WPARAM)(INT)(i),0L) -#define Header_GetItemA(hwndHD,i,phdi) \ - (BOOL)SNDMSGA((hwndHD),HDM_GETITEMA,(WPARAM)(INT)(i),(LPARAM)(HDITEMA*)(phdi)) -#define Header_GetItemW(hwndHD,i,phdi) \ - (BOOL)SNDMSGW((hwndHD),HDM_GETITEMW,(WPARAM)(INT)(i),(LPARAM)(HDITEMW*)(phdi)) -#define Header_GetItem WINELIB_NAME_AW(Header_GetItem) -#define Header_SetItemA(hwndHD,i,phdi) \ - (BOOL)SNDMSGA((hwndHD),HDM_SETITEMA,(WPARAM)(INT)(i),(LPARAM)(const HDITEMA*)(phdi)) -#define Header_SetItemW(hwndHD,i,phdi) \ - (BOOL)SNDMSGW((hwndHD),HDM_SETITEMW,(WPARAM)(INT)(i),(LPARAM)(const HDITEMW*)(phdi)) -#define Header_SetItem WINELIB_NAME_AW(Header_SetItem) -#define Header_Layout(hwndHD,playout) \ - (BOOL)SNDMSG((hwndHD),HDM_LAYOUT,0,(LPARAM)(LPHDLAYOUT)(playout)) -#define Header_GetItemRect(hwnd,iItem,lprc) \ - (BOOL)SNDMSG((hwnd),HDM_GETITEMRECT,(WPARAM)iItem,(LPARAM)lprc) -#define Header_SetImageList(hwnd,himl) \ - (HIMAGELIST)SNDMSG((hwnd),HDM_SETIMAGELIST,0,(LPARAM)himl) -#define Header_GetImageList(hwnd) \ - (HIMAGELIST)SNDMSG((hwnd),HDM_GETIMAGELIST,0,0) -#define Header_OrderToIndex(hwnd,i) \ - (INT)SNDMSG((hwnd),HDM_ORDERTOINDEX,(WPARAM)i,0) -#define Header_CreateDragImage(hwnd,i) \ - (HIMAGELIST)SNDMSG((hwnd),HDM_CREATEDRAGIMAGE,(WPARAM)i,0) -#define Header_GetOrderArray(hwnd,iCount,lpi) \ - (BOOL)SNDMSG((hwnd),HDM_GETORDERARRAY,(WPARAM)iCount,(LPARAM)lpi) -#define Header_SetOrderArray(hwnd,iCount,lpi) \ - (BOOL)SNDMSG((hwnd),HDM_SETORDERARRAY,(WPARAM)iCount,(LPARAM)lpi) -#define Header_SetHotDivider(hwnd,fPos,dw) \ - (INT)SNDMSG((hwnd),HDM_SETHOTDIVIDER,(WPARAM)fPos,(LPARAM)dw) -#define Header_SetUnicodeFormat(hwnd,fUnicode) \ - (BOOL)SNDMSG((hwnd),HDM_SETUNICODEFORMAT,(WPARAM)(fUnicode),0) -#define Header_GetUnicodeFormat(hwnd) \ - (BOOL)SNDMSG((hwnd),HDM_GETUNICODEFORMAT,0,0) +#ifndef NOTOOLBAR -/* Win32 5.1 Button Theme */ -#define WC_BUTTONA "Button" -# define WC_BUTTONW L"Button" -#define WC_BUTTON WINELIB_NAME_AW(WC_BUTTON) +#define TOOLBARCLASSNAMEW L"ToolbarWindow32" +#define TOOLBARCLASSNAMEA "ToolbarWindow32" -#define BCN_FIRST (0U-1250U) -#define BCN_LAST (0U-1350U) +#ifdef UNICODE +#define TOOLBARCLASSNAME TOOLBARCLASSNAMEW +#else +#define TOOLBARCLASSNAME TOOLBARCLASSNAMEA +#endif -#define BCN_HOTITEMCHANGE (BCN_FIRST + 0x0001) + typedef struct _TBBUTTON { + int iBitmap; + int idCommand; + BYTE fsState; + BYTE fsStyle; +#ifdef _WIN64 + BYTE bReserved[6]; +#else + BYTE bReserved[2]; +#endif + DWORD_PTR dwData; + INT_PTR iString; + } TBBUTTON,NEAR *PTBBUTTON,*LPTBBUTTON; + typedef const TBBUTTON *LPCTBBUTTON; -typedef struct tagNMBCHOTITEM -{ - NMHDR hdr; - DWORD dwFlags; -} NMBCHOTITEM, *LPNMBCHOTITEM; + typedef struct _COLORMAP { + COLORREF from; + COLORREF to; + } COLORMAP,*LPCOLORMAP; -#define BST_HOT 0x0200 + WINCOMMCTRLAPI HWND WINAPI CreateToolbarEx(HWND hwnd,DWORD ws,UINT wID,int nBitmaps,HINSTANCE hBMInst,UINT_PTR wBMID,LPCTBBUTTON lpButtons,int iNumButtons,int dxButton,int dyButton,int dxBitmap,int dyBitmap,UINT uStructSize); + WINCOMMCTRLAPI HBITMAP WINAPI CreateMappedBitmap(HINSTANCE hInstance,INT_PTR idBitmap,UINT wFlags,LPCOLORMAP lpColorMap,int iNumMaps); -/* Toolbar */ +#define CMB_MASKED 0x2 +#define TBSTATE_CHECKED 0x1 +#define TBSTATE_PRESSED 0x2 +#define TBSTATE_ENABLED 0x4 +#define TBSTATE_HIDDEN 0x8 +#define TBSTATE_INDETERMINATE 0x10 +#define TBSTATE_WRAP 0x20 +#define TBSTATE_ELLIPSES 0x40 +#define TBSTATE_MARKED 0x80 -#define TOOLBARCLASSNAMEA "ToolbarWindow32" -# define TOOLBARCLASSNAMEW L"ToolbarWindow32" +#define TBSTYLE_BUTTON 0x0 +#define TBSTYLE_SEP 0x1 +#define TBSTYLE_CHECK 0x2 +#define TBSTYLE_GROUP 0x4 +#define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) +#define TBSTYLE_DROPDOWN 0x8 +#define TBSTYLE_AUTOSIZE 0x10 +#define TBSTYLE_NOPREFIX 0x20 +#define TBSTYLE_TOOLTIPS 0x100 +#define TBSTYLE_WRAPABLE 0x200 +#define TBSTYLE_ALTDRAG 0x400 +#define TBSTYLE_FLAT 0x800 +#define TBSTYLE_LIST 0x1000 +#define TBSTYLE_CUSTOMERASE 0x2000 +#define TBSTYLE_REGISTERDROP 0x4000 +#define TBSTYLE_TRANSPARENT 0x8000 +#define TBSTYLE_EX_DRAWDDARROWS 0x1 -#define TOOLBARCLASSNAME WINELIB_NAME_AW(TOOLBARCLASSNAME) +#define BTNS_BUTTON TBSTYLE_BUTTON +#define BTNS_SEP TBSTYLE_SEP +#define BTNS_CHECK TBSTYLE_CHECK +#define BTNS_GROUP TBSTYLE_GROUP +#define BTNS_CHECKGROUP TBSTYLE_CHECKGROUP +#define BTNS_DROPDOWN TBSTYLE_DROPDOWN +#define BTNS_AUTOSIZE TBSTYLE_AUTOSIZE +#define BTNS_NOPREFIX TBSTYLE_NOPREFIX +#define BTNS_SHOWTEXT 0x40 +#define BTNS_WHOLEDROPDOWN 0x80 -#define CMB_MASKED 0x02 +#define TBSTYLE_EX_MIXEDBUTTONS 0x8 +#define TBSTYLE_EX_HIDECLIPPEDBUTTONS 0x10 +#define TBSTYLE_EX_DOUBLEBUFFER 0x80 -#define TBSTATE_CHECKED 0x01 -#define TBSTATE_PRESSED 0x02 -#define TBSTATE_ENABLED 0x04 -#define TBSTATE_HIDDEN 0x08 -#define TBSTATE_INDETERMINATE 0x10 -#define TBSTATE_WRAP 0x20 -#define TBSTATE_ELLIPSES 0x40 -#define TBSTATE_MARKED 0x80 - - -/* as of _WIN32_IE >= 0x0500 the following symbols are obsolete, - * "everyone" should use the BTNS_... stuff below - */ -#define TBSTYLE_BUTTON 0x00 -#define TBSTYLE_SEP 0x01 -#define TBSTYLE_CHECK 0x02 -#define TBSTYLE_GROUP 0x04 -#define TBSTYLE_CHECKGROUP (TBSTYLE_GROUP | TBSTYLE_CHECK) -#define TBSTYLE_DROPDOWN 0x08 -#define TBSTYLE_AUTOSIZE 0x10 -#define TBSTYLE_NOPREFIX 0x20 -#define BTNS_BUTTON TBSTYLE_BUTTON -#define BTNS_SEP TBSTYLE_SEP -#define BTNS_CHECK TBSTYLE_CHECK -#define BTNS_GROUP TBSTYLE_GROUP -#define BTNS_CHECKGROUP TBSTYLE_CHECKGROUP -#define BTNS_DROPDOWN TBSTYLE_DROPDOWN -#define BTNS_AUTOSIZE TBSTYLE_AUTOSIZE -#define BTNS_NOPREFIX TBSTYLE_NOPREFIX -#define BTNS_SHOWTEXT 0x40 /* ignored unless TBSTYLE_EX_MIXEDB set */ -#define BTNS_WHOLEDROPDOWN 0x80 /* draw dropdown arrow, but without split arrow section */ - -#define TBSTYLE_TOOLTIPS 0x0100 -#define TBSTYLE_WRAPABLE 0x0200 -#define TBSTYLE_ALTDRAG 0x0400 -#define TBSTYLE_FLAT 0x0800 -#define TBSTYLE_LIST 0x1000 -#define TBSTYLE_CUSTOMERASE 0x2000 -#define TBSTYLE_REGISTERDROP 0x4000 -#define TBSTYLE_TRANSPARENT 0x8000 -#define TBSTYLE_EX_DRAWDDARROWS 0x00000001 -#define TBSTYLE_EX_UNDOC1 0x00000004 /* similar to TBSTYLE_WRAPABLE */ -#define TBSTYLE_EX_MIXEDBUTTONS 0x00000008 -#define TBSTYLE_EX_HIDECLIPPEDBUTTONS 0x00000010 /* don't show partially obscured buttons */ -#define TBSTYLE_EX_DOUBLEBUFFER 0x00000080 /* Double Buffer the toolbar */ - -#define TBIF_IMAGE 0x00000001 -#define TBIF_TEXT 0x00000002 -#define TBIF_STATE 0x00000004 -#define TBIF_STYLE 0x00000008 -#define TBIF_LPARAM 0x00000010 -#define TBIF_COMMAND 0x00000020 -#define TBIF_SIZE 0x00000040 -#define TBIF_BYINDEX 0x80000000 - -#define TBBF_LARGE 0x0001 - -#define TB_ENABLEBUTTON (WM_USER+1) -#define TB_CHECKBUTTON (WM_USER+2) -#define TB_PRESSBUTTON (WM_USER+3) -#define TB_HIDEBUTTON (WM_USER+4) -#define TB_INDETERMINATE (WM_USER+5) -#define TB_MARKBUTTON (WM_USER+6) -#define TB_ISBUTTONENABLED (WM_USER+9) -#define TB_ISBUTTONCHECKED (WM_USER+10) -#define TB_ISBUTTONPRESSED (WM_USER+11) -#define TB_ISBUTTONHIDDEN (WM_USER+12) -#define TB_ISBUTTONINDETERMINATE (WM_USER+13) -#define TB_ISBUTTONHIGHLIGHTED (WM_USER+14) -#define TB_SETSTATE (WM_USER+17) -#define TB_GETSTATE (WM_USER+18) -#define TB_ADDBITMAP (WM_USER+19) -#define TB_ADDBUTTONSA (WM_USER+20) -#define TB_ADDBUTTONSW (WM_USER+68) -#define TB_ADDBUTTONS WINELIB_NAME_AW(TB_ADDBUTTONS) -#define TB_HITTEST (WM_USER+69) -#define TB_INSERTBUTTONA (WM_USER+21) -#define TB_INSERTBUTTONW (WM_USER+67) -#define TB_INSERTBUTTON WINELIB_NAME_AW(TB_INSERTBUTTON) -#define TB_DELETEBUTTON (WM_USER+22) -#define TB_GETBUTTON (WM_USER+23) -#define TB_BUTTONCOUNT (WM_USER+24) -#define TB_COMMANDTOINDEX (WM_USER+25) -#define TB_SAVERESTOREA (WM_USER+26) -#define TB_SAVERESTOREW (WM_USER+76) -#define TB_SAVERESTORE WINELIB_NAME_AW(TB_SAVERESTORE) -#define TB_CUSTOMIZE (WM_USER+27) -#define TB_ADDSTRINGA (WM_USER+28) -#define TB_ADDSTRINGW (WM_USER+77) -#define TB_ADDSTRING WINELIB_NAME_AW(TB_ADDSTRING) -#define TB_GETITEMRECT (WM_USER+29) -#define TB_BUTTONSTRUCTSIZE (WM_USER+30) -#define TB_SETBUTTONSIZE (WM_USER+31) -#define TB_SETBITMAPSIZE (WM_USER+32) -#define TB_AUTOSIZE (WM_USER+33) -#define TB_GETTOOLTIPS (WM_USER+35) -#define TB_SETTOOLTIPS (WM_USER+36) -#define TB_SETPARENT (WM_USER+37) -#define TB_SETROWS (WM_USER+39) -#define TB_GETROWS (WM_USER+40) -#define TB_GETBITMAPFLAGS (WM_USER+41) -#define TB_SETCMDID (WM_USER+42) -#define TB_CHANGEBITMAP (WM_USER+43) -#define TB_GETBITMAP (WM_USER+44) -#define TB_GETBUTTONTEXTA (WM_USER+45) -#define TB_GETBUTTONTEXTW (WM_USER+75) -#define TB_GETBUTTONTEXT WINELIB_NAME_AW(TB_GETBUTTONTEXT) -#define TB_REPLACEBITMAP (WM_USER+46) -#define TB_SETINDENT (WM_USER+47) -#define TB_SETIMAGELIST (WM_USER+48) -#define TB_GETIMAGELIST (WM_USER+49) -#define TB_LOADIMAGES (WM_USER+50) -#define TB_GETRECT (WM_USER+51) /* wParam is the Cmd instead of index */ -#define TB_SETHOTIMAGELIST (WM_USER+52) -#define TB_GETHOTIMAGELIST (WM_USER+53) -#define TB_SETDISABLEDIMAGELIST (WM_USER+54) -#define TB_GETDISABLEDIMAGELIST (WM_USER+55) -#define TB_SETSTYLE (WM_USER+56) -#define TB_GETSTYLE (WM_USER+57) -#define TB_GETBUTTONSIZE (WM_USER+58) -#define TB_SETBUTTONWIDTH (WM_USER+59) -#define TB_SETMAXTEXTROWS (WM_USER+60) -#define TB_GETTEXTROWS (WM_USER+61) -#define TB_GETOBJECT (WM_USER+62) -#define TB_GETBUTTONINFOW (WM_USER+63) -#define TB_GETBUTTONINFOA (WM_USER+65) -#define TB_GETBUTTONINFO WINELIB_NAME_AW(TB_GETBUTTONINFO) -#define TB_SETBUTTONINFOW (WM_USER+64) -#define TB_SETBUTTONINFOA (WM_USER+66) -#define TB_SETBUTTONINFO WINELIB_NAME_AW(TB_SETBUTTONINFO) -#define TB_SETDRAWTEXTFLAGS (WM_USER+70) -#define TB_GETHOTITEM (WM_USER+71) -#define TB_SETHOTITEM (WM_USER+72) -#define TB_SETANCHORHIGHLIGHT (WM_USER+73) -#define TB_GETANCHORHIGHLIGHT (WM_USER+74) -#define TB_MAPACCELERATORA (WM_USER+78) -#define TB_MAPACCELERATORW (WM_USER+90) -#define TB_MAPACCELERATOR WINELIB_NAME_AW(TB_MAPACCELERATOR) -#define TB_GETINSERTMARK (WM_USER+79) -#define TB_SETINSERTMARK (WM_USER+80) -#define TB_INSERTMARKHITTEST (WM_USER+81) -#define TB_MOVEBUTTON (WM_USER+82) -#define TB_GETMAXSIZE (WM_USER+83) -#define TB_SETEXTENDEDSTYLE (WM_USER+84) -#define TB_GETEXTENDEDSTYLE (WM_USER+85) -#define TB_GETPADDING (WM_USER+86) -#define TB_SETPADDING (WM_USER+87) -#define TB_SETINSERTMARKCOLOR (WM_USER+88) -#define TB_GETINSERTMARKCOLOR (WM_USER+89) -#define TB_SETCOLORSCHEME CCM_SETCOLORSCHEME -#define TB_GETCOLORSCHEME CCM_GETCOLORSCHEME -#define TB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define TB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define TB_GETSTRINGW (WM_USER+91) -#define TB_GETSTRINGA (WM_USER+92) -#define TB_GETSTRING WINELIB_NAME_AW(TB_GETSTRING) - -/* undocumented messages in Toolbar */ -/* #ifdef __WINESRC__ */ -#define TB_UNKWN45D (WM_USER+93) -#define TB_SETHOTITEM2 (WM_USER+94) -#define TB_SETLISTGAP (WM_USER+96) -#define TB_GETIMAGELISTCOUNT (WM_USER+98) -#define TB_GETIDEALSIZE (WM_USER+99) -#define TB_UNKWN464 (WM_USER+100) -/* #endif */ - -#define TB_GETMETRICS (WM_USER+101) -#define TB_SETMETRICS (WM_USER+102) -#define TB_SETWINDOWTHEME CCM_SETWINDOWTHEME - -#define TBN_FIRST (0U-700U) -#define TBN_LAST (0U-720U) -#define TBN_GETBUTTONINFOA (TBN_FIRST-0) -#define TBN_GETBUTTONINFOW (TBN_FIRST-20) -#define TBN_GETBUTTONINFO WINELIB_NAME_AW(TBN_GETBUTTONINFO) -#define TBN_BEGINDRAG (TBN_FIRST-1) -#define TBN_ENDDRAG (TBN_FIRST-2) -#define TBN_BEGINADJUST (TBN_FIRST-3) -#define TBN_ENDADJUST (TBN_FIRST-4) -#define TBN_RESET (TBN_FIRST-5) -#define TBN_QUERYINSERT (TBN_FIRST-6) -#define TBN_QUERYDELETE (TBN_FIRST-7) -#define TBN_TOOLBARCHANGE (TBN_FIRST-8) -#define TBN_CUSTHELP (TBN_FIRST-9) -#define TBN_DROPDOWN (TBN_FIRST-10) -#define TBN_GETOBJECT (TBN_FIRST-12) -#define TBN_HOTITEMCHANGE (TBN_FIRST-13) -#define TBN_DRAGOUT (TBN_FIRST-14) -#define TBN_DELETINGBUTTON (TBN_FIRST-15) -#define TBN_GETDISPINFOA (TBN_FIRST-16) -#define TBN_GETDISPINFOW (TBN_FIRST-17) -#define TBN_GETDISPINFO WINELIB_NAME_AW(TBN_GETDISPINFO) -#define TBN_GETINFOTIPA (TBN_FIRST-18) -#define TBN_GETINFOTIPW (TBN_FIRST-19) -#define TBN_GETINFOTIP WINELIB_NAME_AW(TBN_GETINFOTIP) -#define TBN_RESTORE (TBN_FIRST-21) -#define TBN_SAVE (TBN_FIRST-22) -#define TBN_INITCUSTOMIZE (TBN_FIRST-23) -#define TBN_WRAPHOTITEM (TBN_FIRST-24) /* this is undocumented and the name is a guess */ -#define TBNRF_HIDEHELP 0x00000001 - - -/* Return values from TBN_DROPDOWN */ -#define TBDDRET_DEFAULT 0 -#define TBDDRET_NODEFAULT 1 -#define TBDDRET_TREATPRESSED 2 - -typedef struct _NMTBCUSTOMDRAW -{ + typedef struct _NMTBCUSTOMDRAW { NMCUSTOMDRAW nmcd; HBRUSH hbrMonoDither; HBRUSH hbrLines; @@ -1263,183 +861,409 @@ typedef struct _NMTBCUSTOMDRAW int nStringBkMode; int nHLStringBkMode; int iListGap; -} NMTBCUSTOMDRAW, *LPNMTBCUSTOMDRAW; + } NMTBCUSTOMDRAW,*LPNMTBCUSTOMDRAW; -/* return flags for Toolbar NM_CUSTOMDRAW notifications */ -#define TBCDRF_NOEDGES 0x00010000 /* Don't draw button edges */ -#define TBCDRF_HILITEHOTTRACK 0x00020000 /* Use color of the button bkgnd */ - /* when hottracked */ -#define TBCDRF_NOOFFSET 0x00040000 /* No offset button if pressed */ -#define TBCDRF_NOMARK 0x00080000 /* Don't draw default highlight */ - /* for TBSTATE_MARKED */ -#define TBCDRF_NOETCHEDEFFECT 0x00100000 /* No etched effect for */ - /* disabled items */ -#define TBCDRF_BLENDICON 0x00200000 /* ILD_BLEND50 on the icon image */ -#define TBCDRF_NOBACKGROUND 0x00400000 /* ILD_BLEND50 on the icon image */ -#define TBCDRF_USECDCOLORS 0x00800000 +#define TBCDRF_NOEDGES 0x10000 +#define TBCDRF_HILITEHOTTRACK 0x20000 +#define TBCDRF_NOOFFSET 0x40000 +#define TBCDRF_NOMARK 0x80000 +#define TBCDRF_NOETCHEDEFFECT 0x100000 +#define TBCDRF_BLENDICON 0x200000 +#define TBCDRF_NOBACKGROUND 0x400000 -/* This is just for old CreateToolbar. */ -/* Don't use it in new programs. */ -typedef struct _OLDTBBUTTON { - INT iBitmap; - INT idCommand; - BYTE fsState; - BYTE fsStyle; - BYTE bReserved[2]; - DWORD dwData; -} OLDTBBUTTON, *POLDTBBUTTON, *LPOLDTBBUTTON; -typedef const OLDTBBUTTON *LPCOLDTBBUTTON; +#define TB_ENABLEBUTTON (WM_USER+1) +#define TB_CHECKBUTTON (WM_USER+2) +#define TB_PRESSBUTTON (WM_USER+3) +#define TB_HIDEBUTTON (WM_USER+4) +#define TB_INDETERMINATE (WM_USER+5) +#define TB_MARKBUTTON (WM_USER+6) +#define TB_ISBUTTONENABLED (WM_USER+9) +#define TB_ISBUTTONCHECKED (WM_USER+10) +#define TB_ISBUTTONPRESSED (WM_USER+11) +#define TB_ISBUTTONHIDDEN (WM_USER+12) +#define TB_ISBUTTONINDETERMINATE (WM_USER+13) +#define TB_ISBUTTONHIGHLIGHTED (WM_USER+14) +#define TB_SETSTATE (WM_USER+17) +#define TB_GETSTATE (WM_USER+18) +#define TB_ADDBITMAP (WM_USER+19) - -typedef struct _TBBUTTON { - INT iBitmap; - INT idCommand; - BYTE fsState; - BYTE fsStyle; -#ifdef _WIN64 - BYTE bReserved[6]; -#else - BYTE bReserved[2]; -#endif - DWORD_PTR dwData; - INT_PTR iString; -} TBBUTTON, *PTBBUTTON, *LPTBBUTTON; -typedef const TBBUTTON *LPCTBBUTTON; - - -typedef struct _COLORMAP { - COLORREF from; - COLORREF to; -} COLORMAP, *LPCOLORMAP; - - -typedef struct tagTBADDBITMAP { + typedef struct tagTBADDBITMAP { HINSTANCE hInst; - UINT_PTR nID; -} TBADDBITMAP, *LPTBADDBITMAP; + UINT_PTR nID; + } TBADDBITMAP,*LPTBADDBITMAP; -#define HINST_COMMCTRL ((HINSTANCE)-1) -#define IDB_STD_SMALL_COLOR 0 -#define IDB_STD_LARGE_COLOR 1 -#define IDB_VIEW_SMALL_COLOR 4 -#define IDB_VIEW_LARGE_COLOR 5 -#define IDB_HIST_SMALL_COLOR 8 -#define IDB_HIST_LARGE_COLOR 9 +#define HINST_COMMCTRL ((HINSTANCE)-1) +#define IDB_STD_SMALL_COLOR 0 +#define IDB_STD_LARGE_COLOR 1 +#define IDB_VIEW_SMALL_COLOR 4 +#define IDB_VIEW_LARGE_COLOR 5 +#define IDB_HIST_SMALL_COLOR 8 +#define IDB_HIST_LARGE_COLOR 9 -#define STD_CUT 0 -#define STD_COPY 1 -#define STD_PASTE 2 -#define STD_UNDO 3 -#define STD_REDOW 4 -#define STD_DELETE 5 -#define STD_FILENEW 6 -#define STD_FILEOPEN 7 -#define STD_FILESAVE 8 -#define STD_PRINTPRE 9 -#define STD_PROPERTIES 10 -#define STD_HELP 11 -#define STD_FIND 12 -#define STD_REPLACE 13 -#define STD_PRINT 14 +#define STD_CUT 0 +#define STD_COPY 1 +#define STD_PASTE 2 +#define STD_UNDO 3 +#define STD_REDOW 4 +#define STD_DELETE 5 +#define STD_FILENEW 6 +#define STD_FILEOPEN 7 +#define STD_FILESAVE 8 +#define STD_PRINTPRE 9 +#define STD_PROPERTIES 10 +#define STD_HELP 11 +#define STD_FIND 12 +#define STD_REPLACE 13 +#define STD_PRINT 14 -#define VIEW_LARGEICONS 0 -#define VIEW_SMALLICONS 1 -#define VIEW_LIST 2 -#define VIEW_DETAILS 3 -#define VIEW_SORTNAME 4 -#define VIEW_SORTSIZE 5 -#define VIEW_SORTDATE 6 -#define VIEW_SORTTYPE 7 -#define VIEW_PARENTFOLDER 8 -#define VIEW_NETCONNECT 9 -#define VIEW_NETDISCONNECT 10 -#define VIEW_NEWFOLDER 11 -#define VIEW_VIEWMENU 12 +#define VIEW_LARGEICONS 0 +#define VIEW_SMALLICONS 1 +#define VIEW_LIST 2 +#define VIEW_DETAILS 3 +#define VIEW_SORTNAME 4 +#define VIEW_SORTSIZE 5 +#define VIEW_SORTDATE 6 +#define VIEW_SORTTYPE 7 +#define VIEW_PARENTFOLDER 8 +#define VIEW_NETCONNECT 9 +#define VIEW_NETDISCONNECT 10 +#define VIEW_NEWFOLDER 11 +#define VIEW_VIEWMENU 12 +#define HIST_BACK 0 +#define HIST_FORWARD 1 +#define HIST_FAVORITES 2 +#define HIST_ADDTOFAVORITES 3 +#define HIST_VIEWTREE 4 -#define HIST_BACK 0 -#define HIST_FORWARD 1 -#define HIST_FAVORITES 2 -#define HIST_ADDTOFAVORITES 3 -#define HIST_VIEWTREE 4 +#define TB_ADDBUTTONSA (WM_USER+20) +#define TB_INSERTBUTTONA (WM_USER+21) +#define TB_DELETEBUTTON (WM_USER+22) +#define TB_GETBUTTON (WM_USER+23) +#define TB_BUTTONCOUNT (WM_USER+24) +#define TB_COMMANDTOINDEX (WM_USER+25) -typedef struct tagTBSAVEPARAMSA { - HKEY hkr; + typedef struct tagTBSAVEPARAMSA { + HKEY hkr; LPCSTR pszSubKey; LPCSTR pszValueName; -} TBSAVEPARAMSA, *LPTBSAVEPARAMSA; + } TBSAVEPARAMSA,*LPTBSAVEPARAMSA; -typedef struct tagTBSAVEPARAMSW { - HKEY hkr; + typedef struct tagTBSAVEPARAMSW { + HKEY hkr; LPCWSTR pszSubKey; LPCWSTR pszValueName; -} TBSAVEPARAMSW, *LPTBSAVEPARAMSW; + } TBSAVEPARAMSW,*LPTBSAVEPARAMW; -#define TBSAVEPARAMS WINELIB_NAME_AW(TBSAVEPARAMS) -#define LPTBSAVEPARAMS WINELIB_NAME_AW(LPTBSAVEPARAMS) +#ifdef UNICODE +#define TBSAVEPARAMS TBSAVEPARAMSW +#define LPTBSAVEPARAMS LPTBSAVEPARAMSW +#else +#define TBSAVEPARAMS TBSAVEPARAMSA +#define LPTBSAVEPARAMS LPTBSAVEPARAMSA +#endif -typedef struct -{ +#define TB_SAVERESTOREA (WM_USER+26) +#define TB_SAVERESTOREW (WM_USER+76) +#define TB_CUSTOMIZE (WM_USER+27) +#define TB_ADDSTRINGA (WM_USER+28) +#define TB_ADDSTRINGW (WM_USER+77) +#define TB_GETITEMRECT (WM_USER+29) +#define TB_BUTTONSTRUCTSIZE (WM_USER+30) +#define TB_SETBUTTONSIZE (WM_USER+31) +#define TB_SETBITMAPSIZE (WM_USER+32) +#define TB_AUTOSIZE (WM_USER+33) +#define TB_GETTOOLTIPS (WM_USER+35) +#define TB_SETTOOLTIPS (WM_USER+36) +#define TB_SETPARENT (WM_USER+37) +#define TB_SETROWS (WM_USER+39) +#define TB_GETROWS (WM_USER+40) +#define TB_SETCMDID (WM_USER+42) +#define TB_CHANGEBITMAP (WM_USER+43) +#define TB_GETBITMAP (WM_USER+44) +#define TB_GETBUTTONTEXTA (WM_USER+45) +#define TB_GETBUTTONTEXTW (WM_USER+75) +#define TB_REPLACEBITMAP (WM_USER+46) +#define TB_SETINDENT (WM_USER+47) +#define TB_SETIMAGELIST (WM_USER+48) +#define TB_GETIMAGELIST (WM_USER+49) +#define TB_LOADIMAGES (WM_USER+50) +#define TB_GETRECT (WM_USER+51) +#define TB_SETHOTIMAGELIST (WM_USER+52) +#define TB_GETHOTIMAGELIST (WM_USER+53) +#define TB_SETDISABLEDIMAGELIST (WM_USER+54) +#define TB_GETDISABLEDIMAGELIST (WM_USER+55) +#define TB_SETSTYLE (WM_USER+56) +#define TB_GETSTYLE (WM_USER+57) +#define TB_GETBUTTONSIZE (WM_USER+58) +#define TB_SETBUTTONWIDTH (WM_USER+59) +#define TB_SETMAXTEXTROWS (WM_USER+60) +#define TB_GETTEXTROWS (WM_USER+61) + +#ifdef UNICODE +#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTW +#define TB_SAVERESTORE TB_SAVERESTOREW +#define TB_ADDSTRING TB_ADDSTRINGW +#else +#define TB_GETBUTTONTEXT TB_GETBUTTONTEXTA +#define TB_SAVERESTORE TB_SAVERESTOREA +#define TB_ADDSTRING TB_ADDSTRINGA +#endif +#define TB_GETOBJECT (WM_USER+62) +#define TB_GETHOTITEM (WM_USER+71) +#define TB_SETHOTITEM (WM_USER+72) +#define TB_SETANCHORHIGHLIGHT (WM_USER+73) +#define TB_GETANCHORHIGHLIGHT (WM_USER+74) +#define TB_MAPACCELERATORA (WM_USER+78) + + typedef struct { + int iButton; + DWORD dwFlags; + } TBINSERTMARK,*LPTBINSERTMARK; +#define TBIMHT_AFTER 0x1 +#define TBIMHT_BACKGROUND 0x2 + +#define TB_GETINSERTMARK (WM_USER+79) +#define TB_SETINSERTMARK (WM_USER+80) +#define TB_INSERTMARKHITTEST (WM_USER+81) +#define TB_MOVEBUTTON (WM_USER+82) +#define TB_GETMAXSIZE (WM_USER+83) +#define TB_SETEXTENDEDSTYLE (WM_USER+84) +#define TB_GETEXTENDEDSTYLE (WM_USER+85) +#define TB_GETPADDING (WM_USER+86) +#define TB_SETPADDING (WM_USER+87) +#define TB_SETINSERTMARKCOLOR (WM_USER+88) +#define TB_GETINSERTMARKCOLOR (WM_USER+89) + +#define TB_SETCOLORSCHEME CCM_SETCOLORSCHEME +#define TB_GETCOLORSCHEME CCM_GETCOLORSCHEME + +#define TB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define TB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT + +#define TB_MAPACCELERATORW (WM_USER+90) +#ifdef UNICODE +#define TB_MAPACCELERATOR TB_MAPACCELERATORW +#else +#define TB_MAPACCELERATOR TB_MAPACCELERATORA +#endif + + typedef struct { + HINSTANCE hInstOld; + UINT_PTR nIDOld; + HINSTANCE hInstNew; + UINT_PTR nIDNew; + int nButtons; + } TBREPLACEBITMAP,*LPTBREPLACEBITMAP; + +#define TBBF_LARGE 0x1 + +#define TB_GETBITMAPFLAGS (WM_USER+41) + +#define TBIF_IMAGE 0x1 +#define TBIF_TEXT 0x2 +#define TBIF_STATE 0x4 +#define TBIF_STYLE 0x8 +#define TBIF_LPARAM 0x10 +#define TBIF_COMMAND 0x20 +#define TBIF_SIZE 0x40 +#define TBIF_BYINDEX 0x80000000 + + typedef struct { UINT cbSize; - DWORD dwMask; - INT idCommand; - INT iImage; - BYTE fsState; - BYTE fsStyle; - WORD cx; + DWORD dwMask; + int idCommand; + int iImage; + BYTE fsState; + BYTE fsStyle; + WORD cx; DWORD_PTR lParam; - LPSTR pszText; - INT cchText; -} TBBUTTONINFOA, *LPTBBUTTONINFOA; + LPSTR pszText; + int cchText; + } TBBUTTONINFOA,*LPTBBUTTONINFOA; -typedef struct -{ + typedef struct { UINT cbSize; - DWORD dwMask; - INT idCommand; - INT iImage; - BYTE fsState; - BYTE fsStyle; - WORD cx; + DWORD dwMask; + int idCommand; + int iImage; + BYTE fsState; + BYTE fsStyle; + WORD cx; DWORD_PTR lParam; LPWSTR pszText; - INT cchText; -} TBBUTTONINFOW, *LPTBBUTTONINFOW; + int cchText; + } TBBUTTONINFOW,*LPTBBUTTONINFOW; -#define TBBUTTONINFO WINELIB_NAME_AW(TBBUTTONINFO) -#define LPTBBUTTONINFO WINELIB_NAME_AW(LPTBBUTTONINFO) +#ifdef UNICODE +#define TBBUTTONINFO TBBUTTONINFOW +#define LPTBBUTTONINFO LPTBBUTTONINFOW +#else +#define TBBUTTONINFO TBBUTTONINFOA +#define LPTBBUTTONINFO LPTBBUTTONINFOA +#endif -typedef struct tagNMTBHOTITEM -{ +#define TB_GETBUTTONINFOW (WM_USER+63) +#define TB_SETBUTTONINFOW (WM_USER+64) +#define TB_GETBUTTONINFOA (WM_USER+65) +#define TB_SETBUTTONINFOA (WM_USER+66) +#ifdef UNICODE +#define TB_GETBUTTONINFO TB_GETBUTTONINFOW +#define TB_SETBUTTONINFO TB_SETBUTTONINFOW +#else +#define TB_GETBUTTONINFO TB_GETBUTTONINFOA +#define TB_SETBUTTONINFO TB_SETBUTTONINFOA +#endif + +#define TB_INSERTBUTTONW (WM_USER+67) +#define TB_ADDBUTTONSW (WM_USER+68) + +#define TB_HITTEST (WM_USER+69) + +#ifdef UNICODE +#define TB_INSERTBUTTON TB_INSERTBUTTONW +#define TB_ADDBUTTONS TB_ADDBUTTONSW +#else +#define TB_INSERTBUTTON TB_INSERTBUTTONA +#define TB_ADDBUTTONS TB_ADDBUTTONSA +#endif + +#define TB_SETDRAWTEXTFLAGS (WM_USER+70) + +#define TB_GETSTRINGW (WM_USER+91) +#define TB_GETSTRINGA (WM_USER+92) +#ifdef UNICODE +#define TB_GETSTRING TB_GETSTRINGW +#else +#define TB_GETSTRING TB_GETSTRINGA +#endif + +#define TB_SETHOTITEM2 (WM_USER+94) +#define TB_SETLISTGAP (WM_USER+96) +#define TB_GETIMAGELISTCOUNT (WM_USER+98) +#define TB_GETIDEALSIZE (WM_USER+99) +#define TB_TRANSLATEACCELERATOR CCM_TRANSLATEACCELERATOR + +#define TBMF_PAD 0x1 +#define TBMF_BARPAD 0x2 +#define TBMF_BUTTONSPACING 0x4 + + typedef struct { + UINT cbSize; + DWORD dwMask; + int cxPad; + int cyPad; + int cxBarPad; + int cyBarPad; + int cxButtonSpacing; + int cyButtonSpacing; + } TBMETRICS,*LPTBMETRICS; + +#define TB_GETMETRICS (WM_USER+101) +#define TB_SETMETRICS (WM_USER+102) +#define TB_SETWINDOWTHEME CCM_SETWINDOWTHEME + +#define TBN_GETBUTTONINFOA (TBN_FIRST-0) +#define TBN_BEGINDRAG (TBN_FIRST-1) +#define TBN_ENDDRAG (TBN_FIRST-2) +#define TBN_BEGINADJUST (TBN_FIRST-3) +#define TBN_ENDADJUST (TBN_FIRST-4) +#define TBN_RESET (TBN_FIRST-5) +#define TBN_QUERYINSERT (TBN_FIRST-6) +#define TBN_QUERYDELETE (TBN_FIRST-7) +#define TBN_TOOLBARCHANGE (TBN_FIRST-8) +#define TBN_CUSTHELP (TBN_FIRST-9) +#define TBN_DROPDOWN (TBN_FIRST - 10) +#define TBN_GETOBJECT (TBN_FIRST - 12) + typedef struct tagNMTBHOTITEM { NMHDR hdr; int idOld; int idNew; DWORD dwFlags; -} NMTBHOTITEM, *LPNMTBHOTITEM; + } NMTBHOTITEM,*LPNMTBHOTITEM; -typedef struct tagNMTBGETINFOTIPA -{ - NMHDR hdr; - LPSTR pszText; - INT cchTextMax; - INT iItem; +#define HICF_OTHER 0x0 +#define HICF_MOUSE 0x1 +#define HICF_ARROWKEYS 0x2 +#define HICF_ACCELERATOR 0x4 +#define HICF_DUPACCEL 0x8 +#define HICF_ENTERING 0x10 +#define HICF_LEAVING 0x20 +#define HICF_RESELECT 0x40 +#define HICF_LMOUSE 0x80 +#define HICF_TOGGLEDROPDOWN 0x100 + +#define TBN_HOTITEMCHANGE (TBN_FIRST - 13) +#define TBN_DRAGOUT (TBN_FIRST - 14) +#define TBN_DELETINGBUTTON (TBN_FIRST - 15) +#define TBN_GETDISPINFOA (TBN_FIRST - 16) +#define TBN_GETDISPINFOW (TBN_FIRST - 17) +#define TBN_GETINFOTIPA (TBN_FIRST - 18) +#define TBN_GETINFOTIPW (TBN_FIRST - 19) +#define TBN_GETBUTTONINFOW (TBN_FIRST - 20) +#define TBN_RESTORE (TBN_FIRST - 21) +#define TBN_SAVE (TBN_FIRST - 22) +#define TBN_INITCUSTOMIZE (TBN_FIRST - 23) +#define TBN_WRAPHOTITEM (TBN_FIRST - 24) +#define TBN_DUPACCELERATOR (TBN_FIRST - 25) +#define TBN_WRAPACCELERATOR (TBN_FIRST - 26) +#define TBN_DRAGOVER (TBN_FIRST - 27) +#define TBN_MAPACCELERATOR (TBN_FIRST - 28) +#define TBNRF_HIDEHELP 0x1 +#define TBNRF_ENDCUSTOMIZE 0x2 + + typedef struct tagNMTBSAVE { + NMHDR hdr; + DWORD *pData; + DWORD *pCurrent; + UINT cbData; + int iItem; + int cButtons; + TBBUTTON tbButton; + } NMTBSAVE,*LPNMTBSAVE; + + typedef struct tagNMTBRESTORE { + NMHDR hdr; + DWORD *pData; + DWORD *pCurrent; + UINT cbData; + int iItem; + int cButtons; + int cbBytesPerRecord; + TBBUTTON tbButton; + } NMTBRESTORE,*LPNMTBRESTORE; + + typedef struct tagNMTBGETINFOTIPA { + NMHDR hdr; + LPSTR pszText; + int cchTextMax; + int iItem; LPARAM lParam; -} NMTBGETINFOTIPA, *LPNMTBGETINFOTIPA; + } NMTBGETINFOTIPA,*LPNMTBGETINFOTIPA; -typedef struct tagNMTBGETINFOTIPW -{ - NMHDR hdr; + typedef struct tagNMTBGETINFOTIPW { + NMHDR hdr; LPWSTR pszText; - INT cchTextMax; - INT iItem; + int cchTextMax; + int iItem; LPARAM lParam; -} NMTBGETINFOTIPW, *LPNMTBGETINFOTIPW; + } NMTBGETINFOTIPW,*LPNMTBGETINFOTIPW; -#define NMTBGETINFOTIP WINELIB_NAME_AW(NMTBGETINFOTIP) -#define LPNMTBGETINFOTIP WINELIB_NAME_AW(LPNMTBGETINFOTIP) +#ifdef UNICODE +#define TBN_GETINFOTIP TBN_GETINFOTIPW +#define NMTBGETINFOTIP NMTBGETINFOTIPW +#define LPNMTBGETINFOTIP LPNMTBGETINFOTIPW +#else +#define TBN_GETINFOTIP TBN_GETINFOTIPA +#define NMTBGETINFOTIP NMTBGETINFOTIPA +#define LPNMTBGETINFOTIP LPNMTBGETINFOTIPA +#endif -typedef struct -{ +#define TBNF_IMAGE 0x1 +#define TBNF_TEXT 0x2 +#define TBNF_DI_SETITEM 0x10000000 + + typedef struct { NMHDR hdr; DWORD dwMask; int idCommand; @@ -1447,10 +1271,9 @@ typedef struct int iImage; LPSTR pszText; int cchText; -} NMTBDISPINFOA, *LPNMTBDISPINFOA; + } NMTBDISPINFOA,*LPNMTBDISPINFOA; -typedef struct -{ + typedef struct { NMHDR hdr; DWORD dwMask; int idCommand; @@ -1458,266 +1281,350 @@ typedef struct int iImage; LPWSTR pszText; int cchText; -} NMTBDISPINFOW, *LPNMTBDISPINFOW; + } NMTBDISPINFOW,*LPNMTBDISPINFOW; -#define NMTBDISPINFO WINELIB_NAME_AW(NMTBDISPINFO) -#define LPNMTBDISPINFO WINELIB_NAME_AW(LPNMTBDISPINFO) +#ifdef UNICODE +#define TBN_GETDISPINFO TBN_GETDISPINFOW +#define NMTBDISPINFO NMTBDISPINFOW +#define LPNMTBDISPINFO LPNMTBDISPINFOW +#else +#define TBN_GETDISPINFO TBN_GETDISPINFOA +#define NMTBDISPINFO NMTBDISPINFOA +#define LPNMTBDISPINFO LPNMTBDISPINFOA +#endif -/* contents of dwMask in the NMTBDISPINFO structure */ -#define TBNF_IMAGE 0x00000001 -#define TBNF_TEXT 0x00000002 -#define TBNF_DI_SETITEM 0x10000000 +#define TBDDRET_DEFAULT 0 +#define TBDDRET_NODEFAULT 1 +#define TBDDRET_TREATPRESSED 2 +#ifdef UNICODE +#define TBN_GETBUTTONINFO TBN_GETBUTTONINFOW +#else +#define TBN_GETBUTTONINFO TBN_GETBUTTONINFOA +#endif -typedef struct tagNMTOOLBARA -{ - NMHDR hdr; - INT iItem; - TBBUTTON tbButton; - INT cchText; - LPSTR pszText; - RECT rcButton; /* Version 5.80 */ -} NMTOOLBARA, *LPNMTOOLBARA, TBNOTIFYA, *LPTBNOTIFYA; +#define TBNOTIFYA NMTOOLBARA +#define TBNOTIFYW NMTOOLBARW +#define LPTBNOTIFYA LPNMTOOLBARA +#define LPTBNOTIFYW LPNMTOOLBARW -typedef struct tagNMTOOLBARW -{ - NMHDR hdr; - INT iItem; - TBBUTTON tbButton; - INT cchText; - LPWSTR pszText; - RECT rcButton; /* Version 5.80 */ -} NMTOOLBARW, *LPNMTOOLBARW, TBNOTIFYW, *LPTBNOTIFYW; +#define TBNOTIFY NMTOOLBAR +#define LPTBNOTIFY LPNMTOOLBAR -#define NMTOOLBAR WINELIB_NAME_AW(NMTOOLBAR) -#define LPNMTOOLBAR WINELIB_NAME_AW(LPNMTOOLBAR) -#define TBNOTIFY WINELIB_NAME_AW(TBNOTIFY) -#define LPTBNOTIFY WINELIB_NAME_AW(LPTBNOTIFY) - -typedef struct -{ - HINSTANCE hInstOld; - UINT_PTR nIDOld; - HINSTANCE hInstNew; - UINT_PTR nIDNew; - INT nButtons; -} TBREPLACEBITMAP, *LPTBREPLACEBITMAP; - -#define HICF_OTHER 0x00000000 -#define HICF_MOUSE 0x00000001 /* Triggered by mouse */ -#define HICF_ARROWKEYS 0x00000002 /* Triggered by arrow keys */ -#define HICF_ACCELERATOR 0x00000004 /* Triggered by accelerator */ -#define HICF_DUPACCEL 0x00000008 /* This accelerator is not unique */ -#define HICF_ENTERING 0x00000010 /* idOld is invalid */ -#define HICF_LEAVING 0x00000020 /* idNew is invalid */ -#define HICF_RESELECT 0x00000040 /* hot item reselected */ -#define HICF_LMOUSE 0x00000080 /* left mouse button selected */ -#define HICF_TOGGLEDROPDOWN 0x00000100 /* Toggle button's dropdown state */ - -typedef struct -{ - int iButton; - DWORD dwFlags; -} TBINSERTMARK, *LPTBINSERTMARK; -#define TBIMHT_AFTER 0x00000001 /* TRUE = insert After iButton, otherwise before */ -#define TBIMHT_BACKGROUND 0x00000002 /* TRUE if and only if missed buttons completely */ - -typedef struct tagNMTBSAVE -{ + typedef struct tagNMTOOLBARA { NMHDR hdr; - DWORD* pData; - DWORD* pCurrent; - UINT cbData; int iItem; - int cButtons; TBBUTTON tbButton; -} NMTBSAVE, *LPNMTBSAVE; + int cchText; + LPSTR pszText; + RECT rcButton; + } NMTOOLBARA,*LPNMTOOLBARA; -typedef struct tagNMTBRESTORE -{ + typedef struct tagNMTOOLBARW { NMHDR hdr; - DWORD* pData; - DWORD* pCurrent; - UINT cbData; int iItem; - int cButtons; - int cbBytesPerRecord; TBBUTTON tbButton; -} NMTBRESTORE, *LPNMTBRESTORE; + int cchText; + LPWSTR pszText; + RECT rcButton; + } NMTOOLBARW,*LPNMTOOLBARW; -#define TBMF_PAD 0x00000001 -#define TBMF_BARPAD 0x00000002 -#define TBMF_BUTTONSPACING 0x00000004 +#ifdef UNICODE +#define NMTOOLBAR NMTOOLBARW +#define LPNMTOOLBAR LPNMTOOLBARW +#else +#define NMTOOLBAR NMTOOLBARA +#define LPNMTOOLBAR LPNMTOOLBARA +#endif +#endif -typedef struct -{ +#ifndef NOREBAR + +#define REBARCLASSNAMEW L"ReBarWindow32" +#define REBARCLASSNAMEA "ReBarWindow32" + +#ifdef UNICODE +#define REBARCLASSNAME REBARCLASSNAMEW +#else +#define REBARCLASSNAME REBARCLASSNAMEA +#endif + +#define RBIM_IMAGELIST 0x1 + +#define RBS_TOOLTIPS 0x100 +#define RBS_VARHEIGHT 0x200 +#define RBS_BANDBORDERS 0x400 +#define RBS_FIXEDORDER 0x800 +#define RBS_REGISTERDROP 0x1000 +#define RBS_AUTOSIZE 0x2000 +#define RBS_VERTICALGRIPPER 0x4000 +#define RBS_DBLCLKTOGGLE 0x8000 + + typedef struct tagREBARINFO { UINT cbSize; - DWORD dwMask; - INT cxPad; - INT cyPad; - INT cxBarPad; - INT cyBarPad; - INT cxButtonSpacing; - INT cyButtonSpacing; -} TBMETRICS, *LPTBMETRICS; - -/* these are undocumented and the names are guesses */ -typedef struct -{ - NMHDR hdr; - HWND hwndDialog; -} NMTBINITCUSTOMIZE; - -typedef struct -{ - NMHDR hdr; - INT idNew; - INT iDirection; /* left is -1, right is 1 */ - DWORD dwReason; /* HICF_* */ -} NMTBWRAPHOTITEM; - - -HWND WINAPI -CreateToolbar(HWND, DWORD, UINT, INT, HINSTANCE, - UINT, LPCTBBUTTON, INT); - -HWND WINAPI -CreateToolbarEx(HWND, DWORD, UINT, INT, - HINSTANCE, UINT_PTR, LPCTBBUTTON, - INT, INT, INT, INT, INT, UINT); - -HBITMAP WINAPI -CreateMappedBitmap (HINSTANCE, INT_PTR, UINT, LPCOLORMAP, INT); - - -/* Tool tips */ - -#define TOOLTIPS_CLASSA "tooltips_class32" -# define TOOLTIPS_CLASSW L"tooltips_class32" -#define TOOLTIPS_CLASS WINELIB_NAME_AW(TOOLTIPS_CLASS) - -#if (_WIN32_WINNT >= 0x501) -#define BUTTON_IMAGELIST_ALIGN_LEFT 0 -#define BUTTON_IMAGELIST_ALIGN_RIGHT 1 -#define BUTTON_IMAGELIST_ALIGN_TOP 2 -#define BUTTON_IMAGELIST_ALIGN_BOTTOM 3 -#define BUTTON_IMAGELIST_ALIGN_CENTER 4 - -typedef struct -{ + UINT fMask; +#ifndef NOIMAGEAPIS HIMAGELIST himl; - RECT margin; - UINT uAlign; -} BUTTON_IMAGELIST, *PBUTTON_IMAGELIST; +#else + HANDLE himl; +#endif + } REBARINFO,*LPREBARINFO; -#define BCM_FIRST 0x1600 -#define BCM_GETIDEALSIZE (BCM_FIRST + 1) -#define BCM_SETIMAGELIST (BCM_FIRST + 2) -#endif /* _WIN32_WINNT */ +#define RBBS_BREAK 0x1 +#define RBBS_FIXEDSIZE 0x2 +#define RBBS_CHILDEDGE 0x4 +#define RBBS_HIDDEN 0x8 +#define RBBS_NOVERT 0x10 +#define RBBS_FIXEDBMP 0x20 +#define RBBS_VARIABLEHEIGHT 0x40 +#define RBBS_GRIPPERALWAYS 0x80 +#define RBBS_NOGRIPPER 0x100 +#define RBBS_USECHEVRON 0x200 +#define RBBS_HIDETITLE 0x400 +#define RBBS_TOPALIGN 0x800 -#define INFOTIPSIZE 1024 +#define RBBIM_STYLE 0x1 +#define RBBIM_COLORS 0x2 +#define RBBIM_TEXT 0x4 +#define RBBIM_IMAGE 0x8 +#define RBBIM_CHILD 0x10 +#define RBBIM_CHILDSIZE 0x20 +#define RBBIM_SIZE 0x40 +#define RBBIM_BACKGROUND 0x80 +#define RBBIM_ID 0x100 +#define RBBIM_IDEALSIZE 0x200 +#define RBBIM_LPARAM 0x400 +#define RBBIM_HEADERSIZE 0x800 -#define TTS_ALWAYSTIP 0x01 -#define TTS_NOPREFIX 0x02 -#define TTS_NOANIMATE 0x10 -#define TTS_NOFADE 0x20 -#define TTS_BALLOON 0x40 -#define TTS_CLOSE 0x80 -#define TTS_USEVISUALSTYLE 0x100 + typedef struct tagREBARBANDINFOA { + UINT cbSize; + UINT fMask; + UINT fStyle; + COLORREF clrFore; + COLORREF clrBack; + LPSTR lpText; + UINT cch; + int iImage; + HWND hwndChild; + UINT cxMinChild; + UINT cyMinChild; + UINT cx; + HBITMAP hbmBack; + UINT wID; + UINT cyChild; + UINT cyMaxChild; + UINT cyIntegral; + UINT cxIdeal; + LPARAM lParam; + UINT cxHeader; + } REBARBANDINFOA,*LPREBARBANDINFOA; + typedef REBARBANDINFOA CONST *LPCREBARBANDINFOA; -#define TTF_IDISHWND 0x0001 -#define TTF_CENTERTIP 0x0002 -#define TTF_RTLREADING 0x0004 -#define TTF_SUBCLASS 0x0010 -#define TTF_TRACK 0x0020 -#define TTF_ABSOLUTE 0x0080 -#define TTF_TRANSPARENT 0x0100 -#define TTF_DI_SETITEM 0x8000 /* valid only on the TTN_NEEDTEXT callback */ +#define REBARBANDINFOA_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA,wID) +#define REBARBANDINFOW_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW,wID) +#define REBARBANDINFOA_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA,cxHeader) +#define REBARBANDINFOW_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW,cxHeader) + typedef struct tagREBARBANDINFOW { + UINT cbSize; + UINT fMask; + UINT fStyle; + COLORREF clrFore; + COLORREF clrBack; + LPWSTR lpText; + UINT cch; + int iImage; + HWND hwndChild; + UINT cxMinChild; + UINT cyMinChild; + UINT cx; + HBITMAP hbmBack; + UINT wID; + UINT cyChild; + UINT cyMaxChild; + UINT cyIntegral; + UINT cxIdeal; + LPARAM lParam; + UINT cxHeader; + } REBARBANDINFOW,*LPREBARBANDINFOW; + typedef REBARBANDINFOW CONST *LPCREBARBANDINFOW; -#define TTDT_AUTOMATIC 0 -#define TTDT_RESHOW 1 -#define TTDT_AUTOPOP 2 -#define TTDT_INITIAL 3 +#ifdef UNICODE +#define REBARBANDINFO REBARBANDINFOW +#define LPREBARBANDINFO LPREBARBANDINFOW +#define LPCREBARBANDINFO LPCREBARBANDINFOW +#define REBARBANDINFO_V3_SIZE REBARBANDINFOW_V3_SIZE +#else +#define REBARBANDINFO REBARBANDINFOA +#define LPREBARBANDINFO LPREBARBANDINFOA +#define LPCREBARBANDINFO LPCREBARBANDINFOA +#define REBARBANDINFO_V3_SIZE REBARBANDINFOA_V3_SIZE +#endif +#define RB_INSERTBANDA (WM_USER+1) +#define RB_DELETEBAND (WM_USER+2) +#define RB_GETBARINFO (WM_USER+3) +#define RB_SETBARINFO (WM_USER+4) +#define RB_SETBANDINFOA (WM_USER+6) +#define RB_SETPARENT (WM_USER+7) +#define RB_HITTEST (WM_USER+8) +#define RB_GETRECT (WM_USER+9) +#define RB_INSERTBANDW (WM_USER+10) +#define RB_SETBANDINFOW (WM_USER+11) +#define RB_GETBANDCOUNT (WM_USER+12) +#define RB_GETROWCOUNT (WM_USER+13) +#define RB_GETROWHEIGHT (WM_USER+14) +#define RB_IDTOINDEX (WM_USER+16) +#define RB_GETTOOLTIPS (WM_USER+17) +#define RB_SETTOOLTIPS (WM_USER+18) +#define RB_SETBKCOLOR (WM_USER+19) +#define RB_GETBKCOLOR (WM_USER+20) +#define RB_SETTEXTCOLOR (WM_USER+21) +#define RB_GETTEXTCOLOR (WM_USER+22) -#define TTI_NONE 0 -#define TTI_INFO 1 -#define TTI_WARNING 2 -#define TTI_ERROR 3 +#define RBSTR_CHANGERECT 0x1 +#define RB_SIZETORECT (WM_USER+23) +#define RB_SETCOLORSCHEME CCM_SETCOLORSCHEME +#define RB_GETCOLORSCHEME CCM_GETCOLORSCHEME -#define TTM_ACTIVATE (WM_USER+1) -#define TTM_SETDELAYTIME (WM_USER+3) -#define TTM_ADDTOOLA (WM_USER+4) -#define TTM_ADDTOOLW (WM_USER+50) -#define TTM_ADDTOOL WINELIB_NAME_AW(TTM_ADDTOOL) -#define TTM_DELTOOLA (WM_USER+5) -#define TTM_DELTOOLW (WM_USER+51) -#define TTM_DELTOOL WINELIB_NAME_AW(TTM_DELTOOL) -#define TTM_NEWTOOLRECTA (WM_USER+6) -#define TTM_NEWTOOLRECTW (WM_USER+52) -#define TTM_NEWTOOLRECT WINELIB_NAME_AW(TTM_NEWTOOLRECT) -#define TTM_RELAYEVENT (WM_USER+7) -#define TTM_GETTOOLINFOA (WM_USER+8) -#define TTM_GETTOOLINFOW (WM_USER+53) -#define TTM_GETTOOLINFO WINELIB_NAME_AW(TTM_GETTOOLINFO) -#define TTM_SETTOOLINFOA (WM_USER+9) -#define TTM_SETTOOLINFOW (WM_USER+54) -#define TTM_SETTOOLINFO WINELIB_NAME_AW(TTM_SETTOOLINFO) -#define TTM_HITTESTA (WM_USER+10) -#define TTM_HITTESTW (WM_USER+55) -#define TTM_HITTEST WINELIB_NAME_AW(TTM_HITTEST) -#define TTM_GETTEXTA (WM_USER+11) -#define TTM_GETTEXTW (WM_USER+56) -#define TTM_GETTEXT WINELIB_NAME_AW(TTM_GETTEXT) -#define TTM_UPDATETIPTEXTA (WM_USER+12) -#define TTM_UPDATETIPTEXTW (WM_USER+57) -#define TTM_UPDATETIPTEXT WINELIB_NAME_AW(TTM_UPDATETIPTEXT) -#define TTM_GETTOOLCOUNT (WM_USER+13) -#define TTM_ENUMTOOLSA (WM_USER+14) -#define TTM_ENUMTOOLSW (WM_USER+58) -#define TTM_ENUMTOOLS WINELIB_NAME_AW(TTM_ENUMTOOLS) -#define TTM_GETCURRENTTOOLA (WM_USER+15) -#define TTM_GETCURRENTTOOLW (WM_USER+59) -#define TTM_GETCURRENTTOOL WINELIB_NAME_AW(TTM_GETCURRENTTOOL) -#define TTM_WINDOWFROMPOINT (WM_USER+16) -#define TTM_TRACKACTIVATE (WM_USER+17) -#define TTM_TRACKPOSITION (WM_USER+18) -#define TTM_SETTIPBKCOLOR (WM_USER+19) -#define TTM_SETTIPTEXTCOLOR (WM_USER+20) -#define TTM_GETDELAYTIME (WM_USER+21) -#define TTM_GETTIPBKCOLOR (WM_USER+22) -#define TTM_GETTIPTEXTCOLOR (WM_USER+23) -#define TTM_SETMAXTIPWIDTH (WM_USER+24) -#define TTM_GETMAXTIPWIDTH (WM_USER+25) -#define TTM_SETMARGIN (WM_USER+26) -#define TTM_GETMARGIN (WM_USER+27) -#define TTM_POP (WM_USER+28) -#define TTM_UPDATE (WM_USER+29) -#define TTM_GETBUBBLESIZE (WM_USER+30) -#define TTM_ADJUSTRECT (WM_USER+31) -#define TTM_SETTITLEA (WM_USER+32) -#define TTM_SETTITLEW (WM_USER+33) -#define TTM_SETTITLE WINELIB_NAME_AW(TTM_SETTITLE) -#define TTM_POPUP (WM_USER+34) -#define TTM_GETTITLE (WM_USER+35) -#define TTM_SETWINDOWTHEME CCM_SETWINDOWTHEME +#ifdef UNICODE +#define RB_INSERTBAND RB_INSERTBANDW +#define RB_SETBANDINFO RB_SETBANDINFOW +#else +#define RB_INSERTBAND RB_INSERTBANDA +#define RB_SETBANDINFO RB_SETBANDINFOA +#endif +#define RB_BEGINDRAG (WM_USER+24) +#define RB_ENDDRAG (WM_USER+25) +#define RB_DRAGMOVE (WM_USER+26) +#define RB_GETBARHEIGHT (WM_USER+27) +#define RB_GETBANDINFOW (WM_USER+28) +#define RB_GETBANDINFOA (WM_USER+29) -#define TTN_FIRST (0U-520U) -#define TTN_LAST (0U-549U) -#define TTN_GETDISPINFOA (TTN_FIRST-0) -#define TTN_GETDISPINFOW (TTN_FIRST-10) -#define TTN_GETDISPINFO WINELIB_NAME_AW(TTN_GETDISPINFO) -#define TTN_SHOW (TTN_FIRST-1) -#define TTN_POP (TTN_FIRST-2) +#ifdef UNICODE +#define RB_GETBANDINFO RB_GETBANDINFOW +#else +#define RB_GETBANDINFO RB_GETBANDINFOA +#endif -#define TTN_NEEDTEXT TTN_GETDISPINFO -#define TTN_NEEDTEXTA TTN_GETDISPINFOA -#define TTN_NEEDTEXTW TTN_GETDISPINFOW +#define RB_MINIMIZEBAND (WM_USER+30) +#define RB_MAXIMIZEBAND (WM_USER+31) +#define RB_GETDROPTARGET (CCM_GETDROPTARGET) +#define RB_GETBANDBORDERS (WM_USER+34) +#define RB_SHOWBAND (WM_USER+35) +#define RB_SETPALETTE (WM_USER+37) +#define RB_GETPALETTE (WM_USER+38) +#define RB_MOVEBAND (WM_USER+39) +#define RB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define RB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define RB_GETBANDMARGINS (WM_USER+40) +#define RB_SETWINDOWTHEME CCM_SETWINDOWTHEME +#define RB_PUSHCHEVRON (WM_USER+43) -typedef struct tagTOOLINFOA { +#define RBN_HEIGHTCHANGE (RBN_FIRST - 0) +#define RBN_GETOBJECT (RBN_FIRST - 1) +#define RBN_LAYOUTCHANGED (RBN_FIRST - 2) +#define RBN_AUTOSIZE (RBN_FIRST - 3) +#define RBN_BEGINDRAG (RBN_FIRST - 4) +#define RBN_ENDDRAG (RBN_FIRST - 5) +#define RBN_DELETINGBAND (RBN_FIRST - 6) +#define RBN_DELETEDBAND (RBN_FIRST - 7) +#define RBN_CHILDSIZE (RBN_FIRST - 8) +#define RBN_CHEVRONPUSHED (RBN_FIRST - 10) +#define RBN_MINMAX (RBN_FIRST - 21) +#define RBN_AUTOBREAK (RBN_FIRST - 22) + + typedef struct tagNMREBARCHILDSIZE { + NMHDR hdr; + UINT uBand; + UINT wID; + RECT rcChild; + RECT rcBand; + } NMREBARCHILDSIZE,*LPNMREBARCHILDSIZE; + + typedef struct tagNMREBAR { + NMHDR hdr; + DWORD dwMask; + UINT uBand; + UINT fStyle; + UINT wID; + LPARAM lParam; + } NMREBAR,*LPNMREBAR; + +#define RBNM_ID 0x1 +#define RBNM_STYLE 0x2 +#define RBNM_LPARAM 0x4 + + typedef struct tagNMRBAUTOSIZE { + NMHDR hdr; + WINBOOL fChanged; + RECT rcTarget; + RECT rcActual; + } NMRBAUTOSIZE,*LPNMRBAUTOSIZE; + + typedef struct tagNMREBARCHEVRON { + NMHDR hdr; + UINT uBand; + UINT wID; + LPARAM lParam; + RECT rc; + LPARAM lParamNM; + } NMREBARCHEVRON,*LPNMREBARCHEVRON; + +#define RBAB_AUTOSIZE 0x1 +#define RBAB_ADDBAND 0x2 + + typedef struct tagNMREBARAUTOBREAK { + NMHDR hdr; + UINT uBand; + UINT wID; + LPARAM lParam; + UINT uMsg; + UINT fStyleCurrent; + WINBOOL fAutoBreak; + } NMREBARAUTOBREAK,*LPNMREBARAUTOBREAK; + +#define RBHT_NOWHERE 0x1 +#define RBHT_CAPTION 0x2 +#define RBHT_CLIENT 0x3 +#define RBHT_GRABBER 0x4 +#define RBHT_CHEVRON 0x8 + + typedef struct _RB_HITTESTINFO { + POINT pt; + UINT flags; + int iBand; + } RBHITTESTINFO,*LPRBHITTESTINFO; +#endif + +#ifndef NOTOOLTIPS + +#define TOOLTIPS_CLASSW L"tooltips_class32" +#define TOOLTIPS_CLASSA "tooltips_class32" +#ifdef UNICODE +#define TOOLTIPS_CLASS TOOLTIPS_CLASSW +#else +#define TOOLTIPS_CLASS TOOLTIPS_CLASSA +#endif + +#define LPTOOLINFOA LPTTTOOLINFOA +#define LPTOOLINFOW LPTTTOOLINFOW +#define TOOLINFOA TTTOOLINFOA +#define TOOLINFOW TTTOOLINFOW + +#define LPTOOLINFO LPTTTOOLINFO +#define TOOLINFO TTTOOLINFO + +#define TTTOOLINFOA_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA,lpszText) +#define TTTOOLINFOW_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW,lpszText) +#define TTTOOLINFOA_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA,lParam) +#define TTTOOLINFOW_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW,lParam) +#define TTTOOLINFOA_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA,lpReserved) +#define TTTOOLINFOW_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW,lpReserved) + + typedef struct tagTOOLINFOA { UINT cbSize; UINT uFlags; HWND hwnd; @@ -1727,9 +1634,9 @@ typedef struct tagTOOLINFOA { LPSTR lpszText; LPARAM lParam; void *lpReserved; -} TTTOOLINFOA, *LPTOOLINFOA, *PTOOLINFOA, *LPTTTOOLINFOA; + } TTTOOLINFOA,NEAR *PTOOLINFOA,*LPTTTOOLINFOA; -typedef struct tagTOOLINFOW { + typedef struct tagTOOLINFOW { UINT cbSize; UINT uFlags; HWND hwnd; @@ -1739,1742 +1646,1403 @@ typedef struct tagTOOLINFOW { LPWSTR lpszText; LPARAM lParam; void *lpReserved; -} TTTOOLINFOW, *LPTOOLINFOW, *PTOOLINFOW, *LPTTTOOLINFOW; + } TTTOOLINFOW,NEAR *PTOOLINFOW,*LPTTTOOLINFOW; -#define TTTOOLINFO WINELIB_NAME_AW(TTTOOLINFO) -#define TOOLINFO WINELIB_NAME_AW(TTTOOLINFO) -#define PTOOLINFO WINELIB_NAME_AW(PTOOLINFO) -#define LPTTTOOLINFO WINELIB_NAME_AW(LPTTTOOLINFO) -#define LPTOOLINFO WINELIB_NAME_AW(LPTOOLINFO) +#ifdef UNICODE +#define TTTOOLINFO TTTOOLINFOW +#define PTOOLINFO PTOOLINFOW +#define LPTTTOOLINFO LPTTTOOLINFOW +#define TTTOOLINFO_V1_SIZE TTTOOLINFOW_V1_SIZE +#else +#define PTOOLINFO PTOOLINFOA +#define TTTOOLINFO TTTOOLINFOA +#define LPTTTOOLINFO LPTTTOOLINFOA +#define TTTOOLINFO_V1_SIZE TTTOOLINFOA_V1_SIZE +#endif -#define TTTOOLINFOA_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lpszText) -#define TTTOOLINFOW_V1_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lpszText) -#define TTTOOLINFO_V1_SIZE CCSIZEOF_STRUCT(WINELIB_NAME_AW(TTTOOLINFO), lpszText) -#define TTTOOLINFOA_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lParam) -#define TTTOOLINFOW_V2_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lParam) -#define TTTOOLINFOA_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOA, lpReserved) -#define TTTOOLINFOW_V3_SIZE CCSIZEOF_STRUCT(TTTOOLINFOW, lpReserved) +#define TTS_ALWAYSTIP 0x1 +#define TTS_NOPREFIX 0x2 +#define TTS_NOANIMATE 0x10 +#define TTS_NOFADE 0x20 +#define TTS_BALLOON 0x40 +#define TTS_CLOSE 0x80 -typedef struct _TT_HITTESTINFOA -{ - HWND hwnd; - POINT pt; - TTTOOLINFOA ti; -} TTHITTESTINFOA, *LPTTHITTESTINFOA; -#define LPHITTESTINFOA LPTTHITTESTINFOA +#define TTF_IDISHWND 0x1 +#define TTF_CENTERTIP 0x2 +#define TTF_RTLREADING 0x4 +#define TTF_SUBCLASS 0x10 +#define TTF_TRACK 0x20 +#define TTF_ABSOLUTE 0x80 +#define TTF_TRANSPARENT 0x100 +#define TTF_PARSELINKS 0x1000 +#define TTF_DI_SETITEM 0x8000 -typedef struct _TT_HITTESTINFOW -{ - HWND hwnd; - POINT pt; - TTTOOLINFOW ti; -} TTHITTESTINFOW, *LPTTHITTESTINFOW; -#define LPHITTESTINFOW LPTTHITTESTINFOW +#define TTDT_AUTOMATIC 0 +#define TTDT_RESHOW 1 +#define TTDT_AUTOPOP 2 +#define TTDT_INITIAL 3 -#define TTHITTESTINFO WINELIB_NAME_AW(TTHITTESTINFO) -#define LPTTHITTESTINFO WINELIB_NAME_AW(LPTTHITTESTINFO) -#define LPHITTESTINFO WINELIB_NAME_AW(LPHITTESTINFO) +#define TTI_NONE 0 +#define TTI_INFO 1 +#define TTI_WARNING 2 +#define TTI_ERROR 3 -typedef struct tagNMTTDISPINFOA -{ - NMHDR hdr; - LPSTR lpszText; - CHAR szText[80]; - HINSTANCE hinst; - UINT uFlags; - LPARAM lParam; -} NMTTDISPINFOA, *LPNMTTDISPINFOA; +#define TTM_ACTIVATE (WM_USER+1) +#define TTM_SETDELAYTIME (WM_USER+3) +#define TTM_ADDTOOLA (WM_USER+4) +#define TTM_ADDTOOLW (WM_USER+50) +#define TTM_DELTOOLA (WM_USER+5) +#define TTM_DELTOOLW (WM_USER+51) +#define TTM_NEWTOOLRECTA (WM_USER+6) +#define TTM_NEWTOOLRECTW (WM_USER+52) +#define TTM_RELAYEVENT (WM_USER+7) -typedef struct tagNMTTDISPINFOW -{ - NMHDR hdr; - LPWSTR lpszText; - WCHAR szText[80]; - HINSTANCE hinst; - UINT uFlags; - LPARAM lParam; -} NMTTDISPINFOW, *LPNMTTDISPINFOW; +#define TTM_GETTOOLINFOA (WM_USER+8) +#define TTM_GETTOOLINFOW (WM_USER+53) -#define NMTTDISPINFO WINELIB_NAME_AW(NMTTDISPINFO) -#define LPNMTTDISPINFO WINELIB_NAME_AW(LPNMTTDISPINFO) +#define TTM_SETTOOLINFOA (WM_USER+9) +#define TTM_SETTOOLINFOW (WM_USER+54) -#define NMTTDISPINFO_V1_SIZEA CCSIZEOF_STRUCT(NMTTDISPINFOA, uFlags) -#define NMTTDISPINFO_V1_SIZEW CCSIZEOF_STRUCT(NMTTDISPINFOW, uFlags) -#define NMTTDISPINFO_V1_SIZE WINELIB_NAME_AW(NMTTDISPINFO_V1_SIZE) +#define TTM_HITTESTA (WM_USER +10) +#define TTM_HITTESTW (WM_USER +55) +#define TTM_GETTEXTA (WM_USER +11) +#define TTM_GETTEXTW (WM_USER +56) +#define TTM_UPDATETIPTEXTA (WM_USER +12) +#define TTM_UPDATETIPTEXTW (WM_USER +57) +#define TTM_GETTOOLCOUNT (WM_USER +13) +#define TTM_ENUMTOOLSA (WM_USER +14) +#define TTM_ENUMTOOLSW (WM_USER +58) +#define TTM_GETCURRENTTOOLA (WM_USER+15) +#define TTM_GETCURRENTTOOLW (WM_USER+59) +#define TTM_WINDOWFROMPOINT (WM_USER+16) +#define TTM_TRACKACTIVATE (WM_USER+17) +#define TTM_TRACKPOSITION (WM_USER+18) +#define TTM_SETTIPBKCOLOR (WM_USER+19) +#define TTM_SETTIPTEXTCOLOR (WM_USER+20) +#define TTM_GETDELAYTIME (WM_USER+21) +#define TTM_GETTIPBKCOLOR (WM_USER+22) +#define TTM_GETTIPTEXTCOLOR (WM_USER+23) +#define TTM_SETMAXTIPWIDTH (WM_USER+24) +#define TTM_GETMAXTIPWIDTH (WM_USER+25) +#define TTM_SETMARGIN (WM_USER+26) +#define TTM_GETMARGIN (WM_USER+27) +#define TTM_POP (WM_USER+28) +#define TTM_UPDATE (WM_USER+29) +#define TTM_GETBUBBLESIZE (WM_USER+30) +#define TTM_ADJUSTRECT (WM_USER+31) +#define TTM_SETTITLEA (WM_USER+32) +#define TTM_SETTITLEW (WM_USER+33) -typedef struct _TTGETTITLE -{ +#define TTM_POPUP (WM_USER+34) +#define TTM_GETTITLE (WM_USER+35) + typedef struct _TTGETTITLE { DWORD dwSize; UINT uTitleBitmap; UINT cch; - WCHAR* pszTitle; -} TTGETTITLE, *PTTGETTITLE; + WCHAR *pszTitle; + } TTGETTITLE,*PTTGETTITLE; -#define TOOLTIPTEXTW NMTTDISPINFOW -#define TOOLTIPTEXTA NMTTDISPINFOA -#define TOOLTIPTEXT NMTTDISPINFO -#define LPTOOLTIPTEXTW LPNMTTDISPINFOW -#define LPTOOLTIPTEXTA LPNMTTDISPINFOA -#define LPTOOLTIPTEXT LPNMTTDISPINFO - - -/* Rebar control */ - -#define REBARCLASSNAMEA "ReBarWindow32" -#if defined(__GNUC__) -# define REBARCLASSNAMEW (const WCHAR []){ 'R','e','B','a','r', \ - 'W','i','n','d','o','w','3','2',0 } -#elif defined(_MSC_VER) -# define REBARCLASSNAMEW L"ReBarWindow32" +#ifdef UNICODE +#define TTM_ADDTOOL TTM_ADDTOOLW +#define TTM_DELTOOL TTM_DELTOOLW +#define TTM_NEWTOOLRECT TTM_NEWTOOLRECTW +#define TTM_GETTOOLINFO TTM_GETTOOLINFOW +#define TTM_SETTOOLINFO TTM_SETTOOLINFOW +#define TTM_HITTEST TTM_HITTESTW +#define TTM_GETTEXT TTM_GETTEXTW +#define TTM_UPDATETIPTEXT TTM_UPDATETIPTEXTW +#define TTM_ENUMTOOLS TTM_ENUMTOOLSW +#define TTM_GETCURRENTTOOL TTM_GETCURRENTTOOLW +#define TTM_SETTITLE TTM_SETTITLEW #else -static const WCHAR REBARCLASSNAMEW[] = { 'R','e','B','a','r', - 'W','i','n','d','o','w','3','2',0 }; +#define TTM_ADDTOOL TTM_ADDTOOLA +#define TTM_DELTOOL TTM_DELTOOLA +#define TTM_NEWTOOLRECT TTM_NEWTOOLRECTA +#define TTM_GETTOOLINFO TTM_GETTOOLINFOA +#define TTM_SETTOOLINFO TTM_SETTOOLINFOA +#define TTM_HITTEST TTM_HITTESTA +#define TTM_GETTEXT TTM_GETTEXTA +#define TTM_UPDATETIPTEXT TTM_UPDATETIPTEXTA +#define TTM_ENUMTOOLS TTM_ENUMTOOLSA +#define TTM_GETCURRENTTOOL TTM_GETCURRENTTOOLA +#define TTM_SETTITLE TTM_SETTITLEA #endif -#define REBARCLASSNAME WINELIB_NAME_AW(REBARCLASSNAME) +#define TTM_SETWINDOWTHEME CCM_SETWINDOWTHEME -#define RBS_TOOLTIPS 0x0100 -#define RBS_VARHEIGHT 0x0200 -#define RBS_BANDBORDERS 0x0400 -#define RBS_FIXEDORDER 0x0800 -#define RBS_REGISTERDROP 0x1000 -#define RBS_AUTOSIZE 0x2000 -#define RBS_VERTICALGRIPPER 0x4000 -#define RBS_DBLCLKTOGGLE 0x8000 +#define LPHITTESTINFOW LPTTHITTESTINFOW +#define LPHITTESTINFOA LPTTHITTESTINFOA +#define LPHITTESTINFO LPTTHITTESTINFO -#define RBIM_IMAGELIST 0x00000001 - -#define RBBIM_STYLE 0x00000001 -#define RBBIM_COLORS 0x00000002 -#define RBBIM_TEXT 0x00000004 -#define RBBIM_IMAGE 0x00000008 -#define RBBIM_CHILD 0x00000010 -#define RBBIM_CHILDSIZE 0x00000020 -#define RBBIM_SIZE 0x00000040 -#define RBBIM_BACKGROUND 0x00000080 -#define RBBIM_ID 0x00000100 -#define RBBIM_IDEALSIZE 0x00000200 -#define RBBIM_LPARAM 0x00000400 -#define RBBIM_HEADERSIZE 0x00000800 - -#define RBBS_BREAK 0x00000001 -#define RBBS_FIXEDSIZE 0x00000002 -#define RBBS_CHILDEDGE 0x00000004 -#define RBBS_HIDDEN 0x00000008 -#define RBBS_NOVERT 0x00000010 -#define RBBS_FIXEDBMP 0x00000020 -#define RBBS_VARIABLEHEIGHT 0x00000040 -#define RBBS_GRIPPERALWAYS 0x00000080 -#define RBBS_NOGRIPPER 0x00000100 -#define RBBS_USECHEVRON 0x00000200 -#define RBBS_HIDETITLE 0x00000400 -#define RBBS_TOPALIGN 0x00000800 - -#define RBNM_ID 0x00000001 -#define RBNM_STYLE 0x00000002 -#define RBNM_LPARAM 0x00000004 - -#define RBHT_NOWHERE 0x0001 -#define RBHT_CAPTION 0x0002 -#define RBHT_CLIENT 0x0003 -#define RBHT_GRABBER 0x0004 -#define RBHT_CHEVRON 0x0008 - -#define RB_INSERTBANDA (WM_USER+1) -#define RB_INSERTBANDW (WM_USER+10) -#define RB_INSERTBAND WINELIB_NAME_AW(RB_INSERTBAND) -#define RB_DELETEBAND (WM_USER+2) -#define RB_GETBARINFO (WM_USER+3) -#define RB_SETBARINFO (WM_USER+4) -#define RB_SETBANDINFOA (WM_USER+6) -#define RB_SETBANDINFOW (WM_USER+11) -#define RB_SETBANDINFO WINELIB_NAME_AW(RB_SETBANDINFO) -#define RB_SETPARENT (WM_USER+7) -#define RB_HITTEST (WM_USER+8) -#define RB_GETRECT (WM_USER+9) -#define RB_GETBANDCOUNT (WM_USER+12) -#define RB_GETROWCOUNT (WM_USER+13) -#define RB_GETROWHEIGHT (WM_USER+14) -#define RB_IDTOINDEX (WM_USER+16) -#define RB_GETTOOLTIPS (WM_USER+17) -#define RB_SETTOOLTIPS (WM_USER+18) -#define RB_SETBKCOLOR (WM_USER+19) -#define RB_GETBKCOLOR (WM_USER+20) -#define RB_SETTEXTCOLOR (WM_USER+21) -#define RB_GETTEXTCOLOR (WM_USER+22) -#define RB_SIZETORECT (WM_USER+23) -#define RB_BEGINDRAG (WM_USER+24) -#define RB_ENDDRAG (WM_USER+25) -#define RB_DRAGMOVE (WM_USER+26) -#define RB_GETBARHEIGHT (WM_USER+27) -#define RB_GETBANDINFOW (WM_USER+28) -#define RB_GETBANDINFOA (WM_USER+29) -#define RB_GETBANDINFO WINELIB_NAME_AW(RB_GETBANDINFO) -#define RB_MINIMIZEBAND (WM_USER+30) -#define RB_MAXIMIZEBAND (WM_USER+31) -#define RB_GETBANDBORDERS (WM_USER+34) -#define RB_SHOWBAND (WM_USER+35) -#define RB_SETPALETTE (WM_USER+37) -#define RB_GETPALETTE (WM_USER+38) -#define RB_MOVEBAND (WM_USER+39) -#define RB_GETBANDMARGINS (WM_USER+40) -#define RB_PUSHCHEVRON (WM_USER+43) -#define RB_GETDROPTARGET CCM_GETDROPTARGET -#define RB_SETCOLORSCHEME CCM_SETCOLORSCHEME -#define RB_GETCOLORSCHEME CCM_GETCOLORSCHEME -#define RB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define RB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define RB_SETWINDOWTHEME CCM_SETWINDOWTHEME - -#define RBN_FIRST (0U-831U) -#define RBN_LAST (0U-859U) -#define RBN_HEIGHTCHANGE (RBN_FIRST-0) -#define RBN_GETOBJECT (RBN_FIRST-1) -#define RBN_LAYOUTCHANGED (RBN_FIRST-2) -#define RBN_AUTOSIZE (RBN_FIRST-3) -#define RBN_BEGINDRAG (RBN_FIRST-4) -#define RBN_ENDDRAG (RBN_FIRST-5) -#define RBN_DELETINGBAND (RBN_FIRST-6) -#define RBN_DELETEDBAND (RBN_FIRST-7) -#define RBN_CHILDSIZE (RBN_FIRST-8) -#define RBN_CHEVRONPUSHED (RBN_FIRST-10) -#define RBN_MINMAX (RBN_FIRST-21) -#define RBN_AUTOBREAK (RBN_FIRST-22) - -#define RBSTR_CHANGERECT 0x0001 - -typedef struct tagREBARINFO -{ - UINT cbSize; - UINT fMask; - HIMAGELIST himl; -} REBARINFO, *LPREBARINFO; - -typedef struct tagREBARBANDINFOA -{ - UINT cbSize; - UINT fMask; - UINT fStyle; - COLORREF clrFore; - COLORREF clrBack; - LPSTR lpText; - UINT cch; - INT iImage; - HWND hwndChild; - UINT cxMinChild; - UINT cyMinChild; - UINT cx; - HBITMAP hbmBack; - UINT wID; - UINT cyChild; - UINT cyMaxChild; - UINT cyIntegral; - UINT cxIdeal; - LPARAM lParam; - UINT cxHeader; - /* _WIN32_WINNT >= 0x0600 */ - RECT rcChevronLocation; - UINT uChevronState; -} REBARBANDINFOA, *LPREBARBANDINFOA; - -typedef REBARBANDINFOA const *LPCREBARBANDINFOA; - -typedef struct tagREBARBANDINFOW -{ - UINT cbSize; - UINT fMask; - UINT fStyle; - COLORREF clrFore; - COLORREF clrBack; - LPWSTR lpText; - UINT cch; - INT iImage; - HWND hwndChild; - UINT cxMinChild; - UINT cyMinChild; - UINT cx; - HBITMAP hbmBack; - UINT wID; - UINT cyChild; - UINT cyMaxChild; - UINT cyIntegral; - UINT cxIdeal; - LPARAM lParam; - UINT cxHeader; - /* _WIN32_WINNT >= 0x0600 */ - RECT rcChevronLocation; - UINT uChevronState; -} REBARBANDINFOW, *LPREBARBANDINFOW; - -typedef REBARBANDINFOW const *LPCREBARBANDINFOW; - -#define REBARBANDINFO WINELIB_NAME_AW(REBARBANDINFO) -#define LPREBARBANDINFO WINELIB_NAME_AW(LPREBARBANDINFO) -#define LPCREBARBANDINFO WINELIB_NAME_AW(LPCREBARBANDINFO) - -#define REBARBANDINFOA_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA, wID) -#define REBARBANDINFOW_V3_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW, wID) -#define REBARBANDINFO_V3_SIZE CCSIZEOF_STRUCT(WINELIB_NAME_AW(REBARBANDINFO), wID) -#define REBARBANDINFOA_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOA, cxHeader) -#define REBARBANDINFOW_V6_SIZE CCSIZEOF_STRUCT(REBARBANDINFOW, cxHeader) -#define REBARBANDINFO_V6_SIZE CCSIZEOF_STRUCT(WINELIB_NAME_AW(REBARBANDINFO), cxHeader) - -typedef struct tagNMREBARCHILDSIZE -{ - NMHDR hdr; - UINT uBand; - UINT wID; - RECT rcChild; - RECT rcBand; -} NMREBARCHILDSIZE, *LPNMREBARCHILDSIZE; - -typedef struct tagNMREBAR -{ - NMHDR hdr; - DWORD dwMask; - UINT uBand; - UINT fStyle; - UINT wID; - LPARAM lParam; -} NMREBAR, *LPNMREBAR; - -typedef struct tagNMRBAUTOSIZE -{ - NMHDR hdr; - BOOL fChanged; - RECT rcTarget; - RECT rcActual; -} NMRBAUTOSIZE, *LPNMRBAUTOSIZE; - -typedef struct tagNMREBARCHEVRON -{ - NMHDR hdr; - UINT uBand; - UINT wID; - LPARAM lParam; - RECT rc; - LPARAM lParamNM; -} NMREBARCHEVRON, *LPNMREBARCHEVRON; - -typedef struct _RB_HITTESTINFO -{ + typedef struct _TT_HITTESTINFOA { + HWND hwnd; POINT pt; - UINT flags; - INT iBand; -} RBHITTESTINFO, *LPRBHITTESTINFO; + TTTOOLINFOA ti; + } TTHITTESTINFOA,*LPTTHITTESTINFOA; -#define RBAB_AUTOSIZE 0x0001 -#define RBAB_ADDBAND 0x0002 + typedef struct _TT_HITTESTINFOW { + HWND hwnd; + POINT pt; + TTTOOLINFOW ti; + } TTHITTESTINFOW,*LPTTHITTESTINFOW; -typedef struct tagNMREBARAUTOBREAK -{ - NMHDR hdr; - UINT uBand; - UINT wID; - LPARAM lParam; - UINT uMsg; - UINT fStyleCurrent; - BOOL fAutoBreak; -} NMREBARAUTOBREAK, *LPNMREBARAUTOBREAK; - - -/* Trackbar control */ - -#define TRACKBAR_CLASSA "msctls_trackbar32" -#if defined(__GNUC__) -# define TRACKBAR_CLASSW (const WCHAR []){ 'm','s','c','t','l','s','_', \ - 't','r','a','c','k','b','a','r','3','2',0 } -#elif defined(_MSC_VER) -# define TRACKBAR_CLASSW L"msctls_trackbar32" +#ifdef UNICODE +#define TTHITTESTINFO TTHITTESTINFOW +#define LPTTHITTESTINFO LPTTHITTESTINFOW #else -static const WCHAR TRACKBAR_CLASSW[] = { 'm','s','c','t','l','s','_', - 't','r','a','c','k','b','a','r','3','2',0 }; +#define TTHITTESTINFO TTHITTESTINFOA +#define LPTTHITTESTINFO LPTTHITTESTINFOA #endif -#define TRACKBAR_CLASS WINELIB_NAME_AW(TRACKBAR_CLASS) -#define TBS_AUTOTICKS 0x0001 -#define TBS_VERT 0x0002 -#define TBS_HORZ 0x0000 -#define TBS_TOP 0x0004 -#define TBS_BOTTOM 0x0000 -#define TBS_LEFT 0x0004 -#define TBS_RIGHT 0x0000 -#define TBS_BOTH 0x0008 -#define TBS_NOTICKS 0x0010 -#define TBS_ENABLESELRANGE 0x0020 -#define TBS_FIXEDLENGTH 0x0040 -#define TBS_NOTHUMB 0x0080 -#define TBS_TOOLTIPS 0x0100 -#define TBS_REVERSED 0x0200 -#define TBS_DOWNISLEFT 0x0400 +#define TTN_GETDISPINFOA (TTN_FIRST - 0) +#define TTN_GETDISPINFOW (TTN_FIRST - 10) +#define TTN_SHOW (TTN_FIRST - 1) +#define TTN_POP (TTN_FIRST - 2) +#define TTN_LINKCLICK (TTN_FIRST - 3) -#define TBTS_TOP 0 -#define TBTS_LEFT 1 -#define TBTS_BOTTOM 2 -#define TBTS_RIGHT 3 - -#define TB_LINEUP 0 -#define TB_LINEDOWN 1 -#define TB_PAGEUP 2 -#define TB_PAGEDOWN 3 -#define TB_THUMBPOSITION 4 -#define TB_THUMBTRACK 5 -#define TB_TOP 6 -#define TB_BOTTOM 7 -#define TB_ENDTRACK 8 - -#define TBCD_TICS 0x0001 -#define TBCD_THUMB 0x0002 -#define TBCD_CHANNEL 0x0003 - -#define TBM_GETPOS (WM_USER) -#define TBM_GETRANGEMIN (WM_USER+1) -#define TBM_GETRANGEMAX (WM_USER+2) -#define TBM_GETTIC (WM_USER+3) -#define TBM_SETTIC (WM_USER+4) -#define TBM_SETPOS (WM_USER+5) -#define TBM_SETRANGE (WM_USER+6) -#define TBM_SETRANGEMIN (WM_USER+7) -#define TBM_SETRANGEMAX (WM_USER+8) -#define TBM_CLEARTICS (WM_USER+9) -#define TBM_SETSEL (WM_USER+10) -#define TBM_SETSELSTART (WM_USER+11) -#define TBM_SETSELEND (WM_USER+12) -#define TBM_GETPTICS (WM_USER+14) -#define TBM_GETTICPOS (WM_USER+15) -#define TBM_GETNUMTICS (WM_USER+16) -#define TBM_GETSELSTART (WM_USER+17) -#define TBM_GETSELEND (WM_USER+18) -#define TBM_CLEARSEL (WM_USER+19) -#define TBM_SETTICFREQ (WM_USER+20) -#define TBM_SETPAGESIZE (WM_USER+21) -#define TBM_GETPAGESIZE (WM_USER+22) -#define TBM_SETLINESIZE (WM_USER+23) -#define TBM_GETLINESIZE (WM_USER+24) -#define TBM_GETTHUMBRECT (WM_USER+25) -#define TBM_GETCHANNELRECT (WM_USER+26) -#define TBM_SETTHUMBLENGTH (WM_USER+27) -#define TBM_GETTHUMBLENGTH (WM_USER+28) -#define TBM_SETTOOLTIPS (WM_USER+29) -#define TBM_GETTOOLTIPS (WM_USER+30) -#define TBM_SETTIPSIDE (WM_USER+31) -#define TBM_SETBUDDY (WM_USER+32) -#define TBM_GETBUDDY (WM_USER+33) -#define TBM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define TBM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT - - -/* Pager control */ - -#define WC_PAGESCROLLERA "SysPager" -#if defined(__GNUC__) -# define WC_PAGESCROLLERW (const WCHAR []){ 'S','y','s','P','a','g','e','r',0 } -#elif defined(_MSC_VER) -# define WC_PAGESCROLLERW L"SysPager" +#ifdef UNICODE +#define TTN_GETDISPINFO TTN_GETDISPINFOW #else -static const WCHAR WC_PAGESCROLLERW[] = { 'S','y','s','P','a','g','e','r',0 }; +#define TTN_GETDISPINFO TTN_GETDISPINFOA #endif -#define WC_PAGESCROLLER WINELIB_NAME_AW(WC_PAGESCROLLER) -#define PGS_VERT 0x00000000 -#define PGS_HORZ 0x00000001 -#define PGS_AUTOSCROLL 0x00000002 -#define PGS_DRAGNDROP 0x00000004 +#define TTN_NEEDTEXT TTN_GETDISPINFO +#define TTN_NEEDTEXTA TTN_GETDISPINFOA +#define TTN_NEEDTEXTW TTN_GETDISPINFOW -#define PGF_INVISIBLE 0 -#define PGF_NORMAL 1 -#define PGF_GRAYED 2 -#define PGF_DEPRESSED 4 -#define PGF_HOT 8 +#define TOOLTIPTEXTW NMTTDISPINFOW +#define TOOLTIPTEXTA NMTTDISPINFOA +#define LPTOOLTIPTEXTA LPNMTTDISPINFOA +#define LPTOOLTIPTEXTW LPNMTTDISPINFOW -#define PGB_TOPORLEFT 0 -#define PGB_BOTTOMORRIGHT 1 +#define TOOLTIPTEXT NMTTDISPINFO +#define LPTOOLTIPTEXT LPNMTTDISPINFO -/* only used with PGN_SCROLL */ -#define PGF_SCROLLUP 1 -#define PGF_SCROLLDOWN 2 -#define PGF_SCROLLLEFT 4 -#define PGF_SCROLLRIGHT 8 +#define NMTTDISPINFOA_V1_SIZE CCSIZEOF_STRUCT(NMTTDISPINFOA,uFlags) +#define NMTTDISPINFOW_V1_SIZE CCSIZEOF_STRUCT(NMTTDISPINFOW,uFlags) -#define PGK_SHIFT 1 -#define PGK_CONTROL 2 -#define PGK_MENU 4 - -/* only used with PGN_CALCSIZE */ -#define PGF_CALCWIDTH 1 -#define PGF_CALCHEIGHT 2 - -#define PGM_FIRST 0x1400 -#define PGM_SETCHILD (PGM_FIRST+1) -#define PGM_RECALCSIZE (PGM_FIRST+2) -#define PGM_FORWARDMOUSE (PGM_FIRST+3) -#define PGM_SETBKCOLOR (PGM_FIRST+4) -#define PGM_GETBKCOLOR (PGM_FIRST+5) -#define PGM_SETBORDER (PGM_FIRST+6) -#define PGM_GETBORDER (PGM_FIRST+7) -#define PGM_SETPOS (PGM_FIRST+8) -#define PGM_GETPOS (PGM_FIRST+9) -#define PGM_SETBUTTONSIZE (PGM_FIRST+10) -#define PGM_GETBUTTONSIZE (PGM_FIRST+11) -#define PGM_GETBUTTONSTATE (PGM_FIRST+12) -#define PGM_GETDROPTARGET CCM_GETDROPTARGET - -#define PGN_FIRST (0U-900U) -#define PGN_LAST (0U-950U) -#define PGN_SCROLL (PGN_FIRST-1) -#define PGN_CALCSIZE (PGN_FIRST-2) - -#include - -typedef struct -{ + typedef struct tagNMTTDISPINFOA { NMHDR hdr; - WORD fwKeys; - RECT rcParent; - INT iDir; - INT iXpos; - INT iYpos; - INT iScroll; -} NMPGSCROLL, *LPNMPGSCROLL; + LPSTR lpszText; + char szText[80]; + HINSTANCE hinst; + UINT uFlags; + LPARAM lParam; + } NMTTDISPINFOA,*LPNMTTDISPINFOA; -#include - -typedef struct -{ + typedef struct tagNMTTDISPINFOW { NMHDR hdr; - DWORD dwFlag; - INT iWidth; - INT iHeight; -} NMPGCALCSIZE, *LPNMPGCALCSIZE; + LPWSTR lpszText; + WCHAR szText[80]; + HINSTANCE hinst; + UINT uFlags; + LPARAM lParam; + } NMTTDISPINFOW,*LPNMTTDISPINFOW; - -/* Treeview control */ - -#define WC_TREEVIEWA "SysTreeView32" -#if defined(__GNUC__) -# define WC_TREEVIEWW (const WCHAR []){ 'S','y','s', \ - 'T','r','e','e','V','i','e','w','3','2',0 } -#elif defined(_MSC_VER) -# define WC_TREEVIEWW L"SysTreeView32" +#ifdef UNICODE +#define NMTTDISPINFO NMTTDISPINFOW +#define LPNMTTDISPINFO LPNMTTDISPINFOW +#define NMTTDISPINFO_V1_SIZE NMTTDISPINFOW_V1_SIZE #else -static const WCHAR WC_TREEVIEWW[] = { 'S','y','s', - 'T','r','e','e','V','i','e','w','3','2',0 }; +#define NMTTDISPINFO NMTTDISPINFOA +#define LPNMTTDISPINFO LPNMTTDISPINFOA +#define NMTTDISPINFO_V1_SIZE NMTTDISPINFOA_V1_SIZE +#endif #endif -#define WC_TREEVIEW WINELIB_NAME_AW(WC_TREEVIEW) -#define TVSIL_NORMAL 0 -#define TVSIL_STATE 2 +#ifndef NOSTATUSBAR -#define TV_FIRST 0x1100 -#define TVM_INSERTITEMA (TV_FIRST+0) -#define TVM_INSERTITEMW (TV_FIRST+50) -#define TVM_INSERTITEM WINELIB_NAME_AW(TVM_INSERTITEM) -#define TVM_DELETEITEM (TV_FIRST+1) -#define TVM_EXPAND (TV_FIRST+2) -#define TVM_GETITEMRECT (TV_FIRST+4) -#define TVM_GETCOUNT (TV_FIRST+5) -#define TVM_GETINDENT (TV_FIRST+6) -#define TVM_SETINDENT (TV_FIRST+7) -#define TVM_GETIMAGELIST (TV_FIRST+8) -#define TVM_SETIMAGELIST (TV_FIRST+9) -#define TVM_GETNEXTITEM (TV_FIRST+10) -#define TVM_SELECTITEM (TV_FIRST+11) -#define TVM_GETITEMA (TV_FIRST+12) -#define TVM_GETITEMW (TV_FIRST+62) -#define TVM_GETITEM WINELIB_NAME_AW(TVM_GETITEM) -#define TVM_SETITEMA (TV_FIRST+13) -#define TVM_SETITEMW (TV_FIRST+63) -#define TVM_SETITEM WINELIB_NAME_AW(TVM_SETITEM) -#define TVM_EDITLABELA (TV_FIRST+14) -#define TVM_EDITLABELW (TV_FIRST+65) -#define TVM_EDITLABEL WINELIB_NAME_AW(TVM_EDITLABEL) -#define TVM_GETEDITCONTROL (TV_FIRST+15) -#define TVM_GETVISIBLECOUNT (TV_FIRST+16) -#define TVM_HITTEST (TV_FIRST+17) -#define TVM_CREATEDRAGIMAGE (TV_FIRST+18) -#define TVM_SORTCHILDREN (TV_FIRST+19) -#define TVM_ENSUREVISIBLE (TV_FIRST+20) -#define TVM_SORTCHILDRENCB (TV_FIRST+21) -#define TVM_ENDEDITLABELNOW (TV_FIRST+22) -#define TVM_GETISEARCHSTRINGA (TV_FIRST+23) -#define TVM_GETISEARCHSTRINGW (TV_FIRST+64) -#define TVM_GETISEARCHSTRING WINELIB_NAME_AW(TVM_GETISEARCHSTRING) -#define TVM_SETTOOLTIPS (TV_FIRST+24) -#define TVM_GETTOOLTIPS (TV_FIRST+25) -#define TVM_SETINSERTMARK (TV_FIRST+26) -#define TVM_SETITEMHEIGHT (TV_FIRST+27) -#define TVM_GETITEMHEIGHT (TV_FIRST+28) -#define TVM_SETBKCOLOR (TV_FIRST+29) -#define TVM_SETTEXTCOLOR (TV_FIRST+30) -#define TVM_GETBKCOLOR (TV_FIRST+31) -#define TVM_GETTEXTCOLOR (TV_FIRST+32) -#define TVM_SETSCROLLTIME (TV_FIRST+33) -#define TVM_GETSCROLLTIME (TV_FIRST+34) -#define TVM_UNKNOWN35 (TV_FIRST+35) -#define TVM_UNKNOWN36 (TV_FIRST+36) -#define TVM_SETINSERTMARKCOLOR (TV_FIRST+37) -#define TVM_GETINSERTMARKCOLOR (TV_FIRST+38) -#define TVM_GETITEMSTATE (TV_FIRST+39) -#define TVM_SETLINECOLOR (TV_FIRST+40) -#define TVM_GETLINECOLOR (TV_FIRST+41) -#define TVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define TVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define TVM_MAPACCIDTOHTREEITEM (TV_FIRST + 42) -#define TVM_MAPHTREEITEMTOACCID (TV_FIRST + 43) +#define SBARS_SIZEGRIP 0x100 +#define SBARS_TOOLTIPS 0x800 +#define SBT_TOOLTIPS 0x800 + WINCOMMCTRLAPI void WINAPI DrawStatusTextA(HDC hDC,LPCRECT lprc,LPCSTR pszText,UINT uFlags); + WINCOMMCTRLAPI void WINAPI DrawStatusTextW(HDC hDC,LPCRECT lprc,LPCWSTR pszText,UINT uFlags); -#define TVN_FIRST (0U-400U) -#define TVN_LAST (0U-499U) + WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowA(LONG style,LPCSTR lpszText,HWND hwndParent,UINT wID); + WINCOMMCTRLAPI HWND WINAPI CreateStatusWindowW(LONG style,LPCWSTR lpszText,HWND hwndParent,UINT wID); -#define TVN_SELCHANGINGA (TVN_FIRST-1) -#define TVN_SELCHANGINGW (TVN_FIRST-50) -#define TVN_SELCHANGING WINELIB_NAME_AW(TVN_SELCHANGING) - -#define TVN_SELCHANGEDA (TVN_FIRST-2) -#define TVN_SELCHANGEDW (TVN_FIRST-51) -#define TVN_SELCHANGED WINELIB_NAME_AW(TVN_SELCHANGED) - -#define TVN_GETDISPINFOA (TVN_FIRST-3) -#define TVN_GETDISPINFOW (TVN_FIRST-52) -#define TVN_GETDISPINFO WINELIB_NAME_AW(TVN_GETDISPINFO) - -#define TVN_SETDISPINFOA (TVN_FIRST-4) -#define TVN_SETDISPINFOW (TVN_FIRST-53) -#define TVN_SETDISPINFO WINELIB_NAME_AW(TVN_SETDISPINFO) - -#define TVN_ITEMEXPANDINGA (TVN_FIRST-5) -#define TVN_ITEMEXPANDINGW (TVN_FIRST-54) -#define TVN_ITEMEXPANDING WINELIB_NAME_AW(TVN_ITEMEXPANDING) - -#define TVN_ITEMEXPANDEDA (TVN_FIRST-6) -#define TVN_ITEMEXPANDEDW (TVN_FIRST-55) -#define TVN_ITEMEXPANDED WINELIB_NAME_AW(TVN_ITEMEXPANDED) - -#define TVN_BEGINDRAGA (TVN_FIRST-7) -#define TVN_BEGINDRAGW (TVN_FIRST-56) -#define TVN_BEGINDRAG WINELIB_NAME_AW(TVN_BEGINDRAG) - -#define TVN_BEGINRDRAGA (TVN_FIRST-8) -#define TVN_BEGINRDRAGW (TVN_FIRST-57) -#define TVN_BEGINRDRAG WINELIB_NAME_AW(TVN_BEGINRDRAG) - -#define TVN_DELETEITEMA (TVN_FIRST-9) -#define TVN_DELETEITEMW (TVN_FIRST-58) -#define TVN_DELETEITEM WINELIB_NAME_AW(TVN_DELETEITEM) - -#define TVN_BEGINLABELEDITA (TVN_FIRST-10) -#define TVN_BEGINLABELEDITW (TVN_FIRST-59) -#define TVN_BEGINLABELEDIT WINELIB_NAME_AW(TVN_BEGINLABELEDIT) - -#define TVN_ENDLABELEDITA (TVN_FIRST-11) -#define TVN_ENDLABELEDITW (TVN_FIRST-60) -#define TVN_ENDLABELEDIT WINELIB_NAME_AW(TVN_ENDLABELEDIT) - -#define TVN_KEYDOWN (TVN_FIRST-12) - -#define TVN_GETINFOTIPA (TVN_FIRST-13) -#define TVN_GETINFOTIPW (TVN_FIRST-14) -#define TVN_GETINFOTIP WINELIB_NAME_AW(TVN_GETINFOTIP) - -#define TVN_SINGLEEXPAND (TVN_FIRST-15) - - - - - -#define TVIF_TEXT 0x0001 -#define TVIF_IMAGE 0x0002 -#define TVIF_PARAM 0x0004 -#define TVIF_STATE 0x0008 -#define TVIF_HANDLE 0x0010 -#define TVIF_SELECTEDIMAGE 0x0020 -#define TVIF_CHILDREN 0x0040 -#define TVIF_INTEGRAL 0x0080 -#define TVIF_DI_SETITEM 0x1000 - -#define TVI_ROOT ((HTREEITEM)-65536) -#define TVI_FIRST ((HTREEITEM)-65535) -#define TVI_LAST ((HTREEITEM)-65534) -#define TVI_SORT ((HTREEITEM)-65533) - -#define TVIS_FOCUSED 0x0001 -#define TVIS_SELECTED 0x0002 -#define TVIS_CUT 0x0004 -#define TVIS_DROPHILITED 0x0008 -#define TVIS_BOLD 0x0010 -#define TVIS_EXPANDED 0x0020 -#define TVIS_EXPANDEDONCE 0x0040 -#define TVIS_EXPANDPARTIAL 0x0080 -#define TVIS_OVERLAYMASK 0x0f00 -#define TVIS_STATEIMAGEMASK 0xf000 -#define TVIS_USERMASK 0xf000 - -#define TVHT_NOWHERE 0x0001 -#define TVHT_ONITEMICON 0x0002 -#define TVHT_ONITEMLABEL 0x0004 -#define TVHT_ONITEMINDENT 0x0008 -#define TVHT_ONITEMBUTTON 0x0010 -#define TVHT_ONITEMRIGHT 0x0020 -#define TVHT_ONITEMSTATEICON 0x0040 -#define TVHT_ONITEM 0x0046 -#define TVHT_ABOVE 0x0100 -#define TVHT_BELOW 0x0200 -#define TVHT_TORIGHT 0x0400 -#define TVHT_TOLEFT 0x0800 - -#define TVS_HASBUTTONS 0x0001 -#define TVS_HASLINES 0x0002 -#define TVS_LINESATROOT 0x0004 -#define TVS_EDITLABELS 0x0008 -#define TVS_DISABLEDRAGDROP 0x0010 -#define TVS_SHOWSELALWAYS 0x0020 -#define TVS_RTLREADING 0x0040 -#define TVS_NOTOOLTIPS 0x0080 -#define TVS_CHECKBOXES 0x0100 -#define TVS_TRACKSELECT 0x0200 -#define TVS_SINGLEEXPAND 0x0400 -#define TVS_INFOTIP 0x0800 -#define TVS_FULLROWSELECT 0x1000 -#define TVS_NOSCROLL 0x2000 -#define TVS_NONEVENHEIGHT 0x4000 -#define TVS_NOHSCROLL 0x8000 - -#define TVS_SHAREDIMAGELISTS 0x0000 -#define TVS_PRIVATEIMAGELISTS 0x0400 - - -#define TVE_COLLAPSE 0x0001 -#define TVE_EXPAND 0x0002 -#define TVE_TOGGLE 0x0003 -#define TVE_EXPANDPARTIAL 0x4000 -#define TVE_COLLAPSERESET 0x8000 - -#define TVGN_ROOT 0 -#define TVGN_NEXT 1 -#define TVGN_PREVIOUS 2 -#define TVGN_PARENT 3 -#define TVGN_CHILD 4 -#define TVGN_FIRSTVISIBLE 5 -#define TVGN_NEXTVISIBLE 6 -#define TVGN_PREVIOUSVISIBLE 7 -#define TVGN_DROPHILITE 8 -#define TVGN_CARET 9 -#define TVGN_LASTVISIBLE 10 -#define TVSI_NOSINGLEEXPAND 0x8000 - -#define TVC_UNKNOWN 0x00 -#define TVC_BYMOUSE 0x01 -#define TVC_BYKEYBOARD 0x02 - - -typedef struct _TREEITEM *HTREEITEM; - -typedef struct { - UINT mask; - HTREEITEM hItem; - UINT state; - UINT stateMask; - LPSTR pszText; - INT cchTextMax; - INT iImage; - INT iSelectedImage; - INT cChildren; - LPARAM lParam; -} TVITEMA, *LPTVITEMA; - -typedef struct { - UINT mask; - HTREEITEM hItem; - UINT state; - UINT stateMask; - LPWSTR pszText; - INT cchTextMax; - INT iImage; - INT iSelectedImage; - INT cChildren; - LPARAM lParam; -} TVITEMW, *LPTVITEMW; - -#define TV_ITEMA TVITEMA -#define TV_ITEMW TVITEMW -#define LPTV_ITEMA LPTVITEMA -#define LPTV_ITEMW LPTVITEMW - -#define TVITEM WINELIB_NAME_AW(TVITEM) -#define LPTVITEM WINELIB_NAME_AW(LPTVITEM) -#define TV_ITEM WINELIB_NAME_AW(TV_ITEM) -#define LPTV_ITEM WINELIB_NAME_AW(LPTV_ITEM) - -typedef struct { - UINT mask; - HTREEITEM hItem; - UINT state; - UINT stateMask; - LPSTR pszText; - INT cchTextMax; - INT iImage; - INT iSelectedImage; - INT cChildren; - LPARAM lParam; - INT iIntegral; - UINT uStateEx; /* _WIN32_IE >= 0x600 */ - HWND hwnd; /* _WIN32_IE >= 0x600 */ - INT iExpandedImage; /* _WIN32_IE >= 0x600 */ -} TVITEMEXA, *LPTVITEMEXA; - -typedef struct { - UINT mask; - HTREEITEM hItem; - UINT state; - UINT stateMask; - LPWSTR pszText; - INT cchTextMax; - INT iImage; - INT iSelectedImage; - INT cChildren; - LPARAM lParam; - INT iIntegral; - UINT uStateEx; /* _WIN32_IE >= 0x600 */ - HWND hwnd; /* _WIN32_IE >= 0x600 */ - INT iExpandedImage; /* _WIN32_IE >= 0x600 */ -} TVITEMEXW, *LPTVITEMEXW; - -#define TVITEMEX WINELIB_NAME_AW(TVITEMEX) -#define LPTVITEMEX WINELIB_NAME_AW(LPTVITEMEX) - -typedef struct tagTVINSERTSTRUCTA { - HTREEITEM hParent; - HTREEITEM hInsertAfter; - union { - TVITEMEXA itemex; - TVITEMA item; - } DUMMYUNIONNAME; -} TVINSERTSTRUCTA, *LPTVINSERTSTRUCTA; - -typedef struct tagTVINSERTSTRUCTW { - HTREEITEM hParent; - HTREEITEM hInsertAfter; - union { - TVITEMEXW itemex; - TVITEMW item; - } DUMMYUNIONNAME; -} TVINSERTSTRUCTW, *LPTVINSERTSTRUCTW; - -#define TVINSERTSTRUCT WINELIB_NAME_AW(TVINSERTSTRUCT) -#define LPTVINSERTSTRUCT WINELIB_NAME_AW(LPTVINSERTSTRUCT) - -#define TVINSERTSTRUCT_V1_SIZEA CCSIZEOF_STRUCT(TVINSERTSTRUCTA, item) -#define TVINSERTSTRUCT_V1_SIZEW CCSIZEOF_STRUCT(TVINSERTSTRUCTW, item) -#define TVINSERTSTRUCT_V1_SIZE WINELIB_NAME_AW(TVINSERTSTRUCT_V1_SIZE) - -#define TV_INSERTSTRUCT TVINSERTSTRUCT -#define TV_INSERTSTRUCTA TVINSERTSTRUCTA -#define TV_INSERTSTRUCTW TVINSERTSTRUCTW -#define LPTV_INSERTSTRUCT LPTVINSERTSTRUCT -#define LPTV_INSERTSTRUCTA LPTVINSERTSTRUCTA -#define LPTV_INSERTSTRUCTW LPTVINSERTSTRUCTW - - - -typedef struct tagNMTREEVIEWA { - NMHDR hdr; - UINT action; - TVITEMA itemOld; - TVITEMA itemNew; - POINT ptDrag; -} NMTREEVIEWA, *LPNMTREEVIEWA; - -typedef struct tagNMTREEVIEWW { - NMHDR hdr; - UINT action; - TVITEMW itemOld; - TVITEMW itemNew; - POINT ptDrag; -} NMTREEVIEWW, *LPNMTREEVIEWW; - -#define NMTREEVIEW WINELIB_NAME_AW(NMTREEVIEW) -#define NM_TREEVIEW WINELIB_NAME_AW(NMTREEVIEW) -#define NM_TREEVIEWA NMTREEVIEWA -#define NM_TREEVIEWW NMTREEVIEWW -#define LPNMTREEVIEW WINELIB_NAME_AW(LPNMTREEVIEW) - -#define LPNM_TREEVIEW LPNMTREEVIEW -#define LPNM_TREEVIEWA LPNMTREEVIEWA -#define LPNM_TREEVIEWW LPNMTREEVIEWW - -typedef struct tagTVDISPINFOA { - NMHDR hdr; - TVITEMA item; -} NMTVDISPINFOA, *LPNMTVDISPINFOA; - -typedef struct tagTVDISPINFOW { - NMHDR hdr; - TVITEMW item; -} NMTVDISPINFOW, *LPNMTVDISPINFOW; - -typedef struct tagTVDISPINFOEXA { - NMHDR hdr; - TVITEMEXA item; -} NMTVDISPINFOEXA, *LPNMTVDISPINFOEXA; - -typedef struct tagTVDISPINFOEXW { - NMHDR hdr; - TVITEMEXW item; -} NMTVDISPINFOEXW, *LPNMTVDISPINFOEXW; - -#define NMTVDISPINFO WINELIB_NAME_AW(NMTVDISPINFO) -#define LPNMTVDISPINFO WINELIB_NAME_AW(LPNMTVDISPINFO) -#define NMTVDISPINFOEX WINELIB_NAME_AW(NMTVDISPINFOEX) -#define LPNMTVDISPINFOEX WINELIB_NAME_AW(LPNMTVDISPINFOEX) -#define TV_DISPINFOA NMTVDISPINFOA -#define TV_DISPINFOW NMTVDISPINFOW -#define TV_DISPINFO NMTVDISPINFO - -typedef INT (CALLBACK *PFNTVCOMPARE)(LPARAM, LPARAM, LPARAM); - -typedef struct tagTVSORTCB -{ - HTREEITEM hParent; - PFNTVCOMPARE lpfnCompare; - LPARAM lParam; -} TVSORTCB, *LPTVSORTCB; - -#define TV_SORTCB TVSORTCB -#define LPTV_SORTCB LPTVSORTCB - -typedef struct tagTVHITTESTINFO { - POINT pt; - UINT flags; - HTREEITEM hItem; -} TVHITTESTINFO, *LPTVHITTESTINFO; - -#define TV_HITTESTINFO TVHITTESTINFO - - -/* Custom Draw Treeview */ - -#define NMTVCUSTOMDRAW_V3_SIZE CCSIZEOF_STRUCT(NMTVCUSTOMDRAW, clrTextBk) - -#define TVCDRF_NOIMAGES 0x00010000 - -typedef struct tagNMTVCUSTOMDRAW -{ - NMCUSTOMDRAW nmcd; - COLORREF clrText; - COLORREF clrTextBk; - INT iLevel; /* IE>0x0400 */ -} NMTVCUSTOMDRAW, *LPNMTVCUSTOMDRAW; - -/* Treeview tooltips */ - -typedef struct tagNMTVGETINFOTIPA -{ - NMHDR hdr; - LPSTR pszText; - INT cchTextMax; - HTREEITEM hItem; - LPARAM lParam; -} NMTVGETINFOTIPA, *LPNMTVGETINFOTIPA; - -typedef struct tagNMTVGETINFOTIPW -{ - NMHDR hdr; - LPWSTR pszText; - INT cchTextMax; - HTREEITEM hItem; - LPARAM lParam; -} NMTVGETINFOTIPW, *LPNMTVGETINFOTIPW; - -#define NMTVGETINFOTIP WINELIB_NAME_AW(NMTVGETINFOTIP) -#define LPNMTVGETINFOTIP WINELIB_NAME_AW(LPNMTVGETINFOTIP) - -#include -typedef struct tagTVKEYDOWN -{ - NMHDR hdr; - WORD wVKey; - UINT flags; -} NMTVKEYDOWN, *LPNMTVKEYDOWN; -#include - -#define TV_KEYDOWN NMTVKEYDOWN - -#define TreeView_InsertItemA(hwnd, phdi) \ - (HTREEITEM)SNDMSGA((hwnd), TVM_INSERTITEMA, 0, \ - (LPARAM)(LPTVINSERTSTRUCTA)(phdi)) -#define TreeView_InsertItemW(hwnd,phdi) \ - (HTREEITEM)SNDMSGW((hwnd), TVM_INSERTITEMW, 0, \ - (LPARAM)(LPTVINSERTSTRUCTW)(phdi)) -#define TreeView_InsertItem WINELIB_NAME_AW(TreeView_InsertItem) - -#define TreeView_DeleteItem(hwnd, hItem) \ - (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)(HTREEITEM)(hItem)) -#define TreeView_DeleteAllItems(hwnd) \ - (BOOL)SNDMSG((hwnd), TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT) -#define TreeView_Expand(hwnd, hitem, code) \ - (BOOL)SNDMSG((hwnd), TVM_EXPAND, (WPARAM)code, \ - (LPARAM)(HTREEITEM)(hitem)) - -#define TreeView_GetItemRect(hwnd, hitem, prc, code) \ - (*(HTREEITEM *)prc = (hitem), (BOOL)SNDMSG((hwnd), \ - TVM_GETITEMRECT, (WPARAM)(code), (LPARAM)(RECT *)(prc))) - -#define TreeView_GetCount(hwnd) \ - (UINT)SNDMSG((hwnd), TVM_GETCOUNT, 0, 0) -#define TreeView_GetIndent(hwnd) \ - (UINT)SNDMSG((hwnd), TVM_GETINDENT, 0, 0) -#define TreeView_SetIndent(hwnd, indent) \ - (BOOL)SNDMSG((hwnd), TVM_SETINDENT, (WPARAM)indent, 0) - -#define TreeView_GetImageList(hwnd, iImage) \ - (HIMAGELIST)SNDMSG((hwnd), TVM_GETIMAGELIST, iImage, 0) - -#define TreeView_SetImageList(hwnd, himl, iImage) \ - (HIMAGELIST)SNDMSG((hwnd), TVM_SETIMAGELIST, iImage, \ - (LPARAM)(HIMAGELIST)(himl)) - -#define TreeView_GetNextItem(hwnd, hitem, code) \ - (HTREEITEM)SNDMSG((hwnd), TVM_GETNEXTITEM, (WPARAM)code,\ -(LPARAM)(HTREEITEM) (hitem)) - -#define TreeView_GetChild(hwnd, hitem) \ - TreeView_GetNextItem(hwnd, hitem , TVGN_CHILD) -#define TreeView_GetNextSibling(hwnd, hitem) \ - TreeView_GetNextItem(hwnd, hitem , TVGN_NEXT) -#define TreeView_GetPrevSibling(hwnd, hitem) \ - TreeView_GetNextItem(hwnd, hitem , TVGN_PREVIOUS) -#define TreeView_GetParent(hwnd, hitem) \ - TreeView_GetNextItem(hwnd, hitem , TVGN_PARENT) -#define TreeView_GetFirstVisible(hwnd) \ - TreeView_GetNextItem(hwnd, NULL, TVGN_FIRSTVISIBLE) -#define TreeView_GetLastVisible(hwnd) \ - TreeView_GetNextItem(hwnd, NULL, TVGN_LASTVISIBLE) -#define TreeView_GetNextVisible(hwnd, hitem) \ - TreeView_GetNextItem(hwnd, hitem , TVGN_NEXTVISIBLE) -#define TreeView_GetPrevVisible(hwnd, hitem) \ - TreeView_GetNextItem(hwnd, hitem , TVGN_PREVIOUSVISIBLE) -#define TreeView_GetSelection(hwnd) \ - TreeView_GetNextItem(hwnd, NULL, TVGN_CARET) -#define TreeView_GetDropHilight(hwnd) \ - TreeView_GetNextItem(hwnd, NULL, TVGN_DROPHILITE) -#define TreeView_GetRoot(hwnd) \ - TreeView_GetNextItem(hwnd, NULL, TVGN_ROOT) -#define TreeView_GetLastVisible(hwnd) \ - TreeView_GetNextItem(hwnd, NULL, TVGN_LASTVISIBLE) - - -#define TreeView_Select(hwnd, hitem, code) \ - (BOOL)SNDMSG((hwnd), TVM_SELECTITEM, (WPARAM)(code), \ -(LPARAM)(HTREEITEM)(hitem)) - - -#define TreeView_SelectItem(hwnd, hitem) \ - TreeView_Select(hwnd, hitem, TVGN_CARET) -#define TreeView_SelectDropTarget(hwnd, hitem) \ - TreeView_Select(hwnd, hitem, TVGN_DROPHILITE) -#define TreeView_SelectSetFirstVisible(hwnd, hitem) \ - TreeView_Select(hwnd, hitem, TVGN_FIRSTVISIBLE) - - -#define TreeView_GetItemA(hwnd, pitem) \ - (BOOL)SNDMSGA((hwnd), TVM_GETITEMA, 0, (LPARAM) (TVITEMA *)(pitem)) -#define TreeView_GetItemW(hwnd, pitem) \ - (BOOL)SNDMSGW((hwnd), TVM_GETITEMW, 0, (LPARAM) (TVITEMW *)(pitem)) -#define TreeView_GetItem WINELIB_NAME_AW(TreeView_GetItem) - -#define TreeView_SetItemA(hwnd, pitem) \ - (BOOL)SNDMSGA((hwnd), TVM_SETITEMA, 0, (LPARAM)(const TVITEMA *)(pitem)) -#define TreeView_SetItemW(hwnd, pitem) \ - (BOOL)SNDMSGW((hwnd), TVM_SETITEMW, 0, (LPARAM)(const TVITEMW *)(pitem)) -#define TreeView_SetItem WINELIB_NAME_AW(TreeView_SetItem) - -#define TreeView_EditLabel(hwnd, hitem) \ - (HWND)SNDMSG((hwnd), TVM_EDITLABEL, 0, (LPARAM)(HTREEITEM)(hitem)) - -#define TreeView_GetEditControl(hwnd) \ - (HWND)SNDMSG((hwnd), TVM_GETEDITCONTROL, 0, 0) - -#define TreeView_GetVisibleCount(hwnd) \ - (UINT)SNDMSG((hwnd), TVM_GETVISIBLECOUNT, 0, 0) - -#define TreeView_HitTest(hwnd, lpht) \ - (HTREEITEM)SNDMSG((hwnd), TVM_HITTEST, 0,\ -(LPARAM)(LPTVHITTESTINFO)(lpht)) - -#define TreeView_CreateDragImage(hwnd, hitem) \ - (HIMAGELIST)SNDMSG((hwnd), TVM_CREATEDRAGIMAGE, 0,\ -(LPARAM)(HTREEITEM)(hitem)) - -#define TreeView_SortChildren(hwnd, hitem, recurse) \ - (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)recurse,\ -(LPARAM)(HTREEITEM)(hitem)) - -#define TreeView_EnsureVisible(hwnd, hitem) \ - (BOOL)SNDMSG((hwnd), TVM_ENSUREVISIBLE, 0, (LPARAM)(UINT)(hitem)) - -#define TreeView_SortChildrenCB(hwnd, psort, recurse) \ - (BOOL)SNDMSG((hwnd), TVM_SORTCHILDRENCB, (WPARAM)recurse, \ - (LPARAM)(LPTV_SORTCB)(psort)) - -#define TreeView_EndEditLabelNow(hwnd, fCancel) \ - (BOOL)SNDMSG((hwnd), TVM_ENDEDITLABELNOW, (WPARAM)fCancel, 0) - -#define TreeView_GetISearchString(hwnd, lpsz) \ - (BOOL)SNDMSG((hwnd), TVM_GETISEARCHSTRING, 0, \ - (LPARAM)(LPTSTR)lpsz) - -#define TreeView_SetToolTips(hwnd, hwndTT) \ - (HWND)SNDMSG((hwnd), TVM_SETTOOLTIPS, (WPARAM)(hwndTT), 0) - -#define TreeView_GetToolTips(hwnd) \ - (HWND)SNDMSG((hwnd), TVM_GETTOOLTIPS, 0, 0) - -#define TreeView_SetItemHeight(hwnd, iHeight) \ - (INT)SNDMSG((hwnd), TVM_SETITEMHEIGHT, (WPARAM)iHeight, 0) - -#define TreeView_GetItemHeight(hwnd) \ - (INT)SNDMSG((hwnd), TVM_GETITEMHEIGHT, 0, 0) - -#define TreeView_SetBkColor(hwnd, clr) \ - (COLORREF)SNDMSG((hwnd), TVM_SETBKCOLOR, 0, (LPARAM)clr) - -#define TreeView_SetTextColor(hwnd, clr) \ - (COLORREF)SNDMSG((hwnd), TVM_SETTEXTCOLOR, 0, (LPARAM)clr) - -#define TreeView_GetBkColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), TVM_GETBKCOLOR, 0, 0) - -#define TreeView_GetTextColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), TVM_GETTEXTCOLOR, 0, 0) - -#define TreeView_SetScrollTime(hwnd, uTime) \ - (UINT)SNDMSG((hwnd), TVM_SETSCROLLTIME, uTime, 0) - -#define TreeView_GetScrollTime(hwnd) \ - (UINT)SNDMSG((hwnd), TVM_GETSCROLLTIME, 0, 0) - -#define TreeView_SetInsertMark(hwnd, hItem, fAfter) \ - (BOOL)SNDMSG((hwnd), TVM_SETINSERTMARK, (WPARAM)(fAfter), \ - (LPARAM) (hItem)) - -#define TreeView_SetInsertMarkColor(hwnd, clr) \ - (COLORREF)SNDMSG((hwnd), TVM_SETINSERTMARKCOLOR, 0, (LPARAM)clr) - -#define TreeView_GetInsertMarkColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), TVM_GETINSERTMARKCOLOR, 0, 0) - -#define TreeView_SetItemState(hwndTV, hti, data, _mask) \ -{ TVITEM _TVi; \ - _TVi.mask = TVIF_STATE; \ - _TVi.hItem = hti; \ - _TVi.stateMask = _mask; \ - _TVi.state = data; \ - SNDMSG((hwndTV), TVM_SETITEM, 0, (LPARAM)&_TVi); \ -} - -#define TreeView_GetItemState(hwndTV, hti, mask) \ - (UINT)SNDMSG((hwndTV), TVM_GETITEMSTATE, (WPARAM)(hti), (LPARAM)(mask)) -#define TreeView_GetCheckState(hwndTV, hti) \ - ((((UINT)(SNDMSG((hwndTV), TVM_GETITEMSTATE, (WPARAM)(hti), \ - TVIS_STATEIMAGEMASK))) >> 12) -1) - -#define TreeView_SetLineColor(hwnd, clr) \ - (COLORREF)SNDMSG((hwnd), TVM_SETLINECOLOR, 0, (LPARAM)(clr)) - -#define TreeView_GetLineColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), TVM_GETLINECOLOR, 0, 0) - -#define TreeView_MapAccIDToHTREEITEM(hwnd, id) \ - (HTREEITEM)SNDMSG((hwnd), TVM_MAPACCIDTOHTREEITEM, id, 0) - -#define TreeView_MapHTREEITEMToAccID(hwnd, htreeitem) \ - (UINT)SNDMSG((hwnd), TVM_MAPHTREEITEMTOACCID, (WPARAM)htreeitem, 0) - -#define TreeView_SetUnicodeFormat(hwnd, fUnicode) \ - (BOOL)SNDMSG((hwnd), TVM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0) -#define TreeView_GetUnicodeFormat(hwnd) \ - (BOOL)SNDMSG((hwnd), TVM_GETUNICODEFORMAT, 0, 0) - -/* Listview control */ - -#define WC_LISTVIEWA "SysListView32" -#if defined(__GNUC__) -# define WC_LISTVIEWW (const WCHAR []){ 'S','y','s', \ - 'L','i','s','t','V','i','e','w','3','2',0 } -#elif defined(_MSC_VER) -# define WC_LISTVIEWW L"SysListView32" +#ifdef UNICODE +#define CreateStatusWindow CreateStatusWindowW +#define DrawStatusText DrawStatusTextW #else -static const WCHAR WC_LISTVIEWW[] = { 'S','y','s', - 'L','i','s','t','V','i','e','w','3','2',0 }; +#define CreateStatusWindow CreateStatusWindowA +#define DrawStatusText DrawStatusTextA #endif -#define WC_LISTVIEW WINELIB_NAME_AW(WC_LISTVIEW) -#define LVSCW_AUTOSIZE -1 -#define LVSCW_AUTOSIZE_USEHEADER -2 +#define STATUSCLASSNAMEW L"msctls_statusbar32" +#define STATUSCLASSNAMEA "msctls_statusbar32" +#ifdef UNICODE +#define STATUSCLASSNAME STATUSCLASSNAMEW +#else +#define STATUSCLASSNAME STATUSCLASSNAMEA +#endif -#define LVS_ICON 0x0000 -#define LVS_REPORT 0x0001 -#define LVS_SMALLICON 0x0002 -#define LVS_LIST 0x0003 -#define LVS_TYPEMASK 0x0003 -#define LVS_SINGLESEL 0x0004 -#define LVS_SHOWSELALWAYS 0x0008 -#define LVS_SORTASCENDING 0x0010 -#define LVS_SORTDESCENDING 0x0020 -#define LVS_SHAREIMAGELISTS 0x0040 -#define LVS_NOLABELWRAP 0x0080 -#define LVS_AUTOARRANGE 0x0100 -#define LVS_EDITLABELS 0x0200 -#define LVS_OWNERDATA 0x1000 -#define LVS_NOSCROLL 0x2000 -#define LVS_TYPESTYLEMASK 0xfc00 -#define LVS_ALIGNTOP 0x0000 -#define LVS_ALIGNLEFT 0x0800 -#define LVS_ALIGNMASK 0x0c00 -#define LVS_OWNERDRAWFIXED 0x0400 -#define LVS_NOCOLUMNHEADER 0x4000 -#define LVS_NOSORTHEADER 0x8000 +#define SB_SETTEXTA (WM_USER+1) +#define SB_SETTEXTW (WM_USER+11) +#define SB_GETTEXTA (WM_USER+2) +#define SB_GETTEXTW (WM_USER+13) +#define SB_GETTEXTLENGTHA (WM_USER+3) +#define SB_GETTEXTLENGTHW (WM_USER+12) -#define LVS_EX_GRIDLINES 0x0001 -#define LVS_EX_SUBITEMIMAGES 0x0002 -#define LVS_EX_CHECKBOXES 0x0004 -#define LVS_EX_TRACKSELECT 0x0008 -#define LVS_EX_HEADERDRAGDROP 0x0010 -#define LVS_EX_FULLROWSELECT 0x0020 -#define LVS_EX_ONECLICKACTIVATE 0x0040 -#define LVS_EX_TWOCLICKACTIVATE 0x0080 -#define LVS_EX_FLATSB 0x0100 -#define LVS_EX_REGIONAL 0x0200 -#define LVS_EX_INFOTIP 0x0400 -#define LVS_EX_UNDERLINEHOT 0x0800 -#define LVS_EX_UNDERLINECOLD 0x1000 -#define LVS_EX_MULTIWORKAREAS 0x2000 -#define LVS_EX_LABELTIP 0x4000 -#define LVS_EX_BORDERSELECT 0x8000 -#define LVS_EX_DOUBLEBUFFER 0x00010000 -#define LVS_EX_HIDELABELS 0x00020000 -#define LVS_EX_SINGLEROW 0x00040000 -#define LVS_EX_SNAPTOGRID 0x00080000 -#define LVS_EX_SIMPLESELECT 0x00100000 -#define LVS_EX_JUSTIFYCOLUMNS 0x00200000 -#define LVS_EX_TRANSPARENTBKGND 0x00400000 -#define LVS_EX_TRANSPARENTSHADOWTEXT 0x00800000 -#define LVS_EX_AUTOAUTOARRANGE 0x01000000 -#define LVS_EX_HEADERINALLVIEWS 0x02000000 -#define LVS_EX_AUTOCHECKSELECT 0x08000000 -#define LVS_EX_AUTOSIZECOLUMNS 0x10000000 -#define LVS_EX_COLUMNSNAPPOINTS 0x40000000 -#define LVS_EX_COLUMNOVERFLOW 0x80000000 +#ifdef UNICODE +#define SB_GETTEXT SB_GETTEXTW +#define SB_SETTEXT SB_SETTEXTW +#define SB_GETTEXTLENGTH SB_GETTEXTLENGTHW +#define SB_SETTIPTEXT SB_SETTIPTEXTW +#define SB_GETTIPTEXT SB_GETTIPTEXTW +#else +#define SB_GETTEXT SB_GETTEXTA +#define SB_SETTEXT SB_SETTEXTA +#define SB_GETTEXTLENGTH SB_GETTEXTLENGTHA +#define SB_SETTIPTEXT SB_SETTIPTEXTA +#define SB_GETTIPTEXT SB_GETTIPTEXTA +#endif -#define LVCF_FMT 0x0001 -#define LVCF_WIDTH 0x0002 -#define LVCF_TEXT 0x0004 -#define LVCF_SUBITEM 0x0008 -#define LVCF_IMAGE 0x0010 -#define LVCF_ORDER 0x0020 -#define LVCF_MINWIDTH 0x0040 +#define SB_SETPARTS (WM_USER+4) +#define SB_GETPARTS (WM_USER+6) +#define SB_GETBORDERS (WM_USER+7) +#define SB_SETMINHEIGHT (WM_USER+8) +#define SB_SIMPLE (WM_USER+9) +#define SB_GETRECT (WM_USER+10) +#define SB_ISSIMPLE (WM_USER+14) +#define SB_SETICON (WM_USER+15) +#define SB_SETTIPTEXTA (WM_USER+16) +#define SB_SETTIPTEXTW (WM_USER+17) +#define SB_GETTIPTEXTA (WM_USER+18) +#define SB_GETTIPTEXTW (WM_USER+19) +#define SB_GETICON (WM_USER+20) +#define SB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define SB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define LVCFMT_LEFT 0x0000 -#define LVCFMT_RIGHT 0x0001 -#define LVCFMT_CENTER 0x0002 -#define LVCFMT_JUSTIFYMASK 0x0003 -#define LVCFMT_FIXED_WIDTH 0x0100 -#define LVCFMT_IMAGE 0x0800 -#define LVCFMT_BITMAP_ON_RIGHT 0x1000 -#define LVCFMT_COL_HAS_IMAGES 0x8000 -#define LVCFMT_NO_DPI_SCALE 0x00040000 -#define LVCFMT_FIXED_RATIO 0x00080000 -#define LVCFMT_LINE_BREAK 0x00100000 -#define LVCFMT_FILL 0x00200000 -#define LVCFMT_WRAP 0x00400000 -#define LVCFMT_NO_TITLE 0x00800000 -#define LVCFMT_SPLIT_BUTTON 0x01000000 -#define LVCFMT_TILE_PLACEMENTMASK (LVCFMT_LINE_BREAK | LVCFMT_FILL) +#define SBT_OWNERDRAW 0x1000 +#define SBT_NOBORDERS 0x100 +#define SBT_POPOUT 0x200 +#define SBT_RTLREADING 0x400 +#define SBT_NOTABPARSING 0x800 -#define LVSIL_NORMAL 0 -#define LVSIL_SMALL 1 -#define LVSIL_STATE 2 -#define LVSIL_GROUPHEADER 3 +#define SB_SETBKCOLOR CCM_SETBKCOLOR -/* following 2 flags only for LVS_OWNERDATA listviews */ -/* and only in report or list mode */ -#define LVSICF_NOINVALIDATEALL 0x0001 -#define LVSICF_NOSCROLL 0x0002 +#define SBN_SIMPLEMODECHANGE (SBN_FIRST - 0) + +#define SB_SIMPLEID 0xff +#endif + +#ifndef NOMENUHELP + + WINCOMMCTRLAPI void WINAPI MenuHelp(UINT uMsg,WPARAM wParam,LPARAM lParam,HMENU hMainMenu,HINSTANCE hInst,HWND hwndStatus,UINT *lpwIDs); + WINCOMMCTRLAPI WINBOOL WINAPI ShowHideMenuCtl(HWND hWnd,UINT_PTR uFlags,LPINT lpInfo); + WINCOMMCTRLAPI void WINAPI GetEffectiveClientRect(HWND hWnd,LPRECT lprc,const INT *lpInfo); + +#define MINSYSCOMMAND SC_SIZE +#endif + +#ifndef NOTRACKBAR + +#define TRACKBAR_CLASSA "msctls_trackbar32" +#define TRACKBAR_CLASSW L"msctls_trackbar32" +#ifdef UNICODE +#define TRACKBAR_CLASS TRACKBAR_CLASSW +#else +#define TRACKBAR_CLASS TRACKBAR_CLASSA +#endif + +#define TBS_AUTOTICKS 0x1 +#define TBS_VERT 0x2 +#define TBS_HORZ 0x0 +#define TBS_TOP 0x4 +#define TBS_BOTTOM 0x0 +#define TBS_LEFT 0x4 +#define TBS_RIGHT 0x0 +#define TBS_BOTH 0x8 +#define TBS_NOTICKS 0x10 +#define TBS_ENABLESELRANGE 0x20 +#define TBS_FIXEDLENGTH 0x40 +#define TBS_NOTHUMB 0x80 +#define TBS_TOOLTIPS 0x100 +#define TBS_REVERSED 0x200 +#define TBS_DOWNISLEFT 0x400 + +#define TBM_GETPOS (WM_USER) +#define TBM_GETRANGEMIN (WM_USER+1) +#define TBM_GETRANGEMAX (WM_USER+2) +#define TBM_GETTIC (WM_USER+3) +#define TBM_SETTIC (WM_USER+4) +#define TBM_SETPOS (WM_USER+5) +#define TBM_SETRANGE (WM_USER+6) +#define TBM_SETRANGEMIN (WM_USER+7) +#define TBM_SETRANGEMAX (WM_USER+8) +#define TBM_CLEARTICS (WM_USER+9) +#define TBM_SETSEL (WM_USER+10) +#define TBM_SETSELSTART (WM_USER+11) +#define TBM_SETSELEND (WM_USER+12) +#define TBM_GETPTICS (WM_USER+14) +#define TBM_GETTICPOS (WM_USER+15) +#define TBM_GETNUMTICS (WM_USER+16) +#define TBM_GETSELSTART (WM_USER+17) +#define TBM_GETSELEND (WM_USER+18) +#define TBM_CLEARSEL (WM_USER+19) +#define TBM_SETTICFREQ (WM_USER+20) +#define TBM_SETPAGESIZE (WM_USER+21) +#define TBM_GETPAGESIZE (WM_USER+22) +#define TBM_SETLINESIZE (WM_USER+23) +#define TBM_GETLINESIZE (WM_USER+24) +#define TBM_GETTHUMBRECT (WM_USER+25) +#define TBM_GETCHANNELRECT (WM_USER+26) +#define TBM_SETTHUMBLENGTH (WM_USER+27) +#define TBM_GETTHUMBLENGTH (WM_USER+28) +#define TBM_SETTOOLTIPS (WM_USER+29) +#define TBM_GETTOOLTIPS (WM_USER+30) +#define TBM_SETTIPSIDE (WM_USER+31) + +#define TBTS_TOP 0 +#define TBTS_LEFT 1 +#define TBTS_BOTTOM 2 +#define TBTS_RIGHT 3 + +#define TBM_SETBUDDY (WM_USER+32) +#define TBM_GETBUDDY (WM_USER+33) +#define TBM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define TBM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT + +#define TB_LINEUP 0 +#define TB_LINEDOWN 1 +#define TB_PAGEUP 2 +#define TB_PAGEDOWN 3 +#define TB_THUMBPOSITION 4 +#define TB_THUMBTRACK 5 +#define TB_TOP 6 +#define TB_BOTTOM 7 +#define TB_ENDTRACK 8 + +#define TBCD_TICS 0x1 +#define TBCD_THUMB 0x2 +#define TBCD_CHANNEL 0x3 +#endif + +#ifndef NODRAGLIST + + typedef struct tagDRAGLISTINFO { + UINT uNotification; + HWND hWnd; + POINT ptCursor; + } DRAGLISTINFO,*LPDRAGLISTINFO; + +#define DL_BEGINDRAG (WM_USER+133) +#define DL_DRAGGING (WM_USER+134) +#define DL_DROPPED (WM_USER+135) +#define DL_CANCELDRAG (WM_USER+136) + +#define DL_CURSORSET 0 +#define DL_STOPCURSOR 1 +#define DL_COPYCURSOR 2 +#define DL_MOVECURSOR 3 + +#define DRAGLISTMSGSTRING TEXT("commctrl_DragListMsg") + + WINCOMMCTRLAPI WINBOOL WINAPI MakeDragList(HWND hLB); + WINCOMMCTRLAPI void WINAPI DrawInsert(HWND handParent,HWND hLB,int nItem); + + WINCOMMCTRLAPI int WINAPI LBItemFromPt(HWND hLB,POINT pt,WINBOOL bAutoScroll); +#endif + +#ifndef NOUPDOWN + +#define UPDOWN_CLASSA "msctls_updown32" +#define UPDOWN_CLASSW L"msctls_updown32" +#ifdef UNICODE +#define UPDOWN_CLASS UPDOWN_CLASSW +#else +#define UPDOWN_CLASS UPDOWN_CLASSA +#endif + + typedef struct _UDACCEL { + UINT nSec; + UINT nInc; + } UDACCEL,*LPUDACCEL; + +#define UD_MAXVAL 0x7fff +#define UD_MINVAL (-UD_MAXVAL) + +#define UDS_WRAP 0x1 +#define UDS_SETBUDDYINT 0x2 +#define UDS_ALIGNRIGHT 0x4 +#define UDS_ALIGNLEFT 0x8 +#define UDS_AUTOBUDDY 0x10 +#define UDS_ARROWKEYS 0x20 +#define UDS_HORZ 0x40 +#define UDS_NOTHOUSANDS 0x80 +#define UDS_HOTTRACK 0x100 + +#define UDM_SETRANGE (WM_USER+101) +#define UDM_GETRANGE (WM_USER+102) +#define UDM_SETPOS (WM_USER+103) +#define UDM_GETPOS (WM_USER+104) +#define UDM_SETBUDDY (WM_USER+105) +#define UDM_GETBUDDY (WM_USER+106) +#define UDM_SETACCEL (WM_USER+107) +#define UDM_GETACCEL (WM_USER+108) +#define UDM_SETBASE (WM_USER+109) +#define UDM_GETBASE (WM_USER+110) +#define UDM_SETRANGE32 (WM_USER+111) +#define UDM_GETRANGE32 (WM_USER+112) +#define UDM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define UDM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define UDM_SETPOS32 (WM_USER+113) +#define UDM_GETPOS32 (WM_USER+114) + + WINCOMMCTRLAPI HWND WINAPI CreateUpDownControl(DWORD dwStyle,int x,int y,int cx,int cy,HWND hParent,int nID,HINSTANCE hInst,HWND hBuddy,int nUpper,int nLower,int nPos); + +#define NM_UPDOWN NMUPDOWN +#define LPNM_UPDOWN LPNMUPDOWN + + typedef struct _NM_UPDOWN { + NMHDR hdr; + int iPos; + int iDelta; + } NMUPDOWN,*LPNMUPDOWN; + +#define UDN_DELTAPOS (UDN_FIRST - 1) +#endif + +#ifndef NOPROGRESS + +#define PROGRESS_CLASSA "msctls_progress32" +#define PROGRESS_CLASSW L"msctls_progress32" +#ifdef UNICODE +#define PROGRESS_CLASS PROGRESS_CLASSW +#else +#define PROGRESS_CLASS PROGRESS_CLASSA +#endif + +#define PBS_SMOOTH 0x1 +#define PBS_VERTICAL 0x4 + +#define PBM_SETRANGE (WM_USER+1) +#define PBM_SETPOS (WM_USER+2) +#define PBM_DELTAPOS (WM_USER+3) +#define PBM_SETSTEP (WM_USER+4) +#define PBM_STEPIT (WM_USER+5) +#define PBM_SETRANGE32 (WM_USER+6) + typedef struct { + int iLow; + int iHigh; + } PBRANGE,*PPBRANGE; +#define PBM_GETRANGE (WM_USER+7) +#define PBM_GETPOS (WM_USER+8) +#define PBM_SETBARCOLOR (WM_USER+9) +#define PBM_SETBKCOLOR CCM_SETBKCOLOR + +#define PBS_MARQUEE 0x8 +#define PBM_SETMARQUEE (WM_USER+10) + +#if (_WIN32_WINNT >= 0x0600) +#define PBM_GETSTEP (WM_USER+13) +#define PBM_GETBKCOLOR (WM_USER+14) +#define PBM_GETBARCOLOR (WM_USER+15) +#define PBM_SETSTATE (WM_USER+16) +#define PBM_GETSTATE (WM_USER+17) +#define PBS_SMOOTHREVERSE 0x10 +#define PBST_NORMAL 1 +#define PBST_ERROR 2 +#define PBST_PAUSED 3 +#endif /* (_WIN32_WINNT >= 0x0600) */ + +#endif /* !NOPROGRESS */ -#define LVFI_PARAM 0x0001 -#define LVFI_STRING 0x0002 -#define LVFI_SUBSTRING 0x0004 -#define LVFI_PARTIAL 0x0008 -#define LVFI_WRAP 0x0020 -#define LVFI_NEARESTXY 0x0040 +#ifndef NOHOTKEY -#define LVIF_TEXT 0x0001 -#define LVIF_IMAGE 0x0002 -#define LVIF_PARAM 0x0004 -#define LVIF_STATE 0x0008 -#define LVIF_INDENT 0x0010 -#define LVIF_GROUPID 0x0100 -#define LVIF_COLUMNS 0x0200 -#define LVIF_NORECOMPUTE 0x0800 -#define LVIF_DI_SETITEM 0x1000 -#define LVIF_COLFMT 0x00010000 +#define HOTKEYF_SHIFT 0x1 +#define HOTKEYF_CONTROL 0x2 +#define HOTKEYF_ALT 0x4 +#define HOTKEYF_EXT 0x8 +#define HKCOMB_NONE 0x1 +#define HKCOMB_S 0x2 +#define HKCOMB_C 0x4 +#define HKCOMB_A 0x8 +#define HKCOMB_SC 0x10 +#define HKCOMB_SA 0x20 +#define HKCOMB_CA 0x40 +#define HKCOMB_SCA 0x80 -#define LVIR_BOUNDS 0x0000 -#define LVIR_ICON 0x0001 -#define LVIR_LABEL 0x0002 -#define LVIR_SELECTBOUNDS 0x0003 +#define HKM_SETHOTKEY (WM_USER+1) +#define HKM_GETHOTKEY (WM_USER+2) +#define HKM_SETRULES (WM_USER+3) -#define LVIS_FOCUSED 0x0001 -#define LVIS_SELECTED 0x0002 -#define LVIS_CUT 0x0004 -#define LVIS_DROPHILITED 0x0008 -#define LVIS_ACTIVATING 0x0020 +#define HOTKEY_CLASSA "msctls_hotkey32" +#define HOTKEY_CLASSW L"msctls_hotkey32" +#ifdef UNICODE +#define HOTKEY_CLASS HOTKEY_CLASSW +#else +#define HOTKEY_CLASS HOTKEY_CLASSA +#endif +#endif -#define LVIS_OVERLAYMASK 0x0F00 -#define LVIS_STATEIMAGEMASK 0xF000 +#define CCS_TOP 0x1L +#define CCS_NOMOVEY 0x2L +#define CCS_BOTTOM 0x3L +#define CCS_NORESIZE 0x4L +#define CCS_NOPARENTALIGN 0x8L +#define CCS_ADJUSTABLE 0x20L +#define CCS_NODIVIDER 0x40L +#define CCS_VERT 0x80L +#define CCS_LEFT (CCS_VERT | CCS_TOP) +#define CCS_RIGHT (CCS_VERT | CCS_BOTTOM) +#define CCS_NOMOVEX (CCS_VERT | CCS_NOMOVEY) -#define LVNI_ALL 0x0000 -#define LVNI_FOCUSED 0x0001 -#define LVNI_SELECTED 0x0002 -#define LVNI_CUT 0x0004 -#define LVNI_DROPHILITED 0x0008 +#ifndef NOLISTVIEW -#define LVNI_ABOVE 0x0100 -#define LVNI_BELOW 0x0200 -#define LVNI_TOLEFT 0x0400 -#define LVNI_TORIGHT 0x0800 +#define WC_LISTVIEWA "SysListView32" +#define WC_LISTVIEWW L"SysListView32" +#ifdef UNICODE +#define WC_LISTVIEW WC_LISTVIEWW +#else +#define WC_LISTVIEW WC_LISTVIEWA +#endif -#define LVHT_NOWHERE 0x0001 -#define LVHT_ONITEMICON 0x0002 -#define LVHT_ONITEMLABEL 0x0004 -#define LVHT_ONITEMSTATEICON 0x0008 -#define LVHT_ONITEM (LVHT_ONITEMICON|LVHT_ONITEMLABEL|LVHT_ONITEMSTATEICON) +#define LVS_ICON 0x0 +#define LVS_REPORT 0x1 +#define LVS_SMALLICON 0x2 +#define LVS_LIST 0x3 +#define LVS_TYPEMASK 0x3 +#define LVS_SINGLESEL 0x4 +#define LVS_SHOWSELALWAYS 0x8 +#define LVS_SORTASCENDING 0x10 +#define LVS_SORTDESCENDING 0x20 +#define LVS_SHAREIMAGELISTS 0x40 +#define LVS_NOLABELWRAP 0x80 +#define LVS_AUTOARRANGE 0x100 +#define LVS_EDITLABELS 0x200 +#define LVS_OWNERDATA 0x1000 +#define LVS_NOSCROLL 0x2000 -#define LVHT_ABOVE 0x0008 -#define LVHT_BELOW 0x0010 -#define LVHT_TORIGHT 0x0020 -#define LVHT_TOLEFT 0x0040 +#define LVS_TYPESTYLEMASK 0xfc00 -#define LV_VIEW_ICON 0x0000 -#define LV_VIEW_DETAILS 0x0001 -#define LV_VIEW_SMALLICON 0x0002 -#define LV_VIEW_LIST 0x0003 -#define LV_VIEW_TILE 0x0004 -#define LV_VIEW_MAX 0x0004 +#define LVS_ALIGNTOP 0x0 +#define LVS_ALIGNLEFT 0x800 +#define LVS_ALIGNMASK 0xc00 -#define LVGF_NONE 0x00000000 -#define LVGF_HEADER 0x00000001 -#define LVGF_FOOTER 0x00000002 -#define LVGF_STATE 0x00000004 -#define LVGF_ALIGN 0x00000008 -#define LVGF_GROUPID 0x00000010 -#define LVGF_SUBTITLE 0x00000100 -#define LVGF_TASK 0x00000200 -#define LVGF_DESCRIPTIONTOP 0x00000400 -#define LVGF_DESCRIPTIONBOTTOM 0x00000800 -#define LVGF_TITLEIMAGE 0x00001000 -#define LVGF_EXTENDEDIMAGE 0x00002000 -#define LVGF_ITEMS 0x00004000 -#define LVGF_SUBSET 0x00008000 -#define LVGF_SUBSETITEMS 0x00010000 +#define LVS_OWNERDRAWFIXED 0x400 +#define LVS_NOCOLUMNHEADER 0x4000 +#define LVS_NOSORTHEADER 0x8000 -#define LVGS_NORMAL 0x00000000 -#define LVGS_COLLAPSED 0x00000001 -#define LVGS_HIDDEN 0x00000002 +#define LVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define ListView_SetUnicodeFormat(hwnd,fUnicode) (WINBOOL)SNDMSG((hwnd),LVM_SETUNICODEFORMAT,(WPARAM)(fUnicode),0) +#define LVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define ListView_GetUnicodeFormat(hwnd) (WINBOOL)SNDMSG((hwnd),LVM_GETUNICODEFORMAT,0,0) +#define LVM_GETBKCOLOR (LVM_FIRST+0) +#define ListView_GetBkColor(hwnd) (COLORREF)SNDMSG((hwnd),LVM_GETBKCOLOR,0,0L) +#define LVM_SETBKCOLOR (LVM_FIRST+1) +#define ListView_SetBkColor(hwnd,clrBk) (WINBOOL)SNDMSG((hwnd),LVM_SETBKCOLOR,0,(LPARAM)(COLORREF)(clrBk)) +#define LVM_GETIMAGELIST (LVM_FIRST+2) +#define ListView_GetImageList(hwnd,iImageList) (HIMAGELIST)SNDMSG((hwnd),LVM_GETIMAGELIST,(WPARAM)(INT)(iImageList),0L) -#define LVGA_HEADER_LEFT 0x00000001 -#define LVGA_HEADER_CENTER 0x00000002 -#define LVGA_HEADER_RIGHT 0x00000004 -#define LVGA_FOOTER_LEFT 0x00000008 -#define LVGA_FOOTER_CENTER 0x00000010 -#define LVGA_FOOTER_RIGHT 0x00000020 +#define LVSIL_NORMAL 0 +#define LVSIL_SMALL 1 +#define LVSIL_STATE 2 -#define LVGMF_NONE 0x00000000 -#define LVGMF_BORDERSIZE 0x00000001 -#define LVGMF_BORDERCOLOR 0x00000002 -#define LVGMF_TEXTCOLOR 0x00000004 +#define LVM_SETIMAGELIST (LVM_FIRST+3) +#define ListView_SetImageList(hwnd,himl,iImageList) (HIMAGELIST)SNDMSG((hwnd),LVM_SETIMAGELIST,(WPARAM)(iImageList),(LPARAM)(HIMAGELIST)(himl)) -#define LVTVIF_AUTOSIZE 0x00000000 -#define LVTVIF_FIXEDWIDTH 0x00000001 -#define LVTVIF_FIXEDHEIGHT 0x00000002 -#define LVTVIF_FIXEDSIZE 0x00000003 -#define LVTVIF_EXTENDED 0x00000004 +#define LVM_GETITEMCOUNT (LVM_FIRST+4) +#define ListView_GetItemCount(hwnd) (int)SNDMSG((hwnd),LVM_GETITEMCOUNT,0,0L) -#define LVTVIM_TILESIZE 0x00000001 -#define LVTVIM_COLUMNS 0x00000002 -#define LVTVIM_LABELMARGIN 0x00000004 +#define LVIF_TEXT 0x1 +#define LVIF_IMAGE 0x2 +#define LVIF_PARAM 0x4 +#define LVIF_STATE 0x8 +#define LVIF_INDENT 0x10 +#define LVIF_NORECOMPUTE 0x800 +#define LVIF_GROUPID 0x100 +#define LVIF_COLUMNS 0x200 -#define LVIM_AFTER 0x00000001 +#define LVIS_FOCUSED 0x1 +#define LVIS_SELECTED 0x2 +#define LVIS_CUT 0x4 +#define LVIS_DROPHILITED 0x8 +#define LVIS_GLOW 0x10 +#define LVIS_ACTIVATING 0x20 -#define LVM_FIRST 0x1000 -#define LVM_GETBKCOLOR (LVM_FIRST+0) -#define LVM_SETBKCOLOR (LVM_FIRST+1) -#define LVM_GETIMAGELIST (LVM_FIRST+2) -#define LVM_SETIMAGELIST (LVM_FIRST+3) -#define LVM_GETITEMCOUNT (LVM_FIRST+4) -#define LVM_GETITEMA (LVM_FIRST+5) -#define LVM_GETITEMW (LVM_FIRST+75) -#define LVM_GETITEM WINELIB_NAME_AW(LVM_GETITEM) -#define LVM_SETITEMA (LVM_FIRST+6) -#define LVM_SETITEMW (LVM_FIRST+76) -#define LVM_SETITEM WINELIB_NAME_AW(LVM_SETITEM) -#define LVM_INSERTITEMA (LVM_FIRST+7) -#define LVM_INSERTITEMW (LVM_FIRST+77) -#define LVM_INSERTITEM WINELIB_NAME_AW(LVM_INSERTITEM) -#define LVM_DELETEITEM (LVM_FIRST+8) -#define LVM_DELETEALLITEMS (LVM_FIRST+9) -#define LVM_GETCALLBACKMASK (LVM_FIRST+10) -#define LVM_SETCALLBACKMASK (LVM_FIRST+11) -#define LVM_GETNEXTITEM (LVM_FIRST+12) -#define LVM_FINDITEMA (LVM_FIRST+13) -#define LVM_FINDITEMW (LVM_FIRST+83) -#define LVM_FINDITEM WINELIB_NAME_AW(LVM_FINDITEM) -#define LVM_GETITEMRECT (LVM_FIRST+14) -#define LVM_SETITEMPOSITION (LVM_FIRST+15) -#define LVM_GETITEMPOSITION (LVM_FIRST+16) -#define LVM_GETSTRINGWIDTHA (LVM_FIRST+17) -#define LVM_GETSTRINGWIDTHW (LVM_FIRST+87) -#define LVM_GETSTRINGWIDTH WINELIB_NAME_AW(LVM_GETSTRINGWIDTH) -#define LVM_HITTEST (LVM_FIRST+18) -#define LVM_ENSUREVISIBLE (LVM_FIRST+19) -#define LVM_SCROLL (LVM_FIRST+20) -#define LVM_REDRAWITEMS (LVM_FIRST+21) -#define LVM_ARRANGE (LVM_FIRST+22) -#define LVM_EDITLABELA (LVM_FIRST+23) -#define LVM_EDITLABELW (LVM_FIRST+118) -#define LVM_EDITLABEL WINELIB_NAME_AW(LVM_EDITLABEL) -#define LVM_GETEDITCONTROL (LVM_FIRST+24) -#define LVM_GETCOLUMNA (LVM_FIRST+25) -#define LVM_GETCOLUMNW (LVM_FIRST+95) -#define LVM_GETCOLUMN WINELIB_NAME_AW(LVM_GETCOLUMN) -#define LVM_SETCOLUMNA (LVM_FIRST+26) -#define LVM_SETCOLUMNW (LVM_FIRST+96) -#define LVM_SETCOLUMN WINELIB_NAME_AW(LVM_SETCOLUMN) -#define LVM_INSERTCOLUMNA (LVM_FIRST+27) -#define LVM_INSERTCOLUMNW (LVM_FIRST+97) -#define LVM_INSERTCOLUMN WINELIB_NAME_AW(LVM_INSERTCOLUMN) -#define LVM_DELETECOLUMN (LVM_FIRST+28) -#define LVM_GETCOLUMNWIDTH (LVM_FIRST+29) -#define LVM_SETCOLUMNWIDTH (LVM_FIRST+30) -#define LVM_GETHEADER (LVM_FIRST+31) +#define LVIS_OVERLAYMASK 0xf00 +#define LVIS_STATEIMAGEMASK 0xF000 -#define LVM_CREATEDRAGIMAGE (LVM_FIRST+33) -#define LVM_GETVIEWRECT (LVM_FIRST+34) -#define LVM_GETTEXTCOLOR (LVM_FIRST+35) -#define LVM_SETTEXTCOLOR (LVM_FIRST+36) -#define LVM_GETTEXTBKCOLOR (LVM_FIRST+37) -#define LVM_SETTEXTBKCOLOR (LVM_FIRST+38) -#define LVM_GETTOPINDEX (LVM_FIRST+39) -#define LVM_GETCOUNTPERPAGE (LVM_FIRST+40) -#define LVM_GETORIGIN (LVM_FIRST+41) -#define LVM_UPDATE (LVM_FIRST+42) -#define LVM_SETITEMSTATE (LVM_FIRST+43) -#define LVM_GETITEMSTATE (LVM_FIRST+44) -#define LVM_GETITEMTEXTA (LVM_FIRST+45) -#define LVM_GETITEMTEXTW (LVM_FIRST+115) -#define LVM_GETITEMTEXT WINELIB_NAME_AW(LVM_GETITEMTEXT) -#define LVM_SETITEMTEXTA (LVM_FIRST+46) -#define LVM_SETITEMTEXTW (LVM_FIRST+116) -#define LVM_SETITEMTEXT WINELIB_NAME_AW(LVM_SETITEMTEXT) -#define LVM_SETITEMCOUNT (LVM_FIRST+47) -#define LVM_SORTITEMS (LVM_FIRST+48) -#define LVM_SORTITEMSEX (LVM_FIRST+81) -#define LVM_SETITEMPOSITION32 (LVM_FIRST+49) -#define LVM_GETSELECTEDCOUNT (LVM_FIRST+50) -#define LVM_GETITEMSPACING (LVM_FIRST+51) -#define LVM_GETISEARCHSTRINGA (LVM_FIRST+52) -#define LVM_GETISEARCHSTRINGW (LVM_FIRST+117) -#define LVM_GETISEARCHSTRING WINELIB_NAME_AW(LVM_GETISEARCHSTRING) -#define LVM_SETICONSPACING (LVM_FIRST+53) -#define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+54) -#define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+55) -#define LVM_GETSUBITEMRECT (LVM_FIRST+56) -#define LVM_SUBITEMHITTEST (LVM_FIRST+57) -#define LVM_SETCOLUMNORDERARRAY (LVM_FIRST+58) -#define LVM_GETCOLUMNORDERARRAY (LVM_FIRST+59) -#define LVM_SETHOTITEM (LVM_FIRST+60) -#define LVM_GETHOTITEM (LVM_FIRST+61) -#define LVM_SETHOTCURSOR (LVM_FIRST+62) -#define LVM_GETHOTCURSOR (LVM_FIRST+63) -#define LVM_APPROXIMATEVIEWRECT (LVM_FIRST+64) -#define LVM_SETWORKAREAS (LVM_FIRST+65) -#define LVM_GETSELECTIONMARK (LVM_FIRST+66) -#define LVM_SETSELECTIONMARK (LVM_FIRST+67) -#define LVM_SETBKIMAGEA (LVM_FIRST+68) -#define LVM_SETBKIMAGEW (LVM_FIRST+138) -#define LVM_SETBKIMAGE WINELIB_NAME_AW(LVM_SETBKIMAGE) -#define LVM_GETBKIMAGEA (LVM_FIRST+69) -#define LVM_GETBKIMAGEW (LVM_FIRST+139) -#define LVM_GETBKIMAGE WINELIB_NAME_AW(LVM_GETBKIMAGE) -#define LVM_GETWORKAREAS (LVM_FIRST+70) -#define LVM_SETHOVERTIME (LVM_FIRST+71) -#define LVM_GETHOVERTIME (LVM_FIRST+72) -#define LVM_GETNUMBEROFWORKAREAS (LVM_FIRST+73) -#define LVM_SETTOOLTIPS (LVM_FIRST+74) -#define LVM_GETTOOLTIPS (LVM_FIRST+78) -#define LVM_GETUNICODEFORMAT (CCM_GETUNICODEFORMAT) -#define LVM_SETUNICODEFORMAT (CCM_SETUNICODEFORMAT) -#define LVM_SETSELECTEDCOLUMN (LVM_FIRST + 140) -#define LVM_SETTILEWIDTH (LVM_FIRST + 141) -#define LVM_SETVIEW (LVM_FIRST + 142) -#define LVM_GETVIEW (LVM_FIRST + 143) -#define LVM_INSERTGROUP (LVM_FIRST + 145) -#define LVM_SETGROUPINFO (LVM_FIRST + 147) -#define LVM_GETGROUPINFO (LVM_FIRST + 149) -#define LVM_REMOVEGROUP (LVM_FIRST + 150) -#define LVM_MOVEGROUP (LVM_FIRST + 151) -#define LVM_MOVEITEMTOGROUP (LVM_FIRST + 154) -#define LVM_SETGROUPMETRICS (LVM_FIRST + 155) -#define LVM_GETGROUPMETRICS (LVM_FIRST + 156) -#define LVM_ENABLEGROUPVIEW (LVM_FIRST + 157) -#define LVM_SORTGROUPS (LVM_FIRST + 158) -#define LVM_INSERTGROUPSORTED (LVM_FIRST + 159) -#define LVM_REMOVEALLGROUPS (LVM_FIRST + 160) -#define LVM_HASGROUP (LVM_FIRST + 161) -#define LVM_SETTILEVIEWINFO (LVM_FIRST + 162) -#define LVM_GETTILEVIEWINFO (LVM_FIRST + 163) -#define LVM_SETTILEINFO (LVM_FIRST + 164) -#define LVM_GETTILEINFO (LVM_FIRST + 165) -#define LVM_SETINSERTMARK (LVM_FIRST + 166) -#define LVM_GETINSERTMARK (LVM_FIRST + 167) -#define LVM_INSERTMARKHITTEST (LVM_FIRST + 168) -#define LVM_GETINSERTMARKRECT (LVM_FIRST + 169) -#define LVM_SETINSERTMARKCOLOR (LVM_FIRST + 170) -#define LVM_GETINSERTMARKCOLOR (LVM_FIRST + 171) -#define LVM_SETINFOTIP (LVM_FIRST + 173) -#define LVM_GETSELECTEDCOLUMN (LVM_FIRST + 174) -#define LVM_ISGROUPVIEWENABLED (LVM_FIRST + 175) -#define LVM_GETOUTLINECOLOR (LVM_FIRST + 176) -#define LVM_SETOUTLINECOLOR (LVM_FIRST + 177) -#define LVM_CANCELEDITLABEL (LVM_FIRST + 179) -#define LVM_MAPINDEXTOID (LVM_FIRST + 180) -#define LVM_MAPIDTOINDEX (LVM_FIRST + 181) -#define LVM_ISITEMVISIBLE (LVM_FIRST + 182) +#define INDEXTOSTATEIMAGEMASK(i) ((i) << 12) -#define LVN_FIRST (0U-100U) -#define LVN_LAST (0U-199U) -#define LVN_ITEMCHANGING (LVN_FIRST-0) -#define LVN_ITEMCHANGED (LVN_FIRST-1) -#define LVN_INSERTITEM (LVN_FIRST-2) -#define LVN_DELETEITEM (LVN_FIRST-3) -#define LVN_DELETEALLITEMS (LVN_FIRST-4) -#define LVN_BEGINLABELEDITA (LVN_FIRST-5) -#define LVN_BEGINLABELEDITW (LVN_FIRST-75) -#define LVN_BEGINLABELEDIT WINELIB_NAME_AW(LVN_BEGINLABELEDIT) -#define LVN_ENDLABELEDITA (LVN_FIRST-6) -#define LVN_ENDLABELEDITW (LVN_FIRST-76) -#define LVN_ENDLABELEDIT WINELIB_NAME_AW(LVN_ENDLABELEDIT) -#define LVN_COLUMNCLICK (LVN_FIRST-8) -#define LVN_BEGINDRAG (LVN_FIRST-9) -#define LVN_BEGINRDRAG (LVN_FIRST-11) -#define LVN_ODCACHEHINT (LVN_FIRST-13) -#define LVN_ITEMACTIVATE (LVN_FIRST-14) -#define LVN_ODSTATECHANGED (LVN_FIRST-15) -#define LVN_HOTTRACK (LVN_FIRST-21) -#define LVN_ODFINDITEMA (LVN_FIRST-52) -#define LVN_ODFINDITEMW (LVN_FIRST-79) -#define LVN_ODFINDITEM WINELIB_NAME_AW(LVN_ODFINDITEM) -#define LVN_GETDISPINFOA (LVN_FIRST-50) -#define LVN_GETDISPINFOW (LVN_FIRST-77) -#define LVN_GETDISPINFO WINELIB_NAME_AW(LVN_GETDISPINFO) -#define LVN_SETDISPINFOA (LVN_FIRST-51) -#define LVN_SETDISPINFOW (LVN_FIRST-78) -#define LVN_SETDISPINFO WINELIB_NAME_AW(LVN_SETDISPINFO) -#define LVN_KEYDOWN (LVN_FIRST-55) -#define LVN_MARQUEEBEGIN (LVN_FIRST-56) -#define LVN_GETINFOTIPA (LVN_FIRST-57) -#define LVN_GETINFOTIPW (LVN_FIRST-58) -#define LVN_GETINFOTIP WINELIB_NAME_AW(LVN_GETINFOTIP) -#define LVN_INCREMENTALSEARCHA (LVN_FIRST-62) -#define LVN_INCREMENTALSEARCHW (LVN_FIRST-63) -#define LVN_INCREMENTALSEARCH WINELIB_NAME_AW(LVN_INCREMENTALSEARCH) -#define LVN_BEGINSCROLL (LVN_FIRST-80) -#define LVN_ENDSCROLL (LVN_FIRST-81) -#define LVN_LINKCLICK (LVN_FIRST-84) -#define LVN_ASYNCDRAWN (LVN_FIRST-86) -#define LVN_GETEMPTYMARKUP (LVN_FIRST-87) - -/* LVN_INCREMENTALSEARCH return codes */ -#define LVNSCH_DEFAULT -1 -#define LVNSCH_ERROR -2 -#define LVNSCH_IGNORE -3 - -#define LVA_DEFAULT 0x0000 -#define LVA_ALIGNLEFT 0x0001 -#define LVA_ALIGNTOP 0x0002 -#define LVA_SNAPTOGRID 0x0005 - -typedef struct tagLVITEMA -{ - UINT mask; - INT iItem; - INT iSubItem; - UINT state; - UINT stateMask; - LPSTR pszText; - INT cchTextMax; - INT iImage; - LPARAM lParam; - /* (_WIN32_IE >= 0x0300) */ - INT iIndent; - /* (_WIN32_IE >= 0x0560) */ - INT iGroupId; - UINT cColumns; - PUINT puColumns; - /* (_WIN32_WINNT >= 0x0600) */ - PINT piColFmt; - INT iGroup; -} LVITEMA, *LPLVITEMA; - -typedef struct tagLVITEMW -{ - UINT mask; - INT iItem; - INT iSubItem; - UINT state; - UINT stateMask; - LPWSTR pszText; - INT cchTextMax; - INT iImage; - LPARAM lParam; - /* (_WIN32_IE >= 0x0300) */ - INT iIndent; - /* (_WIN32_IE >= 0x0560) */ - INT iGroupId; - UINT cColumns; - PUINT puColumns; - /* (_WIN32_WINNT >= 0x0600) */ - PINT piColFmt; - INT iGroup; -} LVITEMW, *LPLVITEMW; - -#define LVITEM WINELIB_NAME_AW(LVITEM) -#define LPLVITEM WINELIB_NAME_AW(LPLVITEM) - -#define LVITEM_V1_SIZEA CCSIZEOF_STRUCT(LVITEMA, lParam) -#define LVITEM_V1_SIZEW CCSIZEOF_STRUCT(LVITEMW, lParam) -#define LVITEM_V1_SIZE WINELIB_NAME_AW(LVITEM_V1_SIZE) - -#define LVITEMA_V5_SIZE CCSIZEOF_STRUCT(LVITEMA, puColumns) -#define LVITEMW_V5_SIZE CCSIZEOF_STRUCT(LVITEMW, puColumns) -#define LVITEM_V5_SIZE WINELIB_NAME_AW(LVITEM_V5_SIZE) - -#define LV_ITEM LVITEM +#define I_INDENTCALLBACK (-1) #define LV_ITEMA LVITEMA #define LV_ITEMW LVITEMW -typedef struct LVSETINFOTIP -{ - UINT cbSize; - DWORD dwFlags; - LPWSTR pszText; +#define I_GROUPIDCALLBACK (-1) +#define I_GROUPIDNONE (-2) + +#define LV_ITEM LVITEM + +#define LVITEMA_V1_SIZE CCSIZEOF_STRUCT(LVITEMA,lParam) +#define LVITEMW_V1_SIZE CCSIZEOF_STRUCT(LVITEMW,lParam) + + typedef struct tagLVITEMA { + UINT mask; int iItem; int iSubItem; -} LVSETINFOTIP, *PLVSETINFOTIP; + UINT state; + UINT stateMask; + LPSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; + int iIndent; + int iGroupId; + UINT cColumns; + PUINT puColumns; + } LVITEMA,*LPLVITEMA; -/* ListView background image structs and constants - For _WIN32_IE version 0x400 and later. */ + typedef struct tagLVITEMW + { + UINT mask; + int iItem; + int iSubItem; + UINT state; + UINT stateMask; + LPWSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; + int iIndent; + int iGroupId; + UINT cColumns; + PUINT puColumns; + } LVITEMW,*LPLVITEMW; -typedef struct tagLVBKIMAGEA -{ +#ifdef UNICODE +#define LVITEM LVITEMW +#define LPLVITEM LPLVITEMW +#define LVITEM_V1_SIZE LVITEMW_V1_SIZE +#else +#define LVITEM LVITEMA +#define LPLVITEM LPLVITEMA +#define LVITEM_V1_SIZE LVITEMA_V1_SIZE +#endif + +#define LPSTR_TEXTCALLBACKW ((LPWSTR)-1L) +#define LPSTR_TEXTCALLBACKA ((LPSTR)-1L) +#ifdef UNICODE +#define LPSTR_TEXTCALLBACK LPSTR_TEXTCALLBACKW +#else +#define LPSTR_TEXTCALLBACK LPSTR_TEXTCALLBACKA +#endif + +#define I_IMAGECALLBACK (-1) +#define I_IMAGENONE (-2) +#define I_COLUMNSCALLBACK ((UINT)-1) + +#define LVM_GETITEMA (LVM_FIRST+5) +#define LVM_GETITEMW (LVM_FIRST+75) +#ifdef UNICODE +#define LVM_GETITEM LVM_GETITEMW +#else +#define LVM_GETITEM LVM_GETITEMA +#endif + +#define ListView_GetItem(hwnd,pitem) (WINBOOL)SNDMSG((hwnd),LVM_GETITEM,0,(LPARAM)(LV_ITEM *)(pitem)) + +#define LVM_SETITEMA (LVM_FIRST+6) +#define LVM_SETITEMW (LVM_FIRST+76) +#ifdef UNICODE +#define LVM_SETITEM LVM_SETITEMW +#else +#define LVM_SETITEM LVM_SETITEMA +#endif + +#define ListView_SetItem(hwnd,pitem) (WINBOOL)SNDMSG((hwnd),LVM_SETITEM,0,(LPARAM)(const LV_ITEM *)(pitem)) + +#define LVM_INSERTITEMA (LVM_FIRST+7) +#define LVM_INSERTITEMW (LVM_FIRST+77) +#ifdef UNICODE +#define LVM_INSERTITEM LVM_INSERTITEMW +#else +#define LVM_INSERTITEM LVM_INSERTITEMA +#endif +#define ListView_InsertItem(hwnd,pitem) (int)SNDMSG((hwnd),LVM_INSERTITEM,0,(LPARAM)(const LV_ITEM *)(pitem)) + +#define LVM_DELETEITEM (LVM_FIRST+8) +#define ListView_DeleteItem(hwnd,i) (WINBOOL)SNDMSG((hwnd),LVM_DELETEITEM,(WPARAM)(int)(i),0L) + +#define LVM_DELETEALLITEMS (LVM_FIRST+9) +#define ListView_DeleteAllItems(hwnd) (WINBOOL)SNDMSG((hwnd),LVM_DELETEALLITEMS,0,0L) + +#define LVM_GETCALLBACKMASK (LVM_FIRST+10) +#define ListView_GetCallbackMask(hwnd) (WINBOOL)SNDMSG((hwnd),LVM_GETCALLBACKMASK,0,0) + +#define LVM_SETCALLBACKMASK (LVM_FIRST+11) +#define ListView_SetCallbackMask(hwnd,mask) (WINBOOL)SNDMSG((hwnd),LVM_SETCALLBACKMASK,(WPARAM)(UINT)(mask),0) + +#define LVNI_ALL 0x0 +#define LVNI_FOCUSED 0x1 +#define LVNI_SELECTED 0x2 +#define LVNI_CUT 0x4 +#define LVNI_DROPHILITED 0x8 + +#define LVNI_ABOVE 0x100 +#define LVNI_BELOW 0x200 +#define LVNI_TOLEFT 0x400 +#define LVNI_TORIGHT 0x800 + +#define LVM_GETNEXTITEM (LVM_FIRST+12) +#define ListView_GetNextItem(hwnd,i,flags) (int)SNDMSG((hwnd),LVM_GETNEXTITEM,(WPARAM)(int)(i),MAKELPARAM((flags),0)) + +#define LVFI_PARAM 0x1 +#define LVFI_STRING 0x2 +#define LVFI_PARTIAL 0x8 +#define LVFI_WRAP 0x20 +#define LVFI_NEARESTXY 0x40 + +#define LV_FINDINFOA LVFINDINFOA +#define LV_FINDINFOW LVFINDINFOW +#define LV_FINDINFO LVFINDINFO + + typedef struct tagLVFINDINFOA { + UINT flags; + LPCSTR psz; + LPARAM lParam; + POINT pt; + UINT vkDirection; + } LVFINDINFOA,*LPFINDINFOA; + + typedef struct tagLVFINDINFOW { + UINT flags; + LPCWSTR psz; + LPARAM lParam; + POINT pt; + UINT vkDirection; + } LVFINDINFOW,*LPFINDINFOW; + +#ifdef UNICODE +#define LVFINDINFO LVFINDINFOW +#else +#define LVFINDINFO LVFINDINFOA +#endif + +#define LVM_FINDITEMA (LVM_FIRST+13) +#define LVM_FINDITEMW (LVM_FIRST+83) +#ifdef UNICODE +#define LVM_FINDITEM LVM_FINDITEMW +#else +#define LVM_FINDITEM LVM_FINDITEMA +#endif + +#define ListView_FindItem(hwnd,iStart,plvfi) (int)SNDMSG((hwnd),LVM_FINDITEM,(WPARAM)(int)(iStart),(LPARAM)(const LV_FINDINFO *)(plvfi)) + +#define LVIR_BOUNDS 0 +#define LVIR_ICON 1 +#define LVIR_LABEL 2 +#define LVIR_SELECTBOUNDS 3 + +#define LVM_GETITEMRECT (LVM_FIRST+14) +#define ListView_GetItemRect(hwnd,i,prc,code) (WINBOOL)SNDMSG((hwnd),LVM_GETITEMRECT,(WPARAM)(int)(i),((prc) ? (((RECT *)(prc))->left = (code),(LPARAM)(RECT *)(prc)) : (LPARAM)(RECT *)NULL)) + +#define LVM_SETITEMPOSITION (LVM_FIRST+15) +#define ListView_SetItemPosition(hwndLV,i,x,y) (WINBOOL)SNDMSG((hwndLV),LVM_SETITEMPOSITION,(WPARAM)(int)(i),MAKELPARAM((x),(y))) + +#define LVM_GETITEMPOSITION (LVM_FIRST+16) +#define ListView_GetItemPosition(hwndLV,i,ppt) (WINBOOL)SNDMSG((hwndLV),LVM_GETITEMPOSITION,(WPARAM)(int)(i),(LPARAM)(POINT *)(ppt)) + +#define LVM_GETSTRINGWIDTHA (LVM_FIRST+17) +#define LVM_GETSTRINGWIDTHW (LVM_FIRST+87) +#ifdef UNICODE +#define LVM_GETSTRINGWIDTH LVM_GETSTRINGWIDTHW +#else +#define LVM_GETSTRINGWIDTH LVM_GETSTRINGWIDTHA +#endif + +#define ListView_GetStringWidth(hwndLV,psz) (int)SNDMSG((hwndLV),LVM_GETSTRINGWIDTH,0,(LPARAM)(LPCTSTR)(psz)) + +#define LVHT_NOWHERE 0x1 +#define LVHT_ONITEMICON 0x2 +#define LVHT_ONITEMLABEL 0x4 +#define LVHT_ONITEMSTATEICON 0x8 +#define LVHT_ONITEM (LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON) + +#define LVHT_ABOVE 0x8 +#define LVHT_BELOW 0x10 +#define LVHT_TORIGHT 0x20 +#define LVHT_TOLEFT 0x40 + +#define LV_HITTESTINFO LVHITTESTINFO + +#define LVHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(LVHITTESTINFO,iItem) + + typedef struct tagLVHITTESTINFO { + POINT pt; + UINT flags; + int iItem; + int iSubItem; + } LVHITTESTINFO,*LPLVHITTESTINFO; + +#define LVM_HITTEST (LVM_FIRST+18) +#define ListView_HitTest(hwndLV,pinfo) (int)SNDMSG((hwndLV),LVM_HITTEST,0,(LPARAM)(LV_HITTESTINFO *)(pinfo)) + +#define LVM_ENSUREVISIBLE (LVM_FIRST+19) +#define ListView_EnsureVisible(hwndLV,i,fPartialOK) (WINBOOL)SNDMSG((hwndLV),LVM_ENSUREVISIBLE,(WPARAM)(int)(i),MAKELPARAM((fPartialOK),0)) + +#define LVM_SCROLL (LVM_FIRST+20) +#define ListView_Scroll(hwndLV,dx,dy) (WINBOOL)SNDMSG((hwndLV),LVM_SCROLL,(WPARAM)(int)(dx),(LPARAM)(int)(dy)) + +#define LVM_REDRAWITEMS (LVM_FIRST+21) +#define ListView_RedrawItems(hwndLV,iFirst,iLast) (WINBOOL)SNDMSG((hwndLV),LVM_REDRAWITEMS,(WPARAM)(int)(iFirst),(LPARAM)(int)(iLast)) + +#define LVA_DEFAULT 0x0 +#define LVA_ALIGNLEFT 0x1 +#define LVA_ALIGNTOP 0x2 +#define LVA_SNAPTOGRID 0x5 + +#define LVM_ARRANGE (LVM_FIRST+22) +#define ListView_Arrange(hwndLV,code) (WINBOOL)SNDMSG((hwndLV),LVM_ARRANGE,(WPARAM)(UINT)(code),0L) + +#define LVM_EDITLABELA (LVM_FIRST+23) +#define LVM_EDITLABELW (LVM_FIRST+118) +#ifdef UNICODE +#define LVM_EDITLABEL LVM_EDITLABELW +#else +#define LVM_EDITLABEL LVM_EDITLABELA +#endif + +#define ListView_EditLabel(hwndLV,i) (HWND)SNDMSG((hwndLV),LVM_EDITLABEL,(WPARAM)(int)(i),0L) + +#define LVM_GETEDITCONTROL (LVM_FIRST+24) +#define ListView_GetEditControl(hwndLV) (HWND)SNDMSG((hwndLV),LVM_GETEDITCONTROL,0,0L) + +#define LV_COLUMNA LVCOLUMNA +#define LV_COLUMNW LVCOLUMNW +#define LV_COLUMN LVCOLUMN + +#define LVCOLUMNA_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNA,iSubItem) +#define LVCOLUMNW_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNW,iSubItem) + + typedef struct tagLVCOLUMNA { + UINT mask; + int fmt; + int cx; + LPSTR pszText; + int cchTextMax; + int iSubItem; + int iImage; + int iOrder; + } LVCOLUMNA,*LPLVCOLUMNA; + + typedef struct tagLVCOLUMNW { + UINT mask; + int fmt; + int cx; + LPWSTR pszText; + int cchTextMax; + int iSubItem; + #if (_WIN32_IE >= 0x0300) + int iImage; + int iOrder; + #endif + #if (_WIN32_WINNT >= 0x0600) + int cxMin; + int cxDefault; + int cxIdeal; + #endif + } LVCOLUMNW,*LPLVCOLUMNW; + +#ifdef UNICODE +#define LVCOLUMN LVCOLUMNW +#define LPLVCOLUMN LPLVCOLUMNW +#define LVCOLUMN_V1_SIZE LVCOLUMNW_V1_SIZE +#else +#define LVCOLUMN LVCOLUMNA +#define LPLVCOLUMN LPLVCOLUMNA +#define LVCOLUMN_V1_SIZE LVCOLUMNA_V1_SIZE +#endif + +#define LVCF_FMT 0x1 +#define LVCF_WIDTH 0x2 +#define LVCF_TEXT 0x4 +#define LVCF_SUBITEM 0x8 +#define LVCF_IMAGE 0x10 +#define LVCF_ORDER 0x20 +#if (_WIN32_WINNT >= 0x0600) +#define LVCF_MINWIDTH 0x40 +#define LVCF_DEFAULTWIDTH 0x80 +#define LVCF_IDEALWIDTH 0x100 +#endif /* (_WIN32_WINNT >= 0x0600) */ + +#define LVCFMT_LEFT 0x0 +#define LVCFMT_RIGHT 0x1 +#define LVCFMT_CENTER 0x2 +#define LVCFMT_JUSTIFYMASK 0x3 +#define LVCFMT_IMAGE 0x800 +#define LVCFMT_BITMAP_ON_RIGHT 0x1000 +#define LVCFMT_COL_HAS_IMAGES 0x8000 +#if (_WIN32_WINNT >= 0x0600) +#define LVCFMT_FIXED_WIDTH 0x100 +#define LVCFMT_NO_DPI_SCALE 0x40000 +#define LVCFMT_FIXED_RATIO 0x80000 +#define LVCFMT_LINE_BREAK 0x100000 +#define LVCFMT_FILL 0x200000 +#define LVCFMT_WRAP 0x400000 +#define LVCFMT_NO_TITLE 0x800000 +#define LVCFMT_SPLITBUTTON 0x1000000 +#define LVCFMT_TILE_PLACEMENTMASK (LVCFMT_LINE_BREAK|LVCFMT_FILL) +#endif /* (_WIN32_WINNT >= 0x0600) */ + +#define LVM_GETCOLUMNA (LVM_FIRST+25) +#define LVM_GETCOLUMNW (LVM_FIRST+95) +#ifdef UNICODE +#define LVM_GETCOLUMN LVM_GETCOLUMNW +#else +#define LVM_GETCOLUMN LVM_GETCOLUMNA +#endif + +#define ListView_GetColumn(hwnd,iCol,pcol) (WINBOOL)SNDMSG((hwnd),LVM_GETCOLUMN,(WPARAM)(int)(iCol),(LPARAM)(LV_COLUMN *)(pcol)) + +#define LVM_SETCOLUMNA (LVM_FIRST+26) +#define LVM_SETCOLUMNW (LVM_FIRST+96) +#ifdef UNICODE +#define LVM_SETCOLUMN LVM_SETCOLUMNW +#else +#define LVM_SETCOLUMN LVM_SETCOLUMNA +#endif + +#define ListView_SetColumn(hwnd,iCol,pcol) (WINBOOL)SNDMSG((hwnd),LVM_SETCOLUMN,(WPARAM)(int)(iCol),(LPARAM)(const LV_COLUMN *)(pcol)) + +#define LVM_INSERTCOLUMNA (LVM_FIRST+27) +#define LVM_INSERTCOLUMNW (LVM_FIRST+97) +#ifdef UNICODE +#define LVM_INSERTCOLUMN LVM_INSERTCOLUMNW +#else +#define LVM_INSERTCOLUMN LVM_INSERTCOLUMNA +#endif + +#define ListView_InsertColumn(hwnd,iCol,pcol) (int)SNDMSG((hwnd),LVM_INSERTCOLUMN,(WPARAM)(int)(iCol),(LPARAM)(const LV_COLUMN *)(pcol)) + +#define LVM_DELETECOLUMN (LVM_FIRST+28) +#define ListView_DeleteColumn(hwnd,iCol) (WINBOOL)SNDMSG((hwnd),LVM_DELETECOLUMN,(WPARAM)(int)(iCol),0) + +#define LVM_GETCOLUMNWIDTH (LVM_FIRST+29) +#define ListView_GetColumnWidth(hwnd,iCol) (int)SNDMSG((hwnd),LVM_GETCOLUMNWIDTH,(WPARAM)(int)(iCol),0) + +#define LVSCW_AUTOSIZE -1 +#define LVSCW_AUTOSIZE_USEHEADER -2 +#define LVM_SETCOLUMNWIDTH (LVM_FIRST+30) + +#define ListView_SetColumnWidth(hwnd,iCol,cx) (WINBOOL)SNDMSG((hwnd),LVM_SETCOLUMNWIDTH,(WPARAM)(int)(iCol),MAKELPARAM((cx),0)) + +#define LVM_GETHEADER (LVM_FIRST+31) +#define ListView_GetHeader(hwnd) (HWND)SNDMSG((hwnd),LVM_GETHEADER,0,0L) +#define LVM_CREATEDRAGIMAGE (LVM_FIRST+33) +#define ListView_CreateDragImage(hwnd,i,lpptUpLeft) (HIMAGELIST)SNDMSG((hwnd),LVM_CREATEDRAGIMAGE,(WPARAM)(int)(i),(LPARAM)(LPPOINT)(lpptUpLeft)) +#define LVM_GETVIEWRECT (LVM_FIRST+34) +#define ListView_GetViewRect(hwnd,prc) (WINBOOL)SNDMSG((hwnd),LVM_GETVIEWRECT,0,(LPARAM)(RECT *)(prc)) +#define LVM_GETTEXTCOLOR (LVM_FIRST+35) +#define ListView_GetTextColor(hwnd) (COLORREF)SNDMSG((hwnd),LVM_GETTEXTCOLOR,0,0L) +#define LVM_SETTEXTCOLOR (LVM_FIRST+36) +#define ListView_SetTextColor(hwnd,clrText) (WINBOOL)SNDMSG((hwnd),LVM_SETTEXTCOLOR,0,(LPARAM)(COLORREF)(clrText)) +#define LVM_GETTEXTBKCOLOR (LVM_FIRST+37) +#define ListView_GetTextBkColor(hwnd) (COLORREF)SNDMSG((hwnd),LVM_GETTEXTBKCOLOR,0,0L) +#define LVM_SETTEXTBKCOLOR (LVM_FIRST+38) +#define ListView_SetTextBkColor(hwnd,clrTextBk) (WINBOOL)SNDMSG((hwnd),LVM_SETTEXTBKCOLOR,0,(LPARAM)(COLORREF)(clrTextBk)) +#define LVM_GETTOPINDEX (LVM_FIRST+39) +#define ListView_GetTopIndex(hwndLV) (int)SNDMSG((hwndLV),LVM_GETTOPINDEX,0,0) +#define LVM_GETCOUNTPERPAGE (LVM_FIRST+40) +#define ListView_GetCountPerPage(hwndLV) (int)SNDMSG((hwndLV),LVM_GETCOUNTPERPAGE,0,0) +#define LVM_GETORIGIN (LVM_FIRST+41) +#define ListView_GetOrigin(hwndLV,ppt) (WINBOOL)SNDMSG((hwndLV),LVM_GETORIGIN,(WPARAM)0,(LPARAM)(POINT *)(ppt)) +#define LVM_UPDATE (LVM_FIRST+42) +#define ListView_Update(hwndLV,i) (WINBOOL)SNDMSG((hwndLV),LVM_UPDATE,(WPARAM)(i),0L) +#define LVM_SETITEMSTATE (LVM_FIRST+43) +#define ListView_SetItemState(hwndLV,i,data,mask) { LV_ITEM _ms_lvi; _ms_lvi.stateMask = mask; _ms_lvi.state = data; SNDMSG((hwndLV),LVM_SETITEMSTATE,(WPARAM)(i),(LPARAM)(LV_ITEM *)&_ms_lvi);} +#define ListView_SetCheckState(hwndLV,i,fCheck) ListView_SetItemState(hwndLV,i,INDEXTOSTATEIMAGEMASK((fCheck)?2:1),LVIS_STATEIMAGEMASK) +#define LVM_GETITEMSTATE (LVM_FIRST+44) +#define ListView_GetItemState(hwndLV,i,mask) (UINT)SNDMSG((hwndLV),LVM_GETITEMSTATE,(WPARAM)(i),(LPARAM)(mask)) +#define ListView_GetCheckState(hwndLV,i) ((((UINT)(SNDMSG((hwndLV),LVM_GETITEMSTATE,(WPARAM)(i),LVIS_STATEIMAGEMASK))) >> 12) -1) + +#define LVM_GETITEMTEXTA (LVM_FIRST+45) +#define LVM_GETITEMTEXTW (LVM_FIRST+115) + +#ifdef UNICODE +#define LVM_GETITEMTEXT LVM_GETITEMTEXTW +#else +#define LVM_GETITEMTEXT LVM_GETITEMTEXTA +#endif + +#define ListView_GetItemText(hwndLV,i,iSubItem_,pszText_,cchTextMax_) { LV_ITEM _ms_lvi; _ms_lvi.iSubItem = iSubItem_; _ms_lvi.cchTextMax = cchTextMax_; _ms_lvi.pszText = pszText_; SNDMSG((hwndLV),LVM_GETITEMTEXT,(WPARAM)(i),(LPARAM)(LV_ITEM *)&_ms_lvi);} + +#define LVM_SETITEMTEXTA (LVM_FIRST+46) +#define LVM_SETITEMTEXTW (LVM_FIRST+116) + +#ifdef UNICODE +#define LVM_SETITEMTEXT LVM_SETITEMTEXTW +#else +#define LVM_SETITEMTEXT LVM_SETITEMTEXTA +#endif + +#define ListView_SetItemText(hwndLV,i,iSubItem_,pszText_) { LV_ITEM _ms_lvi; _ms_lvi.iSubItem = iSubItem_; _ms_lvi.pszText = pszText_; SNDMSG((hwndLV),LVM_SETITEMTEXT,(WPARAM)(i),(LPARAM)(LV_ITEM *)&_ms_lvi);} + +#define LVSICF_NOINVALIDATEALL 0x1 +#define LVSICF_NOSCROLL 0x2 + +#define LVM_SETITEMCOUNT (LVM_FIRST+47) +#define ListView_SetItemCount(hwndLV,cItems) SNDMSG((hwndLV),LVM_SETITEMCOUNT,(WPARAM)(cItems),0) +#define ListView_SetItemCountEx(hwndLV,cItems,dwFlags) SNDMSG((hwndLV),LVM_SETITEMCOUNT,(WPARAM)(cItems),(LPARAM)(dwFlags)) + + typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM,LPARAM,LPARAM); + +#define LVM_SORTITEMS (LVM_FIRST+48) +#define ListView_SortItems(hwndLV,_pfnCompare,_lPrm) (WINBOOL)SNDMSG((hwndLV),LVM_SORTITEMS,(WPARAM)(LPARAM)(_lPrm),(LPARAM)(PFNLVCOMPARE)(_pfnCompare)) + +#define LVM_SETITEMPOSITION32 (LVM_FIRST+49) +#define ListView_SetItemPosition32(hwndLV,i,x0,y0) { POINT ptNewPos; ptNewPos.x = x0; ptNewPos.y = y0; SNDMSG((hwndLV),LVM_SETITEMPOSITION32,(WPARAM)(int)(i),(LPARAM)&ptNewPos); } + +#define LVM_GETSELECTEDCOUNT (LVM_FIRST+50) +#define ListView_GetSelectedCount(hwndLV) (UINT)SNDMSG((hwndLV),LVM_GETSELECTEDCOUNT,0,0L) + +#define LVM_GETITEMSPACING (LVM_FIRST+51) +#define ListView_GetItemSpacing(hwndLV,fSmall) (DWORD)SNDMSG((hwndLV),LVM_GETITEMSPACING,fSmall,0L) + +#define LVM_GETISEARCHSTRINGA (LVM_FIRST+52) +#define LVM_GETISEARCHSTRINGW (LVM_FIRST+117) + +#ifdef UNICODE +#define LVM_GETISEARCHSTRING LVM_GETISEARCHSTRINGW +#else +#define LVM_GETISEARCHSTRING LVM_GETISEARCHSTRINGA +#endif + +#define ListView_GetISearchString(hwndLV,lpsz) (WINBOOL)SNDMSG((hwndLV),LVM_GETISEARCHSTRING,0,(LPARAM)(LPTSTR)(lpsz)) + +#define LVM_SETICONSPACING (LVM_FIRST+53) + +#define ListView_SetIconSpacing(hwndLV,cx,cy) (DWORD)SNDMSG((hwndLV),LVM_SETICONSPACING,0,MAKELONG(cx,cy)) +#define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+54) +#define ListView_SetExtendedListViewStyle(hwndLV,dw) (DWORD)SNDMSG((hwndLV),LVM_SETEXTENDEDLISTVIEWSTYLE,0,dw) +#define ListView_SetExtendedListViewStyleEx(hwndLV,dwMask,dw) (DWORD)SNDMSG((hwndLV),LVM_SETEXTENDEDLISTVIEWSTYLE,dwMask,dw) +#define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+55) +#define ListView_GetExtendedListViewStyle(hwndLV) (DWORD)SNDMSG((hwndLV),LVM_GETEXTENDEDLISTVIEWSTYLE,0,0) +#define LVS_EX_GRIDLINES 0x1 +#define LVS_EX_SUBITEMIMAGES 0x2 +#define LVS_EX_CHECKBOXES 0x4 +#define LVS_EX_TRACKSELECT 0x8 +#define LVS_EX_HEADERDRAGDROP 0x10 +#define LVS_EX_FULLROWSELECT 0x20 +#define LVS_EX_ONECLICKACTIVATE 0x40 +#define LVS_EX_TWOCLICKACTIVATE 0x80 +#define LVS_EX_FLATSB 0x100 +#define LVS_EX_REGIONAL 0x200 +#define LVS_EX_INFOTIP 0x400 +#define LVS_EX_UNDERLINEHOT 0x800 +#define LVS_EX_UNDERLINECOLD 0x1000 +#define LVS_EX_MULTIWORKAREAS 0x2000 +#define LVS_EX_LABELTIP 0x4000 +#define LVS_EX_BORDERSELECT 0x8000 +#define LVS_EX_DOUBLEBUFFER 0x10000 +#define LVS_EX_HIDELABELS 0x20000 +#define LVS_EX_SINGLEROW 0x40000 +#define LVS_EX_SNAPTOGRID 0x80000 +#define LVS_EX_SIMPLESELECT 0x100000 +#if _WIN32_WINNT >= 0x0600 +#define LVS_EX_JUSTIFYCOLUMNS 0x200000 +#define LVS_EX_TRANSPARENTBKGND 0x400000 +#define LVS_EX_TRANSPARENTSHADOWTEXT 0x800000 +#define LVS_EX_AUTOAUTOARRANGE 0x1000000 +#define LVS_EX_HEADERINALLVIEWS 0x2000000 +#define LVS_EX_AUTOCHECKSELECT 0x8000000 +#define LVS_EX_AUTOSIZECOLUMNS 0x10000000 +#define LVS_EX_COLUMNSNAPPOINTS 0x40000000 +#define LVS_EX_COLUMNOVERFLOW 0x80000000 +#endif + +#define LVM_GETSUBITEMRECT (LVM_FIRST+56) +#define ListView_GetSubItemRect(hwnd,iItem,iSubItem,code,prc) (WINBOOL)SNDMSG((hwnd),LVM_GETSUBITEMRECT,(WPARAM)(int)(iItem),((prc) ? ((((LPRECT)(prc))->top = iSubItem),(((LPRECT)(prc))->left = code),(LPARAM)(prc)) : (LPARAM)(LPRECT)NULL)) +#define LVM_SUBITEMHITTEST (LVM_FIRST+57) +#define ListView_SubItemHitTest(hwnd,plvhti) (int)SNDMSG((hwnd),LVM_SUBITEMHITTEST,0,(LPARAM)(LPLVHITTESTINFO)(plvhti)) +#define LVM_SETCOLUMNORDERARRAY (LVM_FIRST+58) +#define ListView_SetColumnOrderArray(hwnd,iCount,pi) (WINBOOL)SNDMSG((hwnd),LVM_SETCOLUMNORDERARRAY,(WPARAM)(iCount),(LPARAM)(LPINT)(pi)) +#define LVM_GETCOLUMNORDERARRAY (LVM_FIRST+59) +#define ListView_GetColumnOrderArray(hwnd,iCount,pi) (WINBOOL)SNDMSG((hwnd),LVM_GETCOLUMNORDERARRAY,(WPARAM)(iCount),(LPARAM)(LPINT)(pi)) +#define LVM_SETHOTITEM (LVM_FIRST+60) +#define ListView_SetHotItem(hwnd,i) (int)SNDMSG((hwnd),LVM_SETHOTITEM,(WPARAM)(i),0) +#define LVM_GETHOTITEM (LVM_FIRST+61) +#define ListView_GetHotItem(hwnd) (int)SNDMSG((hwnd),LVM_GETHOTITEM,0,0) +#define LVM_SETHOTCURSOR (LVM_FIRST+62) +#define ListView_SetHotCursor(hwnd,hcur) (HCURSOR)SNDMSG((hwnd),LVM_SETHOTCURSOR,0,(LPARAM)(hcur)) +#define LVM_GETHOTCURSOR (LVM_FIRST+63) +#define ListView_GetHotCursor(hwnd) (HCURSOR)SNDMSG((hwnd),LVM_GETHOTCURSOR,0,0) +#define LVM_APPROXIMATEVIEWRECT (LVM_FIRST+64) +#define ListView_ApproximateViewRect(hwnd,iWidth,iHeight,iCount) (DWORD)SNDMSG((hwnd),LVM_APPROXIMATEVIEWRECT,iCount,MAKELPARAM(iWidth,iHeight)) + +#define LV_MAX_WORKAREAS 16 +#define LVM_SETWORKAREAS (LVM_FIRST+65) +#define ListView_SetWorkAreas(hwnd,nWorkAreas,prc) (WINBOOL)SNDMSG((hwnd),LVM_SETWORKAREAS,(WPARAM)(int)(nWorkAreas),(LPARAM)(RECT *)(prc)) +#define LVM_GETWORKAREAS (LVM_FIRST+70) +#define ListView_GetWorkAreas(hwnd,nWorkAreas,prc) (WINBOOL)SNDMSG((hwnd),LVM_GETWORKAREAS,(WPARAM)(int)(nWorkAreas),(LPARAM)(RECT *)(prc)) +#define LVM_GETNUMBEROFWORKAREAS (LVM_FIRST+73) +#define ListView_GetNumberOfWorkAreas(hwnd,pnWorkAreas) (WINBOOL)SNDMSG((hwnd),LVM_GETNUMBEROFWORKAREAS,0,(LPARAM)(UINT *)(pnWorkAreas)) +#define LVM_GETSELECTIONMARK (LVM_FIRST+66) +#define ListView_GetSelectionMark(hwnd) (int)SNDMSG((hwnd),LVM_GETSELECTIONMARK,0,0) +#define LVM_SETSELECTIONMARK (LVM_FIRST+67) +#define ListView_SetSelectionMark(hwnd,i) (int)SNDMSG((hwnd),LVM_SETSELECTIONMARK,0,(LPARAM)(i)) +#define LVM_SETHOVERTIME (LVM_FIRST+71) +#define ListView_SetHoverTime(hwndLV,dwHoverTimeMs) (DWORD)SNDMSG((hwndLV),LVM_SETHOVERTIME,0,(LPARAM)(dwHoverTimeMs)) +#define LVM_GETHOVERTIME (LVM_FIRST+72) +#define ListView_GetHoverTime(hwndLV) (DWORD)SNDMSG((hwndLV),LVM_GETHOVERTIME,0,0) +#define LVM_SETTOOLTIPS (LVM_FIRST+74) +#define ListView_SetToolTips(hwndLV,hwndNewHwnd) (HWND)SNDMSG((hwndLV),LVM_SETTOOLTIPS,(WPARAM)(hwndNewHwnd),0) +#define LVM_GETTOOLTIPS (LVM_FIRST+78) +#define ListView_GetToolTips(hwndLV) (HWND)SNDMSG((hwndLV),LVM_GETTOOLTIPS,0,0) +#define LVM_SORTITEMSEX (LVM_FIRST+81) +#define ListView_SortItemsEx(hwndLV,_pfnCompare,_lPrm) (WINBOOL)SNDMSG((hwndLV),LVM_SORTITEMSEX,(WPARAM)(LPARAM)(_lPrm),(LPARAM)(PFNLVCOMPARE)(_pfnCompare)) + + typedef struct tagLVBKIMAGEA { ULONG ulFlags; HBITMAP hbm; LPSTR pszImage; UINT cchImageMax; int xOffsetPercent; int yOffsetPercent; -} LVBKIMAGEA, *LPLVBKIMAGEA; + } LVBKIMAGEA,*LPLVBKIMAGEA; -typedef struct tagLVBKIMAGEW -{ + typedef struct tagLVBKIMAGEW { ULONG ulFlags; HBITMAP hbm; LPWSTR pszImage; UINT cchImageMax; int xOffsetPercent; int yOffsetPercent; -} LVBKIMAGEW, *LPLVBKIMAGEW; + } LVBKIMAGEW,*LPLVBKIMAGEW; -#define LVBKIMAGE WINELIB_NAME_AW(LVBKIMAGE) -#define LPLVBKIMAGE WINELIB_NAME_AW(LPLVBKIMAGE) +#define LVBKIF_SOURCE_NONE 0x0 +#define LVBKIF_SOURCE_HBITMAP 0x1 +#define LVBKIF_SOURCE_URL 0x2 +#define LVBKIF_SOURCE_MASK 0x3 +#define LVBKIF_STYLE_NORMAL 0x0 +#define LVBKIF_STYLE_TILE 0x10 +#define LVBKIF_STYLE_MASK 0x10 +#define LVBKIF_FLAG_TILEOFFSET 0x100 +#define LVBKIF_TYPE_WATERMARK 0x10000000 -#define LVBKIF_SOURCE_NONE 0x00000000 -#define LVBKIF_SOURCE_HBITMAP 0x00000001 -#define LVBKIF_SOURCE_URL 0x00000002 -#define LVBKIF_SOURCE_MASK 0x00000003 -#define LVBKIF_STYLE_NORMAL 0x00000000 -#define LVBKIF_STYLE_TILE 0x00000010 -#define LVBKIF_STYLE_MASK 0x00000010 -#define LVBKIF_FLAG_TILEOFFSET 0x00000100 -#define LVBKIF_TYPE_WATERMARK 0x10000000 +#define LVM_SETBKIMAGEA (LVM_FIRST+68) +#define LVM_SETBKIMAGEW (LVM_FIRST+138) +#define LVM_GETBKIMAGEA (LVM_FIRST+69) +#define LVM_GETBKIMAGEW (LVM_FIRST+139) -#define ListView_SetBkImage(hwnd, plvbki) \ - (BOOL)SNDMSG((hwnd), LVM_SETBKIMAGE, 0, (LPARAM)plvbki) +#define LVM_SETSELECTEDCOLUMN (LVM_FIRST+140) +#define ListView_SetSelectedColumn(hwnd,iCol) SNDMSG((hwnd),LVM_SETSELECTEDCOLUMN,(WPARAM)iCol,0) +#define LVM_SETTILEWIDTH (LVM_FIRST+141) +#define ListView_SetTileWidth(hwnd,cpWidth) SNDMSG((hwnd),LVM_SETTILEWIDTH,(WPARAM)cpWidth,0) +#define LV_VIEW_ICON 0x0 +#define LV_VIEW_DETAILS 0x1 +#define LV_VIEW_SMALLICON 0x2 +#define LV_VIEW_LIST 0x3 +#define LV_VIEW_TILE 0x4 +#define LV_VIEW_MAX 0x4 +#define LVM_SETVIEW (LVM_FIRST+142) +#define ListView_SetView(hwnd,iView) (DWORD)SNDMSG((hwnd),LVM_SETVIEW,(WPARAM)(DWORD)iView,0) +#define LVM_GETVIEW (LVM_FIRST+143) +#define ListView_GetView(hwnd) (DWORD)SNDMSG((hwnd),LVM_GETVIEW,0,0) +#define LVGF_NONE 0x0 +#define LVGF_HEADER 0x1 +#define LVGF_FOOTER 0x2 +#define LVGF_STATE 0x4 +#define LVGF_ALIGN 0x8 +#define LVGF_GROUPID 0x10 -#define ListView_GetBkImage(hwnd, plvbki) \ - (BOOL)SNDMSG((hwnd), LVM_GETBKIMAGE, 0, (LPARAM)plvbki) +#define LVGS_NORMAL 0x0 +#define LVGS_COLLAPSED 0x1 +#define LVGS_HIDDEN 0x2 -typedef struct tagLVCOLUMNA -{ +#define LVGA_HEADER_LEFT 0x1 +#define LVGA_HEADER_CENTER 0x2 +#define LVGA_HEADER_RIGHT 0x4 +#define LVGA_FOOTER_LEFT 0x8 +#define LVGA_FOOTER_CENTER 0x10 +#define LVGA_FOOTER_RIGHT 0x20 + + typedef struct tagLVGROUP { + UINT cbSize; UINT mask; - INT fmt; - INT cx; - LPSTR pszText; - INT cchTextMax; - INT iSubItem; - /* (_WIN32_IE >= 0x0300) */ - INT iImage; - INT iOrder; - /* (_WIN32_WINNT >= 0x0600) */ - INT cxMin; - INT cxDefault; - INT cxIdeal; -} LVCOLUMNA, *LPLVCOLUMNA; + LPWSTR pszHeader; + int cchHeader; + LPWSTR pszFooter; + int cchFooter; + int iGroupId; + UINT stateMask; + UINT state; + UINT uAlign; + } LVGROUP,*PLVGROUP; -typedef struct tagLVCOLUMNW -{ +#define LVM_INSERTGROUP (LVM_FIRST+145) +#define ListView_InsertGroup(hwnd,index,pgrp) SNDMSG((hwnd),LVM_INSERTGROUP,(WPARAM)index,(LPARAM)pgrp) +#define LVM_SETGROUPINFO (LVM_FIRST+147) +#define ListView_SetGroupInfo(hwnd,iGroupId,pgrp) SNDMSG((hwnd),LVM_SETGROUPINFO,(WPARAM)iGroupId,(LPARAM)pgrp) +#define LVM_GETGROUPINFO (LVM_FIRST+149) +#define ListView_GetGroupInfo(hwnd,iGroupId,pgrp) SNDMSG((hwnd),LVM_GETGROUPINFO,(WPARAM)iGroupId,(LPARAM)pgrp) +#define LVM_REMOVEGROUP (LVM_FIRST+150) +#define ListView_RemoveGroup(hwnd,iGroupId) SNDMSG((hwnd),LVM_REMOVEGROUP,(WPARAM)iGroupId,0) +#define LVM_MOVEGROUP (LVM_FIRST+151) +#define ListView_MoveGroup(hwnd,iGroupId,toIndex) SNDMSG((hwnd),LVM_MOVEGROUP,(WPARAM)iGroupId,(LPARAM)toIndex) +#define LVM_MOVEITEMTOGROUP (LVM_FIRST+154) +#define ListView_MoveItemToGroup(hwnd,idItemFrom,idGroupTo) SNDMSG((hwnd),LVM_MOVEITEMTOGROUP,(WPARAM)idItemFrom,(LPARAM)idGroupTo) +#define LVGMF_NONE 0x0 +#define LVGMF_BORDERSIZE 0x1 +#define LVGMF_BORDERCOLOR 0x2 +#define LVGMF_TEXTCOLOR 0x4 + + typedef struct tagLVGROUPMETRICS { + UINT cbSize; UINT mask; - INT fmt; - INT cx; + UINT Left; + UINT Top; + UINT Right; + UINT Bottom; + COLORREF crLeft; + COLORREF crTop; + COLORREF crRight; + COLORREF crBottom; + COLORREF crHeader; + COLORREF crFooter; + } LVGROUPMETRICS,*PLVGROUPMETRICS; + +#define LVM_SETGROUPMETRICS (LVM_FIRST+155) +#define ListView_SetGroupMetrics(hwnd,pGroupMetrics) SNDMSG((hwnd),LVM_SETGROUPMETRICS,0,(LPARAM)pGroupMetrics) +#define LVM_GETGROUPMETRICS (LVM_FIRST+156) +#define ListView_GetGroupMetrics(hwnd,pGroupMetrics) SNDMSG((hwnd),LVM_GETGROUPMETRICS,0,(LPARAM)pGroupMetrics) +#define LVM_ENABLEGROUPVIEW (LVM_FIRST+157) +#define ListView_EnableGroupView(hwnd,fEnable) SNDMSG((hwnd),LVM_ENABLEGROUPVIEW,(WPARAM)fEnable,0) + + typedef int (CALLBACK *PFNLVGROUPCOMPARE)(int,int,void *); + +#define LVM_SORTGROUPS (LVM_FIRST+158) +#define ListView_SortGroups(hwnd,_pfnGroupCompate,_plv) SNDMSG((hwnd),LVM_SORTGROUPS,(WPARAM)_pfnGroupCompate,(LPARAM)_plv) + + typedef struct tagLVINSERTGROUPSORTED { + PFNLVGROUPCOMPARE pfnGroupCompare; + void *pvData; + LVGROUP lvGroup; + } LVINSERTGROUPSORTED,*PLVINSERTGROUPSORTED; + +#define LVM_INSERTGROUPSORTED (LVM_FIRST+159) +#define ListView_InsertGroupSorted(hwnd,structInsert) SNDMSG((hwnd),LVM_INSERTGROUPSORTED,(WPARAM)structInsert,0) +#define LVM_REMOVEALLGROUPS (LVM_FIRST+160) +#define ListView_RemoveAllGroups(hwnd) SNDMSG((hwnd),LVM_REMOVEALLGROUPS,0,0) +#define LVM_HASGROUP (LVM_FIRST+161) +#define ListView_HasGroup(hwnd,dwGroupId) SNDMSG((hwnd),LVM_HASGROUP,dwGroupId,0) + +#define LVTVIF_AUTOSIZE 0x0 +#define LVTVIF_FIXEDWIDTH 0x1 +#define LVTVIF_FIXEDHEIGHT 0x2 +#define LVTVIF_FIXEDSIZE 0x3 + +#define LVTVIM_TILESIZE 0x1 +#define LVTVIM_COLUMNS 0x2 +#define LVTVIM_LABELMARGIN 0x4 + + typedef struct tagLVTILEVIEWINFO { + UINT cbSize; + DWORD dwMask; + DWORD dwFlags; + SIZE sizeTile; + int cLines; + RECT rcLabelMargin; + } LVTILEVIEWINFO,*PLVTILEVIEWINFO; + + typedef struct tagLVTILEINFO { + UINT cbSize; + int iItem; + UINT cColumns; + PUINT puColumns; + } LVTILEINFO,*PLVTILEINFO; + +#define LVM_SETTILEVIEWINFO (LVM_FIRST+162) +#define ListView_SetTileViewInfo(hwnd,ptvi) SNDMSG((hwnd),LVM_SETTILEVIEWINFO,0,(LPARAM)ptvi) +#define LVM_GETTILEVIEWINFO (LVM_FIRST+163) +#define ListView_GetTileViewInfo(hwnd,ptvi) SNDMSG((hwnd),LVM_GETTILEVIEWINFO,0,(LPARAM)ptvi) +#define LVM_SETTILEINFO (LVM_FIRST+164) +#define ListView_SetTileInfo(hwnd,pti) SNDMSG((hwnd),LVM_SETTILEINFO,0,(LPARAM)pti) +#define LVM_GETTILEINFO (LVM_FIRST+165) +#define ListView_GetTileInfo(hwnd,pti) SNDMSG((hwnd),LVM_GETTILEINFO,0,(LPARAM)pti) + + typedef struct { + UINT cbSize; + DWORD dwFlags; + int iItem; + DWORD dwReserved; + } LVINSERTMARK,*LPLVINSERTMARK; + +#define LVIM_AFTER 0x1 + +#define LVM_SETINSERTMARK (LVM_FIRST+166) +#define ListView_SetInsertMark(hwnd,lvim) (WINBOOL)SNDMSG((hwnd),LVM_SETINSERTMARK,(WPARAM) 0,(LPARAM) (lvim)) +#define LVM_GETINSERTMARK (LVM_FIRST+167) +#define ListView_GetInsertMark(hwnd,lvim) (WINBOOL)SNDMSG((hwnd),LVM_GETINSERTMARK,(WPARAM) 0,(LPARAM) (lvim)) +#define LVM_INSERTMARKHITTEST (LVM_FIRST+168) +#define ListView_InsertMarkHitTest(hwnd,point,lvim) (int)SNDMSG((hwnd),LVM_INSERTMARKHITTEST,(WPARAM)(LPPOINT)(point),(LPARAM)(LPLVINSERTMARK)(lvim)) +#define LVM_GETINSERTMARKRECT (LVM_FIRST+169) +#define ListView_GetInsertMarkRect(hwnd,rc) (int)SNDMSG((hwnd),LVM_GETINSERTMARKRECT,(WPARAM)0,(LPARAM)(LPRECT)(rc)) +#define LVM_SETINSERTMARKCOLOR (LVM_FIRST+170) +#define ListView_SetInsertMarkColor(hwnd,color) (COLORREF)SNDMSG((hwnd),LVM_SETINSERTMARKCOLOR,(WPARAM)0,(LPARAM)(COLORREF)(color)) +#define LVM_GETINSERTMARKCOLOR (LVM_FIRST+171) +#define ListView_GetInsertMarkColor(hwnd) (COLORREF)SNDMSG((hwnd),LVM_GETINSERTMARKCOLOR,(WPARAM)0,(LPARAM)0) + + typedef struct tagLVSETINFOTIP { + UINT cbSize; + DWORD dwFlags; LPWSTR pszText; - INT cchTextMax; - INT iSubItem; - /* (_WIN32_IE >= 0x0300) */ - INT iImage; - INT iOrder; - /* (_WIN32_WINNT >= 0x0600) */ - INT cxMin; - INT cxDefault; - INT cxIdeal; -} LVCOLUMNW, *LPLVCOLUMNW; + int iItem; + int iSubItem; + } LVSETINFOTIP,*PLVSETINFOTIP; -#define LVCOLUMN WINELIB_NAME_AW(LVCOLUMN) -#define LPLVCOLUMN WINELIB_NAME_AW(LPLVCOLUMN) +#define LVM_SETINFOTIP (LVM_FIRST+173) +#define ListView_SetInfoTip(hwndLV,plvInfoTip) (WINBOOL)SNDMSG((hwndLV),LVM_SETINFOTIP,(WPARAM)0,(LPARAM)plvInfoTip) +#define LVM_GETSELECTEDCOLUMN (LVM_FIRST+174) +#define ListView_GetSelectedColumn(hwnd) (UINT)SNDMSG((hwnd),LVM_GETSELECTEDCOLUMN,0,0) +#define LVM_ISGROUPVIEWENABLED (LVM_FIRST+175) +#define ListView_IsGroupViewEnabled(hwnd) (WINBOOL)SNDMSG((hwnd),LVM_ISGROUPVIEWENABLED,0,0) +#define LVM_GETOUTLINECOLOR (LVM_FIRST+176) +#define ListView_GetOutlineColor(hwnd) (COLORREF)SNDMSG((hwnd),LVM_GETOUTLINECOLOR,0,0) +#define LVM_SETOUTLINECOLOR (LVM_FIRST+177) +#define ListView_SetOutlineColor(hwnd,color) (COLORREF)SNDMSG((hwnd),LVM_SETOUTLINECOLOR,(WPARAM)0,(LPARAM)(COLORREF)(color)) +#define LVM_CANCELEDITLABEL (LVM_FIRST+179) +#define ListView_CancelEditLabel(hwnd) (VOID)SNDMSG((hwnd),LVM_CANCELEDITLABEL,(WPARAM)0,(LPARAM)0) +#define LVM_MAPINDEXTOID (LVM_FIRST+180) +#define ListView_MapIndexToID(hwnd,index) (UINT)SNDMSG((hwnd),LVM_MAPINDEXTOID,(WPARAM)index,(LPARAM)0) +#define LVM_MAPIDTOINDEX (LVM_FIRST+181) +#define ListView_MapIDToIndex(hwnd,id) (UINT)SNDMSG((hwnd),LVM_MAPIDTOINDEX,(WPARAM)id,(LPARAM)0) +#define LVM_ISITEMVISIBLE (LVM_FIRST+182) +#define ListView_IsItemVisible(hwnd,index) (UINT)SNDMSG((hwnd),LVM_ISITEMVISIBLE,(WPARAM)(index),(LPARAM)0) -#define LVCOLUMN_V1_SIZEA CCSIZEOF_STRUCT(LVCOLUMNA, iSubItem) -#define LVCOLUMN_V1_SIZEW CCSIZEOF_STRUCT(LVCOLUMNW, iSubItem) -#define LVCOLUMN_V1_SIZE WINELIB_NAME_AW(LVCOLUMN_V1_SIZE) +#ifdef UNICODE +#define LVBKIMAGE LVBKIMAGEW +#define LPLVBKIMAGE LPLVBKIMAGEW +#define LVM_SETBKIMAGE LVM_SETBKIMAGEW +#define LVM_GETBKIMAGE LVM_GETBKIMAGEW +#else +#define LVBKIMAGE LVBKIMAGEA +#define LPLVBKIMAGE LPLVBKIMAGEA +#define LVM_SETBKIMAGE LVM_SETBKIMAGEA +#define LVM_GETBKIMAGE LVM_GETBKIMAGEA +#endif -#define LV_COLUMN LVCOLUMN +#define ListView_SetBkImage(hwnd,plvbki) (WINBOOL)SNDMSG((hwnd),LVM_SETBKIMAGE,0,(LPARAM)(plvbki)) +#define ListView_GetBkImage(hwnd,plvbki) (WINBOOL)SNDMSG((hwnd),LVM_GETBKIMAGE,0,(LPARAM)(plvbki)) +#define LPNM_LISTVIEW LPNMLISTVIEW +#define NM_LISTVIEW NMLISTVIEW -typedef struct tagNMLISTVIEW -{ + typedef struct tagNMLISTVIEW { NMHDR hdr; - INT iItem; - INT iSubItem; + int iItem; + int iSubItem; UINT uNewState; UINT uOldState; UINT uChanged; POINT ptAction; - LPARAM lParam; -} NMLISTVIEW, *LPNMLISTVIEW; + LPARAM lParam; + } NMLISTVIEW,*LPNMLISTVIEW; -#define NM_LISTVIEW NMLISTVIEW -#define LPNM_LISTVIEW LPNMLISTVIEW - -typedef struct tagNMITEMACTIVATE -{ + typedef struct tagNMITEMACTIVATE { NMHDR hdr; int iItem; int iSubItem; @@ -3484,862 +3052,832 @@ typedef struct tagNMITEMACTIVATE POINT ptAction; LPARAM lParam; UINT uKeyFlags; -} NMITEMACTIVATE, *LPNMITEMACTIVATE; + } NMITEMACTIVATE,*LPNMITEMACTIVATE; -#define LVKF_ALT 0x0001 -#define LVKF_CONTROL 0x0002 -#define LVKF_SHIFT 0x0004 +#define LVKF_ALT 0x1 +#define LVKF_CONTROL 0x2 +#define LVKF_SHIFT 0x4 -typedef struct tagLVDISPINFO -{ - NMHDR hdr; - LVITEMA item; -} NMLVDISPINFOA, *LPNMLVDISPINFOA; +#define NMLVCUSTOMDRAW_V3_SIZE CCSIZEOF_STRUCT(NMLVCUSTOMDRW,clrTextBk) -typedef struct tagLVDISPINFOW -{ - NMHDR hdr; - LVITEMW item; -} NMLVDISPINFOW, *LPNMLVDISPINFOW; - -#define NMLVDISPINFO WINELIB_NAME_AW(NMLVDISPINFO) -#define LPNMLVDISPINFO WINELIB_NAME_AW(LPNMLVDISPINFO) - -#define LV_DISPINFO NMLVDISPINFO -#define LV_DISPINFOA NMLVDISPINFOA -#define LV_DISPINFOW NMLVDISPINFOW - -#include -typedef struct tagLVKEYDOWN -{ - NMHDR hdr; - WORD wVKey; - UINT flags; -} NMLVKEYDOWN, *LPNMLVKEYDOWN; -#include - -#define LV_KEYDOWN NMLVKEYDOWN - -typedef struct tagNMLVGETINFOTIPA -{ - NMHDR hdr; - DWORD dwFlags; - LPSTR pszText; - int cchTextMax; - int iItem; - int iSubItem; - LPARAM lParam; -} NMLVGETINFOTIPA, *LPNMLVGETINFOTIPA; - -typedef struct tagNMLVGETINFOTIPW -{ - NMHDR hdr; - DWORD dwFlags; - LPWSTR pszText; - int cchTextMax; - int iItem; - int iSubItem; - LPARAM lParam; -} NMLVGETINFOTIPW, *LPNMLVGETINFOTIPW; - -#define NMLVGETINFOTIP WINELIB_NAME_AW(NMLVGETINFOTIP) -#define LPNMLVGETINFOTIP WINELIB_NAME_AW(LPNMLVGETINFOTIP) - -typedef struct tagLVHITTESTINFO -{ - POINT pt; - UINT flags; - INT iItem; - INT iSubItem; - /* (_WIN32_WINNT >= 0x0600) */ - INT iGroup; -} LVHITTESTINFO, *LPLVHITTESTINFO; - -#define LV_HITTESTINFO LVHITTESTINFO -#define _LV_HITTESTINFO tagLVHITTESTINFO -#define LVHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(LVHITTESTINFO,iItem) - -typedef struct tagLVFINDINFOA -{ - UINT flags; - LPCSTR psz; - LPARAM lParam; - POINT pt; - UINT vkDirection; -} LVFINDINFOA, *LPLVFINDINFOA; - -typedef struct tagLVFINDINFOW -{ - UINT flags; - LPCWSTR psz; - LPARAM lParam; - POINT pt; - UINT vkDirection; -} LVFINDINFOW, *LPLVFINDINFOW; - -#define LVFINDINFO WINELIB_NAME_AW(LVFINDINFO) -#define LPLVFINDINFO WINELIB_NAME_AW(LPLVFINDINFO) - -#define LV_FINDINFO LVFINDINFO -#define LV_FINDINFOA LVFINDINFOA -#define LV_FINDINFOW LVFINDINFOW - -/* Groups relates structures */ - -typedef struct LVGROUP -{ - UINT cbSize; - UINT mask; - LPWSTR pszHeader; - INT cchHeader; - LPWSTR pszFooter; - INT cchFooter; - INT iGroupId; - UINT stateMask; - UINT state; - UINT uAlign; - /* (_WIN32_WINNT >= 0x0600) */ - LPWSTR pszSubtitle; - UINT cchSubtitle; - LPWSTR pszTask; - UINT cchTask; - LPWSTR pszDescriptionTop; - UINT cchDescriptionTop; - LPWSTR pszDescriptionBottom; - UINT cchDescriptionBottom; - INT iTitleImage; - INT iExtendedImage; - INT iFirstItem; - UINT cItems; - LPWSTR pszSubsetTitle; - UINT cchSubsetTitle; -} LVGROUP, *PLVGROUP; - -#define LVGROUP_V5_SIZE CCSIZEOF_STRUCT(LVGROUP, uAlign) - -typedef struct LVGROUPMETRICS -{ - UINT cbSize; - UINT mask; - UINT Left; - UINT Top; - UINT Right; - UINT Bottom; - COLORREF crLeft; - COLORREF crTop; - COLORREF crRight; - COLORREF crBottom; - COLORREF crRightHeader; - COLORREF crFooter; -} LVGROUPMETRICS, *PLVGROUPMETRICS; - -typedef INT (*PFNLVGROUPCOMPARE)(INT, INT, VOID*); - -typedef struct LVINSERTGROUPSORTED -{ - PFNLVGROUPCOMPARE pfnGroupCompare; - LPVOID *pvData; - LVGROUP lvGroup; -} LVINSERTGROUPSORTED, *PLVINSERTGROUPSORTED; - -/* Tile related structures */ - -typedef struct LVTILEINFO -{ - UINT cbSize; - int iItem; - UINT cColumns; - PUINT puColumns; - /* (_WIN32_WINNT >= 0x0600) */ - int* piColFmt; -} LVTILEINFO, *PLVTILEINFO; - -typedef struct LVTILEVIEWINFO -{ - UINT cbSize; - DWORD dwMask; - DWORD dwFlags; - SIZE sizeTile; - int cLines; - RECT rcLabelMargin; -} LVTILEVIEWINFO, *PLVTILEVIEWINFO; - -typedef struct LVINSERTMARK -{ - UINT cbSize; - DWORD dwFlags; - int iItem; - DWORD dwReserved; -} LVINSERTMARK, *PLVINSERTMARK; - -typedef struct tagTCHITTESTINFO -{ - POINT pt; - UINT flags; -} TCHITTESTINFO, *LPTCHITTESTINFO; - -#define TC_HITTESTINFO TCHITTESTINFO - -typedef INT (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM); - -#define NMLVCUSTOMDRAW_V3_SIZE CCSIZEOF_STRUCT(NMLCUSTOMDRW, clrTextBk) - -typedef struct tagNMLVCUSTOMDRAW -{ + typedef struct tagNMLVCUSTOMDRAW { NMCUSTOMDRAW nmcd; COLORREF clrText; COLORREF clrTextBk; - int iSubItem; /* (_WIN32_IE >= 0x0400) */ - DWORD dwItemType; /* (_WIN32_IE >= 0x560) */ - COLORREF clrFace; /* (_WIN32_IE >= 0x560) */ - int iIconEffect; /* (_WIN32_IE >= 0x560) */ - int iIconPhase; /* (_WIN32_IE >= 0x560) */ - int iPartId; /* (_WIN32_IE >= 0x560) */ - int iStateId; /* (_WIN32_IE >= 0x560) */ - RECT rcText; /* (_WIN32_IE >= 0x560) */ - UINT uAlign; /* (_WIN32_IE >= 0x560) */ -} NMLVCUSTOMDRAW, *LPNMLVCUSTOMDRAW; + int iSubItem; + DWORD dwItemType; + COLORREF clrFace; + int iIconEffect; + int iIconPhase; + int iPartId; + int iStateId; + RECT rcText; + UINT uAlign; + } NMLVCUSTOMDRAW,*LPNMLVCUSTOMDRAW; -typedef struct tagNMLVCACHEHINT -{ - NMHDR hdr; - INT iFrom; - INT iTo; -} NMLVCACHEHINT, *LPNMLVCACHEHINT; +#define LVCDI_ITEM 0x0 +#define LVCDI_GROUP 0x1 + +#define LVCDRF_NOSELECT 0x10000 +#define LVCDRF_NOGROUPFRAME 0x20000 + + typedef struct tagNMLVCACHEHINT { + NMHDR hdr; + int iFrom; + int iTo; + } NMLVCACHEHINT,*LPNMLVCACHEHINT; #define LPNM_CACHEHINT LPNMLVCACHEHINT -#define PNM_CACHEHINT LPNMLVCACHEHINT -#define NM_CACHEHINT NMLVCACHEHINT +#define PNM_CACHEHINT LPNMLVCACHEHINT +#define NM_CACHEHINT NMLVCACHEHINT -typedef struct tagNMLVFINDITEMA -{ + typedef struct tagNMLVFINDITEMA { NMHDR hdr; int iStart; LVFINDINFOA lvfi; -} NMLVFINDITEMA, *LPNMLVFINDITEMA; + } NMLVFINDITEMA,*LPNMLVFINDITEMA; -typedef struct tagNMLVFINDITEMW -{ + typedef struct tagNMLVFINDITEMW { NMHDR hdr; int iStart; LVFINDINFOW lvfi; -} NMLVFINDITEMW, *LPNMLVFINDITEMW; + } NMLVFINDITEMW,*LPNMLVFINDITEMW; -#define NMLVFINDITEM WINELIB_NAME_AW(NMLVFINDITEM) -#define LPNMLVFINDITEM WINELIB_NAME_AW(LPNMLVFINDITEM) -#define NM_FINDITEM NMLVFINDITEM -#define LPNM_FINDITEM LPNMLVFINDITEM -#define PNM_FINDITEM LPNMLVFINDITEM +#define PNM_FINDITEMA LPNMLVFINDITEMA +#define LPNM_FINDITEMA LPNMLVFINDITEMA +#define NM_FINDITEMA NMLVFINDITEMA -typedef struct tagNMLVODSTATECHANGE -{ +#define PNM_FINDITEMW LPNMLVFINDITEMW +#define LPNM_FINDITEMW LPNMLVFINDITEMW +#define NM_FINDITEMW NMLVFINDITEMW + +#ifdef UNICODE +#define PNM_FINDITEM PNM_FINDITEMW +#define LPNM_FINDITEM LPNM_FINDITEMW +#define NM_FINDITEM NM_FINDITEMW +#define NMLVFINDITEM NMLVFINDITEMW +#define LPNMLVFINDITEM LPNMLVFINDITEMW +#else +#define PNM_FINDITEM PNM_FINDITEMA +#define LPNM_FINDITEM LPNM_FINDITEMA +#define NM_FINDITEM NM_FINDITEMA +#define NMLVFINDITEM NMLVFINDITEMA +#define LPNMLVFINDITEM LPNMLVFINDITEMA +#endif + + typedef struct tagNMLVODSTATECHANGE { NMHDR hdr; int iFrom; int iTo; UINT uNewState; UINT uOldState; -} NMLVODSTATECHANGE, *LPNMLVODSTATECHANGE; + } NMLVODSTATECHANGE,*LPNMLVODSTATECHANGE; #define PNM_ODSTATECHANGE LPNMLVODSTATECHANGE #define LPNM_ODSTATECHANGE LPNMLVODSTATECHANGE #define NM_ODSTATECHANGE NMLVODSTATECHANGE -typedef struct NMLVSCROLL -{ - NMHDR hdr; - int dx; - int dy; -} NMLVSCROLL, *LPNMLVSCROLL; +#define LVN_ITEMCHANGING (LVN_FIRST-0) +#define LVN_ITEMCHANGED (LVN_FIRST-1) +#define LVN_INSERTITEM (LVN_FIRST-2) +#define LVN_DELETEITEM (LVN_FIRST-3) +#define LVN_DELETEALLITEMS (LVN_FIRST-4) +#define LVN_BEGINLABELEDITA (LVN_FIRST-5) +#define LVN_BEGINLABELEDITW (LVN_FIRST-75) +#define LVN_ENDLABELEDITA (LVN_FIRST-6) +#define LVN_ENDLABELEDITW (LVN_FIRST-76) +#define LVN_COLUMNCLICK (LVN_FIRST-8) +#define LVN_BEGINDRAG (LVN_FIRST-9) +#define LVN_BEGINRDRAG (LVN_FIRST-11) -#define ListView_SetItemCount(hwnd,count) \ - (BOOL)SNDMSG((hwnd),LVM_SETITEMCOUNT,(WPARAM)(INT)(count),0) -#define ListView_SetTextBkColor(hwnd,clrBk) \ - (BOOL)SNDMSG((hwnd),LVM_SETTEXTBKCOLOR,0,(LPARAM)(COLORREF)(clrBk)) -#define ListView_SetTextColor(hwnd,clrBk) \ - (BOOL)SNDMSG((hwnd),LVM_SETTEXTCOLOR,0,(LPARAM)(COLORREF)(clrBk)) -#define ListView_DeleteColumn(hwnd,col)\ - (LRESULT)SNDMSG((hwnd),LVM_DELETECOLUMN,0,(LPARAM)(INT)(col)) -#define ListView_GetColumnA(hwnd,x,col)\ - (LRESULT)SNDMSGA((hwnd),LVM_GETCOLUMNA,(WPARAM)(INT)(x),(LPARAM)(LPLVCOLUMNA)(col)) -#define ListView_GetColumnW(hwnd,x,col)\ - (LRESULT)SNDMSGW((hwnd),LVM_GETCOLUMNW,(WPARAM)(INT)(x),(LPARAM)(LPLVCOLUMNW)(col)) -#define ListView_GetColumn WINELIB_NAME_AW(ListView_GetColumn) -#define ListView_SetColumnA(hwnd,x,col)\ - (LRESULT)SNDMSGA((hwnd),LVM_SETCOLUMNA,(WPARAM)(INT)(x),(LPARAM)(LPLVCOLUMNA)(col)) -#define ListView_SetColumnW(hwnd,x,col)\ - (LRESULT)SNDMSGW((hwnd),LVM_SETCOLUMNW,(WPARAM)(INT)(x),(LPARAM)(LPLVCOLUMNW)(col)) -#define ListView_SetColumn WINELIB_NAME_AW(ListView_SetColumn) -#define ListView_GetColumnWidth(hwnd,x)\ - (INT)SNDMSG((hwnd),LVM_GETCOLUMNWIDTH,(WPARAM)(INT)(x),0L) -#define ListView_SetColumnWidth(hwnd,x,width)\ - (BOOL)SNDMSG((hwnd),LVM_SETCOLUMNWIDTH,(WPARAM)(INT)(x),(LPARAM)(MAKELPARAM(width,0))) +#define LVN_ODCACHEHINT (LVN_FIRST-13) +#define LVN_ODFINDITEMA (LVN_FIRST-52) +#define LVN_ODFINDITEMW (LVN_FIRST-79) +#define LVN_ITEMACTIVATE (LVN_FIRST-14) +#define LVN_ODSTATECHANGED (LVN_FIRST-15) -#define ListView_GetNextItem(hwnd,nItem,flags) \ - (INT)SNDMSG((hwnd),LVM_GETNEXTITEM,(WPARAM)(INT)(nItem),(LPARAM)(MAKELPARAM(flags,0))) -#define ListView_FindItemA(hwnd,nItem,plvfi) \ - (INT)SNDMSGA((hwnd),LVM_FINDITEMA,(WPARAM)(INT)(nItem),(LPARAM)(LVFINDINFOA*)(plvfi)) -#define ListView_FindItemW(hwnd,nItem,plvfi) \ - (INT)SNDMSGW((hwnd),LVM_FINDITEMW,(WPARAM)(INT)(nItem),(LPARAM)(LVFINDINFOW*)(plvfi)) -#define ListView_FindItem WINELIB_NAME_AW(ListView_FindItem) - -#define ListView_Arrange(hwnd,code) \ - (INT)SNDMSG((hwnd),LVM_ARRANGE,(WPARAM)(INT)(code),0L) -#define ListView_GetItemPosition(hwnd,i,ppt) \ - (INT)SNDMSG((hwnd),LVM_GETITEMPOSITION,(WPARAM)(INT)(i),(LPARAM)(LPPOINT)(ppt)) -#define ListView_GetItemRect(hwnd,i,prc,code) \ - (BOOL)SNDMSG((hwnd), LVM_GETITEMRECT, (WPARAM)(int)(i), \ - ((prc) ? (((RECT*)(prc))->left = (code),(LPARAM)(RECT \ - *)(prc)) : (LPARAM)(RECT*)NULL)) -#define ListView_SetItemA(hwnd,pitem) \ - (INT)SNDMSGA((hwnd),LVM_SETITEMA,0,(LPARAM)(const LVITEMA *)(pitem)) -#define ListView_SetItemW(hwnd,pitem) \ - (INT)SNDMSGW((hwnd),LVM_SETITEMW,0,(LPARAM)(const LVITEMW *)(pitem)) -#define ListView_SetItem WINELIB_NAME_AW(ListView_SetItem) -#define ListView_SetItemState(hwnd,i,data,dataMask) \ -{ LVITEM _LVi; _LVi.state = data; _LVi.stateMask = dataMask;\ - SNDMSG(hwnd, LVM_SETITEMSTATE, (WPARAM)(UINT)i, (LPARAM) (LPLVITEM)&_LVi);} -#define ListView_GetItemState(hwnd,i,mask) \ - (UINT)SNDMSG((hwnd),LVM_GETITEMSTATE,(WPARAM)(UINT)(i),(LPARAM)(UINT)(mask)) -#define ListView_SetCheckState(hwndLV, i, bCheck) \ - { LVITEM _LVi; _LVi.state = INDEXTOSTATEIMAGEMASK((bCheck)?2:1); _LVi.stateMask = LVIS_STATEIMAGEMASK; \ - SNDMSG(hwndLV, LVM_SETITEMSTATE, (WPARAM)(UINT)(i), (LPARAM)(LPLVITEM)&_LVi);} -#define ListView_GetCheckState(hwndLV, i) \ - (((UINT)SNDMSG((hwndLV), LVM_GETITEMSTATE, (i), LVIS_STATEIMAGEMASK) >> 12) - 1) -#define ListView_GetCountPerPage(hwnd) \ - (BOOL)SNDMSG((hwnd),LVM_GETCOUNTPERPAGE,0,0L) -#define ListView_GetImageList(hwnd,iImageList) \ - (HIMAGELIST)SNDMSG((hwnd),LVM_GETIMAGELIST,(WPARAM)(INT)(iImageList),0L) -#define ListView_GetStringWidthA(hwnd,pstr) \ - (INT)SNDMSGA((hwnd),LVM_GETSTRINGWIDTHA,0,(LPARAM)(LPCSTR)(pstr)) -#define ListView_GetStringWidthW(hwnd,pstr) \ - (INT)SNDMSGW((hwnd),LVM_GETSTRINGWIDTHW,0,(LPARAM)(LPCWSTR)(pstr)) -#define ListView_GetStringWidth WINELIB_NAME_AW(ListView_GetStringWidth) -#define ListView_GetTopIndex(hwnd) \ - (BOOL)SNDMSG((hwnd),LVM_GETTOPINDEX,0,0L) -#define ListView_Scroll(hwnd,dx,dy) \ - (BOOL)SNDMSG((hwnd),LVM_SCROLL,(WPARAM)(INT)(dx),(LPARAM)(INT)(dy)) -#define ListView_EnsureVisible(hwnd,i,fPartialOk) \ - (BOOL)SNDMSG((hwnd),LVM_ENSUREVISIBLE,(WPARAM)(INT)i,(LPARAM)(BOOL)fPartialOk) -#define ListView_SetBkColor(hwnd,clrBk) \ - (BOOL)SNDMSG((hwnd),LVM_SETBKCOLOR,0,(LPARAM)(COLORREF)(clrBk)) -#define ListView_SetImageList(hwnd,himl,iImageList) \ - (HIMAGELIST)SNDMSG((hwnd),LVM_SETIMAGELIST,(WPARAM)(iImageList),(LPARAM)(HIMAGELIST)(himl)) -#define ListView_GetItemCount(hwnd) \ - (INT)SNDMSG((hwnd),LVM_GETITEMCOUNT,0,0L) -#define ListView_RedrawItems(hwnd,first,last) \ - (BOOL)SNDMSG((hwnd),LVM_REDRAWITEMS,(WPARAM)(INT)(first),(LPARAM)(INT)(last)) -#define ListView_GetEditControl(hwnd) \ - (HWND)SNDMSG((hwnd), LVM_GETEDITCONTROL, 0, 0) -#define ListView_GetTextColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), LVM_GETTEXTCOLOR, 0, 0) -#define ListView_GetTextBkColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), LVM_GETTEXTBKCOLOR, 0, 0) -#define ListView_GetBkColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), LVM_GETBKCOLOR, 0, 0) -#define ListView_GetItemA(hwnd,pitem) \ - (BOOL)SNDMSGA((hwnd),LVM_GETITEMA,0,(LPARAM)(LVITEMA *)(pitem)) -#define ListView_GetItemW(hwnd,pitem) \ - (BOOL)SNDMSGW((hwnd),LVM_GETITEMW,0,(LPARAM)(LVITEMW *)(pitem)) -#define ListView_GetItem WINELIB_NAME_AW(ListView_GetItem) -#define ListView_GetOrigin(hwnd,ppt) \ - (BOOL)SNDMSG((hwnd),LVM_GETORIGIN,0,(LPARAM)(POINT *)(ppt)) - -#define ListView_HitTest(hwnd,pinfo) \ - (INT)SNDMSG((hwnd),LVM_HITTEST,0,(LPARAM)(LPLVHITTESTINFO)(pinfo)) - -#define ListView_InsertItemA(hwnd,pitem) \ - (INT)SNDMSGA((hwnd),LVM_INSERTITEMA,0,(LPARAM)(const LVITEMA *)(pitem)) -#define ListView_InsertItemW(hwnd,pitem) \ - (INT)SNDMSGW((hwnd),LVM_INSERTITEMW,0,(LPARAM)(const LVITEMW *)(pitem)) -#define ListView_InsertItem WINELIB_NAME_AW(ListView_InsertItem) - -#define ListView_DeleteAllItems(hwnd) \ - (BOOL)SNDMSG((hwnd),LVM_DELETEALLITEMS,0,0L) - -#define ListView_InsertColumnA(hwnd,iCol,pcol) \ - (INT)SNDMSGA((hwnd),LVM_INSERTCOLUMNA,(WPARAM)(INT)(iCol),(LPARAM)(const LVCOLUMNA *)(pcol)) -#define ListView_InsertColumnW(hwnd,iCol,pcol) \ - (INT)SNDMSGW((hwnd),LVM_INSERTCOLUMNW,(WPARAM)(INT)(iCol),(LPARAM)(const LVCOLUMNW *)(pcol)) -#define ListView_InsertColumn WINELIB_NAME_AW(ListView_InsertColumn) - -#define ListView_SortItems(hwndLV,_pfnCompare,_lPrm) \ - (BOOL)SNDMSG((hwndLV),LVM_SORTITEMS,(WPARAM)(LPARAM)_lPrm,(LPARAM)(PFNLVCOMPARE)_pfnCompare) -#define ListView_SortItemsEx(hwndLV, _pfnCompare, _lPrm) \ - (BOOL)SNDMSG((hwndLV), LVM_SORTITEMSEX, (WPARAM)(LPARAM)(_lPrm), (LPARAM)(PFNLVCOMPARE)(_pfnCompare)) - -#define ListView_SetItemPosition(hwndLV, i, x, y) \ - (BOOL)SNDMSG((hwndLV),LVM_SETITEMPOSITION,(WPARAM)(INT)(i),MAKELPARAM((x),(y))) -#define ListView_GetSelectedCount(hwndLV) \ - (UINT)SNDMSG((hwndLV),LVM_GETSELECTEDCOUNT,0,0L) - -#define ListView_EditLabelA(hwndLV, i) \ - (HWND)SNDMSG((hwndLV),LVM_EDITLABELA,(WPARAM)(int)(i), 0L) -#define ListView_EditLabelW(hwndLV, i) \ - (HWND)SNDMSG((hwndLV),LVM_EDITLABELW,(WPARAM)(int)(i), 0L) -#define ListView_EditLabel WINELIB_NAME_AW(ListView_EditLabel) - -#define ListView_GetItemTextA(hwndLV, i, _iSubItem, _pszText, _cchTextMax) \ -{ \ - LVITEMA _LVi;\ - _LVi.iSubItem = _iSubItem;\ - _LVi.cchTextMax = _cchTextMax;\ - _LVi.pszText = _pszText;\ - SNDMSGA(hwndLV, LVM_GETITEMTEXTA, (WPARAM)(i), (LPARAM)&_LVi);\ -} -#define ListView_GetItemTextW(hwndLV, i, _iSubItem, _pszText, _cchTextMax) \ -{ \ - LVITEMW _LVi;\ - _LVi.iSubItem = _iSubItem;\ - _LVi.cchTextMax = _cchTextMax;\ - _LVi.pszText = _pszText;\ - SNDMSGW(hwndLV, LVM_GETITEMTEXTW, (WPARAM)(i), (LPARAM)&_LVi);\ -} -#define ListView_GetItemText WINELIB_NAME_AW(ListView_GetItemText) -#define ListView_SetItemPosition32(hwnd,n,x1,y1) \ -{ POINT ptNewPos; ptNewPos.x = (x1); ptNewPos.y = (y1); SNDMSG((hwnd), LVM_SETITEMPOSITION32, (WPARAM)(int)(n), (LPARAM)&ptNewPos); } -#define ListView_SetItemTextA(hwndLV, i, _iSubItem, _pszText) \ -{ LVITEMA _LVi; _LVi.iSubItem = _iSubItem; _LVi.pszText = _pszText;\ - SNDMSGA(hwndLV, LVM_SETITEMTEXTA, (WPARAM)i, (LPARAM) (LVITEMA*)&_LVi);} -#define ListView_SetItemTextW(hwndLV, i, _iSubItem, _pszText) \ -{ LVITEMW _LVi; _LVi.iSubItem = _iSubItem; _LVi.pszText = _pszText;\ - SNDMSGW(hwndLV, LVM_SETITEMTEXTW, (WPARAM)i, (LPARAM) (LVITEMW*)& _LVi);} -#define ListView_SetItemText WINELIB_NAME_AW(ListView_SetItemText) - -#define ListView_DeleteItem(hwndLV, i) \ - (BOOL)SNDMSG(hwndLV, LVM_DELETEITEM, (WPARAM)(int)(i), 0L) -#define ListView_Update(hwndLV, i) \ - (BOOL)SNDMSG((hwndLV), LVM_UPDATE, (WPARAM)(i), 0L) -#define ListView_GetColumnOrderArray(hwndLV, iCount, pi) \ - (BOOL)SNDMSG((hwndLV), LVM_GETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi) -#define ListView_GetExtendedListViewStyle(hwndLV) \ - (DWORD)SNDMSG((hwndLV), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0L) -#define ListView_GetHotCursor(hwndLV) \ - (HCURSOR)SNDMSG((hwndLV), LVM_GETHOTCURSOR, 0, 0L) -#define ListView_GetHotItem(hwndLV) \ - (int)SNDMSG((hwndLV), LVM_GETHOTITEM, 0, 0L) -#define ListView_GetItemSpacing(hwndLV, fSmall) \ - (DWORD)SNDMSG((hwndLV), LVM_GETITEMSPACING, (WPARAM)fSmall, 0L) -#define ListView_GetSubItemRect(hwndLV, iItem, iSubItem, code, prc) \ - (BOOL)SNDMSG((hwndLV), LVM_GETSUBITEMRECT, (WPARAM)(int)(iItem), \ - ((prc) ? ((((LPRECT)(prc))->top = iSubItem), (((LPRECT)(prc))->left = code), (LPARAM)(prc)) : 0)) -#define ListView_GetToolTips(hwndLV) \ - (HWND)SNDMSG((hwndLV), LVM_GETTOOLTIPS, 0, 0L) -#define ListView_SetColumnOrderArray(hwndLV, iCount, pi) \ - (BOOL)SNDMSG((hwndLV), LVM_SETCOLUMNORDERARRAY, (WPARAM)iCount, (LPARAM)(LPINT)pi) -#define ListView_SetExtendedListViewStyle(hwndLV, dw) \ - (DWORD)SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM)dw) -#define ListView_SetExtendedListViewStyleEx(hwndLV, dwMask, dw) \ - (DWORD)SNDMSG((hwndLV), LVM_SETEXTENDEDLISTVIEWSTYLE, (WPARAM)dwMask, (LPARAM)dw) -#define ListView_SetHotCursor(hwndLV, hcur) \ - (HCURSOR)SNDMSG((hwndLV), LVM_SETHOTCURSOR, 0, (LPARAM)hcur) -#define ListView_SetHotItem(hwndLV, i) \ - (int)SNDMSG((hwndLV), LVM_SETHOTITEM, (WPARAM)i, 0L) -#define ListView_SetIconSpacing(hwndLV, cx, cy) \ - (DWORD)SNDMSG((hwndLV), LVM_SETICONSPACING, 0, MAKELONG(cx,cy)) -#define ListView_SetToolTips(hwndLV, hwndNewHwnd) \ - (HWND)SNDMSG((hwndLV), LVM_SETTOOLTIPS, (WPARAM)hwndNewHwnd, 0L) -#define ListView_SubItemHitTest(hwndLV, plvhti) \ - (int)SNDMSG((hwndLV), LVM_SUBITEMHITTEST, 0, (LPARAM)(LPLVHITTESTINFO)(plvhti)) -#define ListView_GetSelectionMark(hwndLV) \ - (int)SNDMSG((hwndLV), LVM_GETSELECTIONMARK, 0, 0) -#define ListView_SetSelectionMark(hwndLV, iItem) \ - (int)SNDMSG((hwndLV), LVM_SETSELECTIONMARK, 0, (LPARAM)(iItem)) -#define ListView_GetViewRect(hwndLV, prc) \ - (BOOL)SNDMSG((hwndLV),LVM_GETVIEWRECT,0,(LPARAM)(LPRECT)(prc)) -#define ListView_GetHeader(hwndLV) \ - (HWND)SNDMSG((hwndLV),LVM_GETHEADER,0,0L) -#define ListView_SetSelectedColumn(hwnd, iCol) \ - SNDMSG((hwnd), LVM_SETSELECTEDCOLUMN, (WPARAM)iCol, 0) -#define ListView_SetTileWidth(hwnd, cpWidth) \ - SNDMSG((hwnd), LVM_SETTILEWIDTH, (WPARAM)cpWidth, 0) -#define ListView_SetView(hwnd, iView) \ - (DWORD)SNDMSG((hwnd), LVM_SETVIEW, (WPARAM)(DWORD)iView, 0) -#define ListView_GetView(hwnd) \ - (DWORD)SNDMSG((hwnd), LVM_GETVIEW, 0, 0) -#define ListView_InsertGroup(hwnd, index, pgrp) \ - SNDMSG((hwnd), LVM_INSERTGROUP, (WPARAM)index, (LPARAM)pgrp) -#define ListView_SetGroupHeaderImageList(hwnd, himl) \ - SNDMSG((hwnd), LVM_SETIMAGELIST, (WPARAM)LVSIL_GROUPHEADER, (LPARAM)himl) -#define ListView_GetGroupHeaderImageList(hwnd) \ - SNDMSG((hwnd), LVM_GETIMAGELIST, (WPARAM)LVSIL_GROUPHEADER, 0) -#define ListView_SetGroupInfo(hwnd, iGroupId, pgrp) \ - SNDMSG((hwnd), LVM_SETGROUPINFO, (WPARAM)iGroupId, (LPARAM)pgrp) -#define ListView_GetGroupInfo(hwnd, iGroupId, pgrp) \ - SNDMSG((hwnd), LVM_GETGROUPINFO, (WPARAM)iGroupId, (LPARAM)pgrp) -#define ListView_RemoveGroup(hwnd, iGroupId) \ - SNDMSG((hwnd), LVM_REMOVEGROUP, (WPARAM)iGroupId, 0) -#define ListView_MoveGroup(hwnd, iGroupId, toIndex) \ - SNDMSG((hwnd), LVM_MOVEGROUP, (WPARAM)iGroupId, (LPARAM)toIndex) -#define ListView_MoveItemToGroup(hwnd, idItemFrom, idGroupTo) \ - SNDMSG((hwnd), LVM_MOVEITEMTOGROUP, (WPARAM)idItemFrom, (LPARAM)idGroupTo) -#define ListView_SetGroupMetrics(hwnd, pGroupMetrics) \ - SNDMSG((hwnd), LVM_SETGROUPMETRICS, 0, (LPARAM)pGroupMetrics) -#define ListView_GetGroupMetrics(hwnd, pGroupMetrics) \ - SNDMSG((hwnd), LVM_GETGROUPMETRICS, 0, (LPARAM)pGroupMetrics) -#define ListView_EnableGroupView(hwnd, fEnable) \ - SNDMSG((hwnd), LVM_ENABLEGROUPVIEW, (WPARAM)fEnable, 0) -#define ListView_SortGroups(hwnd, _pfnGroupCompate, _plv) \ - SNDMSG((hwnd), LVM_SORTGROUPS, (WPARAM)_pfnGroupCompate, (LPARAM)_plv) -#define ListView_InsertGroupSorted(hwnd, structInsert) \ - SNDMSG((hwnd), LVM_INSERTGROUPSORTED, (WPARAM)structInsert, 0) -#define ListView_RemoveAllGroups(hwnd) \ - SNDMSG((hwnd), LVM_REMOVEALLGROUPS, 0, 0) -#define ListView_HasGroup(hwnd, dwGroupId) \ - SNDMSG((hwnd), LVM_HASGROUP, dwGroupId, 0) -#define ListView_SetTileViewInfo(hwnd, ptvi) \ - SNDMSG((hwnd), LVM_SETTILEVIEWINFO, 0, (LPARAM)ptvi) -#define ListView_GetTileViewInfo(hwnd, ptvi) \ - SNDMSG((hwnd), LVM_GETTILEVIEWINFO, 0, (LPARAM)ptvi) -#define ListView_SetTileInfo(hwnd, pti) \ - SNDMSG((hwnd), LVM_SETTILEINFO, 0, (LPARAM)pti) -#define ListView_GetTileInfo(hwnd, pti) \ - SNDMSG((hwnd), LVM_GETTILEINFO, 0, (LPARAM)pti) -#define ListView_SetInsertMark(hwnd, lvim) \ - (BOOL)SNDMSG((hwnd), LVM_SETINSERTMARK, (WPARAM) 0, (LPARAM) (lvim)) -#define ListView_GetInsertMark(hwnd, lvim) \ - (BOOL)SNDMSG((hwnd), LVM_GETINSERTMARK, (WPARAM) 0, (LPARAM) (lvim)) -#define ListView_InsertMarkHitTest(hwnd, point, lvim) \ - (int)SNDMSG((hwnd), LVM_INSERTMARKHITTEST, (WPARAM)(LPPOINT)(point), (LPARAM)(LPLVINSERTMARK)(lvim)) -#define ListView_GetInsertMarkRect(hwnd, rc) \ - (int)SNDMSG((hwnd), LVM_GETINSERTMARKRECT, (WPARAM)0, (LPARAM)(LPRECT)(rc)) -#define ListView_SetInsertMarkColor(hwnd, color) \ - (COLORREF)SNDMSG((hwnd), LVM_SETINSERTMARKCOLOR, (WPARAM)0, (LPARAM)(COLORREF)(color)) -#define ListView_GetInsertMarkColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), LVM_GETINSERTMARKCOLOR, (WPARAM)0, (LPARAM)0) -#define ListView_SetInfoTip(hwndLV, plvInfoTip)\ - (BOOL)SNDMSG((hwndLV), LVM_SETINFOTIP, (WPARAM)0, (LPARAM)plvInfoTip) -#define ListView_GetSelectedColumn(hwnd) \ - (UINT)SNDMSG((hwnd), LVM_GETSELECTEDCOLUMN, 0, 0) -#define ListView_IsGroupViewEnabled(hwnd) \ - (BOOL)SNDMSG((hwnd), LVM_ISGROUPVIEWENABLED, 0, 0) -#define ListView_GetOutlineColor(hwnd) \ - (COLORREF)SNDMSG((hwnd), LVM_GETOUTLINECOLOR, 0, 0) -#define ListView_SetOutlineColor(hwnd, color) \ - (COLORREF)SNDMSG((hwnd), LVM_SETOUTLINECOLOR, (WPARAM)0, (LPARAM)(COLORREF)(color)) -#define ListView_CancelEditLabel(hwnd) \ - (VOID)SNDMSG((hwnd), LVM_CANCELEDITLABEL, (WPARAM)0, (LPARAM)0) -#define ListView_MapIndexToID(hwnd, index) \ - (UINT)SNDMSG((hwnd), LVM_MAPINDEXTOID, (WPARAM)index, (LPARAM)0) -#define ListView_MapIDToIndex(hwnd, id) \ - (UINT)SNDMSG((hwnd), LVM_MAPIDTOINDEX, (WPARAM)id, (LPARAM)0) -#define ListView_SetUnicodeFormat(hwnd, fUnicode) \ - (BOOL)SNDMSG((hwnd), LVM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0) -#define ListView_GetUnicodeFormat(hwnd) \ - (BOOL)SNDMSG((hwnd), LVM_GETUNICODEFORMAT, 0, 0) - -/* Tab Control */ - -#define WC_TABCONTROLA "SysTabControl32" -#if defined(__GNUC__) -# define WC_TABCONTROLW (const WCHAR []){ 'S','y','s', \ - 'T','a','b','C','o','n','t','r','o','l','3','2',0 } -#elif defined(_MSC_VER) -# define WC_TABCONTROLW L"SysTabControl32" +#ifdef UNICODE +#define LVN_ODFINDITEM LVN_ODFINDITEMW #else -static const WCHAR WC_TABCONTROLW[] = { 'S','y','s', - 'T','a','b','C','o','n','t','r','o','l','3','2',0 }; +#define LVN_ODFINDITEM LVN_ODFINDITEMA #endif -#define WC_TABCONTROL WINELIB_NAME_AW(WC_TABCONTROL) -/* tab control styles */ -#define TCS_SCROLLOPPOSITE 0x0001 /* assumes multiline tab */ -#define TCS_BOTTOM 0x0002 -#define TCS_RIGHT 0x0002 -#define TCS_MULTISELECT 0x0004 /* allow multi-select in button mode */ -#define TCS_FLATBUTTONS 0x0008 -#define TCS_FORCEICONLEFT 0x0010 -#define TCS_FORCELABELLEFT 0x0020 -#define TCS_HOTTRACK 0x0040 -#define TCS_VERTICAL 0x0080 -#define TCS_TABS 0x0000 -#define TCS_BUTTONS 0x0100 -#define TCS_SINGLELINE 0x0000 -#define TCS_MULTILINE 0x0200 -#define TCS_RIGHTJUSTIFY 0x0000 -#define TCS_FIXEDWIDTH 0x0400 -#define TCS_RAGGEDRIGHT 0x0800 -#define TCS_FOCUSONBUTTONDOWN 0x1000 -#define TCS_OWNERDRAWFIXED 0x2000 -#define TCS_TOOLTIPS 0x4000 -#define TCS_FOCUSNEVER 0x8000 -#define TCS_EX_FLATSEPARATORS 0x00000001 /* to be used with */ -#define TCS_EX_REGISTERDROP 0x00000002 /* TCM_SETEXTENDEDSTYLE */ +#define LVN_HOTTRACK (LVN_FIRST-21) +#define LVN_GETDISPINFOA (LVN_FIRST-50) +#define LVN_GETDISPINFOW (LVN_FIRST-77) +#define LVN_SETDISPINFOA (LVN_FIRST-51) +#define LVN_SETDISPINFOW (LVN_FIRST-78) +#ifdef UNICODE +#define LVN_BEGINLABELEDIT LVN_BEGINLABELEDITW +#define LVN_ENDLABELEDIT LVN_ENDLABELEDITW +#define LVN_GETDISPINFO LVN_GETDISPINFOW +#define LVN_SETDISPINFO LVN_SETDISPINFOW +#else +#define LVN_BEGINLABELEDIT LVN_BEGINLABELEDITA +#define LVN_ENDLABELEDIT LVN_ENDLABELEDITA +#define LVN_GETDISPINFO LVN_GETDISPINFOA +#define LVN_SETDISPINFO LVN_SETDISPINFOA +#endif -#define TCM_FIRST 0x1300 +#define LVIF_DI_SETITEM 0x1000 -#define TCM_GETIMAGELIST (TCM_FIRST + 2) -#define TCM_SETIMAGELIST (TCM_FIRST + 3) -#define TCM_GETITEMCOUNT (TCM_FIRST + 4) -#define TCM_GETITEM WINELIB_NAME_AW(TCM_GETITEM) -#define TCM_GETITEMA (TCM_FIRST + 5) -#define TCM_GETITEMW (TCM_FIRST + 60) -#define TCM_SETITEMA (TCM_FIRST + 6) -#define TCM_SETITEMW (TCM_FIRST + 61) -#define TCM_SETITEM WINELIB_NAME_AW(TCM_SETITEM) -#define TCM_INSERTITEMA (TCM_FIRST + 7) -#define TCM_INSERTITEMW (TCM_FIRST + 62) -#define TCM_INSERTITEM WINELIB_NAME_AW(TCM_INSERTITEM) -#define TCM_DELETEITEM (TCM_FIRST + 8) -#define TCM_DELETEALLITEMS (TCM_FIRST + 9) -#define TCM_GETITEMRECT (TCM_FIRST + 10) -#define TCM_GETCURSEL (TCM_FIRST + 11) -#define TCM_SETCURSEL (TCM_FIRST + 12) -#define TCM_HITTEST (TCM_FIRST + 13) -#define TCM_SETITEMEXTRA (TCM_FIRST + 14) -#define TCM_ADJUSTRECT (TCM_FIRST + 40) -#define TCM_SETITEMSIZE (TCM_FIRST + 41) -#define TCM_REMOVEIMAGE (TCM_FIRST + 42) -#define TCM_SETPADDING (TCM_FIRST + 43) -#define TCM_GETROWCOUNT (TCM_FIRST + 44) -#define TCM_GETTOOLTIPS (TCM_FIRST + 45) -#define TCM_SETTOOLTIPS (TCM_FIRST + 46) -#define TCM_GETCURFOCUS (TCM_FIRST + 47) -#define TCM_SETCURFOCUS (TCM_FIRST + 48) -#define TCM_SETMINTABWIDTH (TCM_FIRST + 49) -#define TCM_DESELECTALL (TCM_FIRST + 50) -#define TCM_HIGHLIGHTITEM (TCM_FIRST + 51) -#define TCM_SETEXTENDEDSTYLE (TCM_FIRST + 52) -#define TCM_GETEXTENDEDSTYLE (TCM_FIRST + 53) -#define TCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define TCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define LV_DISPINFOA NMLVDISPINFOA +#define LV_DISPINFOW NMLVDISPINFOW +#define LV_DISPINFO NMLVDISPINFO + typedef struct tagLVDISPINFO { + NMHDR hdr; + LVITEMA item; + } NMLVDISPINFOA,*LPNMLVDISPINFOA; -#define TCIF_TEXT 0x0001 -#define TCIF_IMAGE 0x0002 -#define TCIF_RTLREADING 0x0004 -#define TCIF_PARAM 0x0008 -#define TCIF_STATE 0x0010 + typedef struct tagLVDISPINFOW { + NMHDR hdr; + LVITEMW item; + } NMLVDISPINFOW,*LPNMLVDISPINFOW; -#define TCIS_BUTTONPRESSED 0x0001 -#define TCIS_HIGHLIGHTED 0x0002 +#ifdef UNICODE +#define NMLVDISPINFO NMLVDISPINFOW +#else +#define NMLVDISPINFO NMLVDISPINFOA +#endif -/* TabCtrl Macros */ -#define TabCtrl_GetImageList(hwnd) \ - (HIMAGELIST)SNDMSG((hwnd), TCM_GETIMAGELIST, 0, 0L) -#define TabCtrl_SetImageList(hwnd, himl) \ - (HIMAGELIST)SNDMSG((hwnd), TCM_SETIMAGELIST, 0, (LPARAM)(UINT)(HIMAGELIST)(himl)) -#define TabCtrl_GetItemCount(hwnd) \ - (int)SNDMSG((hwnd), TCM_GETITEMCOUNT, 0, 0L) -#define TabCtrl_GetItemA(hwnd, iItem, pitem) \ - (BOOL)SNDMSGA((hwnd), TCM_GETITEMA, (WPARAM)(int)iItem, (LPARAM)(TCITEMA *)(pitem)) -#define TabCtrl_GetItemW(hwnd, iItem, pitem) \ - (BOOL)SNDMSGW((hwnd), TCM_GETITEMW, (WPARAM)(int)iItem, (LPARAM)(TCITEMW *)(pitem)) -#define TabCtrl_GetItem WINELIB_NAME_AW(TabCtrl_GetItem) -#define TabCtrl_SetItemA(hwnd, iItem, pitem) \ - (BOOL)SNDMSGA((hwnd), TCM_SETITEMA, (WPARAM)(int)iItem, (LPARAM)(TCITEMA *)(pitem)) -#define TabCtrl_SetItemW(hwnd, iItem, pitem) \ - (BOOL)SNDMSGW((hwnd), TCM_SETITEMW, (WPARAM)(int)iItem, (LPARAM)(TCITEMW *)(pitem)) -#define TabCtrl_SetItem WINELIB_NAME_AW(TabCtrl_SetItem) -#define TabCtrl_InsertItemA(hwnd, iItem, pitem) \ - (int)SNDMSGA((hwnd), TCM_INSERTITEMA, (WPARAM)(int)iItem, (LPARAM)(const TCITEMA *)(pitem)) -#define TabCtrl_InsertItemW(hwnd, iItem, pitem) \ - (int)SNDMSGW((hwnd), TCM_INSERTITEMW, (WPARAM)(int)iItem, (LPARAM)(const TCITEMW *)(pitem)) -#define TabCtrl_InsertItem WINELIB_NAME_AW(TabCtrl_InsertItem) -#define TabCtrl_DeleteItem(hwnd, i) \ - (BOOL)SNDMSG((hwnd), TCM_DELETEITEM, (WPARAM)(int)(i), 0L) -#define TabCtrl_DeleteAllItems(hwnd) \ - (BOOL)SNDMSG((hwnd), TCM_DELETEALLITEMS, 0, 0L) -#define TabCtrl_GetItemRect(hwnd, i, prc) \ - (BOOL)SNDMSG((hwnd), TCM_GETITEMRECT, (WPARAM)(int)(i), (LPARAM)(RECT *)(prc)) -#define TabCtrl_GetCurSel(hwnd) \ - (int)SNDMSG((hwnd), TCM_GETCURSEL, 0, 0) -#define TabCtrl_SetCurSel(hwnd, i) \ - (int)SNDMSG((hwnd), TCM_SETCURSEL, (WPARAM)i, 0) -#define TabCtrl_HitTest(hwndTC, pinfo) \ - (int)SNDMSG((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO *)(pinfo)) -#define TabCtrl_SetItemExtra(hwndTC, cb) \ - (BOOL)SNDMSG((hwndTC), TCM_SETITEMEXTRA, (WPARAM)(cb), 0L) -#define TabCtrl_AdjustRect(hwnd, bLarger, prc) \ - (int)SNDMSG(hwnd, TCM_ADJUSTRECT, (WPARAM)(BOOL)bLarger, (LPARAM)(RECT *)prc) -#define TabCtrl_SetItemSize(hwnd, x, y) \ - (DWORD)SNDMSG((hwnd), TCM_SETITEMSIZE, 0, MAKELPARAM(x,y)) -#define TabCtrl_RemoveImage(hwnd, i) \ - (void)SNDMSG((hwnd), TCM_REMOVEIMAGE, i, 0L) -#define TabCtrl_SetPadding(hwnd, cx, cy) \ - (void)SNDMSG((hwnd), TCM_SETPADDING, 0, MAKELPARAM(cx, cy)) -#define TabCtrl_GetRowCount(hwnd) \ - (int)SNDMSG((hwnd), TCM_GETROWCOUNT, 0, 0L) -#define TabCtrl_GetToolTips(hwnd) \ - (HWND)SNDMSG((hwnd), TCM_GETTOOLTIPS, 0, 0L) -#define TabCtrl_SetToolTips(hwnd, hwndTT) \ - (void)SNDMSG((hwnd), TCM_SETTOOLTIPS, (WPARAM)hwndTT, 0L) -#define TabCtrl_GetCurFocus(hwnd) \ - (int)SNDMSG((hwnd), TCM_GETCURFOCUS, 0, 0) -#define TabCtrl_SetCurFocus(hwnd, i) \ - SNDMSG((hwnd),TCM_SETCURFOCUS, i, 0) -#define TabCtrl_SetMinTabWidth(hwnd, x) \ - (int)SNDMSG((hwnd), TCM_SETMINTABWIDTH, 0, x) -#define TabCtrl_DeselectAll(hwnd, fExcludeFocus)\ - (void)SNDMSG((hwnd), TCM_DESELECTALL, fExcludeFocus, 0) -#define TabCtrl_GetUnicodeFormat(hwnd) \ - (BOOL)SNDMSG((hwnd), TCM_GETUNICODEFORMAT, 0, 0) -#define TabCtrl_SetUnicodeFormat(hwnd, fUnicode) \ - (BOOL)SNDMSG((hwnd), TCM_SETUNICODEFORMAT, (WPARAM)fUnicode, 0) -#define TabCtrl_GetExtendedStyle(hwnd) \ - (BOOL)SNDMSG((hwnd), TCM_GETEXTENDEDSTYLE, 0, 0) -#define TabCtrl_SetExtendedStyle(hwnd, dwExStyle) \ - (BOOL)SNDMSG((hwnd), TCM_GETEXTENDEDSTYLE, 0, (LPARAM)dwExStyle) -#define TabCtrl_HighlightItem(hwnd, i, fHighlight) \ - (BOOL)SNDMSG((hwnd), TCM_HIGHLIGHTITEM, (WPARAM)i, (LPARAM)MAKELONG(fHighlight, 0)) +#define LVN_KEYDOWN (LVN_FIRST-55) -/* constants for TCHITTESTINFO */ - -#define TCHT_NOWHERE 0x01 -#define TCHT_ONITEMICON 0x02 -#define TCHT_ONITEMLABEL 0x04 -#define TCHT_ONITEM (TCHT_ONITEMICON | TCHT_ONITEMLABEL) - -typedef struct tagTCITEMHEADERA -{ - UINT mask; - UINT lpReserved1; - UINT lpReserved2; - LPSTR pszText; - int cchTextMax; - int iImage; -} TCITEMHEADERA, *LPTCITEMHEADERA; - -typedef struct tagTCITEMHEADERW -{ - UINT mask; - UINT lpReserved1; - UINT lpReserved2; - LPWSTR pszText; - int cchTextMax; - int iImage; -} TCITEMHEADERW, *LPTCITEMHEADERW; - -#define TCITEMHEADER WINELIB_NAME_AW(TCITEMHEADER) -#define LPTCITEMHEADER WINELIB_NAME_AW(LPTCITEMHEADER) -#define TC_ITEMHEADER WINELIB_NAME_AW(TCITEMHEADER) -#define LPTC_ITEMHEADER WINELIB_NAME_AW(LPTCITEMHEADER) - -typedef struct tagTCITEMA -{ - UINT mask; - UINT dwState; - UINT dwStateMask; - LPSTR pszText; - INT cchTextMax; - INT iImage; - LPARAM lParam; -} TCITEMA, *LPTCITEMA; - -typedef struct tagTCITEMW -{ - UINT mask; - DWORD dwState; - DWORD dwStateMask; - LPWSTR pszText; - INT cchTextMax; - INT iImage; - LPARAM lParam; -} TCITEMW, *LPTCITEMW; - -#define TCITEM WINELIB_NAME_AW(TCITEM) -#define LPTCITEM WINELIB_NAME_AW(LPTCITEM) -#define TC_ITEM WINELIB_NAME_AW(TCITEM) -#define LPTC_ITEM WINELIB_NAME_AW(LPTCITEM) - -#define TCN_FIRST (0U-550U) -#define TCN_LAST (0U-580U) -#define TCN_KEYDOWN (TCN_FIRST - 0) -#define TCN_SELCHANGE (TCN_FIRST - 1) -#define TCN_SELCHANGING (TCN_FIRST - 2) -#define TCN_GETOBJECT (TCN_FIRST - 3) -#define TCN_FOCUSCHANGE (TCN_FIRST - 4) +#define LV_KEYDOWN NMLVKEYDOWN #include -typedef struct tagTCKEYDOWN -{ + + typedef struct tagLVKEYDOWN { NMHDR hdr; WORD wVKey; UINT flags; -} NMTCKEYDOWN; + } NMLVKEYDOWN,*LPNMLVKEYDOWN; + #include -#define TC_KEYDOWN NMTCKEYDOWN +#define LVN_MARQUEEBEGIN (LVN_FIRST-56) -/* ComboBoxEx control */ + typedef struct tagNMLVGETINFOTIPA { + NMHDR hdr; + DWORD dwFlags; + LPSTR pszText; + int cchTextMax; + int iItem; + int iSubItem; + LPARAM lParam; + } NMLVGETINFOTIPA,*LPNMLVGETINFOTIPA; -#define WC_COMBOBOXEXA "ComboBoxEx32" -#if defined(__GNUC__) -# define WC_COMBOBOXEXW (const WCHAR []){ 'C','o','m','b','o', \ - 'B','o','x','E','x','3','2',0 } -#elif defined(_MSC_VER) -# define WC_COMBOBOXEXW L"ComboBoxEx32" + typedef struct tagNMLVGETINFOTIPW { + NMHDR hdr; + DWORD dwFlags; + LPWSTR pszText; + int cchTextMax; + int iItem; + int iSubItem; + LPARAM lParam; + } NMLVGETINFOTIPW,*LPNMLVGETINFOTIPW; + +#define LVGIT_UNFOLDED 0x1 + +#define LVN_GETINFOTIPA (LVN_FIRST-57) +#define LVN_GETINFOTIPW (LVN_FIRST-58) + +#ifdef UNICODE +#define LVN_GETINFOTIP LVN_GETINFOTIPW +#define NMLVGETINFOTIP NMLVGETINFOTIPW +#define LPNMLVGETINFOTIP LPNMLVGETINFOTIPW #else -static const WCHAR WC_COMBOBOXEXW[] = { 'C','o','m','b','o', - 'B','o','x','E','x','3','2',0 }; +#define LVN_GETINFOTIP LVN_GETINFOTIPA +#define NMLVGETINFOTIP NMLVGETINFOTIPA +#define LPNMLVGETINFOTIP LPNMLVGETINFOTIPA #endif -#define WC_COMBOBOXEX WINELIB_NAME_AW(WC_COMBOBOXEX) -#define CBEIF_TEXT 0x00000001 -#define CBEIF_IMAGE 0x00000002 -#define CBEIF_SELECTEDIMAGE 0x00000004 -#define CBEIF_OVERLAY 0x00000008 -#define CBEIF_INDENT 0x00000010 -#define CBEIF_LPARAM 0x00000020 -#define CBEIF_DI_SETITEM 0x10000000 + typedef struct tagNMLVSCROLL { + NMHDR hdr; + int dx; + int dy; + } NMLVSCROLL,*LPNMLVSCROLL; -#define CBEM_INSERTITEMA (WM_USER+1) -#define CBEM_INSERTITEMW (WM_USER+11) -#define CBEM_INSERTITEM WINELIB_NAME_AW(CBEM_INSERTITEM) -#define CBEM_SETIMAGELIST (WM_USER+2) -#define CBEM_GETIMAGELIST (WM_USER+3) -#define CBEM_GETITEMA (WM_USER+4) -#define CBEM_GETITEMW (WM_USER+13) -#define CBEM_GETITEM WINELIB_NAME_AW(CBEM_GETITEM) -#define CBEM_SETITEMA (WM_USER+5) -#define CBEM_SETITEMW (WM_USER+12) -#define CBEM_SETITEM WINELIB_NAME_AW(CBEM_SETITEM) -#define CBEM_DELETEITEM CB_DELETESTRING -#define CBEM_GETCOMBOCONTROL (WM_USER+6) -#define CBEM_GETEDITCONTROL (WM_USER+7) -#define CBEM_SETEXSTYLE (WM_USER+8) -#define CBEM_GETEXSTYLE (WM_USER+9) -#define CBEM_GETEXTENDEDSTYLE (WM_USER+9) -#define CBEM_SETEXTENDEDSTYLE (WM_USER+14) -#define CBEM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT -#define CBEM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define CBEM_HASEDITCHANGED (WM_USER+10) -#define CBEM_SETWINDOWTHEME CCM_SETWINDOWTHEME +#define LVN_BEGINSCROLL (LVN_FIRST-80) +#define LVN_ENDSCROLL (LVN_FIRST-81) +#endif -#define CBEIF_TEXT 0x00000001 -#define CBEIF_IMAGE 0x00000002 -#define CBEIF_SELECTEDIMAGE 0x00000004 -#define CBEIF_OVERLAY 0x00000008 -#define CBEIF_INDENT 0x00000010 -#define CBEIF_LPARAM 0x00000020 -#define CBEIF_DI_SETITEM 0x10000000 +#ifndef NOTREEVIEW -#define CBEN_FIRST (0U-800U) -#define CBEN_LAST (0U-830U) +#define WC_TREEVIEWA "SysTreeView32" +#define WC_TREEVIEWW L"SysTreeView32" +#ifdef UNICODE +#define WC_TREEVIEW WC_TREEVIEWW +#else +#define WC_TREEVIEW WC_TREEVIEWA +#endif -#define CBEN_GETDISPINFOA (CBEN_FIRST - 0) -#define CBEN_GETDISPINFOW (CBEN_FIRST - 7) -#define CBEN_GETDISPINFO WINELIB_NAME_AW(CBEN_GETDISPINFO) -#define CBEN_INSERTITEM (CBEN_FIRST - 1) -#define CBEN_DELETEITEM (CBEN_FIRST - 2) -#define CBEN_BEGINEDIT (CBEN_FIRST - 4) -#define CBEN_ENDEDITA (CBEN_FIRST - 5) -#define CBEN_ENDEDITW (CBEN_FIRST - 6) -#define CBEN_ENDEDIT WINELIB_NAME_AW(CBEN_ENDEDIT) -#define CBEN_DRAGBEGINA (CBEN_FIRST - 8) -#define CBEN_DRAGBEGINW (CBEN_FIRST - 9) -#define CBEN_DRAGBEGIN WINELIB_NAME_AW(CBEN_DRAGBEGIN) +#define TVS_HASBUTTONS 0x1 +#define TVS_HASLINES 0x2 +#define TVS_LINESATROOT 0x4 +#define TVS_EDITLABELS 0x8 +#define TVS_DISABLEDRAGDROP 0x10 +#define TVS_SHOWSELALWAYS 0x20 +#define TVS_RTLREADING 0x40 +#define TVS_NOTOOLTIPS 0x80 +#define TVS_CHECKBOXES 0x100 +#define TVS_TRACKSELECT 0x200 +#define TVS_SINGLEEXPAND 0x400 +#define TVS_INFOTIP 0x800 +#define TVS_FULLROWSELECT 0x1000 +#define TVS_NOSCROLL 0x2000 +#define TVS_NONEVENHEIGHT 0x4000 +#define TVS_NOHSCROLL 0x8000 -#define CBES_EX_NOEDITIMAGE 0x00000001 -#define CBES_EX_NOEDITIMAGEINDENT 0x00000002 -#define CBES_EX_PATHWORDBREAKPROC 0x00000004 -#define CBES_EX_NOSIZELIMIT 0x00000008 -#define CBES_EX_CASESENSITIVE 0x00000010 + typedef struct _TREEITEM *HTREEITEM; +#define TVIF_TEXT 0x1 +#define TVIF_IMAGE 0x2 +#define TVIF_PARAM 0x4 +#define TVIF_STATE 0x8 +#define TVIF_HANDLE 0x10 +#define TVIF_SELECTEDIMAGE 0x20 +#define TVIF_CHILDREN 0x40 +#define TVIF_INTEGRAL 0x80 +#define TVIS_SELECTED 0x2 +#define TVIS_CUT 0x4 +#define TVIS_DROPHILITED 0x8 +#define TVIS_BOLD 0x10 +#define TVIS_EXPANDED 0x20 +#define TVIS_EXPANDEDONCE 0x40 +#define TVIS_EXPANDPARTIAL 0x80 +#define TVIS_OVERLAYMASK 0xf00 +#define TVIS_STATEIMAGEMASK 0xF000 +#define TVIS_USERMASK 0xF000 -typedef struct tagCOMBOBOXEXITEMA -{ +#define I_CHILDRENCALLBACK (-1) + +#define LPTV_ITEMW LPTVITEMW +#define LPTV_ITEMA LPTVITEMA +#define TV_ITEMW TVITEMW +#define TV_ITEMA TVITEMA +#define LPTV_ITEM LPTVITEM +#define TV_ITEM TVITEM + + typedef struct tagTVITEMA { + UINT mask; + HTREEITEM hItem; + UINT state; + UINT stateMask; + LPSTR pszText; + int cchTextMax; + int iImage; + int iSelectedImage; + int cChildren; + LPARAM lParam; + } TVITEMA,*LPTVITEMA; + + typedef struct tagTVITEMW { + UINT mask; + HTREEITEM hItem; + UINT state; + UINT stateMask; + LPWSTR pszText; + int cchTextMax; + int iImage; + int iSelectedImage; + int cChildren; + LPARAM lParam; + } TVITEMW,*LPTVITEMW; + + typedef struct tagTVITEMEXA { + UINT mask; + HTREEITEM hItem; + UINT state; + UINT stateMask; + LPSTR pszText; + int cchTextMax; + int iImage; + int iSelectedImage; + int cChildren; + LPARAM lParam; + int iIntegral; + } TVITEMEXA,*LPTVITEMEXA; + + typedef struct tagTVITEMEXW { + UINT mask; + HTREEITEM hItem; + UINT state; + UINT stateMask; + LPWSTR pszText; + int cchTextMax; + int iImage; + int iSelectedImage; + int cChildren; + LPARAM lParam; + int iIntegral; + } TVITEMEXW,*LPTVITEMEXW; +#ifdef UNICODE + typedef TVITEMEXW TVITEMEX; + typedef LPTVITEMEXW LPTVITEMEX; +#else + typedef TVITEMEXA TVITEMEX; + typedef LPTVITEMEXA LPTVITEMEX; +#endif + +#ifdef UNICODE +#define TVITEM TVITEMW +#define LPTVITEM LPTVITEMW +#else +#define TVITEM TVITEMA +#define LPTVITEM LPTVITEMA +#endif + +#define TVI_ROOT ((HTREEITEM)(ULONG_PTR)-0x10000) +#define TVI_FIRST ((HTREEITEM)(ULONG_PTR)-0xffff) +#define TVI_LAST ((HTREEITEM)(ULONG_PTR)-0xfffe) +#define TVI_SORT ((HTREEITEM)(ULONG_PTR)-0xfffd) + +#define LPTV_INSERTSTRUCTA LPTVINSERTSTRUCTA +#define LPTV_INSERTSTRUCTW LPTVINSERTSTRUCTW +#define TV_INSERTSTRUCTA TVINSERTSTRUCTA +#define TV_INSERTSTRUCTW TVINSERTSTRUCTW +#define TV_INSERTSTRUCT TVINSERTSTRUCT +#define LPTV_INSERTSTRUCT LPTVINSERTSTRUCT + +#define TVINSERTSTRUCTA_V1_SIZE CCSIZEOF_STRUCT(TVINSERTSTRUCTA,item) +#define TVINSERTSTRUCTW_V1_SIZE CCSIZEOF_STRUCT(TVINSERTSTRUCTW,item) + + typedef struct tagTVINSERTSTRUCTA { + HTREEITEM hParent; + HTREEITEM hInsertAfter; + __MINGW_EXTENSION union { + TVITEMEXA itemex; + TV_ITEMA item; + } DUMMYUNIONNAME; + } TVINSERTSTRUCTA,*LPTVINSERTSTRUCTA; + + typedef struct tagTVINSERTSTRUCTW { + HTREEITEM hParent; + HTREEITEM hInsertAfter; + __MINGW_EXTENSION union { + TVITEMEXW itemex; + TV_ITEMW item; + } DUMMYUNIONNAME; + } TVINSERTSTRUCTW,*LPTVINSERTSTRUCTW; + +#ifdef UNICODE +#define TVINSERTSTRUCT TVINSERTSTRUCTW +#define LPTVINSERTSTRUCT LPTVINSERTSTRUCTW +#define TVINSERTSTRUCT_V1_SIZE TVINSERTSTRUCTW_V1_SIZE +#else +#define TVINSERTSTRUCT TVINSERTSTRUCTA +#define LPTVINSERTSTRUCT LPTVINSERTSTRUCTA +#define TVINSERTSTRUCT_V1_SIZE TVINSERTSTRUCTA_V1_SIZE +#endif + +#define TVM_INSERTITEMA (TV_FIRST+0) +#define TVM_INSERTITEMW (TV_FIRST+50) +#ifdef UNICODE +#define TVM_INSERTITEM TVM_INSERTITEMW +#else +#define TVM_INSERTITEM TVM_INSERTITEMA +#endif + +#define TreeView_InsertItem(hwnd,lpis) (HTREEITEM)SNDMSG((hwnd),TVM_INSERTITEM,0,(LPARAM)(LPTV_INSERTSTRUCT)(lpis)) + +#define TVM_DELETEITEM (TV_FIRST+1) +#define TreeView_DeleteItem(hwnd,hitem) (WINBOOL)SNDMSG((hwnd),TVM_DELETEITEM,0,(LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_DeleteAllItems(hwnd) (WINBOOL)SNDMSG((hwnd),TVM_DELETEITEM,0,(LPARAM)TVI_ROOT) + +#define TVM_EXPAND (TV_FIRST+2) +#define TreeView_Expand(hwnd,hitem,code) (WINBOOL)SNDMSG((hwnd),TVM_EXPAND,(WPARAM)(code),(LPARAM)(HTREEITEM)(hitem)) + +#define TVE_COLLAPSE 0x1 +#define TVE_EXPAND 0x2 +#define TVE_TOGGLE 0x3 +#define TVE_EXPANDPARTIAL 0x4000 +#define TVE_COLLAPSERESET 0x8000 + +#define TVM_GETITEMRECT (TV_FIRST+4) +#define TreeView_GetItemRect(hwnd,hitem,prc,code) (*(HTREEITEM *)prc = (hitem),(WINBOOL)SNDMSG((hwnd),TVM_GETITEMRECT,(WPARAM)(code),(LPARAM)(RECT *)(prc))) + +#define TVM_GETCOUNT (TV_FIRST+5) +#define TreeView_GetCount(hwnd) (UINT)SNDMSG((hwnd),TVM_GETCOUNT,0,0) + +#define TVM_GETINDENT (TV_FIRST+6) +#define TreeView_GetIndent(hwnd) (UINT)SNDMSG((hwnd),TVM_GETINDENT,0,0) + +#define TVM_SETINDENT (TV_FIRST+7) +#define TreeView_SetIndent(hwnd,indent) (WINBOOL)SNDMSG((hwnd),TVM_SETINDENT,(WPARAM)(indent),0) + +#define TVM_GETIMAGELIST (TV_FIRST+8) +#define TreeView_GetImageList(hwnd,iImage) (HIMAGELIST)SNDMSG((hwnd),TVM_GETIMAGELIST,iImage,0) + +#define TVSIL_NORMAL 0 +#define TVSIL_STATE 2 + +#define TVM_SETIMAGELIST (TV_FIRST+9) +#define TreeView_SetImageList(hwnd,himl,iImage) (HIMAGELIST)SNDMSG((hwnd),TVM_SETIMAGELIST,iImage,(LPARAM)(HIMAGELIST)(himl)) + +#define TVM_GETNEXTITEM (TV_FIRST+10) +#define TreeView_GetNextItem(hwnd,hitem,code) (HTREEITEM)SNDMSG((hwnd),TVM_GETNEXTITEM,(WPARAM)(code),(LPARAM)(HTREEITEM)(hitem)) + +#define TVGN_ROOT 0x0 +#define TVGN_NEXT 0x1 +#define TVGN_PREVIOUS 0x2 +#define TVGN_PARENT 0x3 +#define TVGN_CHILD 0x4 +#define TVGN_FIRSTVISIBLE 0x5 +#define TVGN_NEXTVISIBLE 0x6 +#define TVGN_PREVIOUSVISIBLE 0x7 +#define TVGN_DROPHILITE 0x8 +#define TVGN_CARET 0x9 +#define TVGN_LASTVISIBLE 0xa + +#define TVSI_NOSINGLEEXPAND 0x8000 + +#define TreeView_GetChild(hwnd,hitem) TreeView_GetNextItem(hwnd,hitem,TVGN_CHILD) +#define TreeView_GetNextSibling(hwnd,hitem) TreeView_GetNextItem(hwnd,hitem,TVGN_NEXT) +#define TreeView_GetPrevSibling(hwnd,hitem) TreeView_GetNextItem(hwnd,hitem,TVGN_PREVIOUS) +#define TreeView_GetParent(hwnd,hitem) TreeView_GetNextItem(hwnd,hitem,TVGN_PARENT) +#define TreeView_GetFirstVisible(hwnd) TreeView_GetNextItem(hwnd,NULL,TVGN_FIRSTVISIBLE) +#define TreeView_GetNextVisible(hwnd,hitem) TreeView_GetNextItem(hwnd,hitem,TVGN_NEXTVISIBLE) +#define TreeView_GetPrevVisible(hwnd,hitem) TreeView_GetNextItem(hwnd,hitem,TVGN_PREVIOUSVISIBLE) +#define TreeView_GetSelection(hwnd) TreeView_GetNextItem(hwnd,NULL,TVGN_CARET) +#define TreeView_GetDropHilight(hwnd) TreeView_GetNextItem(hwnd,NULL,TVGN_DROPHILITE) +#define TreeView_GetRoot(hwnd) TreeView_GetNextItem(hwnd,NULL,TVGN_ROOT) +#define TreeView_GetLastVisible(hwnd) TreeView_GetNextItem(hwnd,NULL,TVGN_LASTVISIBLE) + +#define TVM_SELECTITEM (TV_FIRST+11) +#define TreeView_Select(hwnd,hitem,code) (WINBOOL)SNDMSG((hwnd),TVM_SELECTITEM,(WPARAM)(code),(LPARAM)(HTREEITEM)(hitem)) + +#define TreeView_SelectItem(hwnd,hitem) TreeView_Select(hwnd,hitem,TVGN_CARET) +#define TreeView_SelectDropTarget(hwnd,hitem) TreeView_Select(hwnd,hitem,TVGN_DROPHILITE) +#define TreeView_SelectSetFirstVisible(hwnd,hitem) TreeView_Select(hwnd,hitem,TVGN_FIRSTVISIBLE) + +#define TVM_GETITEMA (TV_FIRST+12) +#define TVM_GETITEMW (TV_FIRST+62) + +#ifdef UNICODE +#define TVM_GETITEM TVM_GETITEMW +#else +#define TVM_GETITEM TVM_GETITEMA +#endif + +#define TreeView_GetItem(hwnd,pitem) (WINBOOL)SNDMSG((hwnd),TVM_GETITEM,0,(LPARAM)(TV_ITEM *)(pitem)) + +#define TVM_SETITEMA (TV_FIRST+13) +#define TVM_SETITEMW (TV_FIRST+63) + +#ifdef UNICODE +#define TVM_SETITEM TVM_SETITEMW +#else +#define TVM_SETITEM TVM_SETITEMA +#endif + +#define TreeView_SetItem(hwnd,pitem) (WINBOOL)SNDMSG((hwnd),TVM_SETITEM,0,(LPARAM)(const TV_ITEM *)(pitem)) + +#define TVM_EDITLABELA (TV_FIRST+14) +#define TVM_EDITLABELW (TV_FIRST+65) +#ifdef UNICODE +#define TVM_EDITLABEL TVM_EDITLABELW +#else +#define TVM_EDITLABEL TVM_EDITLABELA +#endif + +#define TreeView_EditLabel(hwnd,hitem) (HWND)SNDMSG((hwnd),TVM_EDITLABEL,0,(LPARAM)(HTREEITEM)(hitem)) + +#define TVM_GETEDITCONTROL (TV_FIRST+15) +#define TreeView_GetEditControl(hwnd) (HWND)SNDMSG((hwnd),TVM_GETEDITCONTROL,0,0) + +#define TVM_GETVISIBLECOUNT (TV_FIRST+16) +#define TreeView_GetVisibleCount(hwnd) (UINT)SNDMSG((hwnd),TVM_GETVISIBLECOUNT,0,0) + +#define TVM_HITTEST (TV_FIRST+17) +#define TreeView_HitTest(hwnd,lpht) (HTREEITEM)SNDMSG((hwnd),TVM_HITTEST,0,(LPARAM)(LPTV_HITTESTINFO)(lpht)) + +#define LPTV_HITTESTINFO LPTVHITTESTINFO +#define TV_HITTESTINFO TVHITTESTINFO + + typedef struct tagTVHITTESTINFO { + POINT pt; + UINT flags; + HTREEITEM hItem; + } TVHITTESTINFO,*LPTVHITTESTINFO; + +#define TVHT_NOWHERE 0x1 +#define TVHT_ONITEMICON 0x2 +#define TVHT_ONITEMLABEL 0x4 +#define TVHT_ONITEM (TVHT_ONITEMICON | TVHT_ONITEMLABEL | TVHT_ONITEMSTATEICON) +#define TVHT_ONITEMINDENT 0x8 +#define TVHT_ONITEMBUTTON 0x10 +#define TVHT_ONITEMRIGHT 0x20 +#define TVHT_ONITEMSTATEICON 0x40 + +#define TVHT_ABOVE 0x100 +#define TVHT_BELOW 0x200 +#define TVHT_TORIGHT 0x400 +#define TVHT_TOLEFT 0x800 + +#define TVM_CREATEDRAGIMAGE (TV_FIRST+18) +#define TreeView_CreateDragImage(hwnd,hitem) (HIMAGELIST)SNDMSG((hwnd),TVM_CREATEDRAGIMAGE,0,(LPARAM)(HTREEITEM)(hitem)) + +#define TVM_SORTCHILDREN (TV_FIRST+19) +#define TreeView_SortChildren(hwnd,hitem,recurse) (WINBOOL)SNDMSG((hwnd),TVM_SORTCHILDREN,(WPARAM)(recurse),(LPARAM)(HTREEITEM)(hitem)) + +#define TVM_ENSUREVISIBLE (TV_FIRST+20) +#define TreeView_EnsureVisible(hwnd,hitem) (WINBOOL)SNDMSG((hwnd),TVM_ENSUREVISIBLE,0,(LPARAM)(HTREEITEM)(hitem)) + +#define TVM_SORTCHILDRENCB (TV_FIRST+21) +#define TreeView_SortChildrenCB(hwnd,psort,recurse) (WINBOOL)SNDMSG((hwnd),TVM_SORTCHILDRENCB,(WPARAM)(recurse),(LPARAM)(LPTV_SORTCB)(psort)) + +#define TVM_ENDEDITLABELNOW (TV_FIRST+22) +#define TreeView_EndEditLabelNow(hwnd,fCancel) (WINBOOL)SNDMSG((hwnd),TVM_ENDEDITLABELNOW,(WPARAM)(fCancel),0) + +#define TVM_GETISEARCHSTRINGA (TV_FIRST+23) +#define TVM_GETISEARCHSTRINGW (TV_FIRST+64) + +#ifdef UNICODE +#define TVM_GETISEARCHSTRING TVM_GETISEARCHSTRINGW +#else +#define TVM_GETISEARCHSTRING TVM_GETISEARCHSTRINGA +#endif + +#define TVM_SETTOOLTIPS (TV_FIRST+24) +#define TreeView_SetToolTips(hwnd,hwndTT) (HWND)SNDMSG((hwnd),TVM_SETTOOLTIPS,(WPARAM)(hwndTT),0) +#define TVM_GETTOOLTIPS (TV_FIRST+25) +#define TreeView_GetToolTips(hwnd) (HWND)SNDMSG((hwnd),TVM_GETTOOLTIPS,0,0) +#define TreeView_GetISearchString(hwndTV,lpsz) (WINBOOL)SNDMSG((hwndTV),TVM_GETISEARCHSTRING,0,(LPARAM)(LPTSTR)(lpsz)) + +#define TVM_SETINSERTMARK (TV_FIRST+26) +#define TreeView_SetInsertMark(hwnd,hItem,fAfter) (WINBOOL)SNDMSG((hwnd),TVM_SETINSERTMARK,(WPARAM) (fAfter),(LPARAM) (hItem)) +#define TVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define TreeView_SetUnicodeFormat(hwnd,fUnicode) (WINBOOL)SNDMSG((hwnd),TVM_SETUNICODEFORMAT,(WPARAM)(fUnicode),0) +#define TVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define TreeView_GetUnicodeFormat(hwnd) (WINBOOL)SNDMSG((hwnd),TVM_GETUNICODEFORMAT,0,0) + +#define TVM_SETITEMHEIGHT (TV_FIRST+27) +#define TreeView_SetItemHeight(hwnd,iHeight) (int)SNDMSG((hwnd),TVM_SETITEMHEIGHT,(WPARAM)(iHeight),0) +#define TVM_GETITEMHEIGHT (TV_FIRST+28) +#define TreeView_GetItemHeight(hwnd) (int)SNDMSG((hwnd),TVM_GETITEMHEIGHT,0,0) +#define TVM_SETBKCOLOR (TV_FIRST+29) +#define TreeView_SetBkColor(hwnd,clr) (COLORREF)SNDMSG((hwnd),TVM_SETBKCOLOR,0,(LPARAM)(clr)) +#define TVM_SETTEXTCOLOR (TV_FIRST+30) +#define TreeView_SetTextColor(hwnd,clr) (COLORREF)SNDMSG((hwnd),TVM_SETTEXTCOLOR,0,(LPARAM)(clr)) +#define TVM_GETBKCOLOR (TV_FIRST+31) +#define TreeView_GetBkColor(hwnd) (COLORREF)SNDMSG((hwnd),TVM_GETBKCOLOR,0,0) +#define TVM_GETTEXTCOLOR (TV_FIRST+32) +#define TreeView_GetTextColor(hwnd) (COLORREF)SNDMSG((hwnd),TVM_GETTEXTCOLOR,0,0) +#define TVM_SETSCROLLTIME (TV_FIRST+33) +#define TreeView_SetScrollTime(hwnd,uTime) (UINT)SNDMSG((hwnd),TVM_SETSCROLLTIME,uTime,0) +#define TVM_GETSCROLLTIME (TV_FIRST+34) +#define TreeView_GetScrollTime(hwnd) (UINT)SNDMSG((hwnd),TVM_GETSCROLLTIME,0,0) +#define TVM_SETINSERTMARKCOLOR (TV_FIRST+37) +#define TreeView_SetInsertMarkColor(hwnd,clr) (COLORREF)SNDMSG((hwnd),TVM_SETINSERTMARKCOLOR,0,(LPARAM)(clr)) +#define TVM_GETINSERTMARKCOLOR (TV_FIRST+38) +#define TreeView_GetInsertMarkColor(hwnd) (COLORREF)SNDMSG((hwnd),TVM_GETINSERTMARKCOLOR,0,0) + +#define TreeView_SetItemState(hwndTV,hti,data,_mask) { TVITEM _ms_TVi; _ms_TVi.mask = TVIF_STATE; _ms_TVi.hItem = hti; _ms_TVi.stateMask = _mask; _ms_TVi.state = data; SNDMSG((hwndTV),TVM_SETITEM,0,(LPARAM)(TV_ITEM *)&_ms_TVi);} +#define TreeView_SetCheckState(hwndTV,hti,fCheck) TreeView_SetItemState(hwndTV,hti,INDEXTOSTATEIMAGEMASK((fCheck)?2:1),TVIS_STATEIMAGEMASK) +#define TVM_GETITEMSTATE (TV_FIRST+39) +#define TreeView_GetItemState(hwndTV,hti,mask) (UINT)SNDMSG((hwndTV),TVM_GETITEMSTATE,(WPARAM)(hti),(LPARAM)(mask)) +#define TreeView_GetCheckState(hwndTV,hti) ((((UINT)(SNDMSG((hwndTV),TVM_GETITEMSTATE,(WPARAM)(hti),TVIS_STATEIMAGEMASK))) >> 12) -1) +#define TVM_SETLINECOLOR (TV_FIRST+40) +#define TreeView_SetLineColor(hwnd,clr) (COLORREF)SNDMSG((hwnd),TVM_SETLINECOLOR,0,(LPARAM)(clr)) +#define TVM_GETLINECOLOR (TV_FIRST+41) +#define TreeView_GetLineColor(hwnd) (COLORREF)SNDMSG((hwnd),TVM_GETLINECOLOR,0,0) + +#define TVM_MAPACCIDTOHTREEITEM (TV_FIRST+42) +#define TreeView_MapAccIDToHTREEITEM(hwnd,id) (HTREEITEM)SNDMSG((hwnd),TVM_MAPACCIDTOHTREEITEM,id,0) + +#define TVM_MAPHTREEITEMTOACCID (TV_FIRST+43) +#define TreeView_MapHTREEITEMToAccID(hwnd,htreeitem) (UINT)SNDMSG((hwnd),TVM_MAPHTREEITEMTOACCID,(WPARAM)htreeitem,0) + + typedef int (CALLBACK *PFNTVCOMPARE)(LPARAM lParam1,LPARAM lParam2,LPARAM lParamSort); + +#define LPTV_SORTCB LPTVSORTCB +#define TV_SORTCB TVSORTCB + + typedef struct tagTVSORTCB { + HTREEITEM hParent; + PFNTVCOMPARE lpfnCompare; + LPARAM lParam; + } TVSORTCB,*LPTVSORTCB; + +#define LPNM_TREEVIEWA LPNMTREEVIEWA +#define LPNM_TREEVIEWW LPNMTREEVIEWW +#define NM_TREEVIEWW NMTREEVIEWW +#define NM_TREEVIEWA NMTREEVIEWA +#define LPNM_TREEVIEW LPNMTREEVIEW +#define NM_TREEVIEW NMTREEVIEW + + typedef struct tagNMTREEVIEWA { + NMHDR hdr; + UINT action; + TVITEMA itemOld; + TVITEMA itemNew; + POINT ptDrag; + } NMTREEVIEWA,*LPNMTREEVIEWA; + + typedef struct tagNMTREEVIEWW { + NMHDR hdr; + UINT action; + TVITEMW itemOld; + TVITEMW itemNew; + POINT ptDrag; + } NMTREEVIEWW,*LPNMTREEVIEWW; + +#ifdef UNICODE +#define NMTREEVIEW NMTREEVIEWW +#define LPNMTREEVIEW LPNMTREEVIEWW +#else +#define NMTREEVIEW NMTREEVIEWA +#define LPNMTREEVIEW LPNMTREEVIEWA +#endif + +#define TVN_SELCHANGINGA (TVN_FIRST-1) +#define TVN_SELCHANGINGW (TVN_FIRST-50) +#define TVN_SELCHANGEDA (TVN_FIRST-2) +#define TVN_SELCHANGEDW (TVN_FIRST-51) + +#define TVC_UNKNOWN 0x0 +#define TVC_BYMOUSE 0x1 +#define TVC_BYKEYBOARD 0x2 + +#define TVN_GETDISPINFOA (TVN_FIRST-3) +#define TVN_GETDISPINFOW (TVN_FIRST-52) +#define TVN_SETDISPINFOA (TVN_FIRST-4) +#define TVN_SETDISPINFOW (TVN_FIRST-53) + +#define TVIF_DI_SETITEM 0x1000 + +#define TV_DISPINFOA NMTVDISPINFOA +#define TV_DISPINFOW NMTVDISPINFOW +#define TV_DISPINFO NMTVDISPINFO + + typedef struct tagTVDISPINFOA { + NMHDR hdr; + TVITEMA item; + } NMTVDISPINFOA,*LPNMTVDISPINFOA; + + typedef struct tagTVDISPINFOW { + NMHDR hdr; + TVITEMW item; + } NMTVDISPINFOW,*LPNMTVDISPINFOW; + +#ifdef UNICODE +#define NMTVDISPINFO NMTVDISPINFOW +#define LPNMTVDISPINFO LPNMTVDISPINFOW +#else +#define NMTVDISPINFO NMTVDISPINFOA +#define LPNMTVDISPINFO LPNMTVDISPINFOA +#endif + +#if (_WIN32_IE >= 0x0600) + +typedef struct tagTVDISPINFOEXA { + NMHDR hdr; + TVITEMEXA item; +} NMTVDISPINFOEXA, *LPNMTVDISPINFOEXA; + +typedef struct tagTVDISPINFOEXW { + NMHDR hdr; + TVITEMEXW item; +} NMTVDISPINFOEXW, *LPNMTVDISPINFOEXW; + +#ifdef UNICODE +#define NMTVDISPINFOEX NMTVDISPINFOEXW +#define LPNMTVDISPINFOEX LPNMTVDISPINFOEXW +#else +#define NMTVDISPINFOEX NMTVDISPINFOEXA +#define LPNMTVDISPINFOEX LPNMTVDISPINFOEXA +#endif /* UNICODE */ + +#define TV_DISPINFOEXA NMTVDISPINFOEXA +#define TV_DISPINFOEXW NMTVDISPINFOEXW +#define TV_DISPINFOEX NMTVDISPINFOEX + +#endif /* (_WIN32_IE >= 0x0600) */ + +#define TVN_ITEMEXPANDINGA (TVN_FIRST-5) +#define TVN_ITEMEXPANDINGW (TVN_FIRST-54) +#define TVN_ITEMEXPANDEDA (TVN_FIRST-6) +#define TVN_ITEMEXPANDEDW (TVN_FIRST-55) +#define TVN_BEGINDRAGA (TVN_FIRST-7) +#define TVN_BEGINDRAGW (TVN_FIRST-56) +#define TVN_BEGINRDRAGA (TVN_FIRST-8) +#define TVN_BEGINRDRAGW (TVN_FIRST-57) +#define TVN_DELETEITEMA (TVN_FIRST-9) +#define TVN_DELETEITEMW (TVN_FIRST-58) +#define TVN_BEGINLABELEDITA (TVN_FIRST-10) +#define TVN_BEGINLABELEDITW (TVN_FIRST-59) +#define TVN_ENDLABELEDITA (TVN_FIRST-11) +#define TVN_ENDLABELEDITW (TVN_FIRST-60) +#define TVN_KEYDOWN (TVN_FIRST-12) +#define TVN_GETINFOTIPA (TVN_FIRST-13) +#define TVN_GETINFOTIPW (TVN_FIRST-14) +#define TVN_SINGLEEXPAND (TVN_FIRST-15) + +#define TVNRET_DEFAULT 0 +#define TVNRET_SKIPOLD 1 +#define TVNRET_SKIPNEW 2 + +#define TV_KEYDOWN NMTVKEYDOWN + +#include + + typedef struct tagTVKEYDOWN { + NMHDR hdr; + WORD wVKey; + UINT flags; + } NMTVKEYDOWN,*LPNMTVKEYDOWN; + +#include + +#ifdef UNICODE +#define TVN_SELCHANGING TVN_SELCHANGINGW +#define TVN_SELCHANGED TVN_SELCHANGEDW +#define TVN_GETDISPINFO TVN_GETDISPINFOW +#define TVN_SETDISPINFO TVN_SETDISPINFOW +#define TVN_ITEMEXPANDING TVN_ITEMEXPANDINGW +#define TVN_ITEMEXPANDED TVN_ITEMEXPANDEDW +#define TVN_BEGINDRAG TVN_BEGINDRAGW +#define TVN_BEGINRDRAG TVN_BEGINRDRAGW +#define TVN_DELETEITEM TVN_DELETEITEMW +#define TVN_BEGINLABELEDIT TVN_BEGINLABELEDITW +#define TVN_ENDLABELEDIT TVN_ENDLABELEDITW +#else +#define TVN_SELCHANGING TVN_SELCHANGINGA +#define TVN_SELCHANGED TVN_SELCHANGEDA +#define TVN_GETDISPINFO TVN_GETDISPINFOA +#define TVN_SETDISPINFO TVN_SETDISPINFOA +#define TVN_ITEMEXPANDING TVN_ITEMEXPANDINGA +#define TVN_ITEMEXPANDED TVN_ITEMEXPANDEDA +#define TVN_BEGINDRAG TVN_BEGINDRAGA +#define TVN_BEGINRDRAG TVN_BEGINRDRAGA +#define TVN_DELETEITEM TVN_DELETEITEMA +#define TVN_BEGINLABELEDIT TVN_BEGINLABELEDITA +#define TVN_ENDLABELEDIT TVN_ENDLABELEDITA +#endif + +#define NMTVCUSTOMDRAW_V3_SIZE CCSIZEOF_STRUCT(NMTVCUSTOMDRAW,clrTextBk) + + typedef struct tagNMTVCUSTOMDRAW { + NMCUSTOMDRAW nmcd; + COLORREF clrText; + COLORREF clrTextBk; + int iLevel; + } NMTVCUSTOMDRAW,*LPNMTVCUSTOMDRAW; + + typedef struct tagNMTVGETINFOTIPA { + NMHDR hdr; + LPSTR pszText; + int cchTextMax; + HTREEITEM hItem; + LPARAM lParam; + } NMTVGETINFOTIPA,*LPNMTVGETINFOTIPA; + + typedef struct tagNMTVGETINFOTIPW { + NMHDR hdr; + LPWSTR pszText; + int cchTextMax; + HTREEITEM hItem; + LPARAM lParam; + } NMTVGETINFOTIPW,*LPNMTVGETINFOTIPW; + +#ifdef UNICODE +#define TVN_GETINFOTIP TVN_GETINFOTIPW +#define NMTVGETINFOTIP NMTVGETINFOTIPW +#define LPNMTVGETINFOTIP LPNMTVGETINFOTIPW +#else +#define TVN_GETINFOTIP TVN_GETINFOTIPA +#define NMTVGETINFOTIP NMTVGETINFOTIPA +#define LPNMTVGETINFOTIP LPNMTVGETINFOTIPA +#endif + +#define TVCDRF_NOIMAGES 0x10000 +#endif + +#ifndef NOUSEREXCONTROLS + +#define WC_COMBOBOXEXW L"ComboBoxEx32" +#define WC_COMBOBOXEXA "ComboBoxEx32" + +#ifdef UNICODE +#define WC_COMBOBOXEX WC_COMBOBOXEXW +#else +#define WC_COMBOBOXEX WC_COMBOBOXEXA +#endif + +#define CBEIF_TEXT 0x1 +#define CBEIF_IMAGE 0x2 +#define CBEIF_SELECTEDIMAGE 0x4 +#define CBEIF_OVERLAY 0x8 +#define CBEIF_INDENT 0x10 +#define CBEIF_LPARAM 0x20 + +#define CBEIF_DI_SETITEM 0x10000000 + + typedef struct tagCOMBOBOXEXITEMA { UINT mask; INT_PTR iItem; LPSTR pszText; @@ -4349,11 +3887,11 @@ typedef struct tagCOMBOBOXEXITEMA int iOverlay; int iIndent; LPARAM lParam; -} COMBOBOXEXITEMA, *PCOMBOBOXEXITEMA; -typedef COMBOBOXEXITEMA const *PCCOMBOEXITEMA; /* Yes, there's a BOX missing */ + } COMBOBOXEXITEMA,*PCOMBOBOXEXITEMA; + typedef COMBOBOXEXITEMA CONST *PCCOMBOEXITEMA; -typedef struct tagCOMBOBOXEXITEMW -{ + typedef struct tagCOMBOBOXEXITEMW + { UINT mask; INT_PTR iItem; LPWSTR pszText; @@ -4363,809 +3901,1212 @@ typedef struct tagCOMBOBOXEXITEMW int iOverlay; int iIndent; LPARAM lParam; -} COMBOBOXEXITEMW, *PCOMBOBOXEXITEMW; -typedef COMBOBOXEXITEMW const *PCCOMBOEXITEMW; /* Yes, there's a BOX missing */ + } COMBOBOXEXITEMW,*PCOMBOBOXEXITEMW; + typedef COMBOBOXEXITEMW CONST *PCCOMBOEXITEMW; -#define COMBOBOXEXITEM WINELIB_NAME_AW(COMBOBOXEXITEM) -#define PCOMBOBOXEXITEM WINELIB_NAME_AW(PCOMBOBOXEXITEM) -#define PCCOMBOBOXEXITEM WINELIB_NAME_AW(PCCOMBOEXITEM) /* Yes, there's a BOX missing */ +#ifdef UNICODE +#define COMBOBOXEXITEM COMBOBOXEXITEMW +#define PCOMBOBOXEXITEM PCOMBOBOXEXITEMW +#define PCCOMBOBOXEXITEM PCCOMBOBOXEXITEMW +#else +#define COMBOBOXEXITEM COMBOBOXEXITEMA +#define PCOMBOBOXEXITEM PCOMBOBOXEXITEMA +#define PCCOMBOBOXEXITEM PCCOMBOBOXEXITEMA +#endif -#define CBENF_KILLFOCUS 1 -#define CBENF_RETURN 2 -#define CBENF_ESCAPE 3 -#define CBENF_DROPDOWN 4 +#define CBEM_INSERTITEMA (WM_USER+1) +#define CBEM_SETIMAGELIST (WM_USER+2) +#define CBEM_GETIMAGELIST (WM_USER+3) +#define CBEM_GETITEMA (WM_USER+4) +#define CBEM_SETITEMA (WM_USER+5) +#define CBEM_DELETEITEM CB_DELETESTRING +#define CBEM_GETCOMBOCONTROL (WM_USER+6) +#define CBEM_GETEDITCONTROL (WM_USER+7) +#define CBEM_SETEXSTYLE (WM_USER+8) +#define CBEM_SETEXTENDEDSTYLE (WM_USER+14) +#define CBEM_GETEXSTYLE (WM_USER+9) +#define CBEM_GETEXTENDEDSTYLE (WM_USER+9) +#define CBEM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define CBEM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define CBEM_HASEDITCHANGED (WM_USER+10) +#define CBEM_INSERTITEMW (WM_USER+11) +#define CBEM_SETITEMW (WM_USER+12) +#define CBEM_GETITEMW (WM_USER+13) + +#ifdef UNICODE +#define CBEM_INSERTITEM CBEM_INSERTITEMW +#define CBEM_SETITEM CBEM_SETITEMW +#define CBEM_GETITEM CBEM_GETITEMW +#else +#define CBEM_INSERTITEM CBEM_INSERTITEMA +#define CBEM_SETITEM CBEM_SETITEMA +#define CBEM_GETITEM CBEM_GETITEMA +#endif + +#define CBEM_SETWINDOWTHEME CCM_SETWINDOWTHEME + +#define CBES_EX_NOEDITIMAGE 0x1 +#define CBES_EX_NOEDITIMAGEINDENT 0x2 +#define CBES_EX_PATHWORDBREAKPROC 0x4 +#define CBES_EX_NOSIZELIMIT 0x8 +#define CBES_EX_CASESENSITIVE 0x10 + + typedef struct { + NMHDR hdr; + COMBOBOXEXITEMA ceItem; + } NMCOMBOBOXEXA,*PNMCOMBOBOXEXA; + + typedef struct { + NMHDR hdr; + COMBOBOXEXITEMW ceItem; + } NMCOMBOBOXEXW,*PNMCOMBOBOXEXW; + +#ifdef UNICODE +#define NMCOMBOBOXEX NMCOMBOBOXEXW +#define PNMCOMBOBOXEX PNMCOMBOBOXEXW +#define CBEN_GETDISPINFO CBEN_GETDISPINFOW +#else +#define NMCOMBOBOXEX NMCOMBOBOXEXA +#define PNMCOMBOBOXEX PNMCOMBOBOXEXA +#define CBEN_GETDISPINFO CBEN_GETDISPINFOA +#endif + +#define CBEN_GETDISPINFOA (CBEN_FIRST - 0) +#define CBEN_INSERTITEM (CBEN_FIRST - 1) +#define CBEN_DELETEITEM (CBEN_FIRST - 2) +#define CBEN_BEGINEDIT (CBEN_FIRST - 4) +#define CBEN_ENDEDITA (CBEN_FIRST - 5) +#define CBEN_ENDEDITW (CBEN_FIRST - 6) + +#define CBEN_GETDISPINFOW (CBEN_FIRST - 7) + +#define CBEN_DRAGBEGINA (CBEN_FIRST - 8) +#define CBEN_DRAGBEGINW (CBEN_FIRST - 9) + +#ifdef UNICODE +#define CBEN_DRAGBEGIN CBEN_DRAGBEGINW +#else +#define CBEN_DRAGBEGIN CBEN_DRAGBEGINA +#endif + +#ifdef UNICODE +#define CBEN_ENDEDIT CBEN_ENDEDITW +#else +#define CBEN_ENDEDIT CBEN_ENDEDITA +#endif + +#define CBENF_KILLFOCUS 1 +#define CBENF_RETURN 2 +#define CBENF_ESCAPE 3 +#define CBENF_DROPDOWN 4 #define CBEMAXSTRLEN 260 -typedef struct tagNMCBEENDEDITW -{ - NMHDR hdr; - BOOL fChanged; - int iNewSelection; - WCHAR szText[CBEMAXSTRLEN]; - int iWhy; -} NMCBEENDEDITW, *LPNMCBEENDEDITW, *PNMCBEENDEDITW; - -typedef struct tagNMCBEENDEDITA -{ - NMHDR hdr; - BOOL fChanged; - int iNewSelection; - char szText[CBEMAXSTRLEN]; - int iWhy; -} NMCBEENDEDITA, *LPNMCBEENDEDITA, *PNMCBEENDEDITA; - -#define NMCBEENDEDIT WINELIB_NAME_AW(NMCBEENDEDIT) -#define LPNMCBEENDEDIT WINELIB_NAME_AW(LPNMCBEENDEDIT) -#define PNMCBEENDEDIT WINELIB_NAME_AW(PNMCBEENDEDIT) - -typedef struct -{ - NMHDR hdr; - COMBOBOXEXITEMA ceItem; -} NMCOMBOBOXEXA, *PNMCOMBOBOXEXA; - -typedef struct -{ - NMHDR hdr; - COMBOBOXEXITEMW ceItem; -} NMCOMBOBOXEXW, *PNMCOMBOBOXEXW; - -#define NMCOMBOBOXEX WINELIB_NAME_AW(NMCOMBOBOXEX) -#define PNMCOMBOBOXEX WINELIB_NAME_AW(PNMCOMBOBOXEX) - -typedef struct -{ - NMHDR hdr; - int iItemid; - char szText[CBEMAXSTRLEN]; -} NMCBEDRAGBEGINA, *PNMCBEDRAGBEGINA, *LPNMCBEDRAGBEGINA; - -typedef struct -{ + typedef struct { NMHDR hdr; int iItemid; WCHAR szText[CBEMAXSTRLEN]; -} NMCBEDRAGBEGINW, *PNMCBEDRAGBEGINW, *LPNMCBEDRAGBEGINW; + }NMCBEDRAGBEGINW,*LPNMCBEDRAGBEGINW,*PNMCBEDRAGBEGINW; -#define NMCBEDRAGBEGIN WINELIB_NAME_AW(NMCBEDRAGBEGIN) -#define PNMCBEDRAGBEGIN WINELIB_NAME_AW(PNMCBEDRAGBEGIN) -#define LPNMCBEDRAGBEGIN WINELIB_NAME_AW(LPNMCBEDRAGBEGIN) - - -/* Hotkey control */ - -#define HOTKEY_CLASSA "msctls_hotkey32" -#if defined(__GNUC__) -# define HOTKEY_CLASSW (const WCHAR []){ 'm','s','c','t','l','s','_', \ - 'h','o','t','k','e','y','3','2',0 } -#elif defined(_MSC_VER) -# define HOTKEY_CLASSW L"msctls_hotkey32" -#else -static const WCHAR HOTKEY_CLASSW[] = { 'm','s','c','t','l','s','_', - 'h','o','t','k','e','y','3','2',0 }; -#endif -#define HOTKEY_CLASS WINELIB_NAME_AW(HOTKEY_CLASS) - -#define HOTKEYF_SHIFT 0x01 -#define HOTKEYF_CONTROL 0x02 -#define HOTKEYF_ALT 0x04 -#define HOTKEYF_EXT 0x08 - -#define HKCOMB_NONE 0x0001 -#define HKCOMB_S 0x0002 -#define HKCOMB_C 0x0004 -#define HKCOMB_A 0x0008 -#define HKCOMB_SC 0x0010 -#define HKCOMB_SA 0x0020 -#define HKCOMB_CA 0x0040 -#define HKCOMB_SCA 0x0080 - -#define HKM_SETHOTKEY (WM_USER+1) -#define HKM_GETHOTKEY (WM_USER+2) -#define HKM_SETRULES (WM_USER+3) - - -/* animate control */ - -#define ANIMATE_CLASSA "SysAnimate32" -#if defined(__GNUC__) -# define ANIMATE_CLASSW (const WCHAR []){ 'S','y','s', \ - 'A','n','i','m','a','t','e','3','2',0 } -#elif defined(_MSC_VER) -# define ANIMATE_CLASSW L"SysAnimate32" -#else -static const WCHAR ANIMATE_CLASSW[] = { 'S','y','s', - 'A','n','i','m','a','t','e','3','2',0 }; -#endif -#define ANIMATE_CLASS WINELIB_NAME_AW(ANIMATE_CLASS) - -#define ACS_CENTER 0x0001 -#define ACS_TRANSPARENT 0x0002 -#define ACS_AUTOPLAY 0x0004 -#define ACS_TIMER 0x0008 /* no threads, just timers */ - -#define ACM_OPENA (WM_USER+100) -#define ACM_OPENW (WM_USER+103) -#define ACM_OPEN WINELIB_NAME_AW(ACM_OPEN) -#define ACM_PLAY (WM_USER+101) -#define ACM_STOP (WM_USER+102) - -#define ACN_START 1 -#define ACN_STOP 2 - -#define Animate_CreateA(hwndP,id,dwStyle,hInstance) \ - CreateWindowA(ANIMATE_CLASSA,NULL,dwStyle,0,0,0,0,hwndP,(HMENU)(id),hInstance,NULL) -#define Animate_CreateW(hwndP,id,dwStyle,hInstance) \ - CreateWindowW(ANIMATE_CLASSW,NULL,dwStyle,0,0,0,0,hwndP,(HMENU)(id),hInstance,NULL) -#define Animate_Create WINELIB_NAME_AW(Animate_Create) -#define Animate_OpenA(hwnd,szName) \ - (BOOL)SNDMSGA(hwnd,ACM_OPENA,0,(LPARAM)(LPSTR)(szName)) -#define Animate_OpenW(hwnd,szName) \ - (BOOL)SNDMSGW(hwnd,ACM_OPENW,0,(LPARAM)(LPWSTR)(szName)) -#define Animate_Open WINELIB_NAME_AW(Animate_Open) -#define Animate_OpenExA(hwnd,hInst,szName) \ - (BOOL)SNDMSGA(hwnd,ACM_OPENA,(WPARAM)hInst,(LPARAM)(LPSTR)(szName)) -#define Animate_OpenExW(hwnd,hInst,szName) \ - (BOOL)SNDMSGW(hwnd,ACM_OPENW,(WPARAM)hInst,(LPARAM)(LPWSTR)(szName)) -#define Animate_OpenEx WINELIB_NAME_AW(Animate_OpenEx) -#define Animate_Play(hwnd,from,to,rep) \ - (BOOL)SNDMSG(hwnd,ACM_PLAY,(WPARAM)(UINT)(rep),(LPARAM)MAKELONG(from,to)) -#define Animate_Stop(hwnd) \ - (BOOL)SNDMSG(hwnd,ACM_STOP,0,0) -#define Animate_Close(hwnd) \ - (BOOL)SNDMSG(hwnd,ACM_OPENA,0,0) -#define Animate_Seek(hwnd,frame) \ - (BOOL)SNDMSG(hwnd,ACM_PLAY,1,(LPARAM)MAKELONG(frame,frame)) - - -/************************************************************************** - * IP Address control - */ - -#define WC_IPADDRESSA "SysIPAddress32" -#if defined(__GNUC__) -# define WC_IPADDRESSW (const WCHAR []){ 'S','y','s', \ - 'I','P','A','d','d','r','e','s','s','3','2',0 } -#elif defined(_MSC_VER) -# define WC_IPADDRESSW L"SysIPAddress32" -#else -static const WCHAR WC_IPADDRESSW[] = { 'S','y','s', - 'I','P','A','d','d','r','e','s','s','3','2',0 }; -#endif -#define WC_IPADDRESS WINELIB_NAME_AW(WC_IPADDRESS) - -#define IPM_CLEARADDRESS (WM_USER+100) -#define IPM_SETADDRESS (WM_USER+101) -#define IPM_GETADDRESS (WM_USER+102) -#define IPM_SETRANGE (WM_USER+103) -#define IPM_SETFOCUS (WM_USER+104) -#define IPM_ISBLANK (WM_USER+105) - -#define IPN_FIRST (0U-860U) -#define IPN_LAST (0U-879U) -#define IPN_FIELDCHANGED (IPN_FIRST-0) - -typedef struct tagNMIPADDRESS -{ + typedef struct { NMHDR hdr; - INT iField; - INT iValue; -} NMIPADDRESS, *LPNMIPADDRESS; + int iItemid; + char szText[CBEMAXSTRLEN]; + }NMCBEDRAGBEGINA,*LPNMCBEDRAGBEGINA,*PNMCBEDRAGBEGINA; -#define MAKEIPRANGE(low,high) \ - ((LPARAM)(WORD)(((BYTE)(high)<<8)+(BYTE)(low))) -#define MAKEIPADDRESS(b1,b2,b3,b4) \ - ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4)))) - -#define FIRST_IPADDRESS(x) (((x)>>24)&0xff) -#define SECOND_IPADDRESS(x) (((x)>>16)&0xff) -#define THIRD_IPADDRESS(x) (((x)>>8)&0xff) -#define FOURTH_IPADDRESS(x) ((x)&0xff) - - -/************************************************************************** - * Native Font control - */ - -#define WC_NATIVEFONTCTLA "NativeFontCtl" -#if defined(__GNUC__) -# define WC_NATIVEFONTCTLW (const WCHAR []){ 'N','a','t','i','v','e', \ - 'F','o','n','t','C','t','l',0 } -#elif defined(_MSC_VER) -# define WC_NATIVEFONTCTLW L"NativeFontCtl" +#ifdef UNICODE +#define NMCBEDRAGBEGIN NMCBEDRAGBEGINW +#define LPNMCBEDRAGBEGIN LPNMCBEDRAGBEGINW +#define PNMCBEDRAGBEGIN PNMCBEDRAGBEGINW #else -static const WCHAR WC_NATIVEFONTCTLW[] = { 'N','a','t','i','v','e', - 'F','o','n','t','C','t','l',0 }; +#define NMCBEDRAGBEGIN NMCBEDRAGBEGINA +#define LPNMCBEDRAGBEGIN LPNMCBEDRAGBEGINA +#define PNMCBEDRAGBEGIN PNMCBEDRAGBEGINA #endif -#define WC_NATIVEFONTCTL WINELIB_NAME_AW(WC_NATIVEFONTCTL) -#define NFS_EDIT 0x0001 -#define NFS_STATIC 0x0002 -#define NFS_LISTCOMBO 0x0004 -#define NFS_BUTTON 0x0008 -#define NFS_ALL 0x0010 + typedef struct { + NMHDR hdr; + WINBOOL fChanged; + int iNewSelection; + WCHAR szText[CBEMAXSTRLEN]; + int iWhy; + } NMCBEENDEDITW,*LPNMCBEENDEDITW,*PNMCBEENDEDITW; + typedef struct { + NMHDR hdr; + WINBOOL fChanged; + int iNewSelection; + char szText[CBEMAXSTRLEN]; + int iWhy; + } NMCBEENDEDITA,*LPNMCBEENDEDITA,*PNMCBEENDEDITA; -/************************************************************************** - * Month calendar control - * - */ - -#define MONTHCAL_CLASSA "SysMonthCal32" -#if defined(__GNUC__) -# define MONTHCAL_CLASSW (const WCHAR []){ 'S','y','s', \ - 'M','o','n','t','h','C','a','l','3','2',0 } -#elif defined(_MSC_VER) -# define MONTHCAL_CLASSW L"SysMonthCal32" +#ifdef UNICODE +#define NMCBEENDEDIT NMCBEENDEDITW +#define LPNMCBEENDEDIT LPNMCBEENDEDITW +#define PNMCBEENDEDIT PNMCBEENDEDITW #else -static const WCHAR MONTHCAL_CLASSW[] = { 'S','y','s', - 'M','o','n','t','h','C','a','l','3','2',0 }; +#define NMCBEENDEDIT NMCBEENDEDITA +#define LPNMCBEENDEDIT LPNMCBEENDEDITA +#define PNMCBEENDEDIT PNMCBEENDEDITA +#endif #endif -#define MONTHCAL_CLASS WINELIB_NAME_AW(MONTHCAL_CLASS) -#define MCM_FIRST 0x1000 -#define MCN_FIRST (0U-750U) -#define MCN_LAST (0U-759U) +#ifndef NOTABCONTROL +#define WC_TABCONTROLA "SysTabControl32" +#define WC_TABCONTROLW L"SysTabControl32" +#ifdef UNICODE +#define WC_TABCONTROL WC_TABCONTROLW +#else +#define WC_TABCONTROL WC_TABCONTROLA +#endif -#define MCM_GETCURSEL (MCM_FIRST + 1) -#define MCM_SETCURSEL (MCM_FIRST + 2) -#define MCM_GETMAXSELCOUNT (MCM_FIRST + 3) -#define MCM_SETMAXSELCOUNT (MCM_FIRST + 4) -#define MCM_GETSELRANGE (MCM_FIRST + 5) -#define MCM_SETSELRANGE (MCM_FIRST + 6) -#define MCM_GETMONTHRANGE (MCM_FIRST + 7) -#define MCM_SETDAYSTATE (MCM_FIRST + 8) -#define MCM_GETMINREQRECT (MCM_FIRST + 9) -#define MCM_SETCOLOR (MCM_FIRST + 10) -#define MCM_GETCOLOR (MCM_FIRST + 11) -#define MCM_SETTODAY (MCM_FIRST + 12) -#define MCM_GETTODAY (MCM_FIRST + 13) -#define MCM_HITTEST (MCM_FIRST + 14) -#define MCM_SETFIRSTDAYOFWEEK (MCM_FIRST + 15) -#define MCM_GETFIRSTDAYOFWEEK (MCM_FIRST + 16) -#define MCM_GETRANGE (MCM_FIRST + 17) -#define MCM_SETRANGE (MCM_FIRST + 18) -#define MCM_GETMONTHDELTA (MCM_FIRST + 19) -#define MCM_SETMONTHDELTA (MCM_FIRST + 20) -#define MCM_GETMAXTODAYWIDTH (MCM_FIRST + 21) -#define MCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT -#define MCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define TCS_SCROLLOPPOSITE 0x1 +#define TCS_BOTTOM 0x2 +#define TCS_RIGHT 0x2 +#define TCS_MULTISELECT 0x4 +#define TCS_FLATBUTTONS 0x8 +#define TCS_FORCEICONLEFT 0x10 +#define TCS_FORCELABELLEFT 0x20 +#define TCS_HOTTRACK 0x40 +#define TCS_VERTICAL 0x80 +#define TCS_TABS 0x0 +#define TCS_BUTTONS 0x100 +#define TCS_SINGLELINE 0x0 +#define TCS_MULTILINE 0x200 +#define TCS_RIGHTJUSTIFY 0x0 +#define TCS_FIXEDWIDTH 0x400 +#define TCS_RAGGEDRIGHT 0x800 +#define TCS_FOCUSONBUTTONDOWN 0x1000 +#define TCS_OWNERDRAWFIXED 0x2000 +#define TCS_TOOLTIPS 0x4000 +#define TCS_FOCUSNEVER 0x8000 +#define TCS_EX_FLATSEPARATORS 0x1 +#define TCS_EX_REGISTERDROP 0x2 -/* Notifications */ +#define TCM_GETIMAGELIST (TCM_FIRST+2) +#define TabCtrl_GetImageList(hwnd) (HIMAGELIST)SNDMSG((hwnd),TCM_GETIMAGELIST,0,0L) -#define MCN_SELCHANGE (MCN_FIRST + 1) -#define MCN_GETDAYSTATE (MCN_FIRST + 3) -#define MCN_SELECT (MCN_FIRST + 4) +#define TCM_SETIMAGELIST (TCM_FIRST+3) +#define TabCtrl_SetImageList(hwnd,himl) (HIMAGELIST)SNDMSG((hwnd),TCM_SETIMAGELIST,0,(LPARAM)(HIMAGELIST)(himl)) -#define MCSC_BACKGROUND 0 -#define MCSC_TEXT 1 -#define MCSC_TITLEBK 2 -#define MCSC_TITLETEXT 3 -#define MCSC_MONTHBK 4 +#define TCM_GETITEMCOUNT (TCM_FIRST+4) +#define TabCtrl_GetItemCount(hwnd) (int)SNDMSG((hwnd),TCM_GETITEMCOUNT,0,0L) + +#define TCIF_TEXT 0x1 +#define TCIF_IMAGE 0x2 +#define TCIF_RTLREADING 0x4 +#define TCIF_PARAM 0x8 +#define TCIF_STATE 0x10 + +#define TCIS_BUTTONPRESSED 0x1 +#define TCIS_HIGHLIGHTED 0x2 + +#define TC_ITEMHEADERA TCITEMHEADERA +#define TC_ITEMHEADERW TCITEMHEADERW +#define TC_ITEMHEADER TCITEMHEADER + + typedef struct tagTCITEMHEADERA { + UINT mask; + UINT lpReserved1; + UINT lpReserved2; + LPSTR pszText; + int cchTextMax; + int iImage; + } TCITEMHEADERA,*LPTCITEMHEADERA; + + typedef struct tagTCITEMHEADERW { + UINT mask; + UINT lpReserved1; + UINT lpReserved2; + LPWSTR pszText; + int cchTextMax; + int iImage; + } TCITEMHEADERW,*LPTCITEMHEADERW; + +#ifdef UNICODE +#define TCITEMHEADER TCITEMHEADERW +#define LPTCITEMHEADER LPTCITEMHEADERW +#else +#define TCITEMHEADER TCITEMHEADERA +#define LPTCITEMHEADER LPTCITEMHEADERA +#endif + +#define TC_ITEMA TCITEMA +#define TC_ITEMW TCITEMW +#define TC_ITEM TCITEM + + typedef struct tagTCITEMA { + UINT mask; + DWORD dwState; + DWORD dwStateMask; + LPSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; + } TCITEMA,*LPTCITEMA; + + typedef struct tagTCITEMW { + UINT mask; + DWORD dwState; + DWORD dwStateMask; + LPWSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; + } TCITEMW,*LPTCITEMW; + +#ifdef UNICODE +#define TCITEM TCITEMW +#define LPTCITEM LPTCITEMW +#else +#define TCITEM TCITEMA +#define LPTCITEM LPTCITEMA +#endif + +#define TCM_GETITEMA (TCM_FIRST+5) +#define TCM_GETITEMW (TCM_FIRST+60) + +#ifdef UNICODE +#define TCM_GETITEM TCM_GETITEMW +#else +#define TCM_GETITEM TCM_GETITEMA +#endif + +#define TabCtrl_GetItem(hwnd,iItem,pitem) (WINBOOL)SNDMSG((hwnd),TCM_GETITEM,(WPARAM)(int)(iItem),(LPARAM)(TC_ITEM *)(pitem)) + +#define TCM_SETITEMA (TCM_FIRST+6) +#define TCM_SETITEMW (TCM_FIRST+61) + +#ifdef UNICODE +#define TCM_SETITEM TCM_SETITEMW +#else +#define TCM_SETITEM TCM_SETITEMA +#endif + +#define TabCtrl_SetItem(hwnd,iItem,pitem) (WINBOOL)SNDMSG((hwnd),TCM_SETITEM,(WPARAM)(int)(iItem),(LPARAM)(TC_ITEM *)(pitem)) + +#define TCM_INSERTITEMA (TCM_FIRST+7) +#define TCM_INSERTITEMW (TCM_FIRST+62) + +#ifdef UNICODE +#define TCM_INSERTITEM TCM_INSERTITEMW +#else +#define TCM_INSERTITEM TCM_INSERTITEMA +#endif + +#define TabCtrl_InsertItem(hwnd,iItem,pitem) (int)SNDMSG((hwnd),TCM_INSERTITEM,(WPARAM)(int)(iItem),(LPARAM)(const TC_ITEM *)(pitem)) + +#define TCM_DELETEITEM (TCM_FIRST+8) +#define TabCtrl_DeleteItem(hwnd,i) (WINBOOL)SNDMSG((hwnd),TCM_DELETEITEM,(WPARAM)(int)(i),0L) + +#define TCM_DELETEALLITEMS (TCM_FIRST+9) +#define TabCtrl_DeleteAllItems(hwnd) (WINBOOL)SNDMSG((hwnd),TCM_DELETEALLITEMS,0,0L) + +#define TCM_GETITEMRECT (TCM_FIRST+10) +#define TabCtrl_GetItemRect(hwnd,i,prc) (WINBOOL)SNDMSG((hwnd),TCM_GETITEMRECT,(WPARAM)(int)(i),(LPARAM)(RECT *)(prc)) + +#define TCM_GETCURSEL (TCM_FIRST+11) +#define TabCtrl_GetCurSel(hwnd) (int)SNDMSG((hwnd),TCM_GETCURSEL,0,0) + +#define TCM_SETCURSEL (TCM_FIRST+12) +#define TabCtrl_SetCurSel(hwnd,i) (int)SNDMSG((hwnd),TCM_SETCURSEL,(WPARAM)(i),0) + +#define TCHT_NOWHERE 0x1 +#define TCHT_ONITEMICON 0x2 +#define TCHT_ONITEMLABEL 0x4 +#define TCHT_ONITEM (TCHT_ONITEMICON | TCHT_ONITEMLABEL) + +#define LPTC_HITTESTINFO LPTCHITTESTINFO +#define TC_HITTESTINFO TCHITTESTINFO + + typedef struct tagTCHITTESTINFO { + POINT pt; + UINT flags; + } TCHITTESTINFO,*LPTCHITTESTINFO; + +#define TCM_HITTEST (TCM_FIRST+13) +#define TabCtrl_HitTest(hwndTC,pinfo) (int)SNDMSG((hwndTC),TCM_HITTEST,0,(LPARAM)(TC_HITTESTINFO *)(pinfo)) +#define TCM_SETITEMEXTRA (TCM_FIRST+14) +#define TabCtrl_SetItemExtra(hwndTC,cb) (WINBOOL)SNDMSG((hwndTC),TCM_SETITEMEXTRA,(WPARAM)(cb),0L) +#define TCM_ADJUSTRECT (TCM_FIRST+40) +#define TabCtrl_AdjustRect(hwnd,bLarger,prc) (int)SNDMSG(hwnd,TCM_ADJUSTRECT,(WPARAM)(WINBOOL)(bLarger),(LPARAM)(RECT *)prc) +#define TCM_SETITEMSIZE (TCM_FIRST+41) +#define TabCtrl_SetItemSize(hwnd,x,y) (DWORD)SNDMSG((hwnd),TCM_SETITEMSIZE,0,MAKELPARAM(x,y)) +#define TCM_REMOVEIMAGE (TCM_FIRST+42) +#define TabCtrl_RemoveImage(hwnd,i) (void)SNDMSG((hwnd),TCM_REMOVEIMAGE,i,0L) +#define TCM_SETPADDING (TCM_FIRST+43) +#define TabCtrl_SetPadding(hwnd,cx,cy) (void)SNDMSG((hwnd),TCM_SETPADDING,0,MAKELPARAM(cx,cy)) +#define TCM_GETROWCOUNT (TCM_FIRST+44) +#define TabCtrl_GetRowCount(hwnd) (int)SNDMSG((hwnd),TCM_GETROWCOUNT,0,0L) +#define TCM_GETTOOLTIPS (TCM_FIRST+45) +#define TabCtrl_GetToolTips(hwnd) (HWND)SNDMSG((hwnd),TCM_GETTOOLTIPS,0,0L) +#define TCM_SETTOOLTIPS (TCM_FIRST+46) +#define TabCtrl_SetToolTips(hwnd,hwndTT) (void)SNDMSG((hwnd),TCM_SETTOOLTIPS,(WPARAM)(hwndTT),0L) +#define TCM_GETCURFOCUS (TCM_FIRST+47) +#define TabCtrl_GetCurFocus(hwnd) (int)SNDMSG((hwnd),TCM_GETCURFOCUS,0,0) +#define TCM_SETCURFOCUS (TCM_FIRST+48) +#define TabCtrl_SetCurFocus(hwnd,i) SNDMSG((hwnd),TCM_SETCURFOCUS,i,0) +#define TCM_SETMINTABWIDTH (TCM_FIRST+49) +#define TabCtrl_SetMinTabWidth(hwnd,x) (int)SNDMSG((hwnd),TCM_SETMINTABWIDTH,0,x) +#define TCM_DESELECTALL (TCM_FIRST+50) +#define TabCtrl_DeselectAll(hwnd,fExcludeFocus) (void)SNDMSG((hwnd),TCM_DESELECTALL,fExcludeFocus,0) +#define TCM_HIGHLIGHTITEM (TCM_FIRST+51) +#define TabCtrl_HighlightItem(hwnd,i,fHighlight) (WINBOOL)SNDMSG((hwnd),TCM_HIGHLIGHTITEM,(WPARAM)(i),(LPARAM)MAKELONG (fHighlight,0)) +#define TCM_SETEXTENDEDSTYLE (TCM_FIRST+52) +#define TabCtrl_SetExtendedStyle(hwnd,dw) (DWORD)SNDMSG((hwnd),TCM_SETEXTENDEDSTYLE,0,dw) +#define TCM_GETEXTENDEDSTYLE (TCM_FIRST+53) +#define TabCtrl_GetExtendedStyle(hwnd) (DWORD)SNDMSG((hwnd),TCM_GETEXTENDEDSTYLE,0,0) +#define TCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define TabCtrl_SetUnicodeFormat(hwnd,fUnicode) (WINBOOL)SNDMSG((hwnd),TCM_SETUNICODEFORMAT,(WPARAM)(fUnicode),0) +#define TCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define TabCtrl_GetUnicodeFormat(hwnd) (WINBOOL)SNDMSG((hwnd),TCM_GETUNICODEFORMAT,0,0) + +#define TCN_KEYDOWN (TCN_FIRST - 0) + +#define TC_KEYDOWN NMTCKEYDOWN + +#include + + typedef struct tagTCKEYDOWN { + NMHDR hdr; + WORD wVKey; + UINT flags; + } NMTCKEYDOWN; + +#include + +#define TCN_SELCHANGE (TCN_FIRST - 1) +#define TCN_SELCHANGING (TCN_FIRST - 2) +#define TCN_GETOBJECT (TCN_FIRST - 3) +#define TCN_FOCUSCHANGE (TCN_FIRST - 4) +#endif + +#ifndef NOANIMATE + +#define ANIMATE_CLASSW L"SysAnimate32" +#define ANIMATE_CLASSA "SysAnimate32" +#ifdef UNICODE +#define ANIMATE_CLASS ANIMATE_CLASSW +#else +#define ANIMATE_CLASS ANIMATE_CLASSA +#endif + +#define ACS_CENTER 0x1 +#define ACS_TRANSPARENT 0x2 +#define ACS_AUTOPLAY 0x4 +#define ACS_TIMER 0x8 + +#define ACM_OPENA (WM_USER+100) +#define ACM_OPENW (WM_USER+103) +#ifdef UNICODE +#define ACM_OPEN ACM_OPENW +#else +#define ACM_OPEN ACM_OPENA +#endif + +#define ACM_PLAY (WM_USER+101) +#define ACM_STOP (WM_USER+102) + +#define ACN_START 1 +#define ACN_STOP 2 + +#define Animate_Create(hwndP,id,dwStyle,hInstance) CreateWindow(ANIMATE_CLASS,NULL,dwStyle,0,0,0,0,hwndP,(HMENU)(id),hInstance,NULL) + +#define Animate_Open(hwnd,szName) (WINBOOL)SNDMSG(hwnd,ACM_OPEN,0,(LPARAM)(LPTSTR)(szName)) +#define Animate_OpenEx(hwnd,hInst,szName) (WINBOOL)SNDMSG(hwnd,ACM_OPEN,(WPARAM)(hInst),(LPARAM)(LPTSTR)(szName)) +#define Animate_Play(hwnd,from,to,rep) (WINBOOL)SNDMSG(hwnd,ACM_PLAY,(WPARAM)(rep),(LPARAM)MAKELONG(from,to)) +#define Animate_Stop(hwnd) (WINBOOL)SNDMSG(hwnd,ACM_STOP,0,0) +#define Animate_Close(hwnd) Animate_Open(hwnd,NULL) +#define Animate_Seek(hwnd,frame) Animate_Play(hwnd,frame,frame,1) +#endif + +#ifndef NOMONTHCAL +#define MONTHCAL_CLASSW L"SysMonthCal32" +#define MONTHCAL_CLASSA "SysMonthCal32" +#ifdef UNICODE +#define MONTHCAL_CLASS MONTHCAL_CLASSW +#else +#define MONTHCAL_CLASS MONTHCAL_CLASSA +#endif + + typedef DWORD MONTHDAYSTATE,*LPMONTHDAYSTATE; + +#define MCM_FIRST 0x1000 + +#define MCM_GETCURSEL (MCM_FIRST+1) +#define MonthCal_GetCurSel(hmc,pst) (WINBOOL)SNDMSG(hmc,MCM_GETCURSEL,0,(LPARAM)(pst)) +#define MCM_SETCURSEL (MCM_FIRST+2) +#define MonthCal_SetCurSel(hmc,pst) (WINBOOL)SNDMSG(hmc,MCM_SETCURSEL,0,(LPARAM)(pst)) +#define MCM_GETMAXSELCOUNT (MCM_FIRST+3) +#define MonthCal_GetMaxSelCount(hmc) (DWORD)SNDMSG(hmc,MCM_GETMAXSELCOUNT,0,0L) +#define MCM_SETMAXSELCOUNT (MCM_FIRST+4) +#define MonthCal_SetMaxSelCount(hmc,n) (WINBOOL)SNDMSG(hmc,MCM_SETMAXSELCOUNT,(WPARAM)(n),0L) +#define MCM_GETSELRANGE (MCM_FIRST+5) +#define MonthCal_GetSelRange(hmc,rgst) SNDMSG(hmc,MCM_GETSELRANGE,0,(LPARAM)(rgst)) +#define MCM_SETSELRANGE (MCM_FIRST+6) +#define MonthCal_SetSelRange(hmc,rgst) SNDMSG(hmc,MCM_SETSELRANGE,0,(LPARAM)(rgst)) +#define MCM_GETMONTHRANGE (MCM_FIRST+7) +#define MonthCal_GetMonthRange(hmc,gmr,rgst) (DWORD)SNDMSG(hmc,MCM_GETMONTHRANGE,(WPARAM)(gmr),(LPARAM)(rgst)) +#define MCM_SETDAYSTATE (MCM_FIRST+8) +#define MonthCal_SetDayState(hmc,cbds,rgds) SNDMSG(hmc,MCM_SETDAYSTATE,(WPARAM)(cbds),(LPARAM)(rgds)) +#define MCM_GETMINREQRECT (MCM_FIRST+9) +#define MonthCal_GetMinReqRect(hmc,prc) SNDMSG(hmc,MCM_GETMINREQRECT,0,(LPARAM)(prc)) +#define MCM_SETCOLOR (MCM_FIRST+10) +#define MonthCal_SetColor(hmc,iColor,clr) SNDMSG(hmc,MCM_SETCOLOR,iColor,clr) +#define MCM_GETCOLOR (MCM_FIRST+11) +#define MonthCal_GetColor(hmc,iColor) SNDMSG(hmc,MCM_GETCOLOR,iColor,0) + +#define MCSC_BACKGROUND 0 +#define MCSC_TEXT 1 +#define MCSC_TITLEBK 2 +#define MCSC_TITLETEXT 3 +#define MCSC_MONTHBK 4 #define MCSC_TRAILINGTEXT 5 -#define MCS_DAYSTATE 0x0001 -#define MCS_MULTISELECT 0x0002 -#define MCS_WEEKNUMBERS 0x0004 -#define MCS_NOTODAY 0x0010 -#define MCS_NOTODAYCIRCLE 0x0008 -#define MCS_NOTRAILINGDATES 0x0040 +#define MCM_SETTODAY (MCM_FIRST+12) +#define MonthCal_SetToday(hmc,pst) SNDMSG(hmc,MCM_SETTODAY,0,(LPARAM)(pst)) +#define MCM_GETTODAY (MCM_FIRST+13) +#define MonthCal_GetToday(hmc,pst) (WINBOOL)SNDMSG(hmc,MCM_GETTODAY,0,(LPARAM)(pst)) +#define MCM_HITTEST (MCM_FIRST+14) +#define MonthCal_HitTest(hmc,pinfo) SNDMSG(hmc,MCM_HITTEST,0,(LPARAM)(PMCHITTESTINFO)(pinfo)) -#define MCHT_TITLE 0x00010000 -#define MCHT_CALENDAR 0x00020000 -#define MCHT_TODAYLINK 0x00030000 + typedef struct { + UINT cbSize; + POINT pt; -#define MCHT_NEXT 0x01000000 -#define MCHT_PREV 0x02000000 -#define MCHT_NOWHERE 0x00000000 -#define MCHT_TITLEBK (MCHT_TITLE) -#define MCHT_TITLEMONTH (MCHT_TITLE | 0x0001) -#define MCHT_TITLEYEAR (MCHT_TITLE | 0x0002) -#define MCHT_TITLEBTNNEXT (MCHT_TITLE | MCHT_NEXT | 0x0003) -#define MCHT_TITLEBTNPREV (MCHT_TITLE | MCHT_PREV | 0x0003) - -#define MCHT_CALENDARBK (MCHT_CALENDAR) -#define MCHT_CALENDARDATE (MCHT_CALENDAR | 0x0001) -#define MCHT_CALENDARDATENEXT (MCHT_CALENDARDATE | MCHT_NEXT) -#define MCHT_CALENDARDATEPREV (MCHT_CALENDARDATE | MCHT_PREV) -#define MCHT_CALENDARDAY (MCHT_CALENDAR | 0x0002) -#define MCHT_CALENDARWEEKNUM (MCHT_CALENDAR | 0x0003) - - - -#define GMR_VISIBLE 0 -#define GMR_DAYSTATE 1 - - -/* Month calendar's structures */ - - -typedef struct { - UINT cbSize; - POINT pt; - UINT uHit; - SYSTEMTIME st; - /* Vista */ - RECT rc; - INT iOffset; - INT iRow; - INT iCol; -} MCHITTESTINFO, *PMCHITTESTINFO; - -#define MCHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(MCHITTESTINFO, st) - -typedef struct tagNMSELCHANGE -{ - NMHDR nmhdr; - SYSTEMTIME stSelStart; - SYSTEMTIME stSelEnd; -} NMSELCHANGE, *LPNMSELCHANGE; - -typedef NMSELCHANGE NMSELECT, *LPNMSELECT; -typedef DWORD MONTHDAYSTATE, *LPMONTHDAYSTATE; - -typedef struct tagNMDAYSTATE -{ - NMHDR nmhdr; - SYSTEMTIME stStart; - int cDayState; - LPMONTHDAYSTATE prgDayState; -} NMDAYSTATE, *LPNMDAYSTATE; - - -/* macros */ - -#define MonthCal_GetCurSel(hmc, pst) \ - (BOOL)SNDMSG(hmc, MCM_GETCURSEL, 0, (LPARAM)(pst)) -#define MonthCal_SetCurSel(hmc, pst) \ - (BOOL)SNDMSG(hmc, MCM_SETCURSEL, 0, (LPARAM)(pst)) -#define MonthCal_GetMaxSelCount(hmc) \ - (DWORD)SNDMSG(hmc, MCM_GETMAXSELCOUNT, 0, 0L) -#define MonthCal_SetMaxSelCount(hmc, n) \ - (BOOL)SNDMSG(hmc, MCM_SETMAXSELCOUNT, (WPARAM)(n), 0L) -#define MonthCal_GetSelRange(hmc, rgst) \ - SNDMSG(hmc, MCM_GETSELRANGE, 0, (LPARAM) (rgst)) -#define MonthCal_SetSelRange(hmc, rgst) \ - SNDMSG(hmc, MCM_SETSELRANGE, 0, (LPARAM) (rgst)) -#define MonthCal_GetMonthRange(hmc, gmr, rgst) \ - (DWORD)SNDMSG(hmc, MCM_GETMONTHRANGE, (WPARAM)(gmr), (LPARAM)(rgst)) -#define MonthCal_SetDayState(hmc, cbds, rgds) \ - SNDMSG(hmc, MCM_SETDAYSTATE, (WPARAM)(cbds), (LPARAM)(rgds)) -#define MonthCal_GetMinReqRect(hmc, prc) \ - SNDMSG(hmc, MCM_GETMINREQRECT, 0, (LPARAM)(prc)) -#define MonthCal_SetColor(hmc, iColor, clr)\ - SNDMSG(hmc, MCM_SETCOLOR, iColor, clr) -#define MonthCal_GetColor(hmc, iColor) \ - SNDMSG(hmc, MCM_SETCOLOR, iColor, 0) -#define MonthCal_GetToday(hmc, pst)\ - (BOOL)SNDMSG(hmc, MCM_GETTODAY, 0, (LPARAM)pst) -#define MonthCal_SetToday(hmc, pst)\ - SNDMSG(hmc, MCM_SETTODAY, 0, (LPARAM)pst) -#define MonthCal_HitTest(hmc, pinfo) \ - SNDMSG(hmc, MCM_HITTEST, 0, (LPARAM)(PMCHITTESTINFO)pinfo) -#define MonthCal_SetFirstDayOfWeek(hmc, iDay) \ - SNDMSG(hmc, MCM_SETFIRSTDAYOFWEEK, 0, iDay) -#define MonthCal_GetFirstDayOfWeek(hmc) \ - (DWORD)SNDMSG(hmc, MCM_GETFIRSTDAYOFWEEK, 0, 0) -#define MonthCal_GetRange(hmc, rgst) \ - (DWORD)SNDMSG(hmc, MCM_GETRANGE, 0, (LPARAM)(rgst)) -#define MonthCal_SetRange(hmc, gd, rgst) \ - (BOOL)SNDMSG(hmc, MCM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst)) -#define MonthCal_GetMonthDelta(hmc) \ - (int)SNDMSG(hmc, MCM_GETMONTHDELTA, 0, 0) -#define MonthCal_SetMonthDelta(hmc, n) \ - (int)SNDMSG(hmc, MCM_SETMONTHDELTA, n, 0) -#define MonthCal_GetMaxTodayWidth(hmc) \ - (DWORD)SNDMSG(hmc, MCM_GETMAXTODAYWIDTH, 0, 0) -#define MonthCal_SetUnicodeFormat(hwnd, fUnicode) \ - (BOOL)SNDMSG((hwnd), MCM_SETUNICODEFORMAT, (WPARAM)(fUnicode), 0) -#define MonthCal_GetUnicodeFormat(hwnd) \ - (BOOL)SNDMSG((hwnd), MCM_GETUNICODEFORMAT, 0, 0) - - -/************************************************************************** - * Date and time picker control - */ - -#define DATETIMEPICK_CLASSA "SysDateTimePick32" -#if defined(__GNUC__) -# define DATETIMEPICK_CLASSW (const WCHAR []){ 'S','y','s', \ - 'D','a','t','e','T','i','m','e','P','i','c','k','3','2',0 } -#elif defined(_MSC_VER) -# define DATETIMEPICK_CLASSW L"SysDateTimePick32" -#else -static const WCHAR DATETIMEPICK_CLASSW[] = { 'S','y','s', - 'D','a','t','e','T','i','m','e','P','i','c','k','3','2',0 }; -#endif -#define DATETIMEPICK_CLASS WINELIB_NAME_AW(DATETIMEPICK_CLASS) - -#define DTM_FIRST 0x1000 -#define DTN_FIRST (0U-760U) -#define DTN_LAST (0U-799U) - - -#define DTM_GETSYSTEMTIME (DTM_FIRST+1) -#define DTM_SETSYSTEMTIME (DTM_FIRST+2) -#define DTM_GETRANGE (DTM_FIRST+3) -#define DTM_SETRANGE (DTM_FIRST+4) -#define DTM_SETFORMATA (DTM_FIRST+5) -#define DTM_SETFORMATW (DTM_FIRST + 50) -#define DTM_SETFORMAT WINELIB_NAME_AW(DTM_SETFORMAT) -#define DTM_SETMCCOLOR (DTM_FIRST+6) -#define DTM_GETMCCOLOR (DTM_FIRST+7) -#define DTM_GETMONTHCAL (DTM_FIRST+8) -#define DTM_SETMCFONT (DTM_FIRST+9) -#define DTM_GETMCFONT (DTM_FIRST+10) - - -/* Datetime Notifications */ - -#define DTN_DATETIMECHANGE (DTN_FIRST + 1) -#define DTN_USERSTRINGA (DTN_FIRST + 2) -#define DTN_WMKEYDOWNA (DTN_FIRST + 3) -#define DTN_FORMATA (DTN_FIRST + 4) -#define DTN_FORMATQUERYA (DTN_FIRST + 5) -#define DTN_DROPDOWN (DTN_FIRST + 6) -#define DTN_CLOSEUP (DTN_FIRST + 7) -#define DTN_USERSTRINGW (DTN_FIRST + 15) -#define DTN_WMKEYDOWNW (DTN_FIRST + 16) -#define DTN_FORMATW (DTN_FIRST + 17) -#define DTN_FORMATQUERYW (DTN_FIRST + 18) - -#define DTN_USERSTRING WINELIB_NAME_AW(DTN_USERSTRING) -#define DTN_WMKEYDOWN WINELIB_NAME_AW(DTN_WMKEYDOWN) -#define DTN_FORMAT WINELIB_NAME_AW(DTN_FORMAT) -#define DTN_FORMATQUERY WINELIB_NAME_AW(DTN_FORMATQUERY) - -#define DTS_SHORTDATEFORMAT 0x0000 -#define DTS_UPDOWN 0x0001 -#define DTS_SHOWNONE 0x0002 -#define DTS_LONGDATEFORMAT 0x0004 -#define DTS_TIMEFORMAT 0x0009 -#define DTS_APPCANPARSE 0x0010 -#define DTS_RIGHTALIGN 0x0020 - -typedef struct tagNMDATETIMECHANGE -{ - NMHDR nmhdr; - DWORD dwFlags; - SYSTEMTIME st; -} NMDATETIMECHANGE, *LPNMDATETIMECHANGE; - -typedef struct tagNMDATETIMESTRINGA -{ - NMHDR nmhdr; - LPCSTR pszUserString; + UINT uHit; SYSTEMTIME st; - DWORD dwFlags; -} NMDATETIMESTRINGA, *LPNMDATETIMESTRINGA; + } MCHITTESTINFO,*PMCHITTESTINFO; -typedef struct tagNMDATETIMESTRINGW -{ - NMHDR nmhdr; - LPCWSTR pszUserString; - SYSTEMTIME st; - DWORD dwFlags; -} NMDATETIMESTRINGW, *LPNMDATETIMESTRINGW; +#define MCHT_TITLE 0x10000 +#define MCHT_CALENDAR 0x20000 +#define MCHT_TODAYLINK 0x30000 -DECL_WINELIB_TYPE_AW(NMDATETIMESTRING) -DECL_WINELIB_TYPE_AW(LPNMDATETIMESTRING) +#define MCHT_NEXT 0x1000000 +#define MCHT_PREV 0x2000000 -typedef struct tagNMDATETIMEWMKEYDOWNA -{ - NMHDR nmhdr; - int nVirtKey; - LPCSTR pszFormat; - SYSTEMTIME st; -} NMDATETIMEWMKEYDOWNA, *LPNMDATETIMEWMKEYDOWNA; +#define MCHT_NOWHERE 0x0 -typedef struct tagNMDATETIMEWMKEYDOWNW -{ - NMHDR nmhdr; - int nVirtKey; - LPCWSTR pszFormat; - SYSTEMTIME st; -} NMDATETIMEWMKEYDOWNW, *LPNMDATETIMEWMKEYDOWNW; +#define MCHT_TITLEBK (MCHT_TITLE) +#define MCHT_TITLEMONTH (MCHT_TITLE | 0x1) +#define MCHT_TITLEYEAR (MCHT_TITLE | 0x2) +#define MCHT_TITLEBTNNEXT (MCHT_TITLE | MCHT_NEXT | 0x3) +#define MCHT_TITLEBTNPREV (MCHT_TITLE | MCHT_PREV | 0x3) -DECL_WINELIB_TYPE_AW(NMDATETIMEWMKEYDOWN) -DECL_WINELIB_TYPE_AW(LPNMDATETIMEWMKEYDOWN) +#define MCHT_CALENDARBK (MCHT_CALENDAR) +#define MCHT_CALENDARDATE (MCHT_CALENDAR | 0x1) +#define MCHT_CALENDARDATENEXT (MCHT_CALENDARDATE | MCHT_NEXT) +#define MCHT_CALENDARDATEPREV (MCHT_CALENDARDATE | MCHT_PREV) +#define MCHT_CALENDARDAY (MCHT_CALENDAR | 0x2) +#define MCHT_CALENDARWEEKNUM (MCHT_CALENDAR | 0x3) -typedef struct tagNMDATETIMEFORMATA -{ +#define MCM_SETFIRSTDAYOFWEEK (MCM_FIRST+15) +#define MonthCal_SetFirstDayOfWeek(hmc,iDay) SNDMSG(hmc,MCM_SETFIRSTDAYOFWEEK,0,iDay) +#define MCM_GETFIRSTDAYOFWEEK (MCM_FIRST+16) +#define MonthCal_GetFirstDayOfWeek(hmc) (DWORD)SNDMSG(hmc,MCM_GETFIRSTDAYOFWEEK,0,0) +#define MCM_GETRANGE (MCM_FIRST+17) +#define MonthCal_GetRange(hmc,rgst) (DWORD)SNDMSG(hmc,MCM_GETRANGE,0,(LPARAM)(rgst)) +#define MCM_SETRANGE (MCM_FIRST+18) +#define MonthCal_SetRange(hmc,gd,rgst) (WINBOOL)SNDMSG(hmc,MCM_SETRANGE,(WPARAM)(gd),(LPARAM)(rgst)) +#define MCM_GETMONTHDELTA (MCM_FIRST+19) +#define MonthCal_GetMonthDelta(hmc) (int)SNDMSG(hmc,MCM_GETMONTHDELTA,0,0) +#define MCM_SETMONTHDELTA (MCM_FIRST+20) +#define MonthCal_SetMonthDelta(hmc,n) (int)SNDMSG(hmc,MCM_SETMONTHDELTA,n,0) +#define MCM_GETMAXTODAYWIDTH (MCM_FIRST+21) +#define MonthCal_GetMaxTodayWidth(hmc) (DWORD)SNDMSG(hmc,MCM_GETMAXTODAYWIDTH,0,0) +#define MCM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define MonthCal_SetUnicodeFormat(hwnd,fUnicode) (WINBOOL)SNDMSG((hwnd),MCM_SETUNICODEFORMAT,(WPARAM)(fUnicode),0) +#define MCM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define MonthCal_GetUnicodeFormat(hwnd) (WINBOOL)SNDMSG((hwnd),MCM_GETUNICODEFORMAT,0,0) + + typedef struct tagNMSELCHANGE { NMHDR nmhdr; - LPCSTR pszFormat; + SYSTEMTIME stSelStart; + SYSTEMTIME stSelEnd; + } NMSELCHANGE,*LPNMSELCHANGE; + +#define MCN_SELCHANGE (MCN_FIRST+1) + + typedef struct tagNMDAYSTATE { + NMHDR nmhdr; + SYSTEMTIME stStart; + int cDayState; + + LPMONTHDAYSTATE prgDayState; + } NMDAYSTATE,*LPNMDAYSTATE; + +#define MCN_GETDAYSTATE (MCN_FIRST+3) + + typedef NMSELCHANGE NMSELECT,*LPNMSELECT; + +#define MCN_SELECT (MCN_FIRST+4) + +#define MCS_DAYSTATE 0x1 +#define MCS_MULTISELECT 0x2 +#define MCS_WEEKNUMBERS 0x4 +#define MCS_NOTODAYCIRCLE 0x8 +#define MCS_NOTODAY 0x10 + +#define GMR_VISIBLE 0 +#define GMR_DAYSTATE 1 +#endif + +#ifndef NODATETIMEPICK +#define DATETIMEPICK_CLASSW L"SysDateTimePick32" +#define DATETIMEPICK_CLASSA "SysDateTimePick32" +#ifdef UNICODE +#define DATETIMEPICK_CLASS DATETIMEPICK_CLASSW +#else +#define DATETIMEPICK_CLASS DATETIMEPICK_CLASSA +#endif +#define DTM_FIRST 0x1000 + +#define DTM_GETSYSTEMTIME (DTM_FIRST+1) +#define DateTime_GetSystemtime(hdp,pst) (DWORD)SNDMSG(hdp,DTM_GETSYSTEMTIME,0,(LPARAM)(pst)) +#define DTM_SETSYSTEMTIME (DTM_FIRST+2) +#define DateTime_SetSystemtime(hdp,gd,pst) (WINBOOL)SNDMSG(hdp,DTM_SETSYSTEMTIME,(WPARAM)(gd),(LPARAM)(pst)) +#define DTM_GETRANGE (DTM_FIRST+3) +#define DateTime_GetRange(hdp,rgst) (DWORD)SNDMSG(hdp,DTM_GETRANGE,0,(LPARAM)(rgst)) +#define DTM_SETRANGE (DTM_FIRST+4) +#define DateTime_SetRange(hdp,gd,rgst) (WINBOOL)SNDMSG(hdp,DTM_SETRANGE,(WPARAM)(gd),(LPARAM)(rgst)) +#define DTM_SETFORMATA (DTM_FIRST+5) +#define DTM_SETFORMATW (DTM_FIRST+50) + +#ifdef UNICODE +#define DTM_SETFORMAT DTM_SETFORMATW +#else +#define DTM_SETFORMAT DTM_SETFORMATA +#endif + +#define DateTime_SetFormat(hdp,sz) (WINBOOL)SNDMSG(hdp,DTM_SETFORMAT,0,(LPARAM)(sz)) + +#define DTM_SETMCCOLOR (DTM_FIRST+6) +#define DateTime_SetMonthCalColor(hdp,iColor,clr) SNDMSG(hdp,DTM_SETMCCOLOR,iColor,clr) +#define DTM_GETMCCOLOR (DTM_FIRST+7) +#define DateTime_GetMonthCalColor(hdp,iColor) SNDMSG(hdp,DTM_GETMCCOLOR,iColor,0) +#define DTM_GETMONTHCAL (DTM_FIRST+8) +#define DateTime_GetMonthCal(hdp) (HWND)SNDMSG(hdp,DTM_GETMONTHCAL,0,0) +#define DTM_SETMCFONT (DTM_FIRST+9) +#define DateTime_SetMonthCalFont(hdp,hfont,fRedraw) SNDMSG(hdp,DTM_SETMCFONT,(WPARAM)(hfont),(LPARAM)(fRedraw)) +#define DTM_GETMCFONT (DTM_FIRST+10) +#define DateTime_GetMonthCalFont(hdp) SNDMSG(hdp,DTM_GETMCFONT,0,0) + +#define DTS_UPDOWN 0x1 +#define DTS_SHOWNONE 0x2 +#define DTS_SHORTDATEFORMAT 0x0 +#define DTS_LONGDATEFORMAT 0x4 +#define DTS_SHORTDATECENTURYFORMAT 0xc +#define DTS_TIMEFORMAT 0x9 +#define DTS_APPCANPARSE 0x10 +#define DTS_RIGHTALIGN 0x20 + +#define DTN_DATETIMECHANGE (DTN_FIRST+1) + typedef struct tagNMDATETIMECHANGE { + NMHDR nmhdr; + DWORD dwFlags; + SYSTEMTIME st; + } NMDATETIMECHANGE,*LPNMDATETIMECHANGE; + +#define DTN_USERSTRINGA (DTN_FIRST+2) +#define DTN_USERSTRINGW (DTN_FIRST+15) + typedef struct tagNMDATETIMESTRINGA { + NMHDR nmhdr; + LPCSTR pszUserString; + SYSTEMTIME st; + DWORD dwFlags; + } NMDATETIMESTRINGA,*LPNMDATETIMESTRINGA; + + typedef struct tagNMDATETIMESTRINGW { + NMHDR nmhdr; + LPCWSTR pszUserString; + SYSTEMTIME st; + DWORD dwFlags; + } NMDATETIMESTRINGW,*LPNMDATETIMESTRINGW; + +#ifdef UNICODE +#define DTN_USERSTRING DTN_USERSTRINGW +#define NMDATETIMESTRING NMDATETIMESTRINGW +#define LPNMDATETIMESTRING LPNMDATETIMESTRINGW +#else +#define DTN_USERSTRING DTN_USERSTRINGA +#define NMDATETIMESTRING NMDATETIMESTRINGA +#define LPNMDATETIMESTRING LPNMDATETIMESTRINGA +#endif + +#define DTN_WMKEYDOWNA (DTN_FIRST+3) +#define DTN_WMKEYDOWNW (DTN_FIRST+16) + typedef struct tagNMDATETIMEWMKEYDOWNA { + NMHDR nmhdr; + int nVirtKey; + LPCSTR pszFormat; + SYSTEMTIME st; + } NMDATETIMEWMKEYDOWNA,*LPNMDATETIMEWMKEYDOWNA; + + typedef struct tagNMDATETIMEWMKEYDOWNW { + NMHDR nmhdr; + int nVirtKey; + LPCWSTR pszFormat; + SYSTEMTIME st; + } NMDATETIMEWMKEYDOWNW,*LPNMDATETIMEWMKEYDOWNW; + +#ifdef UNICODE +#define DTN_WMKEYDOWN DTN_WMKEYDOWNW +#define NMDATETIMEWMKEYDOWN NMDATETIMEWMKEYDOWNW +#define LPNMDATETIMEWMKEYDOWN LPNMDATETIMEWMKEYDOWNW +#else +#define DTN_WMKEYDOWN DTN_WMKEYDOWNA +#define NMDATETIMEWMKEYDOWN NMDATETIMEWMKEYDOWNA +#define LPNMDATETIMEWMKEYDOWN LPNMDATETIMEWMKEYDOWNA +#endif + +#define DTN_FORMATA (DTN_FIRST+4) +#define DTN_FORMATW (DTN_FIRST+17) + typedef struct tagNMDATETIMEFORMATA { + NMHDR nmhdr; + LPCSTR pszFormat; SYSTEMTIME st; LPCSTR pszDisplay; CHAR szDisplay[64]; -} NMDATETIMEFORMATA, *LPNMDATETIMEFORMATA; + } NMDATETIMEFORMATA,*LPNMDATETIMEFORMATA; - -typedef struct tagNMDATETIMEFORMATW -{ + typedef struct tagNMDATETIMEFORMATW { NMHDR nmhdr; LPCWSTR pszFormat; SYSTEMTIME st; LPCWSTR pszDisplay; WCHAR szDisplay[64]; -} NMDATETIMEFORMATW, *LPNMDATETIMEFORMATW; + } NMDATETIMEFORMATW,*LPNMDATETIMEFORMATW; -DECL_WINELIB_TYPE_AW(NMDATETIMEFORMAT) -DECL_WINELIB_TYPE_AW(LPNMDATETIMEFORMAT) +#ifdef UNICODE +#define DTN_FORMAT DTN_FORMATW +#define NMDATETIMEFORMAT NMDATETIMEFORMATW +#define LPNMDATETIMEFORMAT LPNMDATETIMEFORMATW +#else +#define DTN_FORMAT DTN_FORMATA +#define NMDATETIMEFORMAT NMDATETIMEFORMATA +#define LPNMDATETIMEFORMAT LPNMDATETIMEFORMATA +#endif -typedef struct tagNMDATETIMEFORMATQUERYA -{ +#define DTN_FORMATQUERYA (DTN_FIRST+5) +#define DTN_FORMATQUERYW (DTN_FIRST+18) + typedef struct tagNMDATETIMEFORMATQUERYA { NMHDR nmhdr; LPCSTR pszFormat; SIZE szMax; -} NMDATETIMEFORMATQUERYA, *LPNMDATETIMEFORMATQUERYA; + } NMDATETIMEFORMATQUERYA,*LPNMDATETIMEFORMATQUERYA; -typedef struct tagNMDATETIMEFORMATQUERYW -{ + typedef struct tagNMDATETIMEFORMATQUERYW { NMHDR nmhdr; LPCWSTR pszFormat; SIZE szMax; -} NMDATETIMEFORMATQUERYW, *LPNMDATETIMEFORMATQUERYW; + } NMDATETIMEFORMATQUERYW,*LPNMDATETIMEFORMATQUERYW; -DECL_WINELIB_TYPE_AW(NMDATETIMEFORMATQUERY) -DECL_WINELIB_TYPE_AW(LPNMDATETIMEFORMATQUERY) +#ifdef UNICODE +#define DTN_FORMATQUERY DTN_FORMATQUERYW +#define NMDATETIMEFORMATQUERY NMDATETIMEFORMATQUERYW +#define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYW +#else +#define DTN_FORMATQUERY DTN_FORMATQUERYA +#define NMDATETIMEFORMATQUERY NMDATETIMEFORMATQUERYA +#define LPNMDATETIMEFORMATQUERY LPNMDATETIMEFORMATQUERYA +#endif +#define DTN_DROPDOWN (DTN_FIRST+6) +#define DTN_CLOSEUP (DTN_FIRST+7) +#define GDTR_MIN 0x1 +#define GDTR_MAX 0x2 -#define GDT_ERROR -1 -#define GDT_VALID 0 -#define GDT_NONE 1 +#define GDT_ERROR -1 +#define GDT_VALID 0 +#define GDT_NONE 1 -#define GDTR_MIN 0x0001 -#define GDTR_MAX 0x0002 +#ifndef NOIPADDRESS +#define IPM_CLEARADDRESS (WM_USER+100) +#define IPM_SETADDRESS (WM_USER+101) +#define IPM_GETADDRESS (WM_USER+102) +#define IPM_SETRANGE (WM_USER+103) +#define IPM_SETFOCUS (WM_USER+104) +#define IPM_ISBLANK (WM_USER+105) +#define WC_IPADDRESSW L"SysIPAddress32" +#define WC_IPADDRESSA "SysIPAddress32" -#define DateTime_GetSystemtime(hdp, pst) \ - (DWORD)SNDMSG (hdp, DTM_GETSYSTEMTIME , 0, (LPARAM)(pst)) -#define DateTime_SetSystemtime(hdp, gd, pst) \ - (BOOL)SNDMSG (hdp, DTM_SETSYSTEMTIME, (LPARAM)(gd), (LPARAM)(pst)) -#define DateTime_GetRange(hdp, rgst) \ - (DWORD)SNDMSG (hdp, DTM_GETRANGE, 0, (LPARAM)(rgst)) -#define DateTime_SetRange(hdp, gd, rgst) \ - (BOOL)SNDMSG (hdp, DTM_SETRANGE, (WPARAM)(gd), (LPARAM)(rgst)) -#define DateTime_SetFormatA(hdp, sz) \ - (BOOL)SNDMSGA (hdp, DTM_SETFORMATA, 0, (LPARAM)(sz)) -#define DateTime_SetFormatW(hdp, sz) \ - (BOOL)SNDMSGW (hdp, DTM_SETFORMATW, 0, (LPARAM)(sz)) -#define DateTime_SetFormat WINELIB_NAME_AW(DateTime_SetFormat) -#define DateTime_GetMonthCalColor(hdp, iColor) \ - SNDMSG (hdp, DTM_GETMCCOLOR, iColor, 0) -#define DateTime_SetMonthCalColor(hdp, iColor, clr) \ - SNDMSG (hdp, DTM_SETMCCOLOR, iColor, clr) -#define DateTime_GetMonthCal(hdp) \ - (HWND) SNDMSG (hdp, DTM_GETMONTHCAL, 0, 0) -#define DateTime_SetMonthCalFont(hdp, hfont, fRedraw) \ - SNDMSG (hdp, DTM_SETMCFONT, (WPARAM)hfont, (LPARAM)fRedraw) -#define DateTime_GetMonthCalFont(hdp) \ - SNDMSG (hdp, DTM_GETMCFONT, 0, 0) +#ifdef UNICODE +#define WC_IPADDRESS WC_IPADDRESSW +#else +#define WC_IPADDRESS WC_IPADDRESSA +#endif -#define DA_LAST (0x7fffffff) -#define DPA_APPEND (0x7fffffff) -#define DPA_ERR (-1) +#define IPN_FIELDCHANGED (IPN_FIRST - 0) + typedef struct tagNMIPADDRESS { + NMHDR hdr; + int iField; + int iValue; + } NMIPADDRESS,*LPNMIPADDRESS; -#define DSA_APPEND (0x7fffffff) -#define DSA_ERR (-1) +#define MAKEIPRANGE(low,high) ((LPARAM)(WORD)(((BYTE)(high) << 8)+(BYTE)(low))) -struct _DSA; -typedef struct _DSA *HDSA; +#define MAKEIPADDRESS(b1,b2,b3,b4) ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4)))) -typedef INT (CALLBACK *PFNDSAENUMCALLBACK)(LPVOID, LPVOID); +#define FIRST_IPADDRESS(x) ((x>>24) & 0xff) +#define SECOND_IPADDRESS(x) ((x>>16) & 0xff) +#define THIRD_IPADDRESS(x) ((x>>8) & 0xff) +#define FOURTH_IPADDRESS(x) (x & 0xff) +#endif -HDSA WINAPI DSA_Create(INT, INT); -BOOL WINAPI DSA_Destroy(HDSA); -void WINAPI DSA_DestroyCallback(HDSA, PFNDSAENUMCALLBACK, LPVOID); -LPVOID WINAPI DSA_GetItemPtr(HDSA, INT); -INT WINAPI DSA_InsertItem(HDSA, INT, LPVOID); +#ifndef NOPAGESCROLLER +#define WC_PAGESCROLLERW L"SysPager" +#define WC_PAGESCROLLERA "SysPager" -#define DPAS_SORTED 0x0001 -#define DPAS_INSERTBEFORE 0x0002 -#define DPAS_INSERTAFTER 0x0004 +#ifdef UNICODE +#define WC_PAGESCROLLER WC_PAGESCROLLERW +#else +#define WC_PAGESCROLLER WC_PAGESCROLLERA +#endif +#define PGS_VERT 0x0 +#define PGS_HORZ 0x1 +#define PGS_AUTOSCROLL 0x2 +#define PGS_DRAGNDROP 0x4 -struct _DPA; -typedef struct _DPA *HDPA; +#define PGF_INVISIBLE 0 +#define PGF_NORMAL 1 +#define PGF_GRAYED 2 +#define PGF_DEPRESSED 4 +#define PGF_HOT 8 -#define DPA_GetPtrCount(hdpa) (*(INT*)(hdpa)) +#define PGB_TOPORLEFT 0 +#define PGB_BOTTOMORRIGHT 1 -typedef INT (CALLBACK *PFNDPAENUMCALLBACK)(LPVOID, LPVOID); -typedef INT (CALLBACK *PFNDPACOMPARE)(LPVOID, LPVOID, LPARAM); -typedef PVOID (CALLBACK *PFNDPAMERGE)(UINT,PVOID,PVOID,LPARAM); +#define PGM_SETCHILD (PGM_FIRST+1) +#define Pager_SetChild(hwnd,hwndChild) (void)SNDMSG((hwnd),PGM_SETCHILD,0,(LPARAM)(hwndChild)) -/* merge callback codes */ -#define DPAMM_MERGE 1 -#define DPAMM_DELETE 2 -#define DPAMM_INSERT 3 +#define PGM_RECALCSIZE (PGM_FIRST+2) +#define Pager_RecalcSize(hwnd) (void)SNDMSG((hwnd),PGM_RECALCSIZE,0,0) -/* merge options */ -#define DPAM_SORTED 0x00000001 -#define DPAM_NORMAL 0x00000002 -#define DPAM_UNION 0x00000004 -#define DPAM_INTERSECT 0x00000008 +#define PGM_FORWARDMOUSE (PGM_FIRST+3) +#define Pager_ForwardMouse(hwnd,bForward) (void)SNDMSG((hwnd),PGM_FORWARDMOUSE,(WPARAM)(bForward),0) -HDPA WINAPI DPA_Create(INT); -BOOL WINAPI DPA_Destroy(HDPA); -LPVOID WINAPI DPA_DeletePtr(HDPA, INT); -BOOL WINAPI DPA_DeleteAllPtrs(HDPA); -BOOL WINAPI DPA_SetPtr(HDPA, INT, LPVOID); -LPVOID WINAPI DPA_GetPtr(HDPA, INT); -INT WINAPI DPA_GetPtrIndex(HDPA, LPCVOID); -ULONGLONG WINAPI DPA_GetSize(HDPA); -BOOL WINAPI DPA_Grow(HDPA, INT); -INT WINAPI DPA_InsertPtr(HDPA, INT, LPVOID); -BOOL WINAPI DPA_Sort(HDPA, PFNDPACOMPARE, LPARAM); -void WINAPI DPA_EnumCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID); -void WINAPI DPA_DestroyCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID); -INT WINAPI DPA_Search(HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT); -BOOL WINAPI DPA_Merge(HDPA, HDPA, DWORD, PFNDPACOMPARE, PFNDPAMERGE, LPARAM); +#define PGM_SETBKCOLOR (PGM_FIRST+4) +#define Pager_SetBkColor(hwnd,clr) (COLORREF)SNDMSG((hwnd),PGM_SETBKCOLOR,0,(LPARAM)(clr)) -/* save/load from stream */ -typedef struct _DPASTREAMINFO -{ - INT iPos; /* item index */ - LPVOID pvItem; +#define PGM_GETBKCOLOR (PGM_FIRST+5) +#define Pager_GetBkColor(hwnd) (COLORREF)SNDMSG((hwnd),PGM_GETBKCOLOR,0,0) + +#define PGM_SETBORDER (PGM_FIRST+6) +#define Pager_SetBorder(hwnd,iBorder) (int)SNDMSG((hwnd),PGM_SETBORDER,0,(LPARAM)(iBorder)) + +#define PGM_GETBORDER (PGM_FIRST+7) +#define Pager_GetBorder(hwnd) (int)SNDMSG((hwnd),PGM_GETBORDER,0,0) + +#define PGM_SETPOS (PGM_FIRST+8) +#define Pager_SetPos(hwnd,iPos) (int)SNDMSG((hwnd),PGM_SETPOS,0,(LPARAM)(iPos)) + +#define PGM_GETPOS (PGM_FIRST+9) +#define Pager_GetPos(hwnd) (int)SNDMSG((hwnd),PGM_GETPOS,0,0) + +#define PGM_SETBUTTONSIZE (PGM_FIRST+10) +#define Pager_SetButtonSize(hwnd,iSize) (int)SNDMSG((hwnd),PGM_SETBUTTONSIZE,0,(LPARAM)(iSize)) + +#define PGM_GETBUTTONSIZE (PGM_FIRST+11) +#define Pager_GetButtonSize(hwnd) (int)SNDMSG((hwnd),PGM_GETBUTTONSIZE,0,0) + +#define PGM_GETBUTTONSTATE (PGM_FIRST+12) +#define Pager_GetButtonState(hwnd,iButton) (DWORD)SNDMSG((hwnd),PGM_GETBUTTONSTATE,0,(LPARAM)(iButton)) + +#define PGM_GETDROPTARGET CCM_GETDROPTARGET +#define Pager_GetDropTarget(hwnd,ppdt) (void)SNDMSG((hwnd),PGM_GETDROPTARGET,0,(LPARAM)(ppdt)) + +#define PGN_SCROLL (PGN_FIRST-1) + +#define PGF_SCROLLUP 1 +#define PGF_SCROLLDOWN 2 +#define PGF_SCROLLLEFT 4 +#define PGF_SCROLLRIGHT 8 + +#define PGK_SHIFT 1 +#define PGK_CONTROL 2 +#define PGK_MENU 4 + +#include + + typedef struct { + NMHDR hdr; + WORD fwKeys; + RECT rcParent; + int iDir; + int iXpos; + int iYpos; + int iScroll; + }NMPGSCROLL,*LPNMPGSCROLL; + +#include + +#define PGN_CALCSIZE (PGN_FIRST-2) + +#define PGF_CALCWIDTH 1 +#define PGF_CALCHEIGHT 2 + + typedef struct { + NMHDR hdr; + DWORD dwFlag; + int iWidth; + int iHeight; + }NMPGCALCSIZE,*LPNMPGCALCSIZE; + +#define PGN_HOTITEMCHANGE (PGN_FIRST-3) + + typedef struct tagNMPGHOTITEM + { + NMHDR hdr; + int idOld; + int idNew; + DWORD dwFlags; + } NMPGHOTITEM,*LPNMPGHOTITEM; +#endif + +#ifndef NONATIVEFONTCTL + +#define WC_NATIVEFONTCTLW L"NativeFontCtl" +#define WC_NATIVEFONTCTLA "NativeFontCtl" + +#ifdef UNICODE +#define WC_NATIVEFONTCTL WC_NATIVEFONTCTLW +#else +#define WC_NATIVEFONTCTL WC_NATIVEFONTCTLA +#endif + +#define NFS_EDIT 0x1 +#define NFS_STATIC 0x2 +#define NFS_LISTCOMBO 0x4 +#define NFS_BUTTON 0x8 +#define NFS_ALL 0x10 +#define NFS_USEFONTASSOC 0x20 +#endif + +#ifndef NOBUTTON +#define WC_BUTTONA "Button" +#define WC_BUTTONW L"Button" +#ifdef UNICODE +#define WC_BUTTON WC_BUTTONW +#else +#define WC_BUTTON WC_BUTTONA +#endif + +#define BUTTON_IMAGELIST_ALIGN_LEFT 0 +#define BUTTON_IMAGELIST_ALIGN_RIGHT 1 +#define BUTTON_IMAGELIST_ALIGN_TOP 2 +#define BUTTON_IMAGELIST_ALIGN_BOTTOM 3 +#define BUTTON_IMAGELIST_ALIGN_CENTER 4 + + typedef struct { + HIMAGELIST himl; + RECT margin; + UINT uAlign; + } BUTTON_IMAGELIST,*PBUTTON_IMAGELIST; + +#define BCM_GETIDEALSIZE (BCM_FIRST+0x1) +#define Button_GetIdealSize(hwnd,psize) (WINBOOL)SNDMSG((hwnd),BCM_GETIDEALSIZE,0,(LPARAM)(psize)) + +#define BCM_SETIMAGELIST (BCM_FIRST+0x2) +#define Button_SetImageList(hwnd,pbuttonImagelist) (WINBOOL)SNDMSG((hwnd),BCM_SETIMAGELIST,0,(LPARAM)(pbuttonImagelist)) + +#define BCM_GETIMAGELIST (BCM_FIRST+0x3) +#define Button_GetImageList(hwnd,pbuttonImagelist) (WINBOOL)SNDMSG((hwnd),BCM_GETIMAGELIST,0,(LPARAM)(pbuttonImagelist)) + +#define BCM_SETTEXTMARGIN (BCM_FIRST+0x4) +#define Button_SetTextMargin(hwnd,pmargin) (WINBOOL)SNDMSG((hwnd),BCM_SETTEXTMARGIN,0,(LPARAM)(pmargin)) +#define BCM_GETTEXTMARGIN (BCM_FIRST+0x5) +#define Button_GetTextMargin(hwnd,pmargin) (WINBOOL)SNDMSG((hwnd),BCM_GETTEXTMARGIN,0,(LPARAM)(pmargin)) + + typedef struct tagNMBCHOTITEM { + NMHDR hdr; + DWORD dwFlags; + } NMBCHOTITEM,*LPNMBCHOTITEM; + +#define BCN_HOTITEMCHANGE (BCN_FIRST+0x1) + +#define BST_HOT 0x200 + +#endif + +#ifndef NOSTATIC +#define WC_STATICA "Static" +#define WC_STATICW L"Static" +#ifdef UNICODE +#define WC_STATIC WC_STATICW +#else +#define WC_STATIC WC_STATICA +#endif + +#ifndef NOEDIT +#define WC_EDITA "Edit" +#define WC_EDITW L"Edit" +#ifdef UNICODE +#define WC_EDIT WC_EDITW +#else +#define WC_EDIT WC_EDITA +#endif + +#define EM_SETCUEBANNER (ECM_FIRST+1) +#define Edit_SetCueBannerText(hwnd,lpcwText) (WINBOOL)SNDMSG((hwnd),EM_SETCUEBANNER,0,(LPARAM)(lpcwText)) +#define EM_GETCUEBANNER (ECM_FIRST+2) +#define Edit_GetCueBannerText(hwnd,lpwText,cchText) (WINBOOL)SNDMSG((hwnd),EM_GETCUEBANNER,(WPARAM)(lpwText),(LPARAM)(cchText)) + + typedef struct _tagEDITBALLOONTIP { + DWORD cbStruct; + LPCWSTR pszTitle; + LPCWSTR pszText; + INT ttiIcon; + } EDITBALLOONTIP,*PEDITBALLOONTIP; +#define EM_SHOWBALLOONTIP (ECM_FIRST+3) +#define Edit_ShowBalloonTip(hwnd,peditballoontip) (WINBOOL)SNDMSG((hwnd),EM_SHOWBALLOONTIP,0,(LPARAM)(peditballoontip)) +#define EM_HIDEBALLOONTIP (ECM_FIRST+4) +#define Edit_HideBalloonTip(hwnd) (WINBOOL)SNDMSG((hwnd),EM_HIDEBALLOONTIP,0,0) +#endif + +#ifndef NOLISTBOX +#define WC_LISTBOXA "ListBox" +#define WC_LISTBOXW L"ListBox" +#ifdef UNICODE +#define WC_LISTBOX WC_LISTBOXW +#else +#define WC_LISTBOX WC_LISTBOXA +#endif +#endif + +#ifndef NOCOMBOBOX +#define WC_COMBOBOXA "ComboBox" +#define WC_COMBOBOXW L"ComboBox" +#ifdef UNICODE +#define WC_COMBOBOX WC_COMBOBOXW +#else +#define WC_COMBOBOX WC_COMBOBOXA +#endif +#endif + +#define CB_SETMINVISIBLE (CBM_FIRST+1) +#define CB_GETMINVISIBLE (CBM_FIRST+2) + +#define ComboBox_SetMinVisible(hwnd,iMinVisible) (WINBOOL)SNDMSG((hwnd),CB_SETMINVISIBLE,(WPARAM)iMinVisible,0) +#define ComboBox_GetMinVisible(hwnd) (int)SNDMSG((hwnd),CB_GETMINVISIBLE,0,0) + +#ifndef NOSCROLLBAR +#define WC_SCROLLBARA "ScrollBar" +#define WC_SCROLLBARW L"ScrollBar" +#ifdef UNICODE +#define WC_SCROLLBAR WC_SCROLLBARW +#else +#define WC_SCROLLBAR WC_SCROLLBARA +#endif +#endif + +#define INVALID_LINK_INDEX (-1) +#define MAX_LINKID_TEXT 48 +#define L_MAX_URL_LENGTH (2048+32+sizeof("://")) + +#define WC_LINK L"SysLink" + +#define LWS_TRANSPARENT 0x1 +#define LWS_IGNORERETURN 0x2 + +#define LIF_ITEMINDEX 0x1 +#define LIF_STATE 0x2 +#define LIF_ITEMID 0x4 +#define LIF_URL 0x8 + +#define LIS_FOCUSED 0x1 +#define LIS_ENABLED 0x2 +#define LIS_VISITED 0x4 + + typedef struct tagLITEM { + UINT mask; + int iLink; + UINT state; + UINT stateMask; + WCHAR szID[MAX_LINKID_TEXT]; + WCHAR szUrl[L_MAX_URL_LENGTH]; + } LITEM,*PLITEM; + + typedef struct tagLHITTESTINFO { + POINT pt; + LITEM item; + } LHITTESTINFO,*PLHITTESTINFO; + + typedef struct tagNMLINK { + NMHDR hdr; + LITEM item; + } NMLINK,*PNMLINK; + +#define LM_HITTEST (WM_USER+0x300) +#define LM_GETIDEALHEIGHT (WM_USER+0x301) +#define LM_SETITEM (WM_USER+0x302) +#define LM_GETITEM (WM_USER+0x303) + +#ifndef NOMUI + void WINAPI InitMUILanguage(LANGID uiLang); + LANGID WINAPI GetMUILanguage(void); +#endif +#endif + +#define DA_LAST (0x7fffffff) +#define DPA_APPEND (0x7fffffff) +#define DPA_ERR (-1) + +#define DSA_APPEND (0x7fffffff) +#define DSA_ERR (-1) + + typedef struct _DSA *HDSA; + + typedef int (CALLBACK *PFNDPAENUMCALLBACK)(void *p,void *pData); + typedef int (CALLBACK *PFNDSAENUMCALLBACK)(void *p,void *pData); + + WINCOMMCTRLAPI HDSA WINAPI DSA_Create(int cbItem,int cItemGrow); + WINCOMMCTRLAPI WINBOOL WINAPI DSA_Destroy(HDSA hdsa); + WINCOMMCTRLAPI void WINAPI DSA_DestroyCallback(HDSA hdsa,PFNDSAENUMCALLBACK pfnCB,void *pData); + WINCOMMCTRLAPI PVOID WINAPI DSA_GetItemPtr(HDSA hdsa,int i); + WINCOMMCTRLAPI int WINAPI DSA_InsertItem(HDSA hdsa,int i,void *pitem); + + typedef struct _DPA *HDPA; + + WINCOMMCTRLAPI HDPA WINAPI DPA_Create(int cItemGrow); + WINCOMMCTRLAPI WINBOOL WINAPI DPA_Destroy(HDPA hdpa); + WINCOMMCTRLAPI PVOID WINAPI DPA_DeletePtr(HDPA hdpa,int i); + WINCOMMCTRLAPI WINBOOL WINAPI DPA_DeleteAllPtrs(HDPA hdpa); + WINCOMMCTRLAPI void WINAPI DPA_EnumCallback(HDPA hdpa,PFNDPAENUMCALLBACK pfnCB,void *pData); + WINCOMMCTRLAPI void WINAPI DPA_DestroyCallback(HDPA hdpa,PFNDPAENUMCALLBACK pfnCB,void *pData); + WINCOMMCTRLAPI WINBOOL WINAPI DPA_SetPtr(HDPA hdpa,int i,void *p); + WINCOMMCTRLAPI int WINAPI DPA_InsertPtr(HDPA hdpa,int i,void *p); + WINCOMMCTRLAPI PVOID WINAPI DPA_GetPtr(HDPA hdpa,INT_PTR i); + + typedef int (CALLBACK *PFNDPACOMPARE)(void *p1,void *p2,LPARAM lParam); + + WINCOMMCTRLAPI WINBOOL WINAPI DPA_Sort(HDPA hdpa,PFNDPACOMPARE pfnCompare,LPARAM lParam); + +#define DPAS_SORTED 0x1 +#define DPAS_INSERTBEFORE 0x2 +#define DPAS_INSERTAFTER 0x4 + + WINCOMMCTRLAPI int WINAPI DPA_Search(HDPA hdpa,void *pFind,int iStart,PFNDPACOMPARE pfnCompare,LPARAM lParam,UINT options); + WINCOMMCTRLAPI WINBOOL WINAPI Str_SetPtrW(LPWSTR *ppsz,LPCWSTR psz); + +#ifndef NOTRACKMOUSEEVENT + +#ifndef WM_MOUSEHOVER +#define WM_MOUSEHOVER 0x2a1 +#define WM_MOUSELEAVE 0x2a3 +#endif + +#ifndef TME_HOVER + +#define TME_HOVER 0x1 +#define TME_LEAVE 0x2 +#define TME_NONCLIENT 0x10 +#define TME_QUERY 0x40000000 +#define TME_CANCEL 0x80000000 + +#define HOVER_DEFAULT 0xffffffff + + typedef struct tagTRACKMOUSEEVENT { + DWORD cbSize; + DWORD dwFlags; + HWND hwndTrack; + DWORD dwHoverTime; + } TRACKMOUSEEVENT,*LPTRACKMOUSEEVENT; +#endif + + WINCOMMCTRLAPI WINBOOL WINAPI _TrackMouseEvent(LPTRACKMOUSEEVENT lpEventTrack); +#endif + +#ifndef NOFLATSBAPIS + +#define WSB_PROP_CYVSCROLL 0x1L +#define WSB_PROP_CXHSCROLL 0x2L +#define WSB_PROP_CYHSCROLL 0x4L +#define WSB_PROP_CXVSCROLL 0x8L +#define WSB_PROP_CXHTHUMB 0x10L +#define WSB_PROP_CYVTHUMB 0x20L +#define WSB_PROP_VBKGCOLOR 0x40L +#define WSB_PROP_HBKGCOLOR 0x80L +#define WSB_PROP_VSTYLE 0x100L +#define WSB_PROP_HSTYLE 0x200L +#define WSB_PROP_WINSTYLE 0x400L +#define WSB_PROP_PALETTE 0x800L +#define WSB_PROP_MASK 0xfffL + +#define FSB_FLAT_MODE 2 +#define FSB_ENCARTA_MODE 1 +#define FSB_REGULAR_MODE 0 + + WINCOMMCTRLAPI WINBOOL WINAPI FlatSB_EnableScrollBar(HWND,int,UINT); + WINCOMMCTRLAPI WINBOOL WINAPI FlatSB_ShowScrollBar(HWND,int code,WINBOOL); + WINCOMMCTRLAPI WINBOOL WINAPI FlatSB_GetScrollRange(HWND,int code,LPINT,LPINT); + WINCOMMCTRLAPI WINBOOL WINAPI FlatSB_GetScrollInfo(HWND,int code,LPSCROLLINFO); + WINCOMMCTRLAPI int WINAPI FlatSB_GetScrollPos(HWND,int code); + WINCOMMCTRLAPI WINBOOL WINAPI FlatSB_GetScrollProp(HWND,int propIndex,LPINT); +#ifdef _WIN64 + WINCOMMCTRLAPI WINBOOL WINAPI FlatSB_GetScrollPropPtr(HWND,int propIndex,PINT_PTR); +#else +#define FlatSB_GetScrollPropPtr FlatSB_GetScrollProp +#endif + + WINCOMMCTRLAPI int WINAPI FlatSB_SetScrollPos(HWND,int code,int pos,WINBOOL fRedraw); + WINCOMMCTRLAPI int WINAPI FlatSB_SetScrollInfo(HWND,int code,LPSCROLLINFO,WINBOOL fRedraw); + WINCOMMCTRLAPI int WINAPI FlatSB_SetScrollRange(HWND,int code,int min,int max,WINBOOL fRedraw); + WINCOMMCTRLAPI WINBOOL WINAPI FlatSB_SetScrollProp(HWND,UINT index,INT_PTR newValue,WINBOOL); +#define FlatSB_SetScrollPropPtr FlatSB_SetScrollProp + WINCOMMCTRLAPI WINBOOL WINAPI InitializeFlatSB(HWND); + WINCOMMCTRLAPI HRESULT WINAPI UninitializeFlatSB(HWND); +#endif +#endif + + typedef LRESULT (CALLBACK *SUBCLASSPROC)(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam,UINT_PTR uIdSubclass,DWORD_PTR dwRefData); + + WINBOOL WINAPI SetWindowSubclass(HWND hWnd,SUBCLASSPROC pfnSubclass,UINT_PTR uIdSubclass,DWORD_PTR dwRefData); + WINBOOL WINAPI GetWindowSubclass(HWND hWnd,SUBCLASSPROC pfnSubclass,UINT_PTR uIdSubclass,DWORD_PTR *pdwRefData); + WINBOOL WINAPI RemoveWindowSubclass(HWND hWnd,SUBCLASSPROC pfnSubclass,UINT_PTR uIdSubclass); + LRESULT WINAPI DefSubclassProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam); + int WINAPI DrawShadowText(HDC hdc,LPCWSTR pszText,UINT cch,RECT *prc,DWORD dwFlags,COLORREF crText,COLORREF crShadow,int ixOffset,int iyOffset); + +typedef struct _DPASTREAMINFO { + int iPos; + void *pvItem; } DPASTREAMINFO; struct IStream; -typedef HRESULT (CALLBACK *PFNDPASTREAM)(DPASTREAMINFO*, struct IStream*, LPVOID); +typedef HRESULT (CALLBACK *PFNDPASTREAM)(DPASTREAMINFO*, struct IStream*, void*); +typedef void* (CALLBACK *PFNDPAMERGE)(UINT, void*, void*, LPARAM); +typedef const void* (CALLBACK *PFNDPAMERGECONST)(UINT, const void*, const void*, LPARAM); -HRESULT WINAPI DPA_LoadStream(HDPA*, PFNDPASTREAM, struct IStream*, LPVOID); -HRESULT WINAPI DPA_SaveStream(HDPA, PFNDPASTREAM, struct IStream*, LPVOID); + WINCOMMCTRLAPI HRESULT WINAPI DPA_LoadStream(HDPA * phdpa, PFNDPASTREAM pfn, struct IStream * pstream, void *pvInstData); + WINCOMMCTRLAPI HRESULT WINAPI DPA_SaveStream(HDPA hdpa, PFNDPASTREAM pfn, struct IStream * pstream, void *pvInstData); + WINCOMMCTRLAPI BOOL WINAPI DPA_Grow(HDPA pdpa, IN int cp); + WINCOMMCTRLAPI int WINAPI DPA_InsertPtr(HDPA hdpa, IN int i, void *p); + WINCOMMCTRLAPI PVOID WINAPI DPA_GetPtr(HDPA hdpa, INT_PTR i); + WINCOMMCTRLAPI BOOL WINAPI DPA_SetPtr(HDPA hdpa, IN int i, void *p); + WINCOMMCTRLAPI int WINAPI DPA_GetPtrIndex(HDPA hdpa, const void *p); -BOOL WINAPI Str_SetPtrW (LPWSTR *, LPCWSTR); +#define DPA_GetPtrCount(hdpa) (*(int *)(hdpa)) +#define DPA_SetPtrCount(hdpa, cItems) (*(int *)(hdpa) = (cItems)) +#define DPA_GetPtrPtr(hdpa) (*((void * **)((BYTE *)(hdpa) + sizeof(void *)))) +#define DPA_AppendPtr(hdpa, pitem) DPA_InsertPtr(hdpa, DA_LAST, pitem) +#define DPA_FastDeleteLastPtr(hdpa) (--*(int *)(hdpa)) +#define DPA_FastGetPtr(hdpa, i) (DPA_GetPtrPtr(hdpa)[i]) -/************************************************************************** - * SysLink control - */ +#define DPAM_SORTED 1 +#define DPAM_NORMAL 2 +#define DPAM_UNION 4 +#define DPAM_INTERSECT 8 -#if defined(__GNUC__) -# define WC_LINK (const WCHAR []){ 'S','y','s','L','i','n','k',0 } -#elif defined(_MSC_VER) -# define WC_LINK L"SysLink" -#else -static const WCHAR WC_LINK[] = { 'S','y','s','L','i','n','k',0 }; -#endif - -/* SysLink styles */ -#define LWS_TRANSPARENT 0x0001 -#define LWS_IGNORERETURN 0x0002 - -/* SysLink messages */ -#define LM_HITTEST (WM_USER + 768) -#define LM_GETIDEALHEIGHT (WM_USER + 769) -#define LM_GETIDEALSIZE (LM_GETIDEALHEIGHT) -#define LM_SETITEM (WM_USER + 770) -#define LM_GETITEM (WM_USER + 771) - -/* SysLink links flags */ - -#define LIF_ITEMINDEX 1 -#define LIF_STATE 2 -#define LIF_ITEMID 4 -#define LIF_URL 8 - -/* SysLink links states */ - -#define LIS_FOCUSED 1 -#define LIS_ENABLED 2 -#define LIS_VISITED 4 - -/* SysLink misc. */ - -#define INVALID_LINK_INDEX (-1) -#define MAX_LINKID_TEXT 48 -#define L_MAX_URL_LENGTH 2084 - -/* SysLink structures */ - -typedef struct tagLITEM -{ - UINT mask; - int iLink; - UINT state; - UINT stateMask; - WCHAR szID[MAX_LINKID_TEXT]; - WCHAR szUrl[L_MAX_URL_LENGTH]; -} LITEM, *PLITEM; - -typedef struct tagLHITTESTINFO -{ - POINT pt; - LITEM item; -} LHITTESTINFO, *PLHITTESTINFO; - -typedef struct tagNMLINK -{ - NMHDR hdr; - LITEM item; -} NMLINK, *PNMLINK; - -typedef struct tagNMLVLINK -{ - NMHDR hdr; - LITEM link; - int iItem; - int iSubItem; -} NMLVLINK, *PNMLVLINK; - -/************************************************************************** - * Static control - */ - -#define WC_STATICA "Static" -#if defined(__GNUC__) -# define WC_STATICW (const WCHAR []){ 'S','t','a','t','i','c',0 } -#elif defined(_MSC_VER) -# define WC_STATICW L"Static" -#else -static const WCHAR WC_STATICW[] = { 'S','t','a','t','i','c',0 }; -#endif -#define WC_STATIC WINELIB_NAME_AW(WC_STATIC) - -/************************************************************************** - * Combobox control - */ - -#define WC_COMBOBOXA "ComboBox" -#if defined(__GNUC__) -# define WC_COMBOBOXW (const WCHAR []){ 'C','o','m','b','o','B','o','x',0 } -#elif defined(_MSC_VER) -# define WC_COMBOBOXW L"ComboBox" -#else -static const WCHAR WC_COMBOBOXW[] = { 'C','o','m','b','o','B','o','x',0 }; -#endif -#define WC_COMBOBOX WINELIB_NAME_AW(WC_COMBOBOX) - -/************************************************************************** - * Edit control - */ - -#define WC_EDITA "Edit" -#if defined(__GNUC__) -# define WC_EDITW (const WCHAR []){ 'E','d','i','t',0 } -#elif defined(_MSC_VER) -# define WC_EDITW L"Edit" -#else -static const WCHAR WC_EDITW[] = { 'E','d','i','t',0 }; -#endif -#define WC_EDIT WINELIB_NAME_AW(WC_EDIT) - -/************************************************************************** - * Listbox control - */ - -#define WC_LISTBOXA "ListBox" -#if defined(__GNUC__) -# define WC_LISTBOXW (const WCHAR []){ 'L','i','s','t','B','o','x',0 } -#elif defined(_MSC_VER) -# define WC_LISTBOXW L"ListBox" -#else -static const WCHAR WC_LISTBOXW[] = { 'L','i','s','t','B','o','x',0 }; -#endif -#define WC_LISTBOX WINELIB_NAME_AW(WC_LISTBOX) - -/************************************************************************** - * Scrollbar control - */ - -#define WC_SCROLLBARA "ScrollBar" -#if defined(__GNUC__) -# define WC_SCROLLBARW (const WCHAR []){ 'S','c','r','o','l','l','B','a','r',0 } -#elif defined(_MSC_VER) -# define WC_SCROLLBARW L"ScrollBar" -#else -static const WCHAR WC_SCROLLBARW[] = { 'S','c','r','o','l','l','B','a','r',0 }; -#endif -#define WC_SCROLLBAR WINELIB_NAME_AW(WC_SCROLLBAR) +#define DPAMM_MERGE 1 +#define DPAMM_DELETE 2 +#define DPAMM_INSERT 3 #ifdef __cplusplus } #endif - -#endif /* __WINE_COMMCTRL_H */ +#endif +#endif diff --git a/reactos/include/reactos/wine/commctrl.h b/reactos/include/reactos/wine/commctrl.h new file mode 100644 index 00000000000..47c3a806d11 --- /dev/null +++ b/reactos/include/reactos/wine/commctrl.h @@ -0,0 +1,72 @@ + +#ifndef _INC_COMMCTRL_WINE +#define _INC_COMMCTRL_WINE + +#define DPA_GetPtr DPA_GetPtr_wine_hack +#define FlatSB_SetScrollProp FlatSB_SetScrollProp_wine_hack + +#if (_WIN32_IE < 0x501) +#undef _WIN32_IE +#define _WIN32_IE 0x0501 +#endif + +#include_next + +#undef DPA_GetPtr +LPVOID WINAPI DPA_GetPtr(HDPA, INT); + +#undef FlatSB_SetScrollProp +BOOL WINAPI FlatSB_SetScrollProp(HWND, UINT, INT, BOOL); + +#define DRAGLISTMSGSTRINGA "commctrl_DragListMsg" +#if defined(__GNUC__) +# define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \ + '_','D','r','a','g','L','i','s','t','M','s','g',0 } +#elif defined(_MSC_VER) +# define DRAGLISTMSGSTRINGW L"commctrl_DragListMsg" +#else +static const WCHAR DRAGLISTMSGSTRINGW[] = { 'c','o','m','m','c','t','r','l', + '_','D','r','a','g','L','i','s','t','M','s','g',0 }; +#endif + +#define FLATSB_CLASSA "flatsb_class32" +#if defined(__GNUC__) +# define FLATSB_CLASSW (const WCHAR []){ 'f','l','a','t','s','b','_', \ + 'c','l','a','s','s','3','2',0 } +#elif defined(_MSC_VER) +# define FLATSB_CLASSW L"flatsb_class32" +#else +static const WCHAR FLATSB_CLASSW[] = { 'f','l','a','t','s','b','_', + 'c','l','a','s','s','3','2',0 }; +#endif + +typedef TBSAVEPARAMSW *LPTBSAVEPARAMSW; + +typedef LVFINDINFOA *LPLVFINDINFOA; +typedef LVFINDINFOW *LPLVFINDINFOW; + +#define SB_SETBORDERS (WM_USER+5) +#define TBSTYLE_EX_UNDOC1 0x00000004 /* similar to TBSTYLE_WRAPABLE */ + +/* these are undocumented and the names are guesses */ +typedef struct +{ + NMHDR hdr; + HWND hwndDialog; +} NMTBINITCUSTOMIZE; + +typedef struct +{ + NMHDR hdr; + INT idNew; + INT iDirection; /* left is -1, right is 1 */ + DWORD dwReason; /* HICF_* */ +} NMTBWRAPHOTITEM; + +#define LPNMLVDISPINFO WINELIB_NAME_AW(LPNMLVDISPINFO) + +/* undocumented messages in Toolbar */ +#define TB_UNKWN45D (WM_USER+93) +#define TB_UNKWN464 (WM_USER+100) + +#endif /* _INC_COMMCTRL_WINE */ From f820fe7a43420431af07c5aa14d96202367ee5bb Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 May 2010 15:30:59 +0000 Subject: [PATCH 021/151] [WIN32K] Fix broken parameter passing from EngMaskBitBlt to (Alpha)BltMask. It was passing the wrong surface and the wrong point. Rename some parameters to reflect what their usage is. Add ASSERTs to make sure noone passes useless parameters. Fixes crippled text in startmenu. The whole code is broken by design, anyway it will go away, once the new text rendering code is done. See issue #4379 for more details. svn path=/trunk/; revision=47124 --- reactos/subsystems/win32/win32k/eng/bitblt.c | 38 +++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/reactos/subsystems/win32/win32k/eng/bitblt.c b/reactos/subsystems/win32/win32k/eng/bitblt.c index afac0e8a7d3..8806aa75fc5 100644 --- a/reactos/subsystems/win32/win32k/eng/bitblt.c +++ b/reactos/subsystems/win32/win32k/eng/bitblt.c @@ -51,6 +51,9 @@ BltMask(SURFOBJ* psoDest, ULONG Pattern = 0; HBITMAP hbmPattern; + ASSERT(psoSource == NULL); + ASSERT(pptlSource == NULL); + if (psoMask == NULL) { return FALSE; @@ -662,8 +665,8 @@ static BOOLEAN APIENTRY AlphaBltMask(SURFOBJ* psoDest, SURFOBJ* psoSource, // unused SURFOBJ* psoMask, - XLATEOBJ* ColorTranslation, - XLATEOBJ* SrcColorTranslation, + XLATEOBJ* pxloRGB2Dest, + XLATEOBJ* pxloBrush, RECTL* prclDest, POINTL* pptlSource, // unused POINTL* pptlMask, @@ -675,12 +678,15 @@ AlphaBltMask(SURFOBJ* psoDest, ULONG Background, BrushColor, NewColor; BYTE *tMask, *lMask; + ASSERT(psoSource == NULL); + ASSERT(pptlSource == NULL); + dx = prclDest->right - prclDest->left; dy = prclDest->bottom - prclDest->top; if (psoMask != NULL) { - BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, pbo ? pbo->iSolidColor : 0); + BrushColor = XLATEOBJ_iXlate(pxloBrush, pbo ? pbo->iSolidColor : 0); r = (int)GetRValue(BrushColor); g = (int)GetGValue(BrushColor); b = (int)GetBValue(BrushColor); @@ -701,14 +707,14 @@ AlphaBltMask(SURFOBJ* psoDest, else { Background = DIB_GetSource(psoDest, prclDest->left + i, prclDest->top + j, - SrcColorTranslation); + pxloBrush); NewColor = RGB((*lMask * (r - GetRValue(Background)) >> 8) + GetRValue(Background), (*lMask * (g - GetGValue(Background)) >> 8) + GetGValue(Background), (*lMask * (b - GetBValue(Background)) >> 8) + GetBValue(Background)); - Background = XLATEOBJ_iXlate(ColorTranslation, NewColor); + Background = XLATEOBJ_iXlate(pxloRGB2Dest, NewColor); DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel( psoDest, prclDest->left + i, prclDest->top + j, Background); } @@ -846,10 +852,10 @@ EngMaskBitBlt(SURFOBJ *psoDest, case DC_TRIVIAL: if (psoMask->iBitmapFormat == BMF_8BPP) Ret = AlphaBltMask(psoOutput, NULL , psoInput, DestColorTranslation, SourceColorTranslation, - &OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin); + &OutputRect, NULL, &InputPoint, pbo, &AdjustedBrushOrigin); else Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation, - &OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin, + &OutputRect, NULL, &InputPoint, pbo, &AdjustedBrushOrigin, R4_MASK); break; case DC_RECT: @@ -864,13 +870,13 @@ EngMaskBitBlt(SURFOBJ *psoDest, Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top; if (psoMask->iBitmapFormat == BMF_8BPP) { - Ret = AlphaBltMask(psoOutput, psoInput, psoMask, DestColorTranslation, SourceColorTranslation, - &CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin); + Ret = AlphaBltMask(psoOutput, NULL, psoInput, DestColorTranslation, SourceColorTranslation, + &CombinedRect, NULL, &Pt, pbo, &AdjustedBrushOrigin); } else { - Ret = BltMask(psoOutput, psoInput, psoMask, DestColorTranslation, - &CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin, R4_MASK); + Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation, + &CombinedRect, NULL, &Pt, pbo, &AdjustedBrushOrigin, R4_MASK); } } break; @@ -908,17 +914,17 @@ EngMaskBitBlt(SURFOBJ *psoDest, Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top; if (psoMask->iBitmapFormat == BMF_8BPP) { - Ret = AlphaBltMask(psoOutput, psoInput, psoMask, + Ret = AlphaBltMask(psoOutput, NULL, psoInput, DestColorTranslation, SourceColorTranslation, - &CombinedRect, &Pt, pptlMask, pbo, + &CombinedRect, NULL, &Pt, pbo, &AdjustedBrushOrigin) && Ret; } else { - Ret = BltMask(psoOutput, psoInput, psoMask, - DestColorTranslation, &CombinedRect, &Pt, - pptlMask, pbo, &AdjustedBrushOrigin, + Ret = BltMask(psoOutput, NULL, psoInput, + DestColorTranslation, &CombinedRect, NULL, + &Pt, pbo, &AdjustedBrushOrigin, R4_MASK) && Ret; } } From 4b9b7d580f842c505fe71b616089dcfb182b2caf Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sat, 8 May 2010 15:33:40 +0000 Subject: [PATCH 022/151] [EXPLORER] - Use proper buffer size, font type and an arbitrary high system time to create the size of the systray clock window - Fixes clock clipping See issue #2320 for more details. svn path=/trunk/; revision=47125 --- reactos/base/shell/explorer/taskbar/traynotify.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/base/shell/explorer/taskbar/traynotify.cpp b/reactos/base/shell/explorer/taskbar/traynotify.cpp index 5bb76af043e..ea0e85a4204 100644 --- a/reactos/base/shell/explorer/taskbar/traynotify.cpp +++ b/reactos/base/shell/explorer/taskbar/traynotify.cpp @@ -1282,14 +1282,17 @@ HWND ClockWindow::Create(HWND hwndParent) ClientRect clnt(hwndParent); WindowCanvas canvas(hwndParent); - FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT)); + FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT)); RECT rect = {0, 0, 0, 0}; - TCHAR buffer[8]; + TCHAR buffer[16]; + // Arbitrary high time so that the created clock window is big enough + SYSTEMTIME st = { 1601, 1, 0, 1, 23, 59, 59, 999 }; - if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) + if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) _tcscpy(buffer, TEXT("00:00")); + // Calculate the rectangle needed to draw the time (without actually drawing it) DrawText(canvas, buffer, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); int clockwindowWidth = rect.right-rect.left + 4; From 5678dca446e6a65e5f238933e81aac8a37e9f1ef Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 8 May 2010 15:49:02 +0000 Subject: [PATCH 023/151] [win32k] - Modify how non-queued messages are send that originate from the Win23k subsystem. Non-queued messages must go directly to the windows WNDPROC and not through the message pump (previews ROS behavior). More importantly sending these messages must not cause the sending thread to block waiting for a reply. - Add a messaging handling function that always sends message from Win32k to the windows thread without waiting. This will also allow the implementation of message call back later. - Modify PackParam and UnpackParam to accept a BOOL value to determine whether LParam needs to be allocated from NonPagedPool. Use with new message handling as if message sent to another thread have any pointers they must be allocated from NonPagedPool. - Fixed broken logic in can_active_window function and co_WinPosShowWindow. - Fixed broken logic in co_IntSendActivateMessages. The WM_ACTIVATEAPP message was being sent to every window belonging to the desktop twice. Once with flag saying window was activated and again with deactivated. - These changes should fix bugs #969, #3171, #4501, #4676, #4677, #4948. svn path=/trunk/; revision=47126 --- .../win32/win32k/include/msgqueue.h | 16 ++ .../subsystems/win32/win32k/ntuser/focus.c | 44 +--- .../subsystems/win32/win32k/ntuser/message.c | 222 ++++++++++++++++-- .../subsystems/win32/win32k/ntuser/msgqueue.c | 18 +- .../subsystems/win32/win32k/ntuser/winpos.c | 30 +-- 5 files changed, 261 insertions(+), 69 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/msgqueue.h b/reactos/subsystems/win32/win32k/include/msgqueue.h index c751f3a911d..a8cc896df03 100644 --- a/reactos/subsystems/win32/win32k/include/msgqueue.h +++ b/reactos/subsystems/win32/win32k/include/msgqueue.h @@ -6,6 +6,7 @@ #define MSQ_NORMAL 0 #define MSQ_ISHOOK 1 #define MSQ_ISEVENT 2 +#define MSQ_SENTNOWAIT 0x80000000 typedef struct _USER_MESSAGE { @@ -28,6 +29,7 @@ typedef struct _USER_SENT_MESSAGE /* entry in the dispatching list of the sender's message queue */ LIST_ENTRY DispatchingListEntry; INT HookMessage; + BOOL HasPackedLParam; } USER_SENT_MESSAGE, *PUSER_SENT_MESSAGE; typedef struct _USER_SENT_MESSAGE_NOTIFY @@ -184,6 +186,20 @@ co_IntSendMessageTimeout(HWND hWnd, UINT uFlags, UINT uTimeout, ULONG_PTR *uResult); + +LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam); +LRESULT FASTCALL +co_IntSendMessageWithCallBack(HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam, + SENDASYNCPROC CompletionCallback, + ULONG_PTR CompletionCallbackContext, + ULONG_PTR *uResult); + LRESULT FASTCALL IntDispatchMessage(MSG* Msg); BOOL FASTCALL diff --git a/reactos/subsystems/win32/win32k/ntuser/focus.c b/reactos/subsystems/win32/win32k/ntuser/focus.c index 9e309ac7dcd..7a8eeeb32d6 100644 --- a/reactos/subsystems/win32/win32k/ntuser/focus.c +++ b/reactos/subsystems/win32/win32k/ntuser/focus.c @@ -53,8 +53,8 @@ co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd) { if (hWndPrev) { - co_IntPostOrSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0); - co_IntPostOrSendMessage(hWndPrev, WM_ACTIVATE, + co_IntSendMessageNoWait(hWndPrev, WM_NCACTIVATE, FALSE, 0); + co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, UserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE), (LPARAM)hWnd); } @@ -105,38 +105,19 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate) if (Window && WindowPrev) { - PWINDOW_OBJECT cWindow; - HWND *List, *phWnd; HANDLE OldTID = IntGetWndThreadId(WindowPrev); HANDLE NewTID = IntGetWndThreadId(Window); - DPRINT("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID); + DPRINT1("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID); + if (Window->Wnd->style & WS_MINIMIZE) + { + DPRINT1("Widow was nminimized\n"); + } if (OldTID != NewTID) { - List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow())); - if (List) - { - for (phWnd = List; *phWnd; ++phWnd) - { - cWindow = UserGetWindowObject(*phWnd); - if (cWindow && (IntGetWndThreadId(cWindow) == OldTID)) - { // FALSE if the window is being deactivated, - // ThreadId that owns the window being activated. - co_IntPostOrSendMessage(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID); - } - } - for (phWnd = List; *phWnd; ++phWnd) - { - cWindow = UserGetWindowObject(*phWnd); - if (cWindow && (IntGetWndThreadId(cWindow) == NewTID)) - { // TRUE if the window is being activated, - // ThreadId that owns the window being deactivated. - co_IntPostOrSendMessage(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID); - } - } - ExFreePool(List); - } + co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID); + co_IntSendMessageNoWait(hWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID); } UserDerefObjectCo(WindowPrev); // Now allow the previous window to die. } @@ -144,10 +125,9 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate) UserDerefObjectCo(Window); /* FIXME: IntIsWindow */ - - co_IntPostOrSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0); + co_IntSendMessageNoWait(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0); /* FIXME: WA_CLICKACTIVE */ - co_IntPostOrSendMessage(hWnd, WM_ACTIVATE, + co_IntSendMessageNoWait(hWnd, WM_ACTIVATE, MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE, UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE), (LPARAM)hWndPrev); @@ -241,7 +221,9 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin co_IntSendDeactivateMessages(hWndPrev, hWnd); co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus); + IntSetFocusMessageQueue(Window->pti->MessageQueue); + if (Window->pti->MessageQueue) { Window->pti->MessageQueue->ActiveWindow = hWnd; diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 3bd92011346..39b0470c795 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -165,7 +165,7 @@ MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam) } static NTSTATUS -PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) +PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolNeeded) { NCCALCSIZE_PARAMS *UnpackedNcCalcsize; NCCALCSIZE_PARAMS *PackedNcCalcsize; @@ -173,28 +173,34 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) CREATESTRUCTW *PackedCs; PUNICODE_STRING WindowName; PUNICODE_STRING ClassName; + POOL_TYPE PoolType; UINT Size; PCHAR CsData; *lParamPacked = lParam; + + if (NonPagedPoolNeeded) + PoolType = NonPagedPool; + else + PoolType = PagedPool; + if (WM_NCCALCSIZE == Msg && wParam) { + UnpackedNcCalcsize = (NCCALCSIZE_PARAMS *) lParam; - if (UnpackedNcCalcsize->lppos != (PWINDOWPOS) (UnpackedNcCalcsize + 1)) + PackedNcCalcsize = ExAllocatePoolWithTag(PoolType, + sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS), + TAG_MSG); + + if (NULL == PackedNcCalcsize) { - PackedNcCalcsize = ExAllocatePoolWithTag(PagedPool, - sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS), - TAG_MSG); - if (NULL == PackedNcCalcsize) - { - DPRINT1("Not enough memory to pack lParam\n"); - return STATUS_NO_MEMORY; - } - RtlCopyMemory(PackedNcCalcsize, UnpackedNcCalcsize, sizeof(NCCALCSIZE_PARAMS)); - PackedNcCalcsize->lppos = (PWINDOWPOS) (PackedNcCalcsize + 1); - RtlCopyMemory(PackedNcCalcsize->lppos, UnpackedNcCalcsize->lppos, sizeof(WINDOWPOS)); - *lParamPacked = (LPARAM) PackedNcCalcsize; + DPRINT1("Not enough memory to pack lParam\n"); + return STATUS_NO_MEMORY; } + RtlCopyMemory(PackedNcCalcsize, UnpackedNcCalcsize, sizeof(NCCALCSIZE_PARAMS)); + PackedNcCalcsize->lppos = (PWINDOWPOS) (PackedNcCalcsize + 1); + RtlCopyMemory(PackedNcCalcsize->lppos, UnpackedNcCalcsize->lppos, sizeof(WINDOWPOS)); + *lParamPacked = (LPARAM) PackedNcCalcsize; } else if (WM_CREATE == Msg || WM_NCCREATE == Msg) { @@ -210,7 +216,7 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) { Size += sizeof(WCHAR) + ClassName->Length + sizeof(WCHAR); } - PackedCs = ExAllocatePoolWithTag(PagedPool, Size, TAG_MSG); + PackedCs = ExAllocatePoolWithTag(PoolType, Size, TAG_MSG); if (NULL == PackedCs) { DPRINT1("Not enough memory to pack lParam\n"); @@ -244,11 +250,28 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) *lParamPacked = (LPARAM) PackedCs; } + else if (PoolType == NonPagedPool) + { + PMSGMEMORY MsgMemoryEntry; + PVOID PackedData; + + MsgMemoryEntry = FindMsgMemory(Msg); + + if ((!MsgMemoryEntry) || (MsgMemoryEntry->Size < 0)) + { + /* Keep previous behavior */ + return STATUS_SUCCESS; + } + PackedData = ExAllocatePoolWithTag(NonPagedPool, MsgMemorySize(MsgMemoryEntry, wParam, lParam), TAG_MSG); + RtlCopyMemory(PackedData, (PVOID)lParam, MsgMemorySize(MsgMemoryEntry, wParam, lParam)); + *lParamPacked = (LPARAM)PackedData; + } + return STATUS_SUCCESS; } static NTSTATUS -UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) +UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolUsed) { NCCALCSIZE_PARAMS *UnpackedParams; NCCALCSIZE_PARAMS *PackedParams; @@ -277,6 +300,23 @@ UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) return STATUS_SUCCESS; } + else if (NonPagedPoolUsed) + { + PMSGMEMORY MsgMemoryEntry; + MsgMemoryEntry = FindMsgMemory(Msg); + if (MsgMemoryEntry->Size < 0) + { + /* Keep previous behavior */ + return STATUS_INVALID_PARAMETER; + } + + if (MsgMemory->Flags == MMS_FLAG_READWRITE) + { + //RtlCopyMemory((PVOID)lParam, (PVOID)lParamPacked, MsgMemory->Size); + } + ExFreePool((PVOID) lParamPacked); + return STATUS_SUCCESS; + } ASSERT(FALSE); @@ -394,7 +434,7 @@ IntDispatchMessage(PMSG pMsg) lParamBufferSize = MsgMemorySize(MsgMemoryEntry, pMsg->wParam, pMsg->lParam); } - if (! NT_SUCCESS(PackParam(&lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam))) + if (! NT_SUCCESS(PackParam(&lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam, FALSE))) { DPRINT1("Failed to pack message parameters\n"); return 0; @@ -408,7 +448,7 @@ IntDispatchMessage(PMSG pMsg) lParamPacked, lParamBufferSize); - if (! NT_SUCCESS(UnpackParam(lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam))) + if (! NT_SUCCESS(UnpackParam(lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam, FALSE))) { DPRINT1("Failed to unpack message parameters\n"); } @@ -1372,7 +1412,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd, lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam); } - if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam))) + if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, FALSE))) { DPRINT1("Failed to pack message parameters\n"); RETURN( FALSE); @@ -1392,7 +1432,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd, IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); - if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam))) + if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE))) { DPRINT1("Failed to unpack message parameters\n"); RETURN( TRUE); @@ -1499,6 +1539,148 @@ co_IntSendMessageTimeout( HWND hWnd, return (LRESULT) TRUE; } +LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam) +{ + ULONG_PTR Result = 0; + co_IntSendMessageWithCallBack(hWnd, + Msg, + wParam, + lParam, + NULL, + 0, + &Result); + return Result; +} + +LRESULT FASTCALL +co_IntSendMessageWithCallBack( HWND hWnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam, + SENDASYNCPROC CompletionCallback, + ULONG_PTR CompletionCallbackContext, + ULONG_PTR *uResult) +{ + ULONG_PTR Result; + PWINDOW_OBJECT Window = NULL; + PMSGMEMORY MsgMemoryEntry; + INT lParamBufferSize; + LPARAM lParamPacked; + PTHREADINFO Win32Thread; + DECLARE_RETURN(LRESULT); + USER_REFERENCE_ENTRY Ref; + PUSER_SENT_MESSAGE Message; + + if (!(Window = UserGetWindowObject(hWnd))) + { + RETURN(FALSE); + } + + UserRefObjectCo(Window, &Ref); + + if (Window->state & WINDOWSTATUS_DESTROYING) + { + /* FIXME - last error? */ + DPRINT1("Attempted to send message to window 0x%x that is being destroyed!\n", hWnd); + RETURN(FALSE); + } + + Win32Thread = PsGetCurrentThreadWin32Thread(); + + IntCallWndProc( Window, hWnd, Msg, wParam, lParam); + + if (Win32Thread == NULL) + { + ASSERT(FALSE); + RETURN(FALSE); + } + + if (Win32Thread->TIF_flags & TIF_INCLEANUP) + { + /* Never send messages to exiting threads */ + RETURN(FALSE); + } + + /* See if this message type is present in the table */ + MsgMemoryEntry = FindMsgMemory(Msg); + if (NULL == MsgMemoryEntry) + { + lParamBufferSize = -1; + } + else + { + lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam); + } + + if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, Window->pti->MessageQueue != Win32Thread->MessageQueue))) + { + DPRINT1("Failed to pack message parameters\n"); + RETURN( FALSE); + } + + /* If this is not a callback and it can be sent now, then send it. */ + if ((Window->pti->MessageQueue == Win32Thread->MessageQueue) && (CompletionCallback == NULL)) + { + + Result = (ULONG_PTR)co_IntCallWindowProc( Window->Wnd->lpfnWndProc, + !Window->Wnd->Unicode, + hWnd, + Msg, + wParam, + lParamPacked, + lParamBufferSize ); + if(uResult) + { + *uResult = Result; + } + } + + IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); + + if (Window->pti->MessageQueue == Win32Thread->MessageQueue) + { + if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE))) + { + DPRINT1("Failed to unpack message parameters\n"); + RETURN(TRUE); + } + RETURN(TRUE); + } + + if(!(Message = ExAllocatePoolWithTag(NonPagedPool, sizeof(USER_SENT_MESSAGE), TAG_USRMSG))) + { + DPRINT1("MsqSendMessage(): Not enough memory to allocate a message"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + Message->Msg.hwnd = hWnd; + Message->Msg.message = Msg; + Message->Msg.wParam = wParam; + Message->Msg.lParam = lParamPacked; + Message->CompletionEvent = NULL; + Message->Result = 0; + Message->SenderQueue = Win32Thread->MessageQueue; + IntReferenceMessageQueue(Message->SenderQueue); + IntReferenceMessageQueue(Window->pti->MessageQueue); + Message->CompletionCallback = CompletionCallback; + Message->CompletionCallbackContext = CompletionCallbackContext; + Message->HookMessage = MSQ_NORMAL | MSQ_SENTNOWAIT; + Message->HasPackedLParam = (lParamBufferSize > 0); + + InsertTailList(&Window->pti->MessageQueue->SentMessagesListHead, &Message->ListEntry); + InsertTailList(&Win32Thread->MessageQueue->DispatchingMessagesHead, &Message->DispatchingListEntry); + IntDereferenceMessageQueue(Window->pti->MessageQueue); + IntDereferenceMessageQueue(Message->SenderQueue); + + RETURN(TRUE); + +CLEANUP: + if (Window) UserDerefObjectCo(Window); + END_CLEANUP; +} /* This function posts a message if the destination's message queue belongs to another thread, otherwise it sends the message. It does not support broadcast diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 16323aeb5c4..4b45bac5c21 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -969,7 +969,7 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue) /* remove the message from the dispatching list, so lock the sender's message queue */ SenderReturned = (Message->DispatchingListEntry.Flink == NULL); - if(!SenderReturned) + if (!SenderReturned) { /* only remove it from the dispatching list if not already removed by a timeout */ RemoveEntryList(&Message->DispatchingListEntry); @@ -983,6 +983,12 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue) *Message->Result = Result; } + if (Message->HasPackedLParam == TRUE) + { + if (Message->Msg.lParam) + ExFreePool((PVOID)Message->Msg.lParam); + } + /* Notify the sender. */ if (Message->CompletionEvent != NULL) { @@ -1010,9 +1016,12 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue) Notified: - /* dereference both sender and our queue */ - IntDereferenceMessageQueue(MessageQueue); - IntDereferenceMessageQueue(Message->SenderQueue); + /* Only if it is not a no wait message */ + if (!(Message->HookMessage & MSQ_SENTNOWAIT)) + { + IntDereferenceMessageQueue(Message->SenderQueue); + IntDereferenceMessageQueue(MessageQueue); + } /* free the message */ ExFreePool(Message); @@ -1147,6 +1156,7 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue, IntReferenceMessageQueue(ThreadQueue); Message->CompletionCallback = NULL; Message->HookMessage = HookMessage; + Message->HasPackedLParam = FALSE; IntReferenceMessageQueue(MessageQueue); diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index ab45d978c41..6b5b0d9d6f6 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -69,9 +69,6 @@ IntGetClientOrigin(PWINDOW_OBJECT Window OPTIONAL, LPPOINT Point) return TRUE; } - - - BOOL FASTCALL UserGetClientOrigin(PWINDOW_OBJECT Window, LPPOINT Point) { @@ -120,8 +117,13 @@ BOOL FASTCALL can_activate_window( PWINDOW_OBJECT Wnd OPTIONAL) style = Wnd->Wnd->style; if (!(style & WS_VISIBLE) && Wnd->pti->pEThread->ThreadsProcess != CsrProcess) return FALSE; + if ((style & WS_MINIMIZE) && + Wnd->pti->pEThread->ThreadsProcess != CsrProcess) return FALSE; if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE; - return !(style & WS_DISABLED); + return TRUE; + /* FIXME: This window could be disable because the child that closed + was a popup. */ + //return !(style & WS_DISABLED); } @@ -312,7 +314,7 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos) if (Wnd->style & WS_MINIMIZE) { - if (!co_IntSendMessage(Window->hSelf, WM_QUERYOPEN, 0, 0)) + if (!co_IntSendMessageNoWait(Window->hSelf, WM_QUERYOPEN, 0, 0)) { return(SWP_NOSIZE | SWP_NOMOVE); } @@ -531,7 +533,7 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos, params.lppos = &winposCopy; winposCopy = *WinPos; - wvrFlags = co_IntSendMessage(Window->hSelf, WM_NCCALCSIZE, TRUE, (LPARAM) ¶ms); + wvrFlags = co_IntSendMessageNoWait(Window->hSelf, WM_NCCALCSIZE, TRUE, (LPARAM) ¶ms); /* If the application send back garbage, ignore it */ if (params.rgrc[0].left <= params.rgrc[0].right && @@ -590,7 +592,7 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window, if (!(WinPos->flags & SWP_NOSENDCHANGING)) { - co_IntPostOrSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); + co_IntSendMessageNoWait(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); } *WindowRect = Wnd->rcWindow; @@ -1320,7 +1322,7 @@ co_WinPosSetWindowPos( { if ((Window->Wnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD) { - co_IntSendMessage(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0); + co_IntSendMessageNoWait(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0); } else { @@ -1330,7 +1332,7 @@ co_WinPosSetWindowPos( } if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) - co_IntPostOrSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos); + co_IntSendMessageNoWait(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos); return TRUE; } @@ -1343,7 +1345,7 @@ co_WinPosGetNonClientSize(PWINDOW_OBJECT Window, RECT* WindowRect, RECT* ClientR ASSERT_REFS_CO(Window); *ClientRect = *WindowRect; - Result = co_IntSendMessage(Window->hSelf, WM_NCCALCSIZE, FALSE, (LPARAM) ClientRect); + Result = co_IntSendMessageNoWait(Window->hSelf, WM_NCCALCSIZE, FALSE, (LPARAM) ClientRect); FixClientRect(ClientRect, WindowRect); @@ -1462,7 +1464,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd) if (ShowFlag != WasVisible) { - co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0); + co_IntSendMessageNoWait(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0); } /* We can't activate a child window */ @@ -1476,7 +1478,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd) ? HWND_TOPMOST : HWND_TOP, NewPos.left, NewPos.top, NewPos.right, NewPos.bottom, LOWORD(Swp)); - if (Cmd == SW_HIDE) + if ((Cmd == SW_HIDE) || (Cmd == SW_MINIMIZE)) { PWINDOW_OBJECT ThreadFocusWindow; @@ -1520,12 +1522,12 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd) wParam = SIZE_MINIMIZED; } - co_IntSendMessage(Window->hSelf, WM_SIZE, wParam, + co_IntSendMessageNoWait(Window->hSelf, WM_SIZE, wParam, MAKELONG(Wnd->rcClient.right - Wnd->rcClient.left, Wnd->rcClient.bottom - Wnd->rcClient.top)); - co_IntSendMessage(Window->hSelf, WM_MOVE, 0, + co_IntSendMessageNoWait(Window->hSelf, WM_MOVE, 0, MAKELONG(Wnd->rcClient.left, Wnd->rcClient.top)); IntEngWindowChanged(Window, WOC_RGN_CLIENT); From 4545e038a2fbaf4674de61da4366745c9376c60a Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Sat, 8 May 2010 16:27:15 +0000 Subject: [PATCH 024/151] Disable test_GetLongPathNameW() in kernel32:path test for now. Fixes testbot crash, bug 5370 svn path=/trunk/; revision=47127 --- rostests/winetests/kernel32/path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rostests/winetests/kernel32/path.c b/rostests/winetests/kernel32/path.c index 8232fdfaaa7..c418ef245ea 100755 --- a/rostests/winetests/kernel32/path.c +++ b/rostests/winetests/kernel32/path.c @@ -1601,7 +1601,8 @@ START_TEST(path) test_CleanupPathA(origdir,curdir); test_GetTempPath(); test_GetLongPathNameA(); - test_GetLongPathNameW(); + skip("skipping test_GetLongPathNameW(), bug 5370\n"); + //test_GetLongPathNameW(); test_GetShortPathNameW(); test_GetSystemDirectory(); test_GetWindowsDirectory(); From 0963ef8f610372bc04353244e77c6aab9e2e9601 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sat, 8 May 2010 16:27:36 +0000 Subject: [PATCH 025/151] Add some win32k/gdi DC tests created by Jerome Gardou svn path=/trunk/; revision=47128 --- .../w32knapi/ntgdi/NtGdiCreateCompatibleDC.c | 2 ++ .../w32knapi/ntgdi/NtGdiDeleteObjectApp.c | 22 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c index a53821b5889..3597eb67dca 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c @@ -22,6 +22,8 @@ Test_NtGdiCreateCompatibleDC(PTESTINFO pti) hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); TEST(hObj == GetStockObject(BLACK_PEN)); + TEST(NtGdiDeleteObjectApp(hDC) != 0); + return APISTATUS_NORMAL; } diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c index ef4daa228bd..0084b109a9a 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c @@ -16,7 +16,7 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti) TEST(NtGdiDeleteObjectApp((PVOID)(GDI_HANDLE_STOCK_MASK | 0x1234)) == 1); TEST(GetLastError() == 0); - /* Delete a DC */ + /* Delete a compatible DC */ SetLastError(0); hdc = CreateCompatibleDC(NULL); ASSERT(IsHandleValid(hdc) == 1); @@ -24,6 +24,26 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti) TEST(GetLastError() == 0); TEST(IsHandleValid(hdc) == 0); + /* Delete a display DC */ + SetLastError(0); + hdc = CreateDC("DISPLAY", NULL, NULL, NULL); + ASSERT(IsHandleValid(hdc) == 1); + TEST(NtGdiDeleteObjectApp(hdc) != 0); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hdc) == 1); + TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); + TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); + + /* Once more */ + SetLastError(0); + hdc = GetDC(0); + ASSERT(IsHandleValid(hdc) == 1); + TEST(NtGdiDeleteObjectApp(hdc) != 0); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hdc) == 1); + TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); + TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); + /* Delete a brush */ SetLastError(0); hbrush = CreateSolidBrush(0x123456); From e03efb63b2b6e78b4318041d4da2a1021020dfdc Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 8 May 2010 16:30:56 +0000 Subject: [PATCH 026/151] [WINLOGON] - Move environment creation to a separate file. - Impersonate the new user and create the 'Volatile Environment' key for the new user. svn path=/trunk/; revision=47129 --- reactos/base/system/winlogon/environment.c | 129 +++++++++++++++++++ reactos/base/system/winlogon/sas.c | 51 +------- reactos/base/system/winlogon/winlogon.h | 6 + reactos/base/system/winlogon/winlogon.rbuild | 1 + 4 files changed, 138 insertions(+), 49 deletions(-) create mode 100644 reactos/base/system/winlogon/environment.c diff --git a/reactos/base/system/winlogon/environment.c b/reactos/base/system/winlogon/environment.c new file mode 100644 index 00000000000..f0beeba90bd --- /dev/null +++ b/reactos/base/system/winlogon/environment.c @@ -0,0 +1,129 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Winlogon + * FILE: base/system/winlogon/environment.c + * PURPOSE: User environment routines + * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net) + * Herv Poussineau (hpoussin@reactos.org) + * Eric Kohl + */ + +/* INCLUDES *****************************************************************/ + +#include "winlogon.h" + +#include + +WINE_DEFAULT_DEBUG_CHANNEL(winlogon); + +/* GLOBALS ******************************************************************/ + + +/* FUNCTIONS ****************************************************************/ + +BOOL +CreateUserEnvironment(IN PWLSESSION Session, + IN LPVOID *lpEnvironment, + IN LPWSTR *lpFullEnv) +{ + LPCWSTR wstr; + SIZE_T EnvBlockSize = 0, ProfileSize = 0; + LPVOID lpEnviron = NULL; + LPWSTR lpFullEnviron = NULL; + HKEY hKey; + DWORD dwDisp; + LONG lError; + HKEY hKeyCurrentUser; + + TRACE("WL: CreateUserEnvironment called\n"); + + /* Create environment block for the user */ + if (!CreateEnvironmentBlock(&lpEnviron, + Session->UserToken, + TRUE)) + { + WARN("WL: CreateEnvironmentBlock() failed\n"); + return FALSE; + } + + if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment) + { + /* Count required size for full environment */ + wstr = (LPCWSTR)lpEnviron; + while (*wstr != UNICODE_NULL) + { + SIZE_T size = wcslen(wstr) + 1; + wstr += size; + EnvBlockSize += size; + } + + wstr = Session->Profile->pszEnvironment; + while (*wstr != UNICODE_NULL) + { + SIZE_T size = wcslen(wstr) + 1; + wstr += size; + ProfileSize += size; + } + + /* Allocate enough memory */ + lpFullEnviron = HeapAlloc(GetProcessHeap, 0, (EnvBlockSize + ProfileSize + 1) * sizeof(WCHAR)); + if (!lpFullEnviron) + { + TRACE("HeapAlloc() failed\n"); + return FALSE; + } + + /* Fill user environment block */ + CopyMemory(lpFullEnviron, + lpEnviron, + EnvBlockSize * sizeof(WCHAR)); + CopyMemory(&lpFullEnviron[EnvBlockSize], + Session->Profile->pszEnvironment, + ProfileSize * sizeof(WCHAR)); + lpFullEnviron[EnvBlockSize + ProfileSize] = UNICODE_NULL; + } + else + { + lpFullEnviron = (LPWSTR)lpEnviron; + } + + /* Impersonate the new user */ + ImpersonateLoggedOnUser(Session->UserToken); + + /* Open the new users HKCU key */ + lError = RegOpenCurrentUser(KEY_CREATE_SUB_KEY, + &hKeyCurrentUser); + if (lError == ERROR_SUCCESS) + { + /* Create the 'Volatile Environment' key */ + lError = RegCreateKeyExW(hKeyCurrentUser, + L"Volatile Environment", + 0, + NULL, + REG_OPTION_VOLATILE, + KEY_WRITE, + NULL, + &hKey, + &dwDisp); + if (lError == ERROR_SUCCESS) + { + RegCloseKey(hKey); + } + else + { + WARN("WL: RegCreateKeyExW() failed (Error: %ld)\n", lError); + } + + RegCloseKey(hKeyCurrentUser); + } + + /* Revert the impersonation */ + RevertToSelf(); + + *lpEnvironment = lpEnviron; + *lpFullEnv = lpFullEnviron; + + TRACE("WL: CreateUserEnvironment done\n"); + + return TRUE; +} diff --git a/reactos/base/system/winlogon/sas.c b/reactos/base/system/winlogon/sas.c index f560187d702..baecf988a73 100644 --- a/reactos/base/system/winlogon/sas.c +++ b/reactos/base/system/winlogon/sas.c @@ -171,8 +171,6 @@ HandleLogon( PROFILEINFOW ProfileInfo; LPVOID lpEnvironment = NULL; LPWSTR lpFullEnv = NULL; - LPCWSTR wstr; - SIZE_T EnvBlockSize = 0, ProfileSize = 0; BOOLEAN Old; BOOL ret = FALSE; @@ -210,57 +208,12 @@ HandleLogon( } /* Create environment block for the user */ - if (!CreateEnvironmentBlock( - &lpEnvironment, - Session->UserToken, - TRUE)) + if (!CreateUserEnvironment(Session, &lpEnvironment, &lpFullEnv)) { - WARN("WL: CreateEnvironmentBlock() failed\n"); + WARN("WL: SetUserEnvironment() failed\n"); goto cleanup; } - if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment) - { - /* Count required size for full environment */ - wstr = (LPCWSTR)lpEnvironment; - while (*wstr != UNICODE_NULL) - { - SIZE_T size = wcslen(wstr) + 1; - wstr += size; - EnvBlockSize += size; - } - wstr = Session->Profile->pszEnvironment; - while (*wstr != UNICODE_NULL) - { - SIZE_T size = wcslen(wstr) + 1; - wstr += size; - ProfileSize += size; - } - - /* Allocate enough memory */ - lpFullEnv = HeapAlloc(GetProcessHeap, 0, (EnvBlockSize + ProfileSize + 1) * sizeof(WCHAR)); - if (!lpFullEnv) - { - TRACE("HeapAlloc() failed\n"); - goto cleanup; - } - - /* Fill user environment block */ - CopyMemory( - lpFullEnv, - lpEnvironment, - EnvBlockSize * sizeof(WCHAR)); - CopyMemory( - &lpFullEnv[EnvBlockSize], - Session->Profile->pszEnvironment, - ProfileSize * sizeof(WCHAR)); - lpFullEnv[EnvBlockSize + ProfileSize] = UNICODE_NULL; - } - else - { - lpFullEnv = (LPWSTR)lpEnvironment; - } - DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS); UpdatePerUserSystemParameters(0, TRUE); diff --git a/reactos/base/system/winlogon/winlogon.h b/reactos/base/system/winlogon/winlogon.h index 2df4e3aec03..c03bf697925 100644 --- a/reactos/base/system/winlogon/winlogon.h +++ b/reactos/base/system/winlogon/winlogon.h @@ -180,6 +180,12 @@ BOOL WINAPI UpdatePerUserSystemParameters(DWORD dwUnknown, DWORD dwReserved); +/* environment.c */ +BOOL +CreateUserEnvironment(IN PWLSESSION Session, + IN LPVOID *lpEnvironment, + IN LPWSTR *lpFullEnv); + /* sas.c */ BOOL SetDefaultLanguage( diff --git a/reactos/base/system/winlogon/winlogon.rbuild b/reactos/base/system/winlogon/winlogon.rbuild index 6a75ed19015..cc5b2a33ddc 100644 --- a/reactos/base/system/winlogon/winlogon.rbuild +++ b/reactos/base/system/winlogon/winlogon.rbuild @@ -8,6 +8,7 @@ advapi32 userenv secur32 + environment.c sas.c screensaver.c setup.c From 2545e830845a92035d3f4050a960f118f1d0251e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 May 2010 16:38:05 +0000 Subject: [PATCH 027/151] [w32knapi} Patch by Jerome Gardou: add some more tests for NtGdiDeleteObjectApp svn path=/trunk/; revision=47130 --- .../w32knapi/ntgdi/NtGdiCreateCompatibleDC.c | 2 ++ .../w32knapi/ntgdi/NtGdiDeleteObjectApp.c | 22 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c index 3597eb67dca..130e1005bd1 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c @@ -21,6 +21,8 @@ Test_NtGdiCreateCompatibleDC(PTESTINFO pti) /* The default pen should be GetStockObject(BLACK_PEN) */ hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); TEST(hObj == GetStockObject(BLACK_PEN)); + + TEST(NtGdiDeleteObjectApp(hDC) != 0); TEST(NtGdiDeleteObjectApp(hDC) != 0); diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c index 0084b109a9a..53d8d251b1a 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c @@ -23,7 +23,27 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti) TEST(NtGdiDeleteObjectApp(hdc) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hdc) == 0); - + + /* Delete a display DC */ + SetLastError(0); + hdc = CreateDC("DISPLAY", NULL, NULL, NULL); + ASSERT(IsHandleValid(hdc) == 1); + TEST(NtGdiDeleteObjectApp(hdc) != 0); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hdc) == 1); + TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); + TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); + + /* Once more */ + SetLastError(0); + hdc = GetDC(0); + ASSERT(IsHandleValid(hdc) == 1); + TEST(NtGdiDeleteObjectApp(hdc) != 0); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hdc) == 1); + TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); + TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); + /* Delete a display DC */ SetLastError(0); hdc = CreateDC("DISPLAY", NULL, NULL, NULL); From bfe6479cf7d995ce442f18857b1208028d6ae643 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 8 May 2010 16:42:03 +0000 Subject: [PATCH 028/151] Revert r47130, it was already comitted. svn path=/trunk/; revision=47132 --- .../w32knapi/ntgdi/NtGdiCreateCompatibleDC.c | 2 -- .../w32knapi/ntgdi/NtGdiDeleteObjectApp.c | 22 +------------------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c index 130e1005bd1..3597eb67dca 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c @@ -21,8 +21,6 @@ Test_NtGdiCreateCompatibleDC(PTESTINFO pti) /* The default pen should be GetStockObject(BLACK_PEN) */ hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); TEST(hObj == GetStockObject(BLACK_PEN)); - - TEST(NtGdiDeleteObjectApp(hDC) != 0); TEST(NtGdiDeleteObjectApp(hDC) != 0); diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c index 53d8d251b1a..0084b109a9a 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c @@ -23,27 +23,7 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti) TEST(NtGdiDeleteObjectApp(hdc) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hdc) == 0); - - /* Delete a display DC */ - SetLastError(0); - hdc = CreateDC("DISPLAY", NULL, NULL, NULL); - ASSERT(IsHandleValid(hdc) == 1); - TEST(NtGdiDeleteObjectApp(hdc) != 0); - TEST(GetLastError() == 0); - TEST(IsHandleValid(hdc) == 1); - TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); - TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); - - /* Once more */ - SetLastError(0); - hdc = GetDC(0); - ASSERT(IsHandleValid(hdc) == 1); - TEST(NtGdiDeleteObjectApp(hdc) != 0); - TEST(GetLastError() == 0); - TEST(IsHandleValid(hdc) == 1); - TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); - TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); - + /* Delete a display DC */ SetLastError(0); hdc = CreateDC("DISPLAY", NULL, NULL, NULL); From 006a12e270c2736191a1edd87880556604c9d03c Mon Sep 17 00:00:00 2001 From: Kamil Hornicek Date: Sat, 8 May 2010 18:09:45 +0000 Subject: [PATCH 029/151] [WIN32K] - Bring back support for RLE compressed bitmaps. - Merge the decompress functions for 4bb and 8bpp bitmaps to one generic function. - Simplify SURFMEM_bCreateDib a bit by not allowing PNG/JPEG compression at all. See issue #5276 for more details. svn path=/trunk/; revision=47134 --- reactos/subsystems/win32/win32k/eng/surface.c | 228 ++++++++---------- 1 file changed, 99 insertions(+), 129 deletions(-) diff --git a/reactos/subsystems/win32/win32k/eng/surface.c b/reactos/subsystems/win32/win32k/eng/surface.c index c081ed51571..126ae9542ce 100644 --- a/reactos/subsystems/win32/win32k/eng/surface.c +++ b/reactos/subsystems/win32/win32k/eng/surface.c @@ -204,108 +204,59 @@ EngCreateDeviceBitmap(IN DHSURF dhsurf, return NewBitmap; } -VOID Decompress4bpp(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta) +BOOL DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta, ULONG Format) { - int x = 0; - int y = Size.cy - 1; - int c; - int length; - int width = ((Size.cx+1)/2); - int height = Size.cy - 1; + INT x = 0; + INT y = Size.cy - 1; + INT c; + INT length; + INT width; + INT height = Size.cy - 1; BYTE *begin = CompressedBits; BYTE *bits = CompressedBits; BYTE *temp; - while (y >= 0) - { - length = *bits++ / 2; - if (length) - { - c = *bits++; - while (length--) - { - if (x >= width) break; - temp = UncompressedBits + (((height - y) * Delta) + x); - x++; - *temp = c; - } - } - else - { - length = *bits++; - switch (length) - { - case RLE_EOL: - x = 0; - y--; - break; - case RLE_END: - return; - case RLE_DELTA: - x += (*bits++)/2; - y -= (*bits++)/2; - break; - default: - length /= 2; - while (length--) - { - c = *bits++; - if (x < width) - { - temp = UncompressedBits + (((height - y) * Delta) + x); - x++; - *temp = c; - } - } - if ((bits - begin) & 1) - { - bits++; - } - } - } - } -} + INT shift = 0; -VOID Decompress8bpp(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta) -{ - int x = 0; - int y = Size.cy - 1; - int c; - int length; - int width = Size.cx; - int height = Size.cy - 1; - BYTE *begin = CompressedBits; - BYTE *bits = CompressedBits; - BYTE *temp; - while (y >= 0) + if (Format == BMF_4RLE) + shift = 1; + else if(Format != BMF_8RLE) + return FALSE; + + width = ((Size.cx + shift) >> shift); + + _SEH2_TRY { - length = *bits++; - if (length) + while (y >= 0) { - c = *bits++; - while (length--) + length = (*bits++) >> shift; + if (length) { - if (x >= width) break; - temp = UncompressedBits + (((height - y) * Delta) + x); - x++; - *temp = c; + c = *bits++; + while (length--) + { + if (x >= width) break; + temp = UncompressedBits + (((height - y) * Delta) + x); + x++; + *temp = c; + } } - } - else - { - length = *bits++; - switch (length) + else { + length = *bits++; + switch (length) + { case RLE_EOL: x = 0; y--; break; case RLE_END: - return; + _SEH2_YIELD(return TRUE); case RLE_DELTA: - x += *bits++; - y -= *bits++; + x += (*bits++) >> shift; + y -= (*bits++) >> shift; break; default: + length = length >> shift; while (length--) { c = *bits++; @@ -320,9 +271,18 @@ VOID Decompress8bpp(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LO { bits++; } + } } } } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + DPRINT1("Decoding error\n"); + _SEH2_YIELD(return FALSE); + } + _SEH2_END; + + return TRUE; } HBITMAP FASTCALL @@ -362,7 +322,7 @@ IntCreateBitmap(IN SIZEL Size, pso->cjBits = pso->lDelta * Size.cy; UncompressedFormat = BMF_4BPP; UncompressedBits = EngAllocMem(FL_ZERO_MEMORY, pso->cjBits, TAG_DIB); - Decompress4bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, pso->lDelta); + DecompressBitmap(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, pso->lDelta, Format); } else if (Format == BMF_8RLE) { @@ -370,7 +330,7 @@ IntCreateBitmap(IN SIZEL Size, pso->cjBits = pso->lDelta * Size.cy; UncompressedFormat = BMF_8BPP; UncompressedBits = EngAllocMem(FL_ZERO_MEMORY, pso->cjBits, TAG_DIB); - Decompress8bpp(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, pso->lDelta); + DecompressBitmap(Size, (BYTE *)Bits, (BYTE *)UncompressedBits, pso->lDelta, Format); } else { @@ -467,6 +427,7 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, PSURFACE psurf; SIZEL LocalSize; BOOLEAN AllocatedLocally = FALSE; + PVOID DecompressedBits = NULL; /* * First, check the format so we can get the aligned scanline width. @@ -500,17 +461,29 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, break; case BMF_8RLE: - case BMF_4RLE: - case BMF_JPEG: - case BMF_PNG: + ScanLine = (BitmapInfo->Width + 3) & ~3; Compressed = TRUE; break; + case BMF_4RLE: + ScanLine = ((BitmapInfo->Width + 7) & ~7) >> 1; + Compressed = TRUE; + break; + + case BMF_JPEG: + case BMF_PNG: + ASSERT(FALSE); // ENGDDI shouldn't be creating PNGs for drivers ;-) + DPRINT1("No support for JPEG and PNG formats\n"); + return NULL; default: DPRINT1("Invalid bitmap format\n"); return NULL; } + /* Save local bitmap size */ + LocalSize.cy = BitmapInfo->Height; + LocalSize.cx = BitmapInfo->Width; + /* Does the device manage its own surface? */ if (!Bits) { @@ -519,7 +492,8 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, { /* Note: we should not be seeing this scenario from ENGDDI */ ASSERT(FALSE); - Size = BitmapInfo->Size; + DPRINT1("RLE compressed bitmap requested with no valid bitmap bits\n"); + return NULL; } else { @@ -551,6 +525,22 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, { /* Should not have asked for user memory */ ASSERT((BitmapInfo->Flags & BMF_USERMEM) == 0); + + if (Compressed) + { + DecompressedBits = EngAllocMem(FL_ZERO_MEMORY, BitmapInfo->Height * ScanLine, TAG_DIB); + + if(!DecompressedBits) + return NULL; + + if(!DecompressBitmap(LocalSize, (BYTE *)Bits, (BYTE *)DecompressedBits, ScanLine, BitmapInfo->Format)) + { + EngFreeMem(DecompressedBits); + return NULL; + } + + BitmapInfo->Format = (BitmapInfo->Format == BMF_4RLE) ? BMF_4BPP : BMF_8BPP; + } } /* Allocate the actual surface object structure */ @@ -564,6 +554,8 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, else EngFreeMem(Bits); } + if (DecompressedBits) + EngFreeMem(DecompressedBits); return NULL; } @@ -584,11 +576,9 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, pso->fjBitmap = BitmapInfo->Flags & (BMF_TOPDOWN | BMF_UMPDMEM | BMF_USERMEM); /* Save size and type */ - LocalSize.cy = BitmapInfo->Height; - LocalSize.cx = BitmapInfo->Width; pso->sizlBitmap = LocalSize; pso->iType = STYPE_BITMAP; - + /* Device-managed surface, no flags or dimension */ pso->dhsurf = 0; pso->dhpdev = NULL; @@ -599,48 +589,28 @@ SURFMEM_bCreateDib(IN PDEVBITMAPINFO BitmapInfo, psurf->hSecure = NULL; psurf->hDIBSection = NULL; psurf->flHooks = 0; - + /* Set bits */ - pso->pvBits = Bits; - - /* Check for bitmap type */ - if (!Compressed) + if(Compressed) + pso->pvBits = DecompressedBits; + else + pso->pvBits = Bits; + + /* Number of bits is based on the height times the scanline */ + pso->cjBits = BitmapInfo->Height * ScanLine; + if (BitmapInfo->Flags & BMF_TOPDOWN) { - /* Number of bits is based on the height times the scanline */ - pso->cjBits = BitmapInfo->Height * ScanLine; - if (BitmapInfo->Flags & BMF_TOPDOWN) - { - /* For topdown, the base address starts with the bits */ - pso->pvScan0 = pso->pvBits; - pso->lDelta = ScanLine; - } - else - { - /* Otherwise we start with the end and go up */ - pso->pvScan0 = (PVOID)((ULONG_PTR)pso->pvBits + pso->cjBits - ScanLine); - pso->lDelta = -ScanLine; - } + /* For topdown, the base address starts with the bits */ + pso->pvScan0 = pso->pvBits; + pso->lDelta = ScanLine; } else { - /* Compressed surfaces don't have scanlines! */ - pso->lDelta = 0; - pso->cjBits = BitmapInfo->Size; - - /* Check for JPG or PNG */ - if ((BitmapInfo->Format != BMF_JPEG) && (BitmapInfo->Format != BMF_PNG)) - { - /* Wherever the bit data is */ - pso->pvScan0 = pso->pvBits; - } - else - { - /* Fancy formats don't use a base address */ - pso->pvScan0 = NULL; - ASSERT(FALSE); // ENGDDI shouldn't be creating PNGs for drivers ;-) - } + /* Otherwise we start with the end and go up */ + pso->pvScan0 = (PVOID)((ULONG_PTR)pso->pvBits + pso->cjBits - ScanLine); + pso->lDelta = -ScanLine; } - + /* Finally set the handle and uniq */ pso->hsurf = (HSURF)psurf->BaseObject.hHmgr; pso->iUniq = 0; From 438916ee96fb83e24a9e1315edfae6270976b90f Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 8 May 2010 20:38:58 +0000 Subject: [PATCH 030/151] - Fix release build. svn path=/trunk/; revision=47135 --- reactos/boot/freeldr/freeldr/setupldr.rbuild | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/setupldr.rbuild b/reactos/boot/freeldr/freeldr/setupldr.rbuild index 0a352f48602..f951fcc3dc0 100644 --- a/reactos/boot/freeldr/freeldr/setupldr.rbuild +++ b/reactos/boot/freeldr/freeldr/setupldr.rbuild @@ -5,13 +5,13 @@ freeldr_startup freeldr_base64k freeldr_base + mini_hal freeldr_arch setupldr_main rossym cmlib rtl libcntpr - mini_hal -nostartfiles -nostdlib From 1bd675f802650f6ddfaf93d553c088a60c2a4771 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 8 May 2010 21:53:57 +0000 Subject: [PATCH 031/151] [USBDRIVER] - Fix an off-by-one error in the probing code - Scan all PCI buses instead of just the first two - Fix a horrible bug that resulted in reinitializing EHCI controllers as UHCI controllers which caused a crash on VirtualBox (with _MULTI_UHCI) - Implement support for multiple EHCI controllers and enable support for multiple UHCI controllers (greatly increases compatibility with real hardware because the first controller detected is often internal) svn path=/trunk/; revision=47136 --- .../drivers/usb/nt4compat/usbdriver/ehci.c | 23 +++++++++++++------ .../drivers/usb/nt4compat/usbdriver/uhci.c | 23 +++++++++---------- .../usb/nt4compat/usbdriver/usbdriver.rbuild | 2 ++ 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c index 02257052378..9bc6cd90f9b 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c @@ -3461,18 +3461,19 @@ ehci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER d PDEVICE_OBJECT pdev; BYTE buffer[sizeof(PCI_COMMON_CONFIG)]; PEHCI_DEVICE_EXTENSION pdev_ext; + LONG count = 0; slot_num.u.AsULONG = 0; pci_config = (PPCI_COMMON_CONFIG) buffer; pdev = NULL; - //scan the bus to find ehci controller - for(bus = 0; bus < 3; bus++) /* enum bus0-bus2 */ + //scan the PCI buses to find ehci controller + for (bus = 0; bus <= PCI_MAX_BRIDGE_NUMBER; bus++) //Yes, it should be <= { - for(i = 0; i < PCI_MAX_DEVICES; i++) + for(i = 0; i <= PCI_MAX_DEVICES; i++) { slot_num.u.bits.DeviceNumber = i; - for(j = 0; j < PCI_MAX_FUNCTIONS; j++) + for(j = 0; j <= PCI_MAX_FUNCTION; j++) { slot_num.u.bits.FunctionNumber = j; @@ -3490,9 +3491,12 @@ ehci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER d { //well, we find our usb host controller( EHCI ), create device pdev = ehci_alloc(drvr_obj, reg_path, ((bus << 8) | (i << 3) | j), dev_mgr); - - if (!pdev) - continue; + if (pdev) +#ifdef _MULTI_EHCI + count++; +#else + goto LBL_LOOPOUT; +#endif } } @@ -3501,6 +3505,11 @@ ehci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER d } } +#ifndef _MULTI_EHCI +LBL_LOOPOUT: +#endif + DbgPrint("Found %d EHCI controllers\n", count); + if (pdev) { pdev_ext = pdev->DeviceExtension; diff --git a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c index c113ada6610..c11fd2d1048 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c @@ -626,13 +626,13 @@ uhci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER d count = 0; pdev = NULL; - //scan the bus to find uhci controller - for(bus = 0; bus < 3; bus++) /* enum bus0-bus2 */ + //scan the PCI buses to find uhci controller + for (bus = 0; bus <= PCI_MAX_BRIDGE_NUMBER; bus++) { - for(i = 0; i < PCI_MAX_DEVICES; i++) + for(i = 0; i <= PCI_MAX_DEVICES; i++) { slot_num.u.bits.DeviceNumber = i; - for(j = 0; j < PCI_MAX_FUNCTIONS; j++) + for(j = 0; j <= PCI_MAX_FUNCTION; j++) { slot_num.u.bits.FunctionNumber = j; @@ -645,18 +645,15 @@ uhci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER d if (ret == 2) /*no device on the slot */ break; - if (pci_config->BaseClass == 0x0c && pci_config->SubClass == 0x03) + if (pci_config->BaseClass == 0x0c && pci_config->SubClass == 0x03 && + pci_config->ProgIf == 0x00) { // well, we find our usb host controller, create device -#ifdef _MULTI_UHCI - { - pdev = uhci_alloc(drvr_obj, reg_path, ((bus << 8) | (i << 3) | j), dev_mgr); - if (pdev) - count++; - } -#else pdev = uhci_alloc(drvr_obj, reg_path, ((bus << 8) | (i << 3) | j), dev_mgr); if (pdev) +#ifdef _MULTI_UHCI + count++; +#else goto LBL_LOOPOUT; #endif } @@ -669,6 +666,8 @@ uhci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER d #ifndef _MULTI_UHCI LBL_LOOPOUT: #endif + DbgPrint("Found %d UHCI controllers\n", count); + if (pdev) { pdev_ext = pdev->DeviceExtension; diff --git a/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild b/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild index f4f3c844e4c..770e77e5434 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild +++ b/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild @@ -2,6 +2,8 @@ + + . ntoskrnl From 428dff1a79ed6a592bd486c77e4110c0949d3188 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sat, 8 May 2010 22:26:48 +0000 Subject: [PATCH 032/151] [WIN32K] - Check the supplied scancode instead of the state buffer whether a key is up - Fixes the calculator keyboard input regression introduced with r35117 - Ref: http://www.osronline.com/ddkx/w98ddk/keycnt_4ilz.htm and wine implementation See issue #3727 for more details. svn path=/trunk/; revision=47138 --- reactos/subsystems/win32/win32k/ntuser/keyboard.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/keyboard.c b/reactos/subsystems/win32/win32k/ntuser/keyboard.c index 242147c6659..075d79336d0 100644 --- a/reactos/subsystems/win32/win32k/ntuser/keyboard.c +++ b/reactos/subsystems/win32/win32k/ntuser/keyboard.c @@ -42,7 +42,9 @@ /* Key States */ #define KS_DOWN_MASK 0xc0 #define KS_DOWN_BIT 0x80 -#define KS_LOCK_BIT 0x01 +#define KS_LOCK_BIT 0x01 +/* Scan Codes */ +#define SC_KEY_UP 0x8000 /* lParam bits */ #define LP_EXT_BIT (1<<24) /* From kbdxx.c -- Key changes with numlock */ @@ -720,6 +722,11 @@ NtUserToUnicodeEx( DPRINT("Enter NtUserSetKeyboardState\n"); UserEnterShared();//fixme: this syscall doesnt seem to need any locking... + /* Key up? */ + if (wScanCode & SC_KEY_UP) + { + RETURN(0); + } if( !NT_SUCCESS(MmCopyFromCaller(KeyStateBuf, lpKeyState, @@ -729,8 +736,8 @@ NtUserToUnicodeEx( RETURN(0); } - /* Virtual code is correct and key is pressed currently? */ - if (wVirtKey < 0x100 && KeyStateBuf[wVirtKey] & KS_DOWN_BIT) + /* Virtual code is correct? */ + if (wVirtKey < 0x100) { OutPwszBuff = ExAllocatePoolWithTag(NonPagedPool,sizeof(WCHAR) * cchBuff, TAG_STRING); if( !OutPwszBuff ) @@ -752,8 +759,6 @@ NtUserToUnicodeEx( MmCopyToCaller(pwszBuff,OutPwszBuff,sizeof(WCHAR)*cchBuff); ExFreePoolWithTag(OutPwszBuff, TAG_STRING); } - else - ret = 0; RETURN(ret); From e47ef162231c5388241a1e88efeffa2749ff3770 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 9 May 2010 11:18:16 +0000 Subject: [PATCH 033/151] [USBDRIVER] - Register the device with the device manager only after it has been successfully allocated to avoid a crash - A device that failed in xhci_alloc would never get deregistered from the device manager so it would crash when it entered xhci_start with a partially set up device extension - Define release_adapter to HalPutDmaAdapter to fix a DMA adapter leak [HAL] - Export HalPutDmaAdapter svn path=/trunk/; revision=47139 --- .../drivers/usb/nt4compat/usbdriver/ehci.c | 26 +++++++------------ .../drivers/usb/nt4compat/usbdriver/uhci.c | 26 +++++++------------ reactos/hal/hal.pspec | 1 + 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c index 9bc6cd90f9b..2d4b44e933e 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c @@ -58,15 +58,7 @@ #define endp_mult_count( endp ) ( ( ( endp->pusb_endp_desc->wMaxPacketSize & 0x1800 ) >> 11 ) + 1 ) -#if 0 -/* WTF?! */ -#define release_adapter( padapTER ) \ -{\ - ( ( padapTER ) ); \ -} -#else -#define release_adapter( padapTER ) (void)(padapTER) -#endif +#define release_adapter( padapTER ) HalPutDmaAdapter(padapTER) #define get_int_idx( _urb, _idx ) \ {\ @@ -3538,6 +3530,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; PCI_SLOT_NUMBER slot_num; NTSTATUS status; + UCHAR hcd_id; pdev = ehci_create_device(drvr_obj, dev_mgr); @@ -3704,6 +3697,13 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU return NULL; } + //register with dev_mgr + ehci_init_hcd_interface(pdev_ext->ehci); + hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf); + + pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id); + pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr); + return pdev; } @@ -3719,7 +3719,6 @@ ehci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) STRING string, another_string; CHAR str_dev_name[64], str_symb_name[64]; - UCHAR hcd_id; if (drvr_obj == NULL) return NULL; @@ -3769,13 +3768,6 @@ ehci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) RtlFreeUnicodeString(&dev_name); RtlFreeUnicodeString(&symb_name); - //register with dev_mgr though it is not initilized - ehci_init_hcd_interface(pdev_ext->ehci); - hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf); - - pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id); - pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr); - return pdev; } diff --git a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c index c11fd2d1048..8c903d35459 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c @@ -65,15 +65,8 @@ extern PDEVICE_OBJECT ehci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_pa : enDP->pusb_endp_desc->wMaxPacketSize ) -#if 0 -/* WTF?! */ -#define release_adapter( padapTER ) \ -{\ - ( ( padapTER ) ); \ -} -#else -#define release_adapter( padapTER ) (void)(padapTER) -#endif +#define release_adapter( padapTER ) HalPutDmaAdapter(padapTER) + #define get_int_idx( _urb, _idx ) \ {\ @@ -413,7 +406,6 @@ uhci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) STRING string, another_string; CHAR str_dev_name[64], str_symb_name[64]; - UCHAR hcd_id; if (drvr_obj == NULL) return NULL; @@ -463,12 +455,6 @@ uhci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) RtlFreeUnicodeString(&dev_name); RtlFreeUnicodeString(&symb_name); - //register with dev_mgr though it is not initilized - uhci_init_hcd_interface(pdev_ext->uhci); - hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf); - - pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id); - pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr); return pdev; } @@ -695,6 +681,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; PCI_SLOT_NUMBER slot_num; NTSTATUS status; + UCHAR hcd_id; pdev = uhci_create_device(drvr_obj, dev_mgr); @@ -860,6 +847,13 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU return NULL; } + //register with dev_mgr + uhci_init_hcd_interface(pdev_ext->uhci); + hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf); + + pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id); + pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr); + return pdev; } diff --git a/reactos/hal/hal.pspec b/reactos/hal/hal.pspec index 74193047c28..0e6a7c74c14 100644 --- a/reactos/hal/hal.pspec +++ b/reactos/hal/hal.pspec @@ -51,6 +51,7 @@ @ stdcall HalInitializeProcessor(long ptr) @ stdcall HalMakeBeep(long) @ stdcall HalProcessorIdle() +@ stdcall HalPutDmaAdapter(ptr) @ stdcall HalQueryDisplayParameters(ptr ptr ptr ptr) @ stdcall HalQueryRealTimeClock(ptr) @ stdcall HalReadDmaCounter(ptr) From 330de811a7e8ffe6acd62ab0d72103476de7c6a3 Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Sun, 9 May 2010 12:14:25 +0000 Subject: [PATCH 034/151] Bug 5355: [PATCH] cacls: Add Japanese resource by Katayama Hirofumi Bug 5371: TRANSLATION: Italian translation updates by Paolo Devoti Bug 5337: PATCH: Some kernel32 lang updates (de-DE updated, others fixed) by forenkrams@tuxproject.de Bug 5366: TRANSLATION: Czech translation update by Radek Liska svn path=/trunk/; revision=47141 --- reactos/base/applications/cacls/lang/ja-JP.rc | 78 + reactos/base/applications/cacls/rsrc.rc | 1 + reactos/base/applications/rapps/lang/it-IT.rc | 193 + reactos/base/applications/rapps/rsrc.rc | 1 + reactos/base/setup/usetup/lang/it-IT.h | 4 +- reactos/dll/cpl/appwiz/lang/cs-CZ.rc | 4 +- reactos/dll/cpl/sysdm/lang/cs-CZ.rc | 25 +- reactos/dll/cpl/sysdm/lang/it-IT.rc | 25 +- reactos/dll/win32/kernel32/lang/bg-BG.mc | 17494 +--------------- reactos/dll/win32/kernel32/lang/de-DE.mc | 210 +- reactos/dll/win32/kernel32/lang/pl-PL.mc | 2 +- reactos/dll/win32/kernel32/lang/ru-RU.mc | 2 +- reactos/dll/win32/netshell/lang/it-IT.rc | 10 +- reactos/dll/win32/shell32/lang/cs-CZ.rc | 4 +- reactos/dll/win32/shell32/lang/it-IT.rc | 2 +- reactos/media/inf/cpu.inf | Bin 18186 -> 21240 bytes 16 files changed, 420 insertions(+), 17635 deletions(-) create mode 100644 reactos/base/applications/cacls/lang/ja-JP.rc create mode 100644 reactos/base/applications/rapps/lang/it-IT.rc diff --git a/reactos/base/applications/cacls/lang/ja-JP.rc b/reactos/base/applications/cacls/lang/ja-JP.rc new file mode 100644 index 00000000000..3816fe4d94f --- /dev/null +++ b/reactos/base/applications/cacls/lang/ja-JP.rc @@ -0,0 +1,78 @@ +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_HELP, "t@C̃ANZX䃊Xg(ACL) \\܂͕ύX܂B\n\n\ +CACLS t@C [/T] [/E] [/C] [/G [U[:ANZX]\n\ + [/R [U[ [...]] [/P [U[:ANZX [...]]\n\ + [/D [U[ [...]]\n\ + t@C ACL \\܂B\n\ + /T ݂̃fBNgƂׂẴTufBNgɂ\n\ + w肳ꂽt@C ACL ύX܂B\n\ + /E ACL uɁAACL ҏW܂B\n\ + /C ANZXۃG[𖳎āAACL ̕ύX𑱍s܂B\n\ + /G [U[:ANZX\n\ + w肳ꂽ[U[ɃANZX^܂B\n\ + ANZX: R ǂݎ\n\ + W \n\ + C ύX ()\n\ + F t Rg[\n\ + /R [U[ w肳ꂽ[U[̃ANZX܂B\n\ + (/E IvVƋɎgp)B\n\ + /P [U[:ANZX\n\ + w肳ꂽ[U[̃ANZXu܂B\n\ + ANZX: N Ȃ\n\ + W \n\ + R ǂݎ\n\ + C ύX ()\n\ + F t Rg[\n\ + /D [U[ w肳ꂽ[U[̃ANZXۂ܂B\n\ +̃t@Cw肷ɂ́AChJ[hgpł܂B\n\ +̃[U[wł܂B\n\n\ +ȗ`:\n\ + CI - ReipB\n\ + ACE ̓fBNgɌp܂B\n\ + OI - IuWFNgpB\n\ + ACE ̓t@CɌp܂B\n\ + IO - p̂݁B\n\ + ACE ݂͌̃t@C/fBNgɓKp܂B\n" + +IDS_ABBR_CI, "(CI)" +IDS_ABBR_OI, "(OI)" +IDS_ABBR_IO, "(IO)" +IDS_ABBR_FULL, "F" +IDS_ABBR_READ, "R" +IDS_ABBR_WRITE, "W" +IDS_ABBR_CHANGE, "C" +IDS_ABBR_NONE, "N" +IDS_ALLOW, "" +IDS_DENY, "(DENY)" +IDS_SPECIAL_ACCESS, "(special access:)" +IDS_GENERIC_READ, "GENERIC_READ" +IDS_GENERIC_WRITE, "GENERIC_WRITE" +IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" +IDS_GENERIC_ALL, "GENERIC_ALL" +IDS_FILE_GENERIC_EXECUTE, "FILE_GENERIC_EXECUTE" +IDS_FILE_GENERIC_READ, "FILE_GENERIC_READ" +IDS_FILE_GENERIC_WRITE, "FILE_GENERIC_WRITE" +IDS_FILE_READ_DATA, "FILE_READ_DATA" +IDS_FILE_WRITE_DATA, "FILE_WRITE_DATA" +IDS_FILE_APPEND_DATA, "FILE_APPEND_DATA" +IDS_FILE_READ_EA, "FILE_READ_EA" +IDS_FILE_WRITE_EA, "FILE_WRITE_EA" +IDS_FILE_EXECUTE, "FILE_EXECUTE" +IDS_FILE_DELETE_CHILD, "FILE_DELETE_CHILD" +IDS_FILE_READ_ATTRIBUTES, "FILE_READ_ATTRIBUTES" +IDS_FILE_WRITE_ATTRIBUTES, "FILE_WRITE_ATTRIBUTES" +IDS_MAXIMUM_ALLOWED, "MAXIMUM_ALLOWED" +IDS_ACCESS_SYSTEM_SECURITY, "ACCESS_SYSTEM_SECURITY" +IDS_SPECIFIC_RIGHTS_ALL, "SPECIFIC_RIGHTS_ALL" +IDS_STANDARD_RIGHTS_REQUIRED, "STANDARD_RIGHTS_REQUIRED" +IDS_SYNCHRONIZE, "SYNCHRONIZE" +IDS_WRITE_OWNER, "WRITE_OWNER" +IDS_WRITE_DAC, "WRITE_DAC" +IDS_READ_CONTROL, "READ_CONTROL" +IDS_DELETE, "DELETE" +IDS_STANDARD_RIGHTS_ALL, "STANDARD_RIGHTS_ALL" +END diff --git a/reactos/base/applications/cacls/rsrc.rc b/reactos/base/applications/cacls/rsrc.rc index d892f4a1904..cf19989a441 100644 --- a/reactos/base/applications/cacls/rsrc.rc +++ b/reactos/base/applications/cacls/rsrc.rc @@ -10,6 +10,7 @@ #include "lang/fr-FR.rc" #include "lang/id-ID.rc" #include "lang/it-IT.rc" +#include "lang/ja-JP.rc" #include "lang/ko-KR.rc" #include "lang/no-NO.rc" #include "lang/nl-NL.rc" diff --git a/reactos/base/applications/rapps/lang/it-IT.rc b/reactos/base/applications/rapps/lang/it-IT.rc new file mode 100644 index 00000000000..44fcfab4a8a --- /dev/null +++ b/reactos/base/applications/rapps/lang/it-IT.rc @@ -0,0 +1,193 @@ +LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL + +IDR_MAINMENU MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Preferenze", ID_SETTINGS + MENUITEM SEPARATOR + MENUITEM "E&sci", ID_EXIT + END + POPUP "&Programmi" + BEGIN + MENUITEM "&Installa", ID_INSTALL + MENUITEM "&Disinstalla",ID_UNINSTALL + MENUITEM "&Modifica", ID_MODIFY + MENUITEM SEPARATOR + MENUITEM "&Remuovi da Registry", ID_REGREMOVE + MENUITEM SEPARATOR + MENUITEM "&Aggiorna", ID_REFRESH + END + POPUP "?" + BEGIN + MENUITEM "Guida", ID_HELP, GRAYED + MENUITEM "Informazioni", ID_ABOUT + END +END + +IDR_LINKMENU MENU +BEGIN + POPUP "popup" + BEGIN + MENUITEM "&Apri il collegamento in un browser", ID_OPEN_LINK + MENUITEM "&Copia il collegamento negli appunti", ID_COPY_LINK + END +END + +IDR_APPLICATIONMENU MENU +BEGIN + POPUP "popup" + BEGIN + MENUITEM "&Installa", ID_INSTALL + MENUITEM "&Disinstalla", ID_UNINSTALL + MENUITEM "&Modifica", ID_MODIFY + MENUITEM SEPARATOR + MENUITEM "&Rimuovi da Registry", ID_REGREMOVE + MENUITEM SEPARATOR + MENUITEM "&Aggiorna", ID_REFRESH + END +END + +IDD_SETTINGS_DIALOG DIALOGEX DISCARDABLE 0, 0, 250, 144 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Impostazioni" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Generale", -1, 4, 2, 240, 61 + AUTOCHECKBOX "&Salva la posizione della finestra", IDC_SAVE_WINDOW_POS, 15, 12, 219, 12 + AUTOCHECKBOX "&Aggiorna la lista dei programmi accessibili", IDC_UPDATE_AVLIST, 15, 29, 219, 12 + AUTOCHECKBOX "&Registra la installazione o disinstallazione dei programmi", IDC_LOG_ENABLED, 15, 46, 219, 12 + + GROUPBOX "Downloading", -1, 4, 65, 240, 51 + LTEXT "Cartella:", -1, 16, 75, 100, 9 + EDITTEXT IDC_DOWNLOAD_DIR_EDIT, 15, 86, 166, 12, WS_CHILD | WS_VISIBLE | WS_GROUP + PUSHBUTTON "&Scegli", IDC_CHOOSE, 187, 85, 50, 14 + AUTOCHECKBOX "&Rimuovere la procedura di installazione dopo l'uso", IDC_DEL_AFTER_INSTALL, 16, 100, 218, 12 + + PUSHBUTTON "Predefiniti", IDC_DEFAULT_SETTINGS, 8, 124, 60, 14 + PUSHBUTTON "OK", IDOK, 116, 124, 60, 14 + PUSHBUTTON "Annulla", IDCANCEL, 181, 124, 60, 14 +END + +IDD_INSTALL_DIALOG DIALOGEX DISCARDABLE 0, 0, 216, 97 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Installazione" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "...", IDC_INSTALL_TEXT, 4, 5, 209, 35 + + AUTORADIOBUTTON "&Installa da un disco (CD o DVD)", IDC_CD_INSTALL, 10, 46, 197, 11, WS_GROUP + AUTORADIOBUTTON "&Scarica e installa", IDC_DOWNLOAD_INSTALL, 10, 59, 197, 11, NOT WS_TABSTOP + + PUSHBUTTON "OK", IDOK, 86, 78, 60, 14 + PUSHBUTTON "Annulla", IDCANCEL, 150, 78, 60, 14 +END + +IDD_DOWNLOAD_DIALOG DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76 +STYLE DS_SHELLFONT | DS_CENTER | WS_BORDER | WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_VISIBLE +CAPTION "Download in corso" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "Progress1", IDC_DOWNLOAD_PROGRESS, "msctls_progress32", WS_BORDER | PBS_SMOOTH, 10, 10, 200, 12 + LTEXT "", IDC_DOWNLOAD_STATUS, 10, 30, 200, 10, SS_CENTER + PUSHBUTTON "Annulla", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP +END + +IDD_ABOUT_DIALOG DIALOGEX 22, 16, 190, 66 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +CAPTION "Informazioni" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Gestione applicazioni di ReactOS \nCopyright (C) 2009\nby Dmitry Chapyshev (dmitry@reactos.org)", IDC_STATIC, 48, 7, 130, 39 + PUSHBUTTON "Chiudi", IDOK, 133, 46, 50, 14 + ICON IDI_MAIN, IDC_STATIC, 10, 10, 7, 30 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_INSTALL "Installa" + IDS_TOOLTIP_UNINSTALL "Disinstalla" + IDS_TOOLTIP_MODIFY "Modifica" + IDS_TOOLTIP_SETTINGS "Impostazioni" + IDS_TOOLTIP_REFRESH "Aggiorna" + IDS_TOOLTIP_EXIT "Esci" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_NAME "Nome" + IDS_APP_INST_VERSION "Versione" + IDS_APP_DESCRIPTION "Descrizione" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INFO_VERSION "\nVersione: " + IDS_INFO_DESCRIPTION "\nDescrizione: " + IDS_INFO_PUBLISHER "\nPubblicato da: " + IDS_INFO_HELPLINK "\nHelp Link: " + IDS_INFO_HELPPHONE "\nHelp Telefono: " + IDS_INFO_README "\nLeggimi: " + IDS_INFO_REGOWNER "\nProprietario registrato: " + IDS_INFO_PRODUCTID "\nID prodotto: " + IDS_INFO_CONTACT "\nContatto: " + IDS_INFO_UPDATEINFO "\nInformazioni di aggiornamento: " + IDS_INFO_INFOABOUT "\nInformazioni: " + IDS_INFO_COMMENTS "\nCommenti: " + IDS_INFO_INSTLOCATION "\nInstallato in: " + IDS_INFO_INSTALLSRC "\nProvenienza Installazione: " + IDS_INFO_UNINSTALLSTR "\nStringa di disinstallazione: " + IDS_INFO_MODIFYPATH "\nModifica percorso: " + IDS_INFO_INSTALLDATE "\nData installazione: " +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_AINFO_VERSION "\nVersione: " + IDS_AINFO_DESCRIPTION "\nDescrizione: " + IDS_AINFO_SIZE "\nDimensione: " + IDS_AINFO_URLSITE "\nHome Page: " + IDS_AINFO_LICENCE "\nLicenza: " +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CAT_AUDIO "Audio" + IDS_CAT_DEVEL "Sviluppo" + IDS_CAT_DRIVERS "Drivers" + IDS_CAT_EDU "Edutainment" + IDS_CAT_ENGINEER "Engineering" + IDS_CAT_FINANCE "Finanza" + IDS_CAT_GAMES "Giochi e divertimento" + IDS_CAT_GRAPHICS "Graphica" + IDS_CAT_INTERNET "Internet & rete" + IDS_CAT_LIBS "Librerie" + IDS_CAT_OFFICE "Ufficio" + IDS_CAT_OTHER "Altro" + IDS_CAT_SCIENCE "Scienza" + IDS_CAT_TOOLS "Strumenti" + IDS_CAT_VIDEO "Video" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPTITLE "ReactOS Applications Manager" + IDS_SEARCH_TEXT "Cerca..." + IDS_INSTALL "Installa" + IDS_UNINSTALL "Disinstall" + IDS_MODIFY "Modifica" + IDS_APPS_COUNT "Numero applicazioni: %d" + IDS_WELCOME_TITLE "Benvenuto!\n\n" + IDS_WELCOME_TEXT "Scegliere una categoria a sinistra, poi scegliere una applicazione da installare o disinstallare.\nReactOS Web Site: " + IDS_WELCOME_URL "http://www.reactos.org" + IDS_INSTALLED "Installato" + IDS_AVAILABLEFORINST "Disponibile" + IDS_UPDATES "Aggiornamenti" + IDS_APPLICATIONS "Applicazioni" + IDS_CHOOSE_FOLDER_TEXT "Scegliere una cartella dove scaricare le applicazioni:" + IDS_CHOOSE_FOLDER_ERROR "La cartella indicata non esiste." + IDS_USER_NOT_ADMIN "Dovete essere Amministratore per avviare ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Sicuro di voler cancellare dal registry i dati sui programmi installati?" + IDS_INFORMATION "Informazioni" + IDS_UNABLE_TO_REMOVE "Impossibile cancellare i dati dal registry!" +END diff --git a/reactos/base/applications/rapps/rsrc.rc b/reactos/base/applications/rapps/rsrc.rc index b060279c12b..c09097f28cd 100644 --- a/reactos/base/applications/rapps/rsrc.rc +++ b/reactos/base/applications/rapps/rsrc.rc @@ -2,6 +2,7 @@ #include "lang/de-DE.rc" #include "lang/en-US.rc" #include "lang/es-ES.rc" +#include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" #include "lang/pl-PL.rc" diff --git a/reactos/base/setup/usetup/lang/it-IT.h b/reactos/base/setup/usetup/lang/it-IT.h index 21d3d8990bf..bb220000c84 100644 --- a/reactos/base/setup/usetup/lang/it-IT.h +++ b/reactos/base/setup/usetup/lang/it-IT.h @@ -399,13 +399,13 @@ static MUI_ENTRY itITDevicePageEntries[] = { 6, 19, - "Pu scegliere la configurazione con i tasti SU e GI", + "Pu scegliere un elemento della configurazione con i tasti SU e GI", TEXT_STYLE_NORMAL }, { 6, 20, - "Premere INVIO per modificare la configurazione alternativa.", + "e modificarlo premendo INVIO per selezionare un valore alternativo.", TEXT_STYLE_NORMAL }, { diff --git a/reactos/dll/cpl/appwiz/lang/cs-CZ.rc b/reactos/dll/cpl/appwiz/lang/cs-CZ.rc index 5f59fbf8e70..8bfb70e574d 100644 --- a/reactos/dll/cpl/appwiz/lang/cs-CZ.rc +++ b/reactos/dll/cpl/appwiz/lang/cs-CZ.rc @@ -1,6 +1,6 @@ /* FILE: dll/cpl/appwiz/lang/cs-CZ.rc * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) - * UPDATED: 2008-07-27 + * UPDATED: 2010-03-14 */ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT @@ -48,7 +48,7 @@ END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME "Pidat/Odebrat programy" + IDS_CPLSYSTEMNAME "Pidat a odebrat programy" IDS_CPLSYSTEMDESCRIPTION "Nastavuje programy a vytv zstupce." IDS_CREATE_SHORTCUT "Vytvoit zstupce" IDS_ERROR_NOT_FOUND "Soubor %s nebyl nalezen." diff --git a/reactos/dll/cpl/sysdm/lang/cs-CZ.rc b/reactos/dll/cpl/sysdm/lang/cs-CZ.rc index 72c8f4c9f29..5be033c26d3 100644 --- a/reactos/dll/cpl/sysdm/lang/cs-CZ.rc +++ b/reactos/dll/cpl/sysdm/lang/cs-CZ.rc @@ -1,6 +1,6 @@ /* FILE: dll/cpl/sysdm/lang/cs-CZ.rc * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) - * UPDATED: 2009-01-25 + * UPDATED: 2010-03-04 */ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT @@ -48,17 +48,6 @@ BEGIN PUSHBUTTON "Hard&warov profily...", IDC_HARDWARE_PROFILE, 154, 190, 90, 15 END -IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -CAPTION "System Settings" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Version Info",IDC_STATIC,6,3,210,73 - CONTROL "Report as Workstation",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,88,10 - LTEXT "ReactOS is built as a server OS and reports as such. Check this box to change this for applications only.",IDC_STATIC,15,15,183,41 - PUSHBUTTON "OK",IDOK,166,83,50,14 -END - IDD_PROPPAGEADVANCED DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION @@ -78,10 +67,22 @@ BEGIN LTEXT "Monosti sputn a zotaven kaj potai, jak se spustit a co dlat, jestlie jej chyba donut zastavit.", IDC_STATIC, 16, 144, 228, 19 PUSHBUTTON "Nastaven", IDC_STAREC, 194, 162, 50, 15 + PUSHBUTTON "Nastaven systmu", IDC_SYSSETTINGS, 2, 192, 80, 15 PUSHBUTTON "Promnn prosted", IDC_ENVVAR, 84, 192, 80, 15 PUSHBUTTON "Hlen chyb", IDC_ERRORREPORT, 170, 192, 80, 15 END +IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +CAPTION "Nastaven systmu" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Informace o verzi",IDC_STATIC,6,3,210,73 + CONTROL "Hlsit se jako pracovn stanice",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,88,10 + LTEXT "ReactOS je vytvoen jako serverov OS a jako takov se i hls. Po zakrtnut tohoto polka se pro aplikace toto chovn zmn.",IDC_STATIC,15,15,183,41 + PUSHBUTTON "OK",IDOK,166,83,50,14 +END + IDD_HARDWAREPROFILES DIALOGEX 6, 18, 254, 234 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU diff --git a/reactos/dll/cpl/sysdm/lang/it-IT.rc b/reactos/dll/cpl/sysdm/lang/it-IT.rc index 8fc2abc5367..253a4bd1084 100644 --- a/reactos/dll/cpl/sysdm/lang/it-IT.rc +++ b/reactos/dll/cpl/sysdm/lang/it-IT.rc @@ -43,16 +43,6 @@ BEGIN PUSHBUTTON "&Profili Hardware...", IDC_HARDWARE_PROFILE, 154, 190, 90, 14 END -IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -CAPTION "System Settings" -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Version Info",IDC_STATIC,6,3,210,73 - CONTROL "Report as Workstation",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,88,10 - LTEXT "ReactOS is built as a server OS and reports as such. Check this box to change this for applications only.",IDC_STATIC,15,15,183,41 - PUSHBUTTON "OK",IDOK,166,83,50,14 -END IDD_PROPPAGEADVANCED DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION @@ -72,10 +62,22 @@ BEGIN LTEXT "Le opzioni di Avvio e recupero informano il computer su come partire e cosa fare nel caso che un errore fermi il computer.", IDC_STATIC, 16, 144, 210, 19 PUSHBUTTON "Impostazioni", IDC_STAREC, 194, 162, 50, 14 + PUSHBUTTON "Impostazioni di sistema", IDC_SYSSETTINGS, 2, 192, 80, 15 PUSHBUTTON "Variabili di ambiente", IDC_ENVVAR, 84, 192, 80, 14 PUSHBUTTON "Registrazione errori", IDC_ERRORREPORT, 170, 192, 80, 14 END +IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION +CAPTION "System Settings" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Informazioni sulla versione",IDC_STATIC,6,3,210,73 + CONTROL "Notifica come Workstation",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,88,10 + LTEXT "ReactOS compilato come server ed notificato come tale. Non per questa applicazione.",IDC_STATIC,15,15,183,41 + PUSHBUTTON "OK",IDOK,166,83,50,14 +END + IDD_HARDWAREPROFILES DIALOGEX 6, 18, 254, 234 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU @@ -159,7 +161,7 @@ BEGIN EDITTEXT IDC_STRRECRECEDIT, 179, 68, 30, 12, ES_NUMBER CONTROL "", IDC_STRRECRECUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13 LTEXT "secondi", IDC_STATIC, 215, 70, 25, 8 - LTEXT "Per modificare le opzioni di avvio manualmenta , clicca Modifica.", IDC_STATIC, 14, 89, 187, 8 + LTEXT "Per modificare le opzioni di avvio manualmente, clicca Modifica.", IDC_STATIC, 14, 89, 187, 8 PUSHBUTTON "&Modifica", IDC_STRRECEDIT, 188, 87, 50, 14 GROUPBOX "Blocco del sistema", IDC_STATIC, 7, 111, 238, 140 @@ -282,4 +284,5 @@ BEGIN IDS_USERPROFILE_TYPE "Tipo" IDS_USERPROFILE_STATUS "Stato" IDS_USERPROFILE_MODIFIED "Modificato" + IDS_DEVS "\nReactOS Team\n\nCoordinatore\n\nAleksey Bragin\n\nGruppo di sviluppo\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHerv Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blmel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nG van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nUlteriori ringraziamenti\n\na tutti i Contributers\nWine Team\n\n" END diff --git a/reactos/dll/win32/kernel32/lang/bg-BG.mc b/reactos/dll/win32/kernel32/lang/bg-BG.mc index 4a0fa997233..ff0e58602a8 100644 --- a/reactos/dll/win32/kernel32/lang/bg-BG.mc +++ b/reactos/dll/win32/kernel32/lang/bg-BG.mc @@ -2468,17499 +2468,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FAILED_DRIVER_ENTRY Language=Bulgarian -ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed it's initialization call. -. - -MessageId=648 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_ENUMERATION_ERROR -Language=Bulgarian -ERROR_DEVICE_ENUMERATION_ERROR - The \"%hs\" encountered an error while applying power or reading the device configuration. This may be caused by a failure of your hardware or by a poor connection. -. - -MessageId=649 -Severity=Success -Facility=System -SymbolicName=ERROR_MOUNT_POINT_NOT_RESOLVED -Language=Bulgarian -ERROR_MOUNT_POINT_NOT_RESOLVED - The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached. -. - -MessageId=650 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DEVICE_OBJECT_PARAMETER -Language=Bulgarian -ERROR_INVALID_DEVICE_OBJECT_PARAMETER - The device object parameter is either not a valid device object or is not attached to the volume specified by the file name. -. - -MessageId=651 -Severity=Success -Facility=System -SymbolicName=ERROR_MCA_OCCURED -Language=Bulgarian -ERROR_MCA_OCCURED - A Machine Check Error has occurred. Please check the system eventlog for additional information. -. - -MessageId=652 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVER_DATABASE_ERROR -Language=Bulgarian -ERROR_DRIVER_DATABASE_ERROR - There was error [%2] processing the driver database. -. - -MessageId=653 -Severity=Success -Facility=System -SymbolicName=ERROR_SYSTEM_HIVE_TOO_LARGE -Language=Bulgarian -ERROR_SYSTEM_HIVE_TOO_LARGE - System hive size has exceeded its limit. -. - -MessageId=654 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVER_FAILED_PRIOR_UNLOAD -Language=Bulgarian -ERROR_DRIVER_FAILED_PRIOR_UNLOAD - The driver could not be loaded because a previous version of the driver is still in memory. -. - -MessageId=655 -Severity=Success -Facility=System -SymbolicName=ERROR_VOLSNAP_PREPARE_HIBERNATE -Language=Bulgarian -ERROR_VOLSNAP_PREPARE_HIBERNATE - Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation. -. - -MessageId=656 -Severity=Success -Facility=System -SymbolicName=ERROR_HIBERNATION_FAILURE -Language=Bulgarian -ERROR_HIBERNATION_FAILURE - The system has failed to hibernate (The error code is %hs). Hibernation will be disabled until the system is restarted. -. - -MessageId=657 -Severity=Success -Facility=System -SymbolicName=ERROR_HUNG_DISPLAY_DRIVER_THREAD -Language=Bulgarian -ERROR_HUNG_DISPLAY_DRIVER_THREAD - The %hs display driver has stopped working normally. Save your work and reboot the system to restore full display functionality. The next time you reboot the machine a dialog will be displayed giving you a chance to report this failure to Microsoft. -. - -MessageId=665 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_SYSTEM_LIMITATION -Language=Bulgarian -ERROR_FILE_SYSTEM_LIMITATION - The requested operation could not be completed due to a file system limitation. -. - -MessageId=668 -Severity=Success -Facility=System -SymbolicName=ERROR_ASSERTION_FAILURE -Language=Bulgarian -ERROR_ASSERTION_FAILURE - An assertion failure has occurred. -. - -MessageId=669 -Severity=Success -Facility=System -SymbolicName=ERROR_VERIFIER_STOP -Language=Bulgarian -ERROR_VERIFIER_STOP - Application verifier has found an error in the current process. -. - -MessageId=670 -Severity=Success -Facility=System -SymbolicName=ERROR_WOW_ASSERTION -Language=Bulgarian -ERROR_WOW_ASSERTION - WOW Assertion Error. -. - -MessageId=671 -Severity=Success -Facility=System -SymbolicName=ERROR_PNP_BAD_MPS_TABLE -Language=Bulgarian -ERROR_PNP_BAD_MPS_TABLE - A device is missing in the system BIOS MPS table. This device will not be used. Please contact your system vendor for system BIOS update. -. - -MessageId=672 -Severity=Success -Facility=System -SymbolicName=ERROR_PNP_TRANSLATION_FAILED -Language=Bulgarian -ERROR_PNP_TRANSLATION_FAILED - A translator failed to translate resources. -. - -MessageId=673 -Severity=Success -Facility=System -SymbolicName=ERROR_PNP_IRQ_TRANSLATION_FAILED -Language=Bulgarian -ERROR_PNP_IRQ_TRANSLATION_FAILED - A IRQ translator failed to translate resources. -. - -MessageId=674 -Severity=Success -Facility=System -SymbolicName=ERROR_PNP_INVALID_ID -Language=Bulgarian -ERROR_PNP_INVALID_ID - Driver %2 returned invalid ID for a child device (%3). -. - -MessageId=675 -Severity=Success -Facility=System -SymbolicName=ERROR_WAKE_SYSTEM_DEBUGGER -Language=Bulgarian -ERROR_WAKE_SYSTEM_DEBUGGER - The system debugger was awakened by an interrupt. -. - -MessageId=676 -Severity=Success -Facility=System -SymbolicName=ERROR_HANDLES_CLOSED -Language=Bulgarian -ERROR_HANDLES_CLOSED - Handles to objects have been automatically closed as a result of the requested operation. -. - -MessageId=677 -Severity=Success -Facility=System -SymbolicName=ERROR_EXTRANEOUS_INFORMATION -Language=Bulgarian -ERROR_EXTRANEOUS_INFORMATION - he specified access control list (ACL) contained more information than was expected. -. - -MessageId=678 -Severity=Success -Facility=System -SymbolicName=ERROR_RXACT_COMMIT_NECESSARY -Language=Bulgarian -ERROR_RXACT_COMMIT_NECESSARY - This warning level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has NOT been completed, but has not been rolled back either (so it may still be committed if desired). -. - -MessageId=679 -Severity=Success -Facility=System -SymbolicName=ERROR_MEDIA_CHECK -Language=Bulgarian -ERROR_MEDIA_CHECK - The media may have changed. -. - -MessageId=680 -Severity=Success -Facility=System -SymbolicName=ERROR_GUID_SUBSTITUTION_MADE -Language=Bulgarian -ERROR_GUID_SUBSTITUTION_MADE - During the translation of a global identifier (GUID) to a Windows security ID (SID), no administratively-defined GUID prefix was found. A substitute prefix was used, which will not compromise system security. However, this may provide a more restrictive access than intended. -. - -MessageId=681 -Severity=Success -Facility=System -SymbolicName=ERROR_STOPPED_ON_SYMLINK -Language=Bulgarian -ERROR_STOPPED_ON_SYMLINK - The create operation stopped after reaching a symbolic link. -. - -MessageId=682 -Severity=Success -Facility=System -SymbolicName=ERROR_LONGJUMP -Language=Bulgarian -ERROR_LONGJUMP - A long jump has been executed. -. - -MessageId=683 -Severity=Success -Facility=System -SymbolicName=ERROR_PLUGPLAY_QUERY_VETOED -Language=Bulgarian -ERROR_PLUGPLAY_QUERY_VETOED - The Plug and Play query operation was not successful. -. - -MessageId=684 -Severity=Success -Facility=System -SymbolicName=ERROR_UNWIND_CONSOLIDATE -Language=Bulgarian -ERROR_UNWIND_CONSOLIDATE - A frame consolidation has been executed. -. - -MessageId=685 -Severity=Success -Facility=System -SymbolicName=ERROR_REGISTRY_HIVE_RECOVERED -Language=Bulgarian -ERROR_REGISTRY_HIVE_RECOVERED - Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost. -. - -MessageId=686 -Severity=Success -Facility=System -SymbolicName=ERROR_DLL_MIGHT_BE_INSECURE -Language=Bulgarian -ERROR_DLL_MIGHT_BE_INSECURE - The application is attempting to run executable code from the module %hs. This may be insecure. An alternative, %hs, is available. Should the application use the secure module %hs? -. - -MessageId=687 -Severity=Success -Facility=System -SymbolicName=ERROR_DLL_MIGHT_BE_INCOMPATIBLE -Language=Bulgarian -ERROR_DLL_MIGHT_BE_INCOMPATIBLE - The application is loading executable code from the module %hs. This is secure, but may be incompatible with previous releases of the operating system. An alternative, %hs, is available. Should the application use the secure module %hs? -. - -MessageId=688 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_EXCEPTION_NOT_HANDLED -Language=Bulgarian -ERROR_DBG_EXCEPTION_NOT_HANDLED - Debugger did not handle the exception. -. - -MessageId=689 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_REPLY_LATER -Language=Bulgarian -ERROR_DBG_REPLY_LATER - Debugger will reply later. -. - -MessageId=690 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE -Language=Bulgarian -ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE - Debugger can not provide handle. -. - -MessageId=691 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_TERMINATE_THREAD -Language=Bulgarian -ERROR_DBG_TERMINATE_THREAD - Debugger terminated thread. -. - -MessageId=692 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_TERMINATE_PROCESS -Language=Bulgarian -ERROR_DBG_TERMINATE_PROCESS - Debugger terminated process. -. - -MessageId=693 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_CONTROL_C -Language=Bulgarian -ERROR_DBG_CONTROL_C - Debugger got control C. -. - -MessageId=694 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_PRINTEXCEPTION_C -Language=Bulgarian -ERROR_DBG_PRINTEXCEPTION_C - Debugger printed exception on control C. -. - -MessageId=695 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_RIPEXCEPTION -Language=Bulgarian -ERROR_DBG_RIPEXCEPTION - Debugger received RIP exception. -. - -MessageId=696 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_CONTROL_BREAK -Language=Bulgarian -ERROR_DBG_CONTROL_BREAK - Debugger received control break. -. - -MessageId=697 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_COMMAND_EXCEPTION -Language=Bulgarian -ERROR_DBG_COMMAND_EXCEPTION - Debugger command communication exception. -. - -MessageId=698 -Severity=Success -Facility=System -SymbolicName=ERROR_OBJECT_NAME_EXISTS -Language=Bulgarian -ERROR_OBJECT_NAME_EXISTS - An attempt was made to create an object and the object name already existed. -. - -MessageId=699 -Severity=Success -Facility=System -SymbolicName=ERROR_THREAD_WAS_SUSPENDED -Language=Bulgarian -ERROR_THREAD_WAS_SUSPENDED - A thread termination occurred while the thread was suspended. The thread was resumed, and termination proceeded. -. - -MessageId=700 -Severity=Success -Facility=System -SymbolicName=ERROR_IMAGE_NOT_AT_BASE -Language=Bulgarian -ERROR_IMAGE_NOT_AT_BASE - An image file could not be mapped at the address specified in the image file. Local fixups must be performed on this image. -. - -MessageId=701 -Severity=Success -Facility=System -SymbolicName=ERROR_RXACT_STATE_CREATED -Language=Bulgarian -ERROR_RXACT_STATE_CREATED - This informational level status indicates that a specified registry sub-tree transaction state did not yet exist and had to be created. -. - -MessageId=702 -Severity=Success -Facility=System -SymbolicName=ERROR_SEGMENT_NOTIFICATION -Language=Bulgarian -ERROR_SEGMENT_NOTIFICATION - A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. An exception is raised so a debugger can load, unload or track symbols and breakpoints within these 16-bit segments. -. - -MessageId=703 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_CURRENT_DIRECTORY -Language=Bulgarian -ERROR_BAD_CURRENT_DIRECTORY - The process cannot switch to the startup current directory %hs. Select OK to set current directory to %hs, or select CANCEL to exit. -. - -MessageId=704 -Severity=Success -Facility=System -SymbolicName=ERROR_FT_READ_RECOVERY_FROM_BACKUP -Language=Bulgarian -ERROR_FT_READ_RECOVERY_FROM_BACKUP - To satisfy a read request, the NT fault-tolerant file system successfully read the requested data from a redundant copy. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was unable to reassign the failing area of the device. -. - -MessageId=705 -Severity=Success -Facility=System -SymbolicName=ERROR_FT_WRITE_RECOVERY -Language=Bulgarian -ERROR_FT_WRITE_RECOVERY - To satisfy a write request, the NT fault-tolerant file system successfully wrote a redundant copy of the information. This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was not able to reassign the failing area of the device. -. - -MessageId=706 -Severity=Success -Facility=System -SymbolicName=ERROR_IMAGE_MACHINE_TYPE_MISMATCH -Language=Bulgarian -ERROR_IMAGE_MACHINE_TYPE_MISMATCH - The image file %hs is valid, but is for a machine type other than the current machine. Select OK to continue, or CANCEL to fail the DLL load. -. - -MessageId=707 -Severity=Success -Facility=System -SymbolicName=ERROR_RECEIVE_PARTIAL -Language=Bulgarian -ERROR_RECEIVE_PARTIAL - The network transport returned partial data to its client. The remaining data will be sent later. -. - -MessageId=708 -Severity=Success -Facility=System -SymbolicName=ERROR_RECEIVE_EXPEDITED -Language=Bulgarian -ERROR_RECEIVE_EXPEDITED - The network transport returned data to its client that was marked as expedited by the remote system. -. - -MessageId=709 -Severity=Success -Facility=System -SymbolicName=ERROR_RECEIVE_PARTIAL_EXPEDITED -Language=Bulgarian -ERROR_RECEIVE_PARTIAL_EXPEDITED - The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later. -. - -MessageId=710 -Severity=Success -Facility=System -SymbolicName=ERROR_EVENT_DONE -Language=Bulgarian -ERROR_EVENT_DONE - The TDI indication has completed successfully. -. - -MessageId=711 -Severity=Success -Facility=System -SymbolicName=ERROR_EVENT_PENDING -Language=Bulgarian -ERROR_EVENT_PENDING - The TDI indication has entered the pending state. -. - -MessageId=712 -Severity=Success -Facility=System -SymbolicName=ERROR_CHECKING_FILE_SYSTEM -Language=Bulgarian -ERROR_CHECKING_FILE_SYSTEM - Checking file system on %wZ. -. - -MessageId=714 -Severity=Success -Facility=System -SymbolicName=ERROR_PREDEFINED_HANDLE -Language=Bulgarian -ERROR_PREDEFINED_HANDLE - The specified registry key is referenced by a predefined handle. -. - -MessageId=715 -Severity=Success -Facility=System -SymbolicName=ERROR_WAS_UNLOCKED -Language=Bulgarian -ERROR_WAS_UNLOCKED - The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process. -. - -MessageId=717 -Severity=Success -Facility=System -SymbolicName=ERROR_WAS_LOCKED -Language=Bulgarian -ERROR_WAS_LOCKED - One of the pages to lock was already locked. -. - -MessageId=720 -Severity=Success -Facility=System -SymbolicName=ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE -Language=Bulgarian -ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE - The image file %hs is valid, but is for a machine type other than the current machine. -. - -MessageId=721 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_YIELD_PERFORMED -Language=Bulgarian -ERROR_NO_YIELD_PERFORMED - A yield execution was performed and no thread was available to run. -. - -MessageId=722 -Severity=Success -Facility=System -SymbolicName=ERROR_TIMER_RESUME_IGNORED -Language=Bulgarian -ERROR_TIMER_RESUME_IGNORED - The resumable flag to a timer API was ignored. -. - -MessageId=723 -Severity=Success -Facility=System -SymbolicName=ERROR_ARBITRATION_UNHANDLED -Language=Bulgarian -ERROR_ARBITRATION_UNHANDLED - The arbiter has deferred arbitration of these resources to its parent. -. - -MessageId=724 -Severity=Success -Facility=System -SymbolicName=ERROR_CARDBUS_NOT_SUPPORTED -Language=Bulgarian -ERROR_CARDBUS_NOT_SUPPORTED - The device \"%hs\" has detected a CardBus card in its slot, but the firmware on this system is not configured to allow the CardBus controller to be run in CardBus mode. The operating system will currently accept only 16-bit (R2) pc-cards on this controller. -. - -MessageId=725 -Severity=Success -Facility=System -SymbolicName=ERROR_MP_PROCESSOR_MISMATCH -Language=Bulgarian -ERROR_MP_PROCESSOR_MISMATCH - The CPUs in this multiprocessor system are not all the same revision level. To use all processors the operating system restricts itself to the features of the least capable processor in the system. Should problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported. -. - -MessageId=726 -Severity=Success -Facility=System -SymbolicName=ERROR_HIBERNATED -Language=Bulgarian -ERROR_HIBERNATED - The system was put into hibernation. -. - -MessageId=727 -Severity=Success -Facility=System -SymbolicName=ERROR_RESUME_HIBERNATION -Language=Bulgarian -ERROR_RESUME_HIBERNATION - The system was resumed from hibernation. -. - -MessageId=728 -Severity=Success -Facility=System -SymbolicName=ERROR_FIRMWARE_UPDATED -Language=Bulgarian -ERROR_FIRMWARE_UPDATED - Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3]. -. - -MessageId=729 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVERS_LEAKING_LOCKED_PAGES -Language=Bulgarian -ERROR_DRIVERS_LEAKING_LOCKED_PAGES - A device driver is leaking locked I/O pages causing system degradation. The system has automatically enabled tracking code in order to try and catch the culprit. -. - -MessageId=730 -Severity=Success -Facility=System -SymbolicName=ERROR_WAKE_SYSTEM -Language=Bulgarian -ERROR_WAKE_SYSTEM - The system has awoken -. - -MessageId=741 -Severity=Success -Facility=System -SymbolicName=ERROR_REPARSE -Language=Bulgarian -ERROR_REPARSE - A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link. -. - -MessageId=742 -Severity=Success -Facility=System -SymbolicName=ERROR_OPLOCK_BREAK_IN_PROGRESS -Language=Bulgarian -ERROR_OPLOCK_BREAK_IN_PROGRESS - An open/create operation completed while an oplock break is underway. -. - -MessageId=743 -Severity=Success -Facility=System -SymbolicName=ERROR_VOLUME_MOUNTED -Language=Bulgarian -ERROR_VOLUME_MOUNTED - A new volume has been mounted by a file system. -. - -MessageId=744 -Severity=Success -Facility=System -SymbolicName=ERROR_RXACT_COMMITTED -Language=Bulgarian -ERROR_RXACT_COMMITTED - This success level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has now been completed. -. - -MessageId=745 -Severity=Success -Facility=System -SymbolicName=ERROR_NOTIFY_CLEANUP -Language=Bulgarian -ERROR_NOTIFY_CLEANUP - This indicates that a notify change request has been completed due to closing the handle which made the notify change request. -. - -MessageId=746 -Severity=Success -Facility=System -SymbolicName=ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED -Language=Bulgarian -ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED - An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed. The computer WAS able to connect on a secondary transport. -. - -MessageId=747 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGE_FAULT_TRANSITION -Language=Bulgarian -ERROR_PAGE_FAULT_TRANSITION - Page fault was a transition fault. -. - -MessageId=748 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGE_FAULT_DEMAND_ZERO -Language=Bulgarian -ERROR_PAGE_FAULT_DEMAND_ZERO - Page fault was a demand zero fault. -. - -MessageId=749 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGE_FAULT_COPY_ON_WRITE -Language=Bulgarian -ERROR_PAGE_FAULT_COPY_ON_WRITE - Page fault was a demand zero fault. -. - -MessageId=750 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGE_FAULT_GUARD_PAGE -Language=Bulgarian -ERROR_PAGE_FAULT_GUARD_PAGE - Page fault was a demand zero fault. -. - -MessageId=751 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGE_FAULT_PAGING_FILE -Language=Bulgarian -ERROR_PAGE_FAULT_PAGING_FILE - Page fault was satisfied by reading from a secondary storage device. -. - -MessageId=752 -Severity=Success -Facility=System -SymbolicName=ERROR_CACHE_PAGE_LOCKED -Language=Bulgarian -ERROR_CACHE_PAGE_LOCKED - Cached page was locked during operation. -. - -MessageId=753 -Severity=Success -Facility=System -SymbolicName=ERROR_CRASH_DUMP -Language=Bulgarian -ERROR_CRASH_DUMP - Crash dump exists in paging file. -. - -MessageId=754 -Severity=Success -Facility=System -SymbolicName=ERROR_BUFFER_ALL_ZEROS -Language=Bulgarian -ERROR_BUFFER_ALL_ZEROS - Specified buffer contains all zeros. -. - -MessageId=755 -Severity=Success -Facility=System -SymbolicName=ERROR_REPARSE_OBJECT -Language=Bulgarian -ERROR_REPARSE_OBJECT - A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link. -. - -MessageId=756 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_REQUIREMENTS_CHANGED -Language=Bulgarian -ERROR_RESOURCE_REQUIREMENTS_CHANGED - The device has succeeded a query-stop and its resource requirements have changed. -. - -MessageId=757 -Severity=Success -Facility=System -SymbolicName=ERROR_TRANSLATION_COMPLETE -Language=Bulgarian -ERROR_TRANSLATION_COMPLETE - The translator has translated these resources into the global space and no further translations should be performed. -. - -MessageId=758 -Severity=Success -Facility=System -SymbolicName=ERROR_NOTHING_TO_TERMINATE -Language=Bulgarian -ERROR_NOTHING_TO_TERMINATE - A process being terminated has no threads to terminate. -. - -MessageId=759 -Severity=Success -Facility=System -SymbolicName=ERROR_PROCESS_NOT_IN_JOB -Language=Bulgarian -ERROR_PROCESS_NOT_IN_JOB - The specified process is not part of a job. -. - -MessageId=760 -Severity=Success -Facility=System -SymbolicName=ERROR_PROCESS_IN_JOB -Language=Bulgarian -ERROR_PROCESS_IN_JOB - The specified process is part of a job. -. - -MessageId=761 -Severity=Success -Facility=System -SymbolicName=ERROR_VOLSNAP_HIBERNATE_READY -Language=Bulgarian -ERROR_VOLSNAP_HIBERNATE_READY - The system is now ready for hibernation. -. - -MessageId=762 -Severity=Success -Facility=System -SymbolicName=ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY -Language=Bulgarian -ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY - A file system or file system filter driver has successfully completed an FsFilter operation. -. - -MessageId=763 -Severity=Success -Facility=System -SymbolicName=ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED -Language=Bulgarian -ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED - The specified interrupt vector was already connected. -. - -MessageId=764 -Severity=Success -Facility=System -SymbolicName=ERROR_INTERRUPT_STILL_CONNECTED -Language=Bulgarian -ERROR_INTERRUPT_STILL_CONNECTED - The specified interrupt vector is still connected. -. - -MessageId=765 -Severity=Success -Facility=System -SymbolicName=ERROR_WAIT_FOR_OPLOCK -Language=Bulgarian -ERROR_WAIT_FOR_OPLOCK - An operation is blocked waiting for an oplock. -. - -MessageId=766 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_EXCEPTION_HANDLED -Language=Bulgarian -ERROR_DBG_EXCEPTION_HANDLED - Debugger handled exception. -. - -MessageId=767 -Severity=Success -Facility=System -SymbolicName=ERROR_DBG_CONTINUE -Language=Bulgarian -ERROR_DBG_CONTINUE - Debugger continued -. - -MessageId=768 -Severity=Success -Facility=System -SymbolicName=ERROR_CALLBACK_POP_STACK -Language=Bulgarian -ERROR_CALLBACK_POP_STACK - An exception occurred in a user mode callback and the kernel callback frame should be removed. -. - -MessageId=769 -Severity=Success -Facility=System -SymbolicName=ERROR_COMPRESSION_DISABLED -Language=Bulgarian -ERROR_COMPRESSION_DISABLED - Compression is disabled for this volume. -. - -MessageId=770 -Severity=Success -Facility=System -SymbolicName=ERROR_CANTFETCHBACKWARDS -Language=Bulgarian -ERROR_CANTFETCHBACKWARDS - The data provider cannot fetch backwards through a result set. -. - -MessageId=771 -Severity=Success -Facility=System -SymbolicName=ERROR_CANTSCROLLBACKWARDS -Language=Bulgarian -ERROR_CANTSCROLLBACKWARDS - The data provider cannot scroll backwards through a result set. -. - -MessageId=772 -Severity=Success -Facility=System -SymbolicName=ERROR_ROWSNOTRELEASED -Language=Bulgarian -ERROR_ROWSNOTRELEASED - The data provider requires that previously fetched data is released before asking for more data. -. - -MessageId=773 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_ACCESSOR_FLAGS -Language=Bulgarian -ERROR_BAD_ACCESSOR_FLAGS - The data provider was not able to interpret the flags set for a column binding in an accessor. -. - -MessageId=774 -Severity=Success -Facility=System -SymbolicName=ERROR_ERRORS_ENCOUNTERED -Language=Bulgarian -ERROR_ERRORS_ENCOUNTERED - One or more errors occurred while processing the request. -. - -MessageId=775 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_CAPABLE -Language=Bulgarian -ERROR_NOT_CAPABLE - The implementation is not capable of performing the request. -. - -MessageId=776 -Severity=Success -Facility=System -SymbolicName=ERROR_REQUEST_OUT_OF_SEQUENCE -Language=Bulgarian -ERROR_REQUEST_OUT_OF_SEQUENCE - The client of a component requested an operation which is not valid given the state of the component instance. -. - -MessageId=777 -Severity=Success -Facility=System -SymbolicName=ERROR_VERSION_PARSE_ERROR -Language=Bulgarian -ERROR_VERSION_PARSE_ERROR - A version number could not be parsed. -. - -MessageId=778 -Severity=Success -Facility=System -SymbolicName=ERROR_BADSTARTPOSITION -Language=Bulgarian -ERROR_BADSTARTPOSITION - The iterator's start position is invalid. -. - -MessageId=994 -Severity=Success -Facility=System -SymbolicName=ERROR_EA_ACCESS_DENIED -Language=Bulgarian -ERROR_EA_ACCESS_DENIED - Access to the extended attribute was denied. -. - -MessageId=995 -Severity=Success -Facility=System -SymbolicName=ERROR_OPERATION_ABORTED -Language=Bulgarian -ERROR_OPERATION_ABORTED - The I/O operation has been aborted because of either a thread exit or an application request. -. - -MessageId=996 -Severity=Success -Facility=System -SymbolicName=ERROR_IO_INCOMPLETE -Language=Bulgarian -ERROR_IO_INCOMPLETE - Overlapped I/O event is not in a signaled state. -. - -MessageId=997 -Severity=Success -Facility=System -SymbolicName=ERROR_IO_PENDING -Language=Bulgarian -ERROR_IO_PENDING - Overlapped I/O operation is in progress. -. - -MessageId=998 -Severity=Success -Facility=System -SymbolicName=ERROR_NOACCESS -Language=Bulgarian -ERROR_NOACCESS - Invalid access to memory location. -. - -MessageId=999 -Severity=Success -Facility=System -SymbolicName=ERROR_SWAPERROR -Language=Bulgarian -ERROR_SWAPERROR - Error performing inpage operation. -. - -MessageId=1001 -Severity=Success -Facility=System -SymbolicName=ERROR_STACK_OVERFLOW -Language=Bulgarian -ERROR_STACK_OVERFLOW - Recursion too deep; the stack overflowed. -. - -MessageId=1002 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MESSAGE -Language=Bulgarian -ERROR_INVALID_MESSAGE - The window cannot act on the sent message. -. - -MessageId=1003 -Severity=Success -Facility=System -SymbolicName=ERROR_CAN_NOT_COMPLETE -Language=Bulgarian -ERROR_CAN_NOT_COMPLETE - Cannot complete this function. -. - -MessageId=1004 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_FLAGS -Language=Bulgarian -ERROR_INVALID_FLAGS - Invalid flags. -. - -MessageId=1005 -Severity=Success -Facility=System -SymbolicName=ERROR_UNRECOGNIZED_VOLUME -Language=Bulgarian -ERROR_UNRECOGNIZED_VOLUME - The volume does not contain a recognized file system. Please make sure that all required file system drivers are loaded and that the volume is not corrupted. -. - -MessageId=1006 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_INVALID -Language=Bulgarian -ERROR_FILE_INVALID - The volume for a file has been externally altered so that the opened file is no longer valid. -. - -MessageId=1007 -Severity=Success -Facility=System -SymbolicName=ERROR_FULLSCREEN_MODE -Language=Bulgarian -ERROR_FULLSCREEN_MODE - The requested operation cannot be performed in full-screen mode. -. - -MessageId=1008 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_TOKEN -Language=Bulgarian -ERROR_NO_TOKEN - An attempt was made to reference a token that does not exist. -. - -MessageId=1009 -Severity=Success -Facility=System -SymbolicName=ERROR_BADDB -Language=Bulgarian -ERROR_BADDB - The configuration registry database is corrupt. -. - -MessageId=1010 -Severity=Success -Facility=System -SymbolicName=ERROR_BADKEY -Language=Bulgarian -ERROR_BADKEY - The configuration registry key is invalid. -. - -MessageId=1011 -Severity=Success -Facility=System -SymbolicName=ERROR_CANTOPEN -Language=Bulgarian -ERROR_CANTOPEN - The configuration registry key could not be opened. -. - -MessageId=1012 -Severity=Success -Facility=System -SymbolicName=ERROR_CANTREAD -Language=Bulgarian -ERROR_CANTREAD - The configuration registry key could not be read. -. - -MessageId=1013 -Severity=Success -Facility=System -SymbolicName=ERROR_CANTWRITE -Language=Bulgarian -ERROR_CANTWRITE - The configuration registry key could not be written. -. - -MessageId=1014 -Severity=Success -Facility=System -SymbolicName=ERROR_REGISTRY_RECOVERED -Language=Bulgarian -ERROR_REGISTRY_RECOVERED - One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful. -. - -MessageId=1015 -Severity=Success -Facility=System -SymbolicName=ERROR_REGISTRY_CORRUPT -Language=Bulgarian -ERROR_REGISTRY_CORRUPT - The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted. -. - -MessageId=1016 -Severity=Success -Facility=System -SymbolicName=ERROR_REGISTRY_IO_FAILED -Language=Bulgarian -ERROR_REGISTRY_IO_FAILED - An I/O operation initiated by the registry failed unrecoverably. The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry. -. - -MessageId=1017 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_REGISTRY_FILE -Language=Bulgarian -ERROR_NOT_REGISTRY_FILE - The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format. -. - -MessageId=1018 -Severity=Success -Facility=System -SymbolicName=ERROR_KEY_DELETED -Language=Bulgarian -ERROR_KEY_DELETED - Illegal operation attempted on a registry key that has been marked for deletion. -. - -MessageId=1019 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_LOG_SPACE -Language=Bulgarian -ERROR_NO_LOG_SPACE - System could not allocate the required space in a registry log. -. - -MessageId=1020 -Severity=Success -Facility=System -SymbolicName=ERROR_KEY_HAS_CHILDREN -Language=Bulgarian -ERROR_KEY_HAS_CHILDREN - Cannot create a symbolic link in a registry key that already has subkeys or values. -. - -MessageId=1021 -Severity=Success -Facility=System -SymbolicName=ERROR_CHILD_MUST_BE_VOLATILE -Language=Bulgarian -ERROR_CHILD_MUST_BE_VOLATILE - Cannot create a stable subkey under a volatile parent key. -. - -MessageId=1022 -Severity=Success -Facility=System -SymbolicName=ERROR_NOTIFY_ENUM_DIR -Language=Bulgarian -ERROR_NOTIFY_ENUM_DIR - A notify change request is being completed and the information is not being returned in the caller's buffer. The caller now needs to enumerate the files to find the changes. -. - -MessageId=1051 -Severity=Success -Facility=System -SymbolicName=ERROR_DEPENDENT_SERVICES_RUNNING -Language=Bulgarian -ERROR_DEPENDENT_SERVICES_RUNNING - A stop control has been sent to a service that other running services are dependent on. -. - -MessageId=1052 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SERVICE_CONTROL -Language=Bulgarian -ERROR_INVALID_SERVICE_CONTROL - The requested control is not valid for this service. -. - -MessageId=1053 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_REQUEST_TIMEOUT -Language=Bulgarian -ERROR_SERVICE_REQUEST_TIMEOUT - The service did not respond to the start or control request in a timely fashion. -. - -MessageId=1054 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_NO_THREAD -Language=Bulgarian -ERROR_SERVICE_NO_THREAD - A thread could not be created for the service. -. - -MessageId=1055 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_DATABASE_LOCKED -Language=Bulgarian -ERROR_SERVICE_DATABASE_LOCKED - The service database is locked. -. - -MessageId=1056 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_ALREADY_RUNNING -Language=Bulgarian -ERROR_SERVICE_ALREADY_RUNNING - An instance of the service is already running. -. - -MessageId=1057 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SERVICE_ACCOUNT -Language=Bulgarian -ERROR_INVALID_SERVICE_ACCOUNT - The account name is invalid or does not exist, or the password is invalid for the account name specified. -. - -MessageId=1058 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_DISABLED -Language=Bulgarian -ERROR_SERVICE_DISABLED - The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. -. - -MessageId=1059 -Severity=Success -Facility=System -SymbolicName=ERROR_CIRCULAR_DEPENDENCY -Language=Bulgarian -ERROR_CIRCULAR_DEPENDENCY - Circular service dependency was specified. -. - -MessageId=1060 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_DOES_NOT_EXIST -Language=Bulgarian -ERROR_SERVICE_DOES_NOT_EXIST - The specified service does not exist as an installed service. -. - -MessageId=1061 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_CANNOT_ACCEPT_CTRL -Language=Bulgarian -ERROR_SERVICE_CANNOT_ACCEPT_CTRL - The service cannot accept control messages at this time. -. - -MessageId=1062 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_NOT_ACTIVE -Language=Bulgarian -ERROR_SERVICE_NOT_ACTIVE - The service has not been started. -. - -MessageId=1063 -Severity=Success -Facility=System -SymbolicName=ERROR_FAILED_SERVICE_CONTROLLER_CONNECT -Language=Bulgarian -ERROR_FAILED_SERVICE_CONTROLLER_CONNECT - The service process could not connect to the service controller. -. - -MessageId=1064 -Severity=Success -Facility=System -SymbolicName=ERROR_EXCEPTION_IN_SERVICE -Language=Bulgarian -ERROR_EXCEPTION_IN_SERVICE - An exception occurred in the service when handling the control request. -. - -MessageId=1065 -Severity=Success -Facility=System -SymbolicName=ERROR_DATABASE_DOES_NOT_EXIST -Language=Bulgarian -ERROR_DATABASE_DOES_NOT_EXIST - The database specified does not exist. -. - -MessageId=1066 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_SPECIFIC_ERROR -Language=Bulgarian -ERROR_SERVICE_SPECIFIC_ERROR - The service has returned a service-specific error code. -. - -MessageId=1067 -Severity=Success -Facility=System -SymbolicName=ERROR_PROCESS_ABORTED -Language=Bulgarian -ERROR_PROCESS_ABORTED - The process terminated unexpectedly. -. - -MessageId=1068 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_DEPENDENCY_FAIL -Language=Bulgarian -ERROR_SERVICE_DEPENDENCY_FAIL - The dependency service or group failed to start. -. - -MessageId=1069 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_LOGON_FAILED -Language=Bulgarian -ERROR_SERVICE_LOGON_FAILED - The service did not start due to a logon failure. -. - -MessageId=1070 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_START_HANG -Language=Bulgarian -ERROR_SERVICE_START_HANG - After starting, the service hung in a start-pending state. -. - -MessageId=1071 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SERVICE_LOCK -Language=Bulgarian -ERROR_INVALID_SERVICE_LOCK - The specified service database lock is invalid. -. - -MessageId=1072 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_MARKED_FOR_DELETE -Language=Bulgarian -ERROR_SERVICE_MARKED_FOR_DELETE - The specified service has been marked for deletion. -. - -MessageId=1073 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_EXISTS -Language=Bulgarian -ERROR_SERVICE_EXISTS - The specified service already exists. -. - -MessageId=1074 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_RUNNING_LKG -Language=Bulgarian -ERROR_ALREADY_RUNNING_LKG - The system is currently running with the last-known-good configuration. -. - -MessageId=1075 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_DEPENDENCY_DELETED -Language=Bulgarian -ERROR_SERVICE_DEPENDENCY_DELETED - The dependency service does not exist or has been marked for deletion. -. - -MessageId=1076 -Severity=Success -Facility=System -SymbolicName=ERROR_BOOT_ALREADY_ACCEPTED -Language=Bulgarian -ERROR_BOOT_ALREADY_ACCEPTED - The current boot has already been accepted for use as the last-known-good control set. -. - -MessageId=1077 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_NEVER_STARTED -Language=Bulgarian -ERROR_SERVICE_NEVER_STARTED - No attempts to start the service have been made since the last boot. -. - -MessageId=1078 -Severity=Success -Facility=System -SymbolicName=ERROR_DUPLICATE_SERVICE_NAME -Language=Bulgarian -ERROR_DUPLICATE_SERVICE_NAME - The name is already in use as either a service name or a service display name. -. - -MessageId=1079 -Severity=Success -Facility=System -SymbolicName=ERROR_DIFFERENT_SERVICE_ACCOUNT -Language=Bulgarian -ERROR_DIFFERENT_SERVICE_ACCOUNT - The account specified for this service is different from the account specified for other services running in the same process. -. - -MessageId=1080 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_DETECT_DRIVER_FAILURE -Language=Bulgarian -ERROR_CANNOT_DETECT_DRIVER_FAILURE - Failure actions can only be set for Win32 services, not for drivers. -. - -MessageId=1081 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_DETECT_PROCESS_ABORT -Language=Bulgarian -ERROR_CANNOT_DETECT_PROCESS_ABORT - This service runs in the same process as the service control manager. Therefore, the service control manager cannot take action if this service's process terminates unexpectedly. -. - -MessageId=1082 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_RECOVERY_PROGRAM -Language=Bulgarian -ERROR_NO_RECOVERY_PROGRAM - No recovery program has been configured for this service. -. - -MessageId=1083 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_NOT_IN_EXE -Language=Bulgarian -ERROR_SERVICE_NOT_IN_EXE - The executable program that this service is configured to run in does not implement the service. -. - -MessageId=1084 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_SAFEBOOT_SERVICE -Language=Bulgarian -ERROR_NOT_SAFEBOOT_SERVICE - This service cannot be started in Safe Mode. -. - -MessageId=1100 -Severity=Success -Facility=System -SymbolicName=ERROR_END_OF_MEDIA -Language=Bulgarian -ERROR_END_OF_MEDIA - The physical end of the tape has been reached. -. - -MessageId=1101 -Severity=Success -Facility=System -SymbolicName=ERROR_FILEMARK_DETECTED -Language=Bulgarian -ERROR_FILEMARK_DETECTED - A tape access reached a filemark. -. - -MessageId=1102 -Severity=Success -Facility=System -SymbolicName=ERROR_BEGINNING_OF_MEDIA -Language=Bulgarian -ERROR_BEGINNING_OF_MEDIA - The beginning of the tape or a partition was encountered. -. - -MessageId=1103 -Severity=Success -Facility=System -SymbolicName=ERROR_SETMARK_DETECTED -Language=Bulgarian -ERROR_SETMARK_DETECTED - A tape access reached the end of a set of files. -. - -MessageId=1104 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_DATA_DETECTED -Language=Bulgarian -ERROR_NO_DATA_DETECTED - No more data is on the tape. -. - -MessageId=1105 -Severity=Success -Facility=System -SymbolicName=ERROR_PARTITION_FAILURE -Language=Bulgarian -ERROR_PARTITION_FAILURE - Tape could not be partitioned. -. - -MessageId=1106 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_BLOCK_LENGTH -Language=Bulgarian -ERROR_INVALID_BLOCK_LENGTH - When accessing a new tape of a multivolume partition, the current block size is incorrect. -. - -MessageId=1107 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_NOT_PARTITIONED -Language=Bulgarian -ERROR_DEVICE_NOT_PARTITIONED - Tape partition information could not be found when loading a tape. -. - -MessageId=1108 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_LOCK_MEDIA -Language=Bulgarian -ERROR_UNABLE_TO_LOCK_MEDIA - Unable to lock the media eject mechanism. -. - -MessageId=1109 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_UNLOAD_MEDIA -Language=Bulgarian -ERROR_UNABLE_TO_UNLOAD_MEDIA - Unable to unload the media. -. - -MessageId=1110 -Severity=Success -Facility=System -SymbolicName=ERROR_MEDIA_CHANGED -Language=Bulgarian -ERROR_MEDIA_CHANGED - The media in the drive may have changed. -. - -MessageId=1111 -Severity=Success -Facility=System -SymbolicName=ERROR_BUS_RESET -Language=Bulgarian -ERROR_BUS_RESET - The I/O bus was reset. -. - -MessageId=1112 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MEDIA_IN_DRIVE -Language=Bulgarian -ERROR_NO_MEDIA_IN_DRIVE - No media in drive. -. - -MessageId=1113 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_UNICODE_TRANSLATION -Language=Bulgarian -ERROR_NO_UNICODE_TRANSLATION - No mapping for the Unicode character exists in the target multi-byte code page. -. - -MessageId=1114 -Severity=Success -Facility=System -SymbolicName=ERROR_DLL_INIT_FAILED -Language=Bulgarian -ERROR_DLL_INIT_FAILED - A dynamic link library (DLL) initialization routine failed. -. - -MessageId=1115 -Severity=Success -Facility=System -SymbolicName=ERROR_SHUTDOWN_IN_PROGRESS -Language=Bulgarian -ERROR_SHUTDOWN_IN_PROGRESS - A system shutdown is in progress. -. - -MessageId=1116 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SHUTDOWN_IN_PROGRESS -Language=Bulgarian -ERROR_NO_SHUTDOWN_IN_PROGRESS - Unable to abort the system shutdown because no shutdown was in progress. -. - -MessageId=1117 -Severity=Success -Facility=System -SymbolicName=ERROR_IO_DEVICE -Language=Bulgarian -ERROR_IO_DEVICE - The request could not be performed because of an I/O device error. -. - -MessageId=1118 -Severity=Success -Facility=System -SymbolicName=ERROR_SERIAL_NO_DEVICE -Language=Bulgarian -ERROR_SERIAL_NO_DEVICE - No serial device was successfully initialized. The serial driver will unload. -. - -MessageId=1119 -Severity=Success -Facility=System -SymbolicName=ERROR_IRQ_BUSY -Language=Bulgarian -ERROR_IRQ_BUSY - Unable to open a device that was sharing an interrupt request (IRQ) with other devices. At least one other device that uses that IRQ was already opened. -. - -MessageId=1120 -Severity=Success -Facility=System -SymbolicName=ERROR_MORE_WRITES -Language=Bulgarian -ERROR_MORE_WRITES - A serial I/O operation was completed by another write to the serial port. (The IOCTL_SERIAL_XOFF_COUNTER reached zero.) -. - -MessageId=1121 -Severity=Success -Facility=System -SymbolicName=ERROR_COUNTER_TIMEOUT -Language=Bulgarian -ERROR_COUNTER_TIMEOUT - A serial I/O operation completed because the timeout period expired. (The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.) -. - -MessageId=1122 -Severity=Success -Facility=System -SymbolicName=ERROR_FLOPPY_ID_MARK_NOT_FOUND -Language=Bulgarian -ERROR_FLOPPY_ID_MARK_NOT_FOUND - No ID address mark was found on the floppy disk. -. - -MessageId=1123 -Severity=Success -Facility=System -SymbolicName=ERROR_FLOPPY_WRONG_CYLINDER -Language=Bulgarian -ERROR_FLOPPY_WRONG_CYLINDER - Mismatch between the floppy disk sector ID field and the floppy disk controller track address. -. - -MessageId=1124 -Severity=Success -Facility=System -SymbolicName=ERROR_FLOPPY_UNKNOWN_ERROR -Language=Bulgarian -ERROR_FLOPPY_UNKNOWN_ERROR - The floppy disk controller reported an error that is not recognized by the floppy disk driver. -. - -MessageId=1125 -Severity=Success -Facility=System -SymbolicName=ERROR_FLOPPY_BAD_REGISTERS -Language=Bulgarian -ERROR_FLOPPY_BAD_REGISTERS - The floppy disk controller returned inconsistent results in its registers. -. - -MessageId=1126 -Severity=Success -Facility=System -SymbolicName=ERROR_DISK_RECALIBRATE_FAILED -Language=Bulgarian -ERROR_DISK_RECALIBRATE_FAILED - While accessing the hard disk, a recalibrate operation failed, even after retries. -. - -MessageId=1127 -Severity=Success -Facility=System -SymbolicName=ERROR_DISK_OPERATION_FAILED -Language=Bulgarian -ERROR_DISK_OPERATION_FAILED - While accessing the hard disk, a disk operation failed even after retries. -. - -MessageId=1128 -Severity=Success -Facility=System -SymbolicName=ERROR_DISK_RESET_FAILED -Language=Bulgarian -ERROR_DISK_RESET_FAILED - While accessing the hard disk, a disk controller reset was needed, but even that failed. -. - -MessageId=1129 -Severity=Success -Facility=System -SymbolicName=ERROR_EOM_OVERFLOW -Language=Bulgarian -ERROR_EOM_OVERFLOW - Physical end of tape encountered. -. - -MessageId=1130 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_ENOUGH_SERVER_MEMORY -Language=Bulgarian -ERROR_NOT_ENOUGH_SERVER_MEMORY - Not enough server storage is available to process this command. -. - -MessageId=1131 -Severity=Success -Facility=System -SymbolicName=ERROR_POSSIBLE_DEADLOCK -Language=Bulgarian -ERROR_POSSIBLE_DEADLOCK - A potential deadlock condition has been detected. -. - -MessageId=1132 -Severity=Success -Facility=System -SymbolicName=ERROR_MAPPED_ALIGNMENT -Language=Bulgarian -ERROR_MAPPED_ALIGNMENT - The base address or the file offset specified does not have the proper alignment. -. - -MessageId=1140 -Severity=Success -Facility=System -SymbolicName=ERROR_SET_POWER_STATE_VETOED -Language=Bulgarian -ERROR_SET_POWER_STATE_VETOED - An attempt to change the system power state was vetoed by another application or driver. -. - -MessageId=1141 -Severity=Success -Facility=System -SymbolicName=ERROR_SET_POWER_STATE_FAILED -Language=Bulgarian -ERROR_SET_POWER_STATE_FAILED - The system BIOS failed an attempt to change the system power state. -. - -MessageId=1142 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_LINKS -Language=Bulgarian -ERROR_TOO_MANY_LINKS - An attempt was made to create more links on a file than the file system supports. -. - -MessageId=1150 -Severity=Success -Facility=System -SymbolicName=ERROR_OLD_WIN_VERSION -Language=Bulgarian -ERROR_OLD_WIN_VERSION - The specified program requires a newer version of Windows. -. - -MessageId=1151 -Severity=Success -Facility=System -SymbolicName=ERROR_APP_WRONG_OS -Language=Bulgarian -ERROR_APP_WRONG_OS - The specified program is not a Windows or MS-DOS program. -. - -MessageId=1152 -Severity=Success -Facility=System -SymbolicName=ERROR_SINGLE_INSTANCE_APP -Language=Bulgarian -ERROR_SINGLE_INSTANCE_APP - Cannot start more than one instance of the specified program. -. - -MessageId=1153 -Severity=Success -Facility=System -SymbolicName=ERROR_RMODE_APP -Language=Bulgarian -ERROR_RMODE_APP - The specified program was written for an earlier version of Windows. -. - -MessageId=1154 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DLL -Language=Bulgarian -ERROR_INVALID_DLL - One of the library files needed to run this application is damaged. -. - -MessageId=1155 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_ASSOCIATION -Language=Bulgarian -ERROR_NO_ASSOCIATION - No application is associated with the specified file for this operation. -. - -MessageId=1156 -Severity=Success -Facility=System -SymbolicName=ERROR_DDE_FAIL -Language=Bulgarian -ERROR_DDE_FAIL - An error occurred in sending the command to the application. -. - -MessageId=1157 -Severity=Success -Facility=System -SymbolicName=ERROR_DLL_NOT_FOUND -Language=Bulgarian -ERROR_DLL_NOT_FOUND - One of the library files needed to run this application cannot be found. -. - -MessageId=1158 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MORE_USER_HANDLES -Language=Bulgarian -ERROR_NO_MORE_USER_HANDLES - The current process has used all of its system allowance of handles for Window Manager objects. -. - -MessageId=1159 -Severity=Success -Facility=System -SymbolicName=ERROR_MESSAGE_SYNC_ONLY -Language=Bulgarian -ERROR_MESSAGE_SYNC_ONLY - The message can be used only with synchronous operations. -. - -MessageId=1160 -Severity=Success -Facility=System -SymbolicName=ERROR_SOURCE_ELEMENT_EMPTY -Language=Bulgarian -ERROR_SOURCE_ELEMENT_EMPTY - The indicated source element has no media. -. - -MessageId=1161 -Severity=Success -Facility=System -SymbolicName=ERROR_DESTINATION_ELEMENT_FULL -Language=Bulgarian -ERROR_DESTINATION_ELEMENT_FULL - The indicated destination element already contains media. -. - -MessageId=1162 -Severity=Success -Facility=System -SymbolicName=ERROR_ILLEGAL_ELEMENT_ADDRESS -Language=Bulgarian -ERROR_ILLEGAL_ELEMENT_ADDRESS - The indicated element does not exist. -. - -MessageId=1163 -Severity=Success -Facility=System -SymbolicName=ERROR_MAGAZINE_NOT_PRESENT -Language=Bulgarian -ERROR_MAGAZINE_NOT_PRESENT - The indicated element is part of a magazine that is not present. -. - -MessageId=1164 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_REINITIALIZATION_NEEDED -Language=Bulgarian -ERROR_DEVICE_REINITIALIZATION_NEEDED - The indicated device requires reinitialization due to hardware errors. -. - -MessageId=1165 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_REQUIRES_CLEANING -Language=Bulgarian -ERROR_DEVICE_REQUIRES_CLEANING - The device has indicated that cleaning is required before further operations are attempted. -. - -MessageId=1166 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_DOOR_OPEN -Language=Bulgarian -ERROR_DEVICE_DOOR_OPEN - The device has indicated that its door is open. -. - -MessageId=1167 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_NOT_CONNECTED -Language=Bulgarian -ERROR_DEVICE_NOT_CONNECTED - The device is not connected. -. - -MessageId=1168 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_FOUND -Language=Bulgarian -ERROR_NOT_FOUND - Element not found. -. - -MessageId=1169 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MATCH -Language=Bulgarian -ERROR_NO_MATCH - There was no match for the specified key in the index. -. - -MessageId=1170 -Severity=Success -Facility=System -SymbolicName=ERROR_SET_NOT_FOUND -Language=Bulgarian -ERROR_SET_NOT_FOUND - The property set specified does not exist on the object. -. - -MessageId=1171 -Severity=Success -Facility=System -SymbolicName=ERROR_POINT_NOT_FOUND -Language=Bulgarian -ERROR_POINT_NOT_FOUND - The point passed to GetMouseMovePointsEx is not in the buffer. -. - -MessageId=1172 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_TRACKING_SERVICE -Language=Bulgarian -ERROR_NO_TRACKING_SERVICE - The tracking (workstation) service is not running. -. - -MessageId=1173 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_VOLUME_ID -Language=Bulgarian -ERROR_NO_VOLUME_ID - The Volume ID could not be found. -. - -MessageId=1175 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_REMOVE_REPLACED -Language=Bulgarian -ERROR_UNABLE_TO_REMOVE_REPLACED - Unable to remove the file to be replaced. -. - -MessageId=1176 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_MOVE_REPLACEMENT -Language=Bulgarian -ERROR_UNABLE_TO_MOVE_REPLACEMENT - Unable to move the replacement file to the file to be replaced. The file to be replaced has retained its original name. -. - -MessageId=1177 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 -Language=Bulgarian -ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 - Unable to move the replacement file to the file to be replaced. The file to be replaced has been renamed using the backup name. -. - -MessageId=1178 -Severity=Success -Facility=System -SymbolicName=ERROR_JOURNAL_DELETE_IN_PROGRESS -Language=Bulgarian -ERROR_JOURNAL_DELETE_IN_PROGRESS - The volume change journal is being deleted. -. - -MessageId=1179 -Severity=Success -Facility=System -SymbolicName=ERROR_JOURNAL_NOT_ACTIVE -Language=Bulgarian -ERROR_JOURNAL_NOT_ACTIVE - The volume change journal is not active. -. - -MessageId=1180 -Severity=Success -Facility=System -SymbolicName=ERROR_POTENTIAL_FILE_FOUND -Language=Bulgarian -ERROR_POTENTIAL_FILE_FOUND - A file was found, but it may not be the correct file. -. - -MessageId=1181 -Severity=Success -Facility=System -SymbolicName=ERROR_JOURNAL_ENTRY_DELETED -Language=Bulgarian -ERROR_JOURNAL_ENTRY_DELETED - The journal entry has been deleted from the journal. -. - -MessageId=1200 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_DEVICE -Language=Bulgarian -ERROR_BAD_DEVICE - The specified device name is invalid. -. - -MessageId=1201 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTION_UNAVAIL -Language=Bulgarian -ERROR_CONNECTION_UNAVAIL - The device is not currently connected but it is a remembered connection. -. - -MessageId=1202 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_ALREADY_REMEMBERED -Language=Bulgarian -ERROR_DEVICE_ALREADY_REMEMBERED - The local device name has a remembered connection to another network resource. -. - -MessageId=1203 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_NET_OR_BAD_PATH -Language=Bulgarian -ERROR_NO_NET_OR_BAD_PATH - The network path was either typed incorrectly, does not exist, or the network provider is not currently available. Please try retyping the path or contact your network administrator. -. - -MessageId=1204 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_PROVIDER -Language=Bulgarian -ERROR_BAD_PROVIDER - The specified network provider name is invalid. -. - -MessageId=1205 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_OPEN_PROFILE -Language=Bulgarian -ERROR_CANNOT_OPEN_PROFILE - Unable to open the network connection profile. -. - -MessageId=1206 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_PROFILE -Language=Bulgarian -ERROR_BAD_PROFILE - The network connection profile is corrupted. -. - -MessageId=1207 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_CONTAINER -Language=Bulgarian -ERROR_NOT_CONTAINER - Cannot enumerate a noncontainer. -. - -MessageId=1208 -Severity=Success -Facility=System -SymbolicName=ERROR_EXTENDED_ERROR -Language=Bulgarian -ERROR_EXTENDED_ERROR - An extended error has occurred. -. - -MessageId=1209 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_GROUPNAME -Language=Bulgarian -ERROR_INVALID_GROUPNAME - The format of the specified group name is invalid. -. - -MessageId=1210 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_COMPUTERNAME -Language=Bulgarian -ERROR_INVALID_COMPUTERNAME - The format of the specified computer name is invalid. -. - -MessageId=1211 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_EVENTNAME -Language=Bulgarian -ERROR_INVALID_EVENTNAME - The format of the specified event name is invalid. -. - -MessageId=1212 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DOMAINNAME -Language=Bulgarian -ERROR_INVALID_DOMAINNAME - The format of the specified domain name is invalid. -. - -MessageId=1213 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SERVICENAME -Language=Bulgarian -ERROR_INVALID_SERVICENAME - The format of the specified service name is invalid. -. - -MessageId=1214 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_NETNAME -Language=Bulgarian -ERROR_INVALID_NETNAME - The format of the specified network name is invalid. -. - -MessageId=1215 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SHARENAME -Language=Bulgarian -ERROR_INVALID_SHARENAME - The format of the specified share name is invalid. -. - -MessageId=1216 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PASSWORDNAME -Language=Bulgarian -ERROR_INVALID_PASSWORDNAME - The format of the specified password is invalid. -. - -MessageId=1217 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MESSAGENAME -Language=Bulgarian -ERROR_INVALID_MESSAGENAME - The format of the specified message name is invalid. -. - -MessageId=1218 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MESSAGEDEST -Language=Bulgarian -ERROR_INVALID_MESSAGEDEST - The format of the specified message destination is invalid. -. - -MessageId=1219 -Severity=Success -Facility=System -SymbolicName=ERROR_SESSION_CREDENTIAL_CONFLICT -Language=Bulgarian -ERROR_SESSION_CREDENTIAL_CONFLICT - Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again. -. - -MessageId=1220 -Severity=Success -Facility=System -SymbolicName=ERROR_REMOTE_SESSION_LIMIT_EXCEEDED -Language=Bulgarian -ERROR_REMOTE_SESSION_LIMIT_EXCEEDED - An attempt was made to establish a session to a network server, but there are already too many sessions established to that server. -. - -MessageId=1221 -Severity=Success -Facility=System -SymbolicName=ERROR_DUP_DOMAINNAME -Language=Bulgarian -ERROR_DUP_DOMAINNAME - The workgroup or domain name is already in use by another computer on the network. -. - -MessageId=1222 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_NETWORK -Language=Bulgarian -ERROR_NO_NETWORK - The network is not present or not started. -. - -MessageId=1223 -Severity=Success -Facility=System -SymbolicName=ERROR_CANCELLED -Language=Bulgarian -ERROR_CANCELLED - The operation was canceled by the user. -. - -MessageId=1224 -Severity=Success -Facility=System -SymbolicName=ERROR_USER_MAPPED_FILE -Language=Bulgarian -ERROR_USER_MAPPED_FILE - The requested operation cannot be performed on a file with a user-mapped section open. -. - -MessageId=1225 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTION_REFUSED -Language=Bulgarian -ERROR_CONNECTION_REFUSED - The remote system refused the network connection. -. - -MessageId=1226 -Severity=Success -Facility=System -SymbolicName=ERROR_GRACEFUL_DISCONNECT -Language=Bulgarian -ERROR_GRACEFUL_DISCONNECT - The network connection was gracefully closed. -. - -MessageId=1227 -Severity=Success -Facility=System -SymbolicName=ERROR_ADDRESS_ALREADY_ASSOCIATED -Language=Bulgarian -ERROR_ADDRESS_ALREADY_ASSOCIATED - The network transport endpoint already has an address associated with it. -. - -MessageId=1228 -Severity=Success -Facility=System -SymbolicName=ERROR_ADDRESS_NOT_ASSOCIATED -Language=Bulgarian -ERROR_ADDRESS_NOT_ASSOCIATED - An address has not yet been associated with the network endpoint. -. - -MessageId=1229 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTION_INVALID -Language=Bulgarian -ERROR_CONNECTION_INVALID - An operation was attempted on a nonexistent network connection. -. - -MessageId=1230 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTION_ACTIVE -Language=Bulgarian -ERROR_CONNECTION_ACTIVE - An invalid operation was attempted on an active network connection. -. - -MessageId=1231 -Severity=Success -Facility=System -SymbolicName=ERROR_NETWORK_UNREACHABLE -Language=Bulgarian -ERROR_NETWORK_UNREACHABLE - The network location cannot be reached. For information about network troubleshooting, see Windows Help. -. - -MessageId=1232 -Severity=Success -Facility=System -SymbolicName=ERROR_HOST_UNREACHABLE -Language=Bulgarian -ERROR_HOST_UNREACHABLE - The network location cannot be reached. For information about network troubleshooting, see Windows Help. -. - -MessageId=1233 -Severity=Success -Facility=System -SymbolicName=ERROR_PROTOCOL_UNREACHABLE -Language=Bulgarian -ERROR_PROTOCOL_UNREACHABLE - The network location cannot be reached. For information about network troubleshooting, see Windows Help. -. - -MessageId=1234 -Severity=Success -Facility=System -SymbolicName=ERROR_PORT_UNREACHABLE -Language=Bulgarian -ERROR_PORT_UNREACHABLE - No service is operating at the destination network endpoint on the remote system. -. - -MessageId=1235 -Severity=Success -Facility=System -SymbolicName=ERROR_REQUEST_ABORTED -Language=Bulgarian -ERROR_REQUEST_ABORTED - The request was aborted. -. - -MessageId=1236 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTION_ABORTED -Language=Bulgarian -ERROR_CONNECTION_ABORTED - The network connection was aborted by the local system. -. - -MessageId=1237 -Severity=Success -Facility=System -SymbolicName=ERROR_RETRY -Language=Bulgarian -ERROR_RETRY - The operation could not be completed. A retry should be performed. -. - -MessageId=1238 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTION_COUNT_LIMIT -Language=Bulgarian -ERROR_CONNECTION_COUNT_LIMIT - A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached. -. - -MessageId=1239 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGIN_TIME_RESTRICTION -Language=Bulgarian -ERROR_LOGIN_TIME_RESTRICTION - Attempting to log in during an unauthorized time of day for this account. -. - -MessageId=1240 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGIN_WKSTA_RESTRICTION -Language=Bulgarian -ERROR_LOGIN_WKSTA_RESTRICTION - The account is not authorized to log in from this station. -. - -MessageId=1241 -Severity=Success -Facility=System -SymbolicName=ERROR_INCORRECT_ADDRESS -Language=Bulgarian -ERROR_INCORRECT_ADDRESS - The network address could not be used for the operation requested. -. - -MessageId=1242 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_REGISTERED -Language=Bulgarian -ERROR_ALREADY_REGISTERED - The service is already registered. -. - -MessageId=1243 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVICE_NOT_FOUND -Language=Bulgarian -ERROR_SERVICE_NOT_FOUND - The specified service does not exist. -. - -MessageId=1244 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_AUTHENTICATED -Language=Bulgarian -ERROR_NOT_AUTHENTICATED - The operation being requested was not performed because the user has not been authenticated. -. - -MessageId=1245 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_LOGGED_ON -Language=Bulgarian -ERROR_NOT_LOGGED_ON - The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist. -. - -MessageId=1246 -Severity=Success -Facility=System -SymbolicName=ERROR_CONTINUE -Language=Bulgarian -ERROR_CONTINUE - Continue with work in progress. -. - -MessageId=1247 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_INITIALIZED -Language=Bulgarian -ERROR_ALREADY_INITIALIZED - An attempt was made to perform an initialization operation when initialization has already been completed. -. - -MessageId=1248 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MORE_DEVICES -Language=Bulgarian -ERROR_NO_MORE_DEVICES - No more local devices. -. - -MessageId=1249 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_SITE -Language=Bulgarian -ERROR_NO_SUCH_SITE - The specified site does not exist. -. - -MessageId=1250 -Severity=Success -Facility=System -SymbolicName=ERROR_DOMAIN_CONTROLLER_EXISTS -Language=Bulgarian -ERROR_DOMAIN_CONTROLLER_EXISTS - A domain controller with the specified name already exists. -. - -MessageId=1251 -Severity=Success -Facility=System -SymbolicName=ERROR_ONLY_IF_CONNECTED -Language=Bulgarian -ERROR_ONLY_IF_CONNECTED - This operation is supported only when you are connected to the server. -. - -MessageId=1252 -Severity=Success -Facility=System -SymbolicName=ERROR_OVERRIDE_NOCHANGES -Language=Bulgarian -ERROR_OVERRIDE_NOCHANGES - The group policy framework should call the extension even if there are no changes. -. - -MessageId=1253 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_USER_PROFILE -Language=Bulgarian -ERROR_BAD_USER_PROFILE - The specified user does not have a valid profile. -. - -MessageId=1254 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_SUPPORTED_ON_SBS -Language=Bulgarian -ERROR_NOT_SUPPORTED_ON_SBS - This operation is not supported on a computer running Windows Server 2003 for Small Business Server. -. - -MessageId=1255 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVER_SHUTDOWN_IN_PROGRESS -Language=Bulgarian -ERROR_SERVER_SHUTDOWN_IN_PROGRESS - The server machine is shutting down. -. - -MessageId=1256 -Severity=Success -Facility=System -SymbolicName=ERROR_HOST_DOWN -Language=Bulgarian -ERROR_HOST_DOWN - The remote system is not available. For information about network troubleshooting, see Windows Help. -. - -MessageId=1257 -Severity=Success -Facility=System -SymbolicName=ERROR_NON_ACCOUNT_SID -Language=Bulgarian -ERROR_NON_ACCOUNT_SID - The security identifier provided is not from an account domain. -. - -MessageId=1258 -Severity=Success -Facility=System -SymbolicName=ERROR_NON_DOMAIN_SID -Language=Bulgarian -ERROR_NON_DOMAIN_SID - The security identifier provided does not have a domain component. -. - -MessageId=1259 -Severity=Success -Facility=System -SymbolicName=ERROR_APPHELP_BLOCK -Language=Bulgarian -ERROR_APPHELP_BLOCK - AppHelp dialog canceled thus preventing the application from starting. -. - -MessageId=1260 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCESS_DISABLED_BY_POLICY -Language=Bulgarian -ERROR_ACCESS_DISABLED_BY_POLICY - Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open Event Viewer or contact your system administrator. -. - -MessageId=1261 -Severity=Success -Facility=System -SymbolicName=ERROR_REG_NAT_CONSUMPTION -Language=Bulgarian -ERROR_REG_NAT_CONSUMPTION - A program attempt to use an invalid register value. Normally caused by an uninitialized register. This error is Itanium specific. -. - -MessageId=1262 -Severity=Success -Facility=System -SymbolicName=ERROR_CSCSHARE_OFFLINE -Language=Bulgarian -ERROR_CSCSHARE_OFFLINE - The share is currently offline or does not exist. -. - -MessageId=1263 -Severity=Success -Facility=System -SymbolicName=ERROR_PKINIT_FAILURE -Language=Bulgarian -ERROR_PKINIT_FAILURE - The kerberos protocol encountered an error while validating the KDC certificate during smartcard logon. -. - -MessageId=1264 -Severity=Success -Facility=System -SymbolicName=ERROR_SMARTCARD_SUBSYSTEM_FAILURE -Language=Bulgarian -ERROR_SMARTCARD_SUBSYSTEM_FAILURE - The kerberos protocol encountered an error while attempting to utilize the smartcard subsystem. -. - -MessageId=1265 -Severity=Success -Facility=System -SymbolicName=ERROR_DOWNGRADE_DETECTED -Language=Bulgarian -ERROR_DOWNGRADE_DETECTED - The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you. -. - -MessageId=1266 -Severity=Success -Facility=System -SymbolicName=SEC_E_SMARTCARD_CERT_REVOKED -Language=Bulgarian -SEC_E_SMARTCARD_CERT_REVOKED - The smartcard certificate used for authentication has been revoked. Please contact your system administrator. There may be additional information in the event log. -. - -MessageId=1267 -Severity=Success -Facility=System -SymbolicName=SEC_E_ISSUING_CA_UNTRUSTED -Language=Bulgarian -SEC_E_ISSUING_CA_UNTRUSTED - An untrusted certificate authority was detected while processing the smartcard certificate used for authentication. Please contact your system administrator. -. - -MessageId=1268 -Severity=Success -Facility=System -SymbolicName=SEC_E_REVOCATION_OFFLINE_C -Language=Bulgarian -SEC_E_REVOCATION_OFFLINE_C - The revocation status of the smartcard certificate used for authentication could not be determined. Please contact your system administrator. -. - -MessageId=1269 -Severity=Success -Facility=System -SymbolicName=SEC_E_PKINIT_CLIENT_FAILUR -Language=Bulgarian -SEC_E_PKINIT_CLIENT_FAILUR - The smartcard certificate used for authentication was not trusted. Please contact your system administrator. -. - -MessageId=1270 -Severity=Success -Facility=System -SymbolicName=SEC_E_SMARTCARD_CERT_EXPIRED -Language=Bulgarian -SEC_E_SMARTCARD_CERT_EXPIRED - The smartcard certificate used for authentication has expired. Please contact your system administrator. -. - -MessageId=1271 -Severity=Success -Facility=System -SymbolicName=ERROR_MACHINE_LOCKED -Language=Bulgarian -ERROR_MACHINE_LOCKED - The machine is locked and cannot be shut down without the force option. -. - -MessageId=1273 -Severity=Success -Facility=System -SymbolicName=ERROR_CALLBACK_SUPPLIED_INVALID_DATA -Language=Bulgarian -ERROR_CALLBACK_SUPPLIED_INVALID_DATA - An application-defined callback gave invalid data when called. -. - -MessageId=1274 -Severity=Success -Facility=System -SymbolicName=ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED -Language=Bulgarian -ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED - The group policy framework should call the extension in the synchronous foreground policy refresh. -. - -MessageId=1275 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVER_BLOCKED -Language=Bulgarian -ERROR_DRIVER_BLOCKED - This driver has been blocked from loading. -. - -MessageId=1276 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_IMPORT_OF_NON_DLL -Language=Bulgarian -ERROR_INVALID_IMPORT_OF_NON_DLL - A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image. -. - -MessageId=1277 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCESS_DISABLED_WEBBLADE -Language=Bulgarian -ERROR_ACCESS_DISABLED_WEBBLADE - Windows cannot open this program since it has been disabled. -. - -MessageId=1278 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER -Language=Bulgarian -ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER - Windows cannot open this program because the license enforcement system has been tampered with or become corrupted. -. - -MessageId=1279 -Severity=Success -Facility=System -SymbolicName=ERROR_RECOVERY_FAILURE -Language=Bulgarian -ERROR_RECOVERY_FAILURE - A transaction recovery failed. -. - -MessageId=1280 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_FIBER -Language=Bulgarian -ERROR_ALREADY_FIBER - The current thread has already been converted to a fiber. -. - -MessageId=1281 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_THREAD -Language=Bulgarian -ERROR_ALREADY_THREAD - The current thread has already been converted from a fiber. -. - -MessageId=1282 -Severity=Success -Facility=System -SymbolicName=ERROR_STACK_BUFFER_OVERRUN -Language=Bulgarian -ERROR_STACK_BUFFER_OVERRUN - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application. -. - -MessageId=1283 -Severity=Success -Facility=System -SymbolicName=ERROR_PARAMETER_QUOTA_EXCEEDED -Language=Bulgarian -ERROR_PARAMETER_QUOTA_EXCEEDED - Data present in one of the parameters is more than the function can operate on. -. - -MessageId=1284 -Severity=Success -Facility=System -SymbolicName=ERROR_DEBUGGER_INACTIVE -Language=Bulgarian -ERROR_DEBUGGER_INACTIVE - An attempt to do an operation on a debug object failed because the object is in the process of being deleted. -. - -MessageId=1285 -Severity=Success -Facility=System -SymbolicName=ERROR_DELAY_LOAD_FAILED -Language=Bulgarian -ERROR_DELAY_LOAD_FAILED - An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed. -. - -MessageId=1286 -Severity=Success -Facility=System -SymbolicName=ERROR_VDM_DISALLOWED -Language=Bulgarian -ERROR_VDM_DISALLOWED - %1 is a 16-bit application. You do not have permissions to execute 16-bit applications. Check your permissions with your system administrator. -. - -MessageId=1287 -Severity=Success -Facility=System -SymbolicName=ERROR_UNIDENTIFIED_ERROR -Language=Bulgarian -ERROR_UNIDENTIFIED_ERROR - Insufficient information exists to identify the cause of failure. -. - -MessageId=1288 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_BANDWIDTH_PARAMETERS -Language=Bulgarian -ERROR_INVALID_BANDWIDTH_PARAMETERS - An invalid budget or period parameter was specified. -. - -MessageId=1289 -Severity=Success -Facility=System -SymbolicName=ERROR_AFFINITY_NOT_COMPATIBLE -Language=Bulgarian -ERROR_AFFINITY_NOT_COMPATIBLE - An attempt was made to join a thread to a reserve whose affinity did not intersect the reserve affinity or an attempt was made to associate a process with a reserve whose affinity did not intersect the reserve affinity. -. - -MessageId=1290 -Severity=Success -Facility=System -SymbolicName=ERROR_THREAD_ALREADY_IN_RESERVE -Language=Bulgarian -ERROR_THREAD_ALREADY_IN_RESERVE - An attempt was made to join a thread to a reserve which was already joined to another reserve. -. - -MessageId=1291 -Severity=Success -Facility=System -SymbolicName=ERROR_THREAD_NOT_IN_RESERVE -Language=Bulgarian -ERROR_THREAD_NOT_IN_RESERVE - An attempt was made to disjoin a thread from a reserve, but the thread was not joined to the reserve. -. - -MessageId=1292 -Severity=Success -Facility=System -SymbolicName=ERROR_THREAD_PROCESS_IN_RESERVE -Language=Bulgarian -ERROR_THREAD_PROCESS_IN_RESERVE - An attempt was made to disjoin a thread from a reserve whose process is associated with a reserve. -. - -MessageId=1293 -Severity=Success -Facility=System -SymbolicName=ERROR_PROCESS_ALREADY_IN_RESERVE -Language=Bulgarian -ERROR_PROCESS_ALREADY_IN_RESERVE - An attempt was made to associate a process with a reserve that was already associated with a reserve. -. - -MessageId=1294 -Severity=Success -Facility=System -SymbolicName=ERROR_PROCESS_NOT_IN_RESERVE -Language=Bulgarian -ERROR_PROCESS_NOT_IN_RESERVE - An attempt was made to disassociate a process from a reserve, but the process did not have an associated reserve. -. - -MessageId=1295 -Severity=Success -Facility=System -SymbolicName=ERROR_PROCESS_THREADS_IN_RESERVE -Language=Bulgarian -ERROR_PROCESS_THREADS_IN_RESERVE - An attempt was made to associate a process with a reserve, but the process contained thread joined to a reserve. -. - -MessageId=1296 -Severity=Success -Facility=System -SymbolicName=ERROR_AFFINITY_NOT_SET_IN_RESERVE -Language=Bulgarian -ERROR_AFFINITY_NOT_SET_IN_RESERVE - An attempt was made to set the affinity of a thread or a process, but the thread or process was joined or associated with a reserve. -. - -MessageId=1297 -Severity=Success -Facility=System -SymbolicName=ERROR_IMPLEMENTATION_LIMIT -Language=Bulgarian -ERROR_IMPLEMENTATION_LIMIT - An operation attempted to exceed an implementation-defined limit. -. - -MessageId=1298 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CACHE_ONLY -Language=Bulgarian -ERROR_DS_CACHE_ONLY - The requested object is for internal DS operations only. -. - -MessageId=1300 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_ALL_ASSIGNED -Language=Bulgarian -ERROR_NOT_ALL_ASSIGNED - Not all privileges referenced are assigned to the caller. -. - -MessageId=1301 -Severity=Success -Facility=System -SymbolicName=ERROR_SOME_NOT_MAPPED -Language=Bulgarian -ERROR_SOME_NOT_MAPPED - Some mapping between account names and security IDs was not done. -. - -MessageId=1302 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_QUOTAS_FOR_ACCOUNT -Language=Bulgarian -ERROR_NO_QUOTAS_FOR_ACCOUNT - No system quota limits are specifically set for this account. -. - -MessageId=1303 -Severity=Success -Facility=System -SymbolicName=ERROR_LOCAL_USER_SESSION_KEY -Language=Bulgarian -ERROR_LOCAL_USER_SESSION_KEY - No encryption key is available. A well-known encryption key was returned. -. - -MessageId=1304 -Severity=Success -Facility=System -SymbolicName=ERROR_NULL_LM_PASSWORD -Language=Bulgarian -ERROR_NULL_LM_PASSWORD - The password is too complex to be converted to a LAN Manager password. The LAN Manager password returned is a NULL string. -. - -MessageId=1305 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_REVISION -Language=Bulgarian -ERROR_UNKNOWN_REVISION - The revision level is unknown. -. - -MessageId=1306 -Severity=Success -Facility=System -SymbolicName=ERROR_REVISION_MISMATCH -Language=Bulgarian -ERROR_REVISION_MISMATCH - Indicates two revision levels are incompatible. -. - -MessageId=1307 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_OWNER -Language=Bulgarian -ERROR_INVALID_OWNER - This security ID may not be assigned as the owner of this object. -. - -MessageId=1308 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PRIMARY_GROUP -Language=Bulgarian -ERROR_INVALID_PRIMARY_GROUP - This security ID may not be assigned as the primary group of an object. -. - -MessageId=1309 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_IMPERSONATION_TOKEN -Language=Bulgarian -ERROR_NO_IMPERSONATION_TOKEN - An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client. -. - -MessageId=1310 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_DISABLE_MANDATORY -Language=Bulgarian -ERROR_CANT_DISABLE_MANDATORY - The group may not be disabled. -. - -MessageId=1311 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_LOGON_SERVERS -Language=Bulgarian -ERROR_NO_LOGON_SERVERS - There are currently no logon servers available to service the logon request. -. - -MessageId=1312 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_LOGON_SESSION -Language=Bulgarian -ERROR_NO_SUCH_LOGON_SESSION - A specified logon session does not exist. It may already have been terminated. -. - -MessageId=1313 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_PRIVILEGE -Language=Bulgarian -ERROR_NO_SUCH_PRIVILEGE - A specified privilege does not exist. -. - -MessageId=1314 -Severity=Success -Facility=System -SymbolicName=ERROR_PRIVILEGE_NOT_HELD -Language=Bulgarian -ERROR_PRIVILEGE_NOT_HELD - A required privilege is not held by the client. -. - -MessageId=1315 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ACCOUNT_NAME -Language=Bulgarian -ERROR_INVALID_ACCOUNT_NAME - The name provided is not a properly formed account name. -. - -MessageId=1316 -Severity=Success -Facility=System -SymbolicName=ERROR_USER_EXISTS -Language=Bulgarian -ERROR_USER_EXISTS - The specified user already exists. -. - -MessageId=1317 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_USER -Language=Bulgarian -ERROR_NO_SUCH_USER - The specified user does not exist. -. - -MessageId=1318 -Severity=Success -Facility=System -SymbolicName=ERROR_GROUP_EXISTS -Language=Bulgarian -ERROR_GROUP_EXISTS - The specified group already exists. -. - -MessageId=1319 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_GROUP -Language=Bulgarian -ERROR_NO_SUCH_GROUP - The specified group does not exist. -. - -MessageId=1320 -Severity=Success -Facility=System -SymbolicName=ERROR_MEMBER_IN_GROUP -Language=Bulgarian -ERROR_MEMBER_IN_GROUP - Either the specified user account is already a member of the specified group, or the specified group cannot be deleted because it contains a member. -. - -MessageId=1321 -Severity=Success -Facility=System -SymbolicName=ERROR_MEMBER_NOT_IN_GROUP -Language=Bulgarian -ERROR_MEMBER_NOT_IN_GROUP - The specified user account is not a member of the specified group account. -. - -MessageId=1322 -Severity=Success -Facility=System -SymbolicName=ERROR_LAST_ADMIN -Language=Bulgarian -ERROR_LAST_ADMIN - The last remaining administration account cannot be disabled or deleted. -. - -MessageId=1323 -Severity=Success -Facility=System -SymbolicName=ERROR_WRONG_PASSWORD -Language=Bulgarian -ERROR_WRONG_PASSWORD - Unable to update the password. The value provided as the current password is incorrect. -. - -MessageId=1324 -Severity=Success -Facility=System -SymbolicName=ERROR_ILL_FORMED_PASSWORD -Language=Bulgarian -ERROR_ILL_FORMED_PASSWORD - Unable to update the password. The value provided for the new password contains values that are not allowed in passwords. -. - -MessageId=1325 -Severity=Success -Facility=System -SymbolicName=ERROR_PASSWORD_RESTRICTION -Language=Bulgarian -ERROR_PASSWORD_RESTRICTION - Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirement of the domain. -. - -MessageId=1326 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGON_FAILURE -Language=Bulgarian -ERROR_LOGON_FAILURE - Logon failure: unknown user name or bad password. -. - -MessageId=1327 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCOUNT_RESTRICTION -Language=Bulgarian -ERROR_ACCOUNT_RESTRICTION - Logon failure: user account restriction. Possible reasons are blank passwords not allowed, logon hour restrictions, or a policy restriction has been enforced. -. - -MessageId=1328 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LOGON_HOURS -Language=Bulgarian -ERROR_INVALID_LOGON_HOURS - Logon failure: account logon time restriction violation. -. - -MessageId=1329 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_WORKSTATION -Language=Bulgarian -ERROR_INVALID_WORKSTATION - Logon failure: user not allowed to log on to this computer. -. - -MessageId=1330 -Severity=Success -Facility=System -SymbolicName=ERROR_PASSWORD_EXPIRED -Language=Bulgarian -ERROR_PASSWORD_EXPIRED - Logon failure: the specified account password has expired. -. - -MessageId=1331 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCOUNT_DISABLED -Language=Bulgarian -ERROR_ACCOUNT_DISABLED - Logon failure: account currently disabled. -. - -MessageId=1332 -Severity=Success -Facility=System -SymbolicName=ERROR_NONE_MAPPED -Language=Bulgarian -ERROR_NONE_MAPPED - No mapping between account names and security IDs was done. -. - -MessageId=1333 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_LUIDS_REQUESTED -Language=Bulgarian -ERROR_TOO_MANY_LUIDS_REQUESTED - Too many local user identifiers (LUIDs) were requested at one time. -. - -MessageId=1334 -Severity=Success -Facility=System -SymbolicName=ERROR_LUIDS_EXHAUSTED -Language=Bulgarian -ERROR_LUIDS_EXHAUSTED - No more local user identifiers (LUIDs) are available. -. - -MessageId=1335 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SUB_AUTHORITY -Language=Bulgarian -ERROR_INVALID_SUB_AUTHORITY - The subauthority part of a security ID is invalid for this particular use. -. - -MessageId=1336 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ACL -Language=Bulgarian -ERROR_INVALID_ACL - The access control list (ACL) structure is invalid. -. - -MessageId=1337 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SID -Language=Bulgarian -ERROR_INVALID_SID - The security ID structure is invalid. -. - -MessageId=1338 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SECURITY_DESCR -Language=Bulgarian -ERROR_INVALID_SECURITY_DESCR - The security descriptor structure is invalid. -. - -MessageId=1340 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_INHERITANCE_ACL -Language=Bulgarian -ERROR_BAD_INHERITANCE_ACL - The inherited access control list (ACL) or access control entry (ACE) could not be built. -. - -MessageId=1341 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVER_DISABLED -Language=Bulgarian -ERROR_SERVER_DISABLED - The server is currently disabled. -. - -MessageId=1342 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVER_NOT_DISABLED -Language=Bulgarian -ERROR_SERVER_NOT_DISABLED - The server is currently enabled. -. - -MessageId=1343 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ID_AUTHORITY -Language=Bulgarian -ERROR_INVALID_ID_AUTHORITY - The value provided was an invalid value for an identifier authority. -. - -MessageId=1344 -Severity=Success -Facility=System -SymbolicName=ERROR_ALLOTTED_SPACE_EXCEEDED -Language=Bulgarian -ERROR_ALLOTTED_SPACE_EXCEEDED - No more memory is available for security information updates. -. - -MessageId=1345 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_GROUP_ATTRIBUTES -Language=Bulgarian -ERROR_INVALID_GROUP_ATTRIBUTES - The specified attributes are invalid, or incompatible with the attributes for the group as a whole. -. - -MessageId=1346 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_IMPERSONATION_LEVEL -Language=Bulgarian -ERROR_BAD_IMPERSONATION_LEVEL - Either a required impersonation level was not provided, or the provided impersonation level is invalid. -. - -MessageId=1347 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_OPEN_ANONYMOUS -Language=Bulgarian -ERROR_CANT_OPEN_ANONYMOUS - Cannot open an anonymous level security token. -. - -MessageId=1348 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_VALIDATION_CLASS -Language=Bulgarian -ERROR_BAD_VALIDATION_CLASS - The validation information class requested was invalid. -. - -MessageId=1349 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_TOKEN_TYPE -Language=Bulgarian -ERROR_BAD_TOKEN_TYPE - The type of the token is inappropriate for its attempted use. -. - -MessageId=1350 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SECURITY_ON_OBJECT -Language=Bulgarian -ERROR_NO_SECURITY_ON_OBJECT - Unable to perform a security operation on an object that has no associated security. -. - -MessageId=1351 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_ACCESS_DOMAIN_INFO -Language=Bulgarian -ERROR_CANT_ACCESS_DOMAIN_INFO - Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. -. - -MessageId=1352 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SERVER_STATE -Language=Bulgarian -ERROR_INVALID_SERVER_STATE - The security account manager (SAM) or local security authority (LSA) server was in the wrong state to perform the security operation. -. - -MessageId=1353 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DOMAIN_STATE -Language=Bulgarian -ERROR_INVALID_DOMAIN_STATE - The domain was in the wrong state to perform the security operation. -. - -MessageId=1354 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DOMAIN_ROLE -Language=Bulgarian -ERROR_INVALID_DOMAIN_ROLE - This operation is only allowed for the Primary Domain Controller of the domain. -. - -MessageId=1355 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_DOMAIN -Language=Bulgarian -ERROR_NO_SUCH_DOMAIN - The specified domain either does not exist or could not be contacted. -. - -MessageId=1356 -Severity=Success -Facility=System -SymbolicName=ERROR_DOMAIN_EXISTS -Language=Bulgarian -ERROR_DOMAIN_EXISTS - The specified domain already exists. -. - -MessageId=1357 -Severity=Success -Facility=System -SymbolicName=ERROR_DOMAIN_LIMIT_EXCEEDED -Language=Bulgarian -ERROR_DOMAIN_LIMIT_EXCEEDED - An attempt was made to exceed the limit on the number of domains per server. -. - -MessageId=1358 -Severity=Success -Facility=System -SymbolicName=ERROR_INTERNAL_DB_CORRUPTION -Language=Bulgarian -ERROR_INTERNAL_DB_CORRUPTION - Unable to complete the requested operation because of either a catastrophic media failure or a data structure corruption on the disk. -. - -MessageId=1359 -Severity=Success -Facility=System -SymbolicName=ERROR_INTERNAL_ERROR -Language=Bulgarian -ERROR_INTERNAL_ERROR - An internal error occurred. -. - -MessageId=1360 -Severity=Success -Facility=System -SymbolicName=ERROR_GENERIC_NOT_MAPPED -Language=Bulgarian -ERROR_GENERIC_NOT_MAPPED - Generic access types were contained in an access mask which should already be mapped to nongeneric types. -. - -MessageId=1361 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_DESCRIPTOR_FORMAT -Language=Bulgarian -ERROR_BAD_DESCRIPTOR_FORMAT - A security descriptor is not in the right format (absolute or self-relative). -. - -MessageId=1362 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_LOGON_PROCESS -Language=Bulgarian -ERROR_NOT_LOGON_PROCESS - The requested action is restricted for use by logon processes only. The calling process has not registered as a logon process. -. - -MessageId=1363 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGON_SESSION_EXISTS -Language=Bulgarian -ERROR_LOGON_SESSION_EXISTS - Cannot start a new logon session with an ID that is already in use. -. - -MessageId=1364 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_PACKAGE -Language=Bulgarian -ERROR_NO_SUCH_PACKAGE - A specified authentication package is unknown. -. - -MessageId=1365 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_LOGON_SESSION_STATE -Language=Bulgarian -ERROR_BAD_LOGON_SESSION_STATE - The logon session is not in a state that is consistent with the requested operation. -. - -MessageId=1366 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGON_SESSION_COLLISION -Language=Bulgarian -ERROR_LOGON_SESSION_COLLISION - The logon session ID is already in use. -. - -MessageId=1367 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LOGON_TYPE -Language=Bulgarian -ERROR_INVALID_LOGON_TYPE - A logon request contained an invalid logon type value. -. - -MessageId=1368 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_IMPERSONATE -Language=Bulgarian -ERROR_CANNOT_IMPERSONATE - Unable to impersonate using a named pipe until data has been read from that pipe. -. - -MessageId=1369 -Severity=Success -Facility=System -SymbolicName=ERROR_RXACT_INVALID_STATE -Language=Bulgarian -ERROR_RXACT_INVALID_STATE - The transaction state of a registry subtree is incompatible with the requested operation. -. - -MessageId=1370 -Severity=Success -Facility=System -SymbolicName=ERROR_RXACT_COMMIT_FAILURE -Language=Bulgarian -ERROR_RXACT_COMMIT_FAILURE - An internal security database corruption has been encountered. -. - -MessageId=1371 -Severity=Success -Facility=System -SymbolicName=ERROR_SPECIAL_ACCOUNT -Language=Bulgarian -ERROR_SPECIAL_ACCOUNT - Cannot perform this operation on built-in accounts. -. - -MessageId=1372 -Severity=Success -Facility=System -SymbolicName=ERROR_SPECIAL_GROUP -Language=Bulgarian -ERROR_SPECIAL_GROUP - Cannot perform this operation on this built-in special group. -. - -MessageId=1373 -Severity=Success -Facility=System -SymbolicName=ERROR_SPECIAL_USER -Language=Bulgarian -ERROR_SPECIAL_USER - Cannot perform this operation on this built-in special user. -. - -MessageId=1374 -Severity=Success -Facility=System -SymbolicName=ERROR_MEMBERS_PRIMARY_GROUP -Language=Bulgarian -ERROR_MEMBERS_PRIMARY_GROUP - The user cannot be removed from a group because the group is currently the user's primary group. -. - -MessageId=1375 -Severity=Success -Facility=System -SymbolicName=ERROR_TOKEN_ALREADY_IN_USE -Language=Bulgarian -ERROR_TOKEN_ALREADY_IN_USE - The token is already in use as a primary token. -. - -MessageId=1376 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_ALIAS -Language=Bulgarian -ERROR_NO_SUCH_ALIAS - The specified local group does not exist. -. - -MessageId=1377 -Severity=Success -Facility=System -SymbolicName=ERROR_MEMBER_NOT_IN_ALIAS -Language=Bulgarian -ERROR_MEMBER_NOT_IN_ALIAS - The specified account name is not a member of the local group. -. - -MessageId=1378 -Severity=Success -Facility=System -SymbolicName=ERROR_MEMBER_IN_ALIAS -Language=Bulgarian -ERROR_MEMBER_IN_ALIAS - The specified account name is already a member of the local group. -. - -MessageId=1379 -Severity=Success -Facility=System -SymbolicName=ERROR_ALIAS_EXISTS -Language=Bulgarian -ERROR_ALIAS_EXISTS - The specified local group already exists. -. - -MessageId=1380 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGON_NOT_GRANTED -Language=Bulgarian -ERROR_LOGON_NOT_GRANTED - Logon failure: the user has not been granted the requested logon type at this computer. -. - -MessageId=1381 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_SECRETS -Language=Bulgarian -ERROR_TOO_MANY_SECRETS - The maximum number of secrets that may be stored in a single system has been exceeded. -. - -MessageId=1382 -Severity=Success -Facility=System -SymbolicName=ERROR_SECRET_TOO_LONG -Language=Bulgarian -ERROR_SECRET_TOO_LONG - The length of a secret exceeds the maximum length allowed. -. - -MessageId=1383 -Severity=Success -Facility=System -SymbolicName=ERROR_INTERNAL_DB_ERROR -Language=Bulgarian -ERROR_INTERNAL_DB_ERROR - The local security authority database contains an internal inconsistency. -. - -MessageId=1384 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_CONTEXT_IDS -Language=Bulgarian -ERROR_TOO_MANY_CONTEXT_IDS - During a logon attempt, the user's security context accumulated too many security IDs. -. - -MessageId=1385 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGON_TYPE_NOT_GRANTED -Language=Bulgarian -ERROR_LOGON_TYPE_NOT_GRANTED - Logon failure: the user has not been granted the requested logon type at this computer. -. - -MessageId=1386 -Severity=Success -Facility=System -SymbolicName=ERROR_NT_CROSS_ENCRYPTION_REQUIRED -Language=Bulgarian -ERROR_NT_CROSS_ENCRYPTION_REQUIRED - A cross-encrypted password is necessary to change a user password. -. - -MessageId=1387 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUCH_MEMBER -Language=Bulgarian -ERROR_NO_SUCH_MEMBER - A new member could not be added to or removed from the local group because the member does not exist. -. - -MessageId=1388 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MEMBER -Language=Bulgarian -ERROR_INVALID_MEMBER - A new member could not be added to a local group because the member has the wrong account type. -. - -MessageId=1389 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_SIDS -Language=Bulgarian -ERROR_TOO_MANY_SIDS - Too many security IDs have been specified. -. - -MessageId=1390 -Severity=Success -Facility=System -SymbolicName=ERROR_LM_CROSS_ENCRYPTION_REQUIRED -Language=Bulgarian -ERROR_LM_CROSS_ENCRYPTION_REQUIRED - A cross-encrypted password is necessary to change this user password. -. - -MessageId=1391 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_INHERITANCE -Language=Bulgarian -ERROR_NO_INHERITANCE - Indicates an ACL contains no inheritable components. -. - -MessageId=1392 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_CORRUPT -Language=Bulgarian -ERROR_FILE_CORRUPT - The file or directory is corrupted and unreadable. -. - -MessageId=1393 -Severity=Success -Facility=System -SymbolicName=ERROR_DISK_CORRUPT -Language=Bulgarian -ERROR_DISK_CORRUPT - The disk structure is corrupted and unreadable. -. - -MessageId=1394 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_USER_SESSION_KEY -Language=Bulgarian -ERROR_NO_USER_SESSION_KEY - There is no user session key for the specified logon session. -. - -MessageId=1395 -Severity=Success -Facility=System -SymbolicName=ERROR_LICENSE_QUOTA_EXCEEDED -Language=Bulgarian -ERROR_LICENSE_QUOTA_EXCEEDED - The service being accessed is licensed for a particular number of connections. No more connections can be made to the service at this time because there are already as many connections as the service can accept. -. - -MessageId=1396 -Severity=Success -Facility=System -SymbolicName=ERROR_WRONG_TARGET_NAME -Language=Bulgarian -ERROR_WRONG_TARGET_NAME - Logon Failure: The target account name is incorrect. -. - -MessageId=1397 -Severity=Success -Facility=System -SymbolicName=ERROR_MUTUAL_AUTH_FAILED -Language=Bulgarian -ERROR_MUTUAL_AUTH_FAILED - Mutual Authentication failed. The server's password is out of date at the domain controller. -. - -MessageId=1398 -Severity=Success -Facility=System -SymbolicName=ERROR_TIME_SKEW -Language=Bulgarian -ERROR_TIME_SKEW - There is a time and/or date difference between the client and server. -. - -MessageId=1399 -Severity=Success -Facility=System -SymbolicName=ERROR_CURRENT_DOMAIN_NOT_ALLOWED -Language=Bulgarian -ERROR_CURRENT_DOMAIN_NOT_ALLOWED - This operation cannot be performed on the current domain. -. - -MessageId=1400 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_WINDOW_HANDLE -Language=Bulgarian -ERROR_INVALID_WINDOW_HANDLE - Invalid window handle. -. - -MessageId=1401 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MENU_HANDLE -Language=Bulgarian -ERROR_INVALID_MENU_HANDLE - Invalid menu handle. -. - -MessageId=1402 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_CURSOR_HANDLE -Language=Bulgarian -ERROR_INVALID_CURSOR_HANDLE - Invalid cursor handle. -. - -MessageId=1403 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ACCEL_HANDLE -Language=Bulgarian -ERROR_INVALID_ACCEL_HANDLE - Invalid accelerator table handle. -. - -MessageId=1404 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_HOOK_HANDLE -Language=Bulgarian -ERROR_INVALID_HOOK_HANDLE - Invalid hook handle. -. - -MessageId=1405 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DWP_HANDLE -Language=Bulgarian -ERROR_INVALID_DWP_HANDLE - Invalid handle to a multiple-window position structure. -. - -MessageId=1406 -Severity=Success -Facility=System -SymbolicName=ERROR_TLW_WITH_WSCHILD -Language=Bulgarian -ERROR_TLW_WITH_WSCHILD - Cannot create a top-level child window. -. - -MessageId=1407 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_FIND_WND_CLASS -Language=Bulgarian -ERROR_CANNOT_FIND_WND_CLASS - Cannot find window class. -. - -MessageId=1408 -Severity=Success -Facility=System -SymbolicName=ERROR_WINDOW_OF_OTHER_THREAD -Language=Bulgarian -ERROR_WINDOW_OF_OTHER_THREAD - Invalid window; it belongs to other thread. -. - -MessageId=1409 -Severity=Success -Facility=System -SymbolicName=ERROR_HOTKEY_ALREADY_REGISTERED -Language=Bulgarian -ERROR_HOTKEY_ALREADY_REGISTERED - Hot key is already registered. -. - -MessageId=1410 -Severity=Success -Facility=System -SymbolicName=ERROR_CLASS_ALREADY_EXISTS -Language=Bulgarian -ERROR_CLASS_ALREADY_EXISTS - Class already exists. -. - -MessageId=1411 -Severity=Success -Facility=System -SymbolicName=ERROR_CLASS_DOES_NOT_EXIST -Language=Bulgarian -ERROR_CLASS_DOES_NOT_EXIST - Class does not exist. -. - -MessageId=1412 -Severity=Success -Facility=System -SymbolicName=ERROR_CLASS_HAS_WINDOWS -Language=Bulgarian -ERROR_CLASS_HAS_WINDOWS - Class still has open windows. -. - -MessageId=1413 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_INDEX -Language=Bulgarian -ERROR_INVALID_INDEX - Invalid index. -. - -MessageId=1414 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ICON_HANDLE -Language=Bulgarian -ERROR_INVALID_ICON_HANDLE - Invalid icon handle. -. - -MessageId=1415 -Severity=Success -Facility=System -SymbolicName=ERROR_PRIVATE_DIALOG_INDEX -Language=Bulgarian -ERROR_PRIVATE_DIALOG_INDEX - Using private DIALOG window words. -. - -MessageId=1416 -Severity=Success -Facility=System -SymbolicName=ERROR_LISTBOX_ID_NOT_FOUND -Language=Bulgarian -ERROR_LISTBOX_ID_NOT_FOUND - The list box identifier was not found. -. - -MessageId=1417 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_WILDCARD_CHARACTERS -Language=Bulgarian -ERROR_NO_WILDCARD_CHARACTERS - No wildcards were found. -. - -MessageId=1418 -Severity=Success -Facility=System -SymbolicName=ERROR_CLIPBOARD_NOT_OPEN -Language=Bulgarian -ERROR_CLIPBOARD_NOT_OPEN - Thread does not have a clipboard open. -. - -MessageId=1419 -Severity=Success -Facility=System -SymbolicName=ERROR_HOTKEY_NOT_REGISTERED -Language=Bulgarian -ERROR_HOTKEY_NOT_REGISTERED - Hot key is not registered. -. - -MessageId=1420 -Severity=Success -Facility=System -SymbolicName=ERROR_WINDOW_NOT_DIALOG -Language=Bulgarian -ERROR_WINDOW_NOT_DIALOG - The window is not a valid dialog window. -. - -MessageId=1421 -Severity=Success -Facility=System -SymbolicName=ERROR_CONTROL_ID_NOT_FOUND -Language=Bulgarian -ERROR_CONTROL_ID_NOT_FOUND - Control ID not found. -. - -MessageId=1422 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_COMBOBOX_MESSAGE -Language=Bulgarian -ERROR_INVALID_COMBOBOX_MESSAGE - Invalid message for a combo box because it does not have an edit control. -. - -MessageId=1423 -Severity=Success -Facility=System -SymbolicName=ERROR_WINDOW_NOT_COMBOBOX -Language=Bulgarian -ERROR_WINDOW_NOT_COMBOBOX - The window is not a combo box. -. - -MessageId=1424 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_EDIT_HEIGHT -Language=Bulgarian -ERROR_INVALID_EDIT_HEIGHT - Height must be less than 256. -. - -MessageId=1425 -Severity=Success -Facility=System -SymbolicName=ERROR_DC_NOT_FOUND -Language=Bulgarian -ERROR_DC_NOT_FOUND - Invalid device context (DC) handle. -. - -MessageId=1426 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_HOOK_FILTER -Language=Bulgarian -ERROR_INVALID_HOOK_FILTER - Invalid hook procedure type. -. - -MessageId=1427 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_FILTER_PROC -Language=Bulgarian -ERROR_INVALID_FILTER_PROC - Invalid hook procedure. -. - -MessageId=1428 -Severity=Success -Facility=System -SymbolicName=ERROR_HOOK_NEEDS_HMOD -Language=Bulgarian -ERROR_HOOK_NEEDS_HMOD - Cannot set nonlocal hook without a module handle. -. - -MessageId=1429 -Severity=Success -Facility=System -SymbolicName=ERROR_GLOBAL_ONLY_HOOK -Language=Bulgarian -ERROR_GLOBAL_ONLY_HOOK - This hook procedure can only be set globally. -. - -MessageId=1430 -Severity=Success -Facility=System -SymbolicName=ERROR_JOURNAL_HOOK_SET -Language=Bulgarian -ERROR_JOURNAL_HOOK_SET - The journal hook procedure is already installed. -. - -MessageId=1431 -Severity=Success -Facility=System -SymbolicName=ERROR_HOOK_NOT_INSTALLED -Language=Bulgarian -ERROR_HOOK_NOT_INSTALLED - The hook procedure is not installed. -. - -MessageId=1432 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LB_MESSAGE -Language=Bulgarian -ERROR_INVALID_LB_MESSAGE - Invalid message for single-selection list box. -. - -MessageId=1433 -Severity=Success -Facility=System -SymbolicName=ERROR_SETCOUNT_ON_BAD_LB -Language=Bulgarian -ERROR_SETCOUNT_ON_BAD_LB - LB_SETCOUNT sent to non-lazy list box. -. - -MessageId=1434 -Severity=Success -Facility=System -SymbolicName=ERROR_LB_WITHOUT_TABSTOPS -Language=Bulgarian -ERROR_LB_WITHOUT_TABSTOPS - This list box does not support tab stops. -. - -MessageId=1435 -Severity=Success -Facility=System -SymbolicName=ERROR_DESTROY_OBJECT_OF_OTHER_THREAD -Language=Bulgarian -ERROR_DESTROY_OBJECT_OF_OTHER_THREAD - Cannot destroy object created by another thread. -. - -MessageId=1436 -Severity=Success -Facility=System -SymbolicName=ERROR_CHILD_WINDOW_MENU -Language=Bulgarian -ERROR_CHILD_WINDOW_MENU - Child windows cannot have menus. -. - -MessageId=1437 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SYSTEM_MENU -Language=Bulgarian -ERROR_NO_SYSTEM_MENU - The window does not have a system menu. -. - -MessageId=1438 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MSGBOX_STYLE -Language=Bulgarian -ERROR_INVALID_MSGBOX_STYLE - Invalid message box style. -. - -MessageId=1439 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SPI_VALUE -Language=Bulgarian -ERROR_INVALID_SPI_VALUE - Invalid system-wide (SPI_*) parameter. -. - -MessageId=1440 -Severity=Success -Facility=System -SymbolicName=ERROR_SCREEN_ALREADY_LOCKED -Language=Bulgarian -ERROR_SCREEN_ALREADY_LOCKED - Screen already locked. -. - -MessageId=1441 -Severity=Success -Facility=System -SymbolicName=ERROR_HWNDS_HAVE_DIFF_PARENT -Language=Bulgarian -ERROR_HWNDS_HAVE_DIFF_PARENT - All handles to windows in a multiple-window position structure must have the same parent. -. - -MessageId=1442 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_CHILD_WINDOW -Language=Bulgarian -ERROR_NOT_CHILD_WINDOW - The window is not a child window. -. - -MessageId=1443 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_GW_COMMAND -Language=Bulgarian -ERROR_INVALID_GW_COMMAND - Invalid GW_* command. -. - -MessageId=1444 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_THREAD_ID -Language=Bulgarian -ERROR_INVALID_THREAD_ID - Invalid thread identifier. -. - -MessageId=1445 -Severity=Success -Facility=System -SymbolicName=ERROR_NON_MDICHILD_WINDOW -Language=Bulgarian -ERROR_NON_MDICHILD_WINDOW - Cannot process a message from a window that is not a multiple document interface (MDI) window. -. - -MessageId=1446 -Severity=Success -Facility=System -SymbolicName=ERROR_POPUP_ALREADY_ACTIVE -Language=Bulgarian -ERROR_POPUP_ALREADY_ACTIVE - Popup menu already active. -. - -MessageId=1447 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SCROLLBARS -Language=Bulgarian -ERROR_NO_SCROLLBARS - The window does not have scroll bars. -. - -MessageId=1448 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SCROLLBAR_RANGE -Language=Bulgarian -ERROR_INVALID_SCROLLBAR_RANGE - Scroll bar range cannot be greater than MAXLONG. -. - -MessageId=1449 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SHOWWIN_COMMAND -Language=Bulgarian -ERROR_INVALID_SHOWWIN_COMMAND - Cannot show or remove the window in the way specified. -. - -MessageId=1450 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SYSTEM_RESOURCES -Language=Bulgarian -ERROR_NO_SYSTEM_RESOURCES - Insufficient system resources exist to complete the requested service. -. - -MessageId=1451 -Severity=Success -Facility=System -SymbolicName=ERROR_NONPAGED_SYSTEM_RESOURCES -Language=Bulgarian -ERROR_NONPAGED_SYSTEM_RESOURCES - Insufficient system resources exist to complete the requested service. -. - -MessageId=1452 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGED_SYSTEM_RESOURCES -Language=Bulgarian -ERROR_PAGED_SYSTEM_RESOURCES - Insufficient system resources exist to complete the requested service. -. - -MessageId=1453 -Severity=Success -Facility=System -SymbolicName=ERROR_WORKING_SET_QUOTA -Language=Bulgarian -ERROR_WORKING_SET_QUOTA - Insufficient quota to complete the requested service. -. - -MessageId=1454 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGEFILE_QUOTA -Language=Bulgarian -ERROR_PAGEFILE_QUOTA - Insufficient quota to complete the requested service. -. - -MessageId=1455 -Severity=Success -Facility=System -SymbolicName=ERROR_COMMITMENT_LIMIT -Language=Bulgarian -ERROR_COMMITMENT_LIMIT - The paging file is too small for this operation to complete. -. - -MessageId=1456 -Severity=Success -Facility=System -SymbolicName=ERROR_MENU_ITEM_NOT_FOUND -Language=Bulgarian -ERROR_MENU_ITEM_NOT_FOUND - A menu item was not found. -. - -MessageId=1457 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_KEYBOARD_HANDLE -Language=Bulgarian -ERROR_INVALID_KEYBOARD_HANDLE - Invalid keyboard layout handle. -. - -MessageId=1458 -Severity=Success -Facility=System -SymbolicName=ERROR_HOOK_TYPE_NOT_ALLOWED -Language=Bulgarian -ERROR_HOOK_TYPE_NOT_ALLOWED - Hook type not allowed. -. - -MessageId=1459 -Severity=Success -Facility=System -SymbolicName=ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION -Language=Bulgarian -ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION - This operation requires an interactive window station. -. - -MessageId=1460 -Severity=Success -Facility=System -SymbolicName=ERROR_TIMEOUT -Language=Bulgarian -ERROR_TIMEOUT - This operation returned because the timeout period expired. -. - -MessageId=1461 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MONITOR_HANDLE -Language=Bulgarian -ERROR_INVALID_MONITOR_HANDLE - Invalid monitor handle. -. - -MessageId=1500 -Severity=Success -Facility=System -SymbolicName=ERROR_EVENTLOG_FILE_CORRUPT -Language=Bulgarian -ERROR_EVENTLOG_FILE_CORRUPT - The event log file is corrupted. -. - -MessageId=1501 -Severity=Success -Facility=System -SymbolicName=ERROR_EVENTLOG_CANT_START -Language=Bulgarian -ERROR_EVENTLOG_CANT_START - No event log file could be opened, so the event logging service did not start. -. - -MessageId=1502 -Severity=Success -Facility=System -SymbolicName=ERROR_LOG_FILE_FULL -Language=Bulgarian -ERROR_LOG_FILE_FULL - The event log file is full. -. - -MessageId=1503 -Severity=Success -Facility=System -SymbolicName=ERROR_EVENTLOG_FILE_CHANGED -Language=Bulgarian -ERROR_EVENTLOG_FILE_CHANGED - The event log file has changed between read operations. -. - -MessageId=1601 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_SERVICE_FAILURE -Language=Bulgarian -ERROR_INSTALL_SERVICE_FAILURE - The Windows Installer service could not be accessed. This can occur if you are running Windows in safe mode, or if the Windows Installer is not correctly installed. Contact your support personnel for assistance. -. - -MessageId=1602 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_USEREXIT -Language=Bulgarian -ERROR_INSTALL_USEREXIT - User cancelled installation. -. - -MessageId=1603 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_FAILURE -Language=Bulgarian -ERROR_INSTALL_FAILURE - Fatal error during installation. -. - -MessageId=1604 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_SUSPEND -Language=Bulgarian -ERROR_INSTALL_SUSPEND - Installation suspended, incomplete. -. - -MessageId=1605 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_PRODUCT -Language=Bulgarian -ERROR_UNKNOWN_PRODUCT - This action is only valid for products that are currently installed. -. - -MessageId=1606 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_FEATURE -Language=Bulgarian -ERROR_UNKNOWN_FEATURE - Feature ID not registered. -. - -MessageId=1607 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_COMPONENT -Language=Bulgarian -ERROR_UNKNOWN_COMPONENT - Component ID not registered. -. - -MessageId=1608 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_PROPERTY -Language=Bulgarian -ERROR_UNKNOWN_PROPERTY - Unknown property. -. - -MessageId=1609 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_HANDLE_STATE -Language=Bulgarian -ERROR_INVALID_HANDLE_STATE - Handle is in an invalid state. -. - -MessageId=1610 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_CONFIGURATION -Language=Bulgarian -ERROR_BAD_CONFIGURATION - The configuration data for this product is corrupt. Contact your support personnel. -. - -MessageId=1611 -Severity=Success -Facility=System -SymbolicName=ERROR_INDEX_ABSENT -Language=Bulgarian -ERROR_INDEX_ABSENT - Component qualifier not present. -. - -MessageId=1612 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_SOURCE_ABSENT -Language=Bulgarian -ERROR_INSTALL_SOURCE_ABSENT - The installation source for this product is not available. Verify that the source exists and that you can access it. -. - -MessageId=1613 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_PACKAGE_VERSION -Language=Bulgarian -ERROR_INSTALL_PACKAGE_VERSION - This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. -. - -MessageId=1614 -Severity=Success -Facility=System -SymbolicName=ERROR_PRODUCT_UNINSTALLED -Language=Bulgarian -ERROR_PRODUCT_UNINSTALLED - Product is uninstalled. -. - -MessageId=1615 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_QUERY_SYNTAX -Language=Bulgarian -ERROR_BAD_QUERY_SYNTAX - SQL query syntax invalid or unsupported. -. - -MessageId=1616 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_FIELD -Language=Bulgarian -ERROR_INVALID_FIELD - Record field does not exist. -. - -MessageId=1617 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_REMOVED -Language=Bulgarian -ERROR_DEVICE_REMOVED - The device has been removed. -. - -MessageId=1618 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_ALREADY_RUNNING -Language=Bulgarian -ERROR_INSTALL_ALREADY_RUNNING - Another installation is already in progress. Complete that installation before proceeding with this install. -. - -MessageId=1619 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_PACKAGE_OPEN_FAILED -Language=Bulgarian -ERROR_INSTALL_PACKAGE_OPEN_FAILED - This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package. -. - -MessageId=1620 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_PACKAGE_INVALID -Language=Bulgarian -ERROR_INSTALL_PACKAGE_INVALID - This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. -. - -MessageId=1621 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_UI_FAILURE -Language=Bulgarian -ERROR_INSTALL_UI_FAILURE - There was an error starting the Windows Installer service user interface. Contact your support personnel. -. - -MessageId=1622 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_LOG_FAILURE -Language=Bulgarian -ERROR_INSTALL_LOG_FAILURE - Error opening installation log file. Verify that the specified log file location exists and that you can write to it. -. - -MessageId=1623 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_LANGUAGE_UNSUPPORTED -Language=Bulgarian -ERROR_INSTALL_LANGUAGE_UNSUPPORTED - The language of this installation package is not supported by your system. -. - -MessageId=1624 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_TRANSFORM_FAILURE -Language=Bulgarian -ERROR_INSTALL_TRANSFORM_FAILURE - Error applying transforms. Verify that the specified transform paths are valid. -. - -MessageId=1625 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_PACKAGE_REJECTED -Language=Bulgarian -ERROR_INSTALL_PACKAGE_REJECTED - This installation is forbidden by system policy. Contact your system administrator. -. - -MessageId=1626 -Severity=Success -Facility=System -SymbolicName=ERROR_FUNCTION_NOT_CALLED -Language=Bulgarian -ERROR_FUNCTION_NOT_CALLED - Function could not be executed. -. - -MessageId=1627 -Severity=Success -Facility=System -SymbolicName=ERROR_FUNCTION_FAILED -Language=Bulgarian -ERROR_FUNCTION_FAILED - Function failed during execution. -. - -MessageId=1628 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_TABLE -Language=Bulgarian -ERROR_INVALID_TABLE - Invalid or unknown table specified. -. - -MessageId=1629 -Severity=Success -Facility=System -SymbolicName=ERROR_DATATYPE_MISMATCH -Language=Bulgarian -ERROR_DATATYPE_MISMATCH - Data supplied is of wrong type. -. - -MessageId=1630 -Severity=Success -Facility=System -SymbolicName=ERROR_UNSUPPORTED_TYPE -Language=Bulgarian -ERROR_UNSUPPORTED_TYPE - Data of this type is not supported. -. - -MessageId=1631 -Severity=Success -Facility=System -SymbolicName=ERROR_CREATE_FAILED -Language=Bulgarian -ERROR_CREATE_FAILED - The Windows Installer service failed to start. Contact your support personnel. -. - -MessageId=1632 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_TEMP_UNWRITABLE -Language=Bulgarian -ERROR_INSTALL_TEMP_UNWRITABLE - The Temp folder is on a drive that is full or inaccessible. Free up space on the drive or verify that you have write permission on the Temp folder. -. - -MessageId=1633 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_PLATFORM_UNSUPPORTED -Language=Bulgarian -ERROR_INSTALL_PLATFORM_UNSUPPORTED - This installation package is not supported by this processor type. Contact your product vendor. -. - -MessageId=1634 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_NOTUSED -Language=Bulgarian -ERROR_INSTALL_NOTUSED - Component not used on this computer. -. - -MessageId=1635 -Severity=Success -Facility=System -SymbolicName=ERROR_PATCH_PACKAGE_OPEN_FAILED -Language=Bulgarian -ERROR_PATCH_PACKAGE_OPEN_FAILED - This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package. -. - -MessageId=1636 -Severity=Success -Facility=System -SymbolicName=ERROR_PATCH_PACKAGE_INVALID -Language=Bulgarian -ERROR_PATCH_PACKAGE_INVALID - This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package. -. - -MessageId=1637 -Severity=Success -Facility=System -SymbolicName=ERROR_PATCH_PACKAGE_UNSUPPORTED -Language=Bulgarian -ERROR_PATCH_PACKAGE_UNSUPPORTED - This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service. -. - -MessageId=1638 -Severity=Success -Facility=System -SymbolicName=ERROR_PRODUCT_VERSION -Language=Bulgarian -ERROR_PRODUCT_VERSION - Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel. -. - -MessageId=1639 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_COMMAND_LINE -Language=Bulgarian -ERROR_INVALID_COMMAND_LINE - Invalid command line argument. Consult the Windows Installer SDK for detailed command line help. -. - -MessageId=1640 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_REMOTE_DISALLOWED -Language=Bulgarian -ERROR_INSTALL_REMOTE_DISALLOWED - Only administrators have permission to add, remove, or configure server software during a Terminal Services remote session. If you want to install or configure software on the server, contact your network administrator. -. - -MessageId=1641 -Severity=Success -Facility=System -SymbolicName=ERROR_SUCCESS_REBOOT_INITIATED -Language=Bulgarian -ERROR_SUCCESS_REBOOT_INITIATED - The requested operation completed successfully. The system will be restarted so the changes can take effect. -. - -MessageId=1642 -Severity=Success -Facility=System -SymbolicName=ERROR_PATCH_TARGET_NOT_FOUND -Language=Bulgarian -ERROR_PATCH_TARGET_NOT_FOUND - The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. -. - -MessageId=1643 -Severity=Success -Facility=System -SymbolicName=ERROR_PATCH_PACKAGE_REJECTED -Language=Bulgarian -ERROR_PATCH_PACKAGE_REJECTED - The patch package is not permitted by software restriction policy. -. - -MessageId=1644 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_TRANSFORM_REJECTED -Language=Bulgarian -ERROR_INSTALL_TRANSFORM_REJECTED - One or more customizations are not permitted by software restriction policy. -. - -MessageId=1645 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTALL_REMOTE_PROHIBITED -Language=Bulgarian -ERROR_INSTALL_REMOTE_PROHIBITED - The Windows Installer does not permit installation from a Remote Desktop Connection. -. - -MessageId=1700 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_STRING_BINDING -Language=Bulgarian -RPC_S_INVALID_STRING_BINDING - The string binding is invalid. -. - -MessageId=1701 -Severity=Success -Facility=System -SymbolicName=RPC_S_WRONG_KIND_OF_BINDING -Language=Bulgarian -RPC_S_WRONG_KIND_OF_BINDING - The binding handle is not the correct type. -. - -MessageId=1702 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_BINDING -Language=Bulgarian -RPC_S_INVALID_BINDING - The binding handle is invalid. -. - -MessageId=1703 -Severity=Success -Facility=System -SymbolicName=RPC_S_PROTSEQ_NOT_SUPPORTED -Language=Bulgarian -RPC_S_PROTSEQ_NOT_SUPPORTED - The RPC protocol sequence is not supported. -. - -MessageId=1704 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_RPC_PROTSEQ -Language=Bulgarian -RPC_S_INVALID_RPC_PROTSEQ - The RPC protocol sequence is invalid. -. - -MessageId=1705 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_STRING_UUID -Language=Bulgarian -RPC_S_INVALID_STRING_UUID - The string universal unique identifier (UUID) is invalid. -. - -MessageId=1706 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_ENDPOINT_FORMAT -Language=Bulgarian -RPC_S_INVALID_ENDPOINT_FORMAT - The endpoint format is invalid. -. - -MessageId=1707 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_NET_ADDR -Language=Bulgarian -RPC_S_INVALID_NET_ADDR - The network address is invalid. -. - -MessageId=1708 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_ENDPOINT_FOUND -Language=Bulgarian -RPC_S_NO_ENDPOINT_FOUND - No endpoint was found. -. - -MessageId=1709 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_TIMEOUT -Language=Bulgarian -RPC_S_INVALID_TIMEOUT - The timeout value is invalid. -. - -MessageId=1710 -Severity=Success -Facility=System -SymbolicName=RPC_S_OBJECT_NOT_FOUND -Language=Bulgarian -RPC_S_OBJECT_NOT_FOUND - The object universal unique identifier (UUID) was not found. -. - -MessageId=1711 -Severity=Success -Facility=System -SymbolicName=RPC_S_ALREADY_REGISTERED -Language=Bulgarian -RPC_S_ALREADY_REGISTERED - The object universal unique identifier (UUID) has already been registered. -. - -MessageId=1712 -Severity=Success -Facility=System -SymbolicName=RPC_S_TYPE_ALREADY_REGISTERED -Language=Bulgarian -RPC_S_TYPE_ALREADY_REGISTERED - The type universal unique identifier (UUID) has already been registered. -. - -MessageId=1713 -Severity=Success -Facility=System -SymbolicName=RPC_S_ALREADY_LISTENING -Language=Bulgarian -RPC_S_ALREADY_LISTENING - The RPC server is already listening. -. - -MessageId=1714 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_PROTSEQS_REGISTERED -Language=Bulgarian -RPC_S_NO_PROTSEQS_REGISTERED - No protocol sequences have been registered. -. - -MessageId=1715 -Severity=Success -Facility=System -SymbolicName=RPC_S_NOT_LISTENING -Language=Bulgarian -RPC_S_NOT_LISTENING - The RPC server is not listening. -. - -MessageId=1716 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNKNOWN_MGR_TYPE -Language=Bulgarian -RPC_S_UNKNOWN_MGR_TYPE - The manager type is unknown. -. - -MessageId=1717 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNKNOWN_IF -Language=Bulgarian -RPC_S_UNKNOWN_IF - The interface is unknown. -. - -MessageId=1718 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_BINDINGS -Language=Bulgarian -RPC_S_NO_BINDINGS - There are no bindings. -. - -MessageId=1719 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_PROTSEQS -Language=Bulgarian -RPC_S_NO_PROTSEQS - There are no protocol sequences. -. - -MessageId=1720 -Severity=Success -Facility=System -SymbolicName=RPC_S_CANT_CREATE_ENDPOINT -Language=Bulgarian -RPC_S_CANT_CREATE_ENDPOINT - The endpoint cannot be created. -. - -MessageId=1721 -Severity=Success -Facility=System -SymbolicName=RPC_S_OUT_OF_RESOURCES -Language=Bulgarian -RPC_S_OUT_OF_RESOURCES - Not enough resources are available to complete this operation. -. - -MessageId=1722 -Severity=Success -Facility=System -SymbolicName=RPC_S_SERVER_UNAVAILABLE -Language=Bulgarian -RPC_S_SERVER_UNAVAILABLE - The RPC server is unavailable. -. - -MessageId=1723 -Severity=Success -Facility=System -SymbolicName=RPC_S_SERVER_TOO_BUSY -Language=Bulgarian -RPC_S_SERVER_TOO_BUSY - The RPC server is too busy to complete this operation. -. - -MessageId=1724 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_NETWORK_OPTIONS -Language=Bulgarian -RPC_S_INVALID_NETWORK_OPTIONS - The network options are invalid. -. - -MessageId=1725 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_CALL_ACTIVE -Language=Bulgarian -RPC_S_NO_CALL_ACTIVE - There are no remote procedure calls active on this thread. -. - -MessageId=1726 -Severity=Success -Facility=System -SymbolicName=RPC_S_CALL_FAILED -Language=Bulgarian -RPC_S_CALL_FAILED - The remote procedure call failed. -. - -MessageId=1727 -Severity=Success -Facility=System -SymbolicName=RPC_S_CALL_FAILED_DNE -Language=Bulgarian -RPC_S_CALL_FAILED_DNE - The remote procedure call failed and did not execute. -. - -MessageId=1728 -Severity=Success -Facility=System -SymbolicName=RPC_S_PROTOCOL_ERROR -Language=Bulgarian -RPC_S_PROTOCOL_ERROR - A remote procedure call (RPC) protocol error occurred. -. - -MessageId=1730 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNSUPPORTED_TRANS_SYN -Language=Bulgarian -RPC_S_UNSUPPORTED_TRANS_SYN - The transfer syntax is not supported by the RPC server. -. - -MessageId=1732 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNSUPPORTED_TYPE -Language=Bulgarian -RPC_S_UNSUPPORTED_TYPE - The universal unique identifier (UUID) type is not supported. -. - -MessageId=1733 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_TAG -Language=Bulgarian -RPC_S_INVALID_TAG - The tag is invalid. -. - -MessageId=1734 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_BOUND -Language=Bulgarian -RPC_S_INVALID_BOUND - The array bounds are invalid. -. - -MessageId=1735 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_ENTRY_NAME -Language=Bulgarian -RPC_S_NO_ENTRY_NAME - The binding does not contain an entry name. -. - -MessageId=1736 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_NAME_SYNTAX -Language=Bulgarian -RPC_S_INVALID_NAME_SYNTAX - The name syntax is invalid. -. - -MessageId=1737 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNSUPPORTED_NAME_SYNTAX -Language=Bulgarian -RPC_S_UNSUPPORTED_NAME_SYNTAX - The name syntax is not supported. -. - -MessageId=1739 -Severity=Success -Facility=System -SymbolicName=RPC_S_UUID_NO_ADDRESS -Language=Bulgarian -RPC_S_UUID_NO_ADDRESS - No network address is available to use to construct a universal unique identifier (UUID). -. - -MessageId=1740 -Severity=Success -Facility=System -SymbolicName=RPC_S_DUPLICATE_ENDPOINT -Language=Bulgarian -RPC_S_DUPLICATE_ENDPOINT - The endpoint is a duplicate. -. - -MessageId=1741 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNKNOWN_AUTHN_TYPE -Language=Bulgarian -RPC_S_UNKNOWN_AUTHN_TYPE - The authentication type is unknown. -. - -MessageId=1742 -Severity=Success -Facility=System -SymbolicName=RPC_S_MAX_CALLS_TOO_SMALL -Language=Bulgarian -RPC_S_MAX_CALLS_TOO_SMALL - The maximum number of calls is too small. -. - -MessageId=1743 -Severity=Success -Facility=System -SymbolicName=RPC_S_STRING_TOO_LONG -Language=Bulgarian -RPC_S_STRING_TOO_LONG - The string is too long. -. - -MessageId=1744 -Severity=Success -Facility=System -SymbolicName=RPC_S_PROTSEQ_NOT_FOUND -Language=Bulgarian -RPC_S_PROTSEQ_NOT_FOUND - The RPC protocol sequence was not found. -. - -MessageId=1745 -Severity=Success -Facility=System -SymbolicName=RPC_S_PROCNUM_OUT_OF_RANGE -Language=Bulgarian -RPC_S_PROCNUM_OUT_OF_RANGE - The procedure number is out of range. -. - -MessageId=1746 -Severity=Success -Facility=System -SymbolicName=RPC_S_BINDING_HAS_NO_AUTH -Language=Bulgarian -RPC_S_BINDING_HAS_NO_AUTH - The binding does not contain any authentication information. -. - -MessageId=1747 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNKNOWN_AUTHN_SERVICE -Language=Bulgarian -RPC_S_UNKNOWN_AUTHN_SERVICE - The authentication service is unknown. -. - -MessageId=1748 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNKNOWN_AUTHN_LEVEL -Language=Bulgarian -RPC_S_UNKNOWN_AUTHN_LEVEL - The authentication level is unknown. -. - -MessageId=1749 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_AUTH_IDENTITY -Language=Bulgarian -RPC_S_INVALID_AUTH_IDENTITY - The security context is invalid. -. - -MessageId=1750 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNKNOWN_AUTHZ_SERVICE -Language=Bulgarian -RPC_S_UNKNOWN_AUTHZ_SERVICE - The authorization service is unknown. -. - -MessageId=1751 -Severity=Success -Facility=System -SymbolicName=EPT_S_INVALID_ENTRY -Language=Bulgarian -EPT_S_INVALID_ENTRY - The entry is invalid. -. - -MessageId=1752 -Severity=Success -Facility=System -SymbolicName=EPT_S_CANT_PERFORM_OP -Language=Bulgarian -EPT_S_CANT_PERFORM_OP - The server endpoint cannot perform the operation. -. - -MessageId=1753 -Severity=Success -Facility=System -SymbolicName=EPT_S_NOT_REGISTERED -Language=Bulgarian -EPT_S_NOT_REGISTERED - There are no more endpoints available from the endpoint mapper. -. - -MessageId=1754 -Severity=Success -Facility=System -SymbolicName=RPC_S_NOTHING_TO_EXPORT -Language=Bulgarian -RPC_S_NOTHING_TO_EXPORT - No interfaces have been exported. -. - -MessageId=1755 -Severity=Success -Facility=System -SymbolicName=RPC_S_INCOMPLETE_NAME -Language=Bulgarian -RPC_S_INCOMPLETE_NAME - The entry name is incomplete. -. - -MessageId=1756 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_VERS_OPTION -Language=Bulgarian -RPC_S_INVALID_VERS_OPTION - The version option is invalid. -. - -MessageId=1757 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_MORE_MEMBERS -Language=Bulgarian -RPC_S_NO_MORE_MEMBERS - There are no more members. -. - -MessageId=1758 -Severity=Success -Facility=System -SymbolicName=RPC_S_NOT_ALL_OBJS_UNEXPORTED -Language=Bulgarian -RPC_S_NOT_ALL_OBJS_UNEXPORTED - There is nothing to unexport. -. - -MessageId=1759 -Severity=Success -Facility=System -SymbolicName=RPC_S_INTERFACE_NOT_FOUND -Language=Bulgarian -RPC_S_INTERFACE_NOT_FOUND - The interface was not found. -. - -MessageId=1760 -Severity=Success -Facility=System -SymbolicName=RPC_S_ENTRY_ALREADY_EXISTS -Language=Bulgarian -RPC_S_ENTRY_ALREADY_EXISTS - The entry already exists. -. - -MessageId=1761 -Severity=Success -Facility=System -SymbolicName=RPC_S_ENTRY_NOT_FOUND -Language=Bulgarian -RPC_S_ENTRY_NOT_FOUND - The entry is not found. -. - -MessageId=1762 -Severity=Success -Facility=System -SymbolicName=RPC_S_NAME_SERVICE_UNAVAILABLE -Language=Bulgarian -RPC_S_NAME_SERVICE_UNAVAILABLE - The name service is unavailable. -. - -MessageId=1763 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_NAF_ID -Language=Bulgarian -RPC_S_INVALID_NAF_ID - The network address family is invalid. -. - -MessageId=1764 -Severity=Success -Facility=System -SymbolicName=RPC_S_CANNOT_SUPPORT -Language=Bulgarian -RPC_S_CANNOT_SUPPORT - The requested operation is not supported. -. - -MessageId=1765 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_CONTEXT_AVAILABLE -Language=Bulgarian -RPC_S_NO_CONTEXT_AVAILABLE - No security context is available to allow impersonation. -. - -MessageId=1766 -Severity=Success -Facility=System -SymbolicName=RPC_S_INTERNAL_ERROR -Language=Bulgarian -RPC_S_INTERNAL_ERROR - An internal error occurred in a remote procedure call (RPC). -. - -MessageId=1767 -Severity=Success -Facility=System -SymbolicName=RPC_S_ZERO_DIVIDE -Language=Bulgarian -RPC_S_ZERO_DIVIDE - The RPC server attempted an integer division by zero. -. - -MessageId=1768 -Severity=Success -Facility=System -SymbolicName=RPC_S_ADDRESS_ERROR -Language=Bulgarian -RPC_S_ADDRESS_ERROR - An addressing error occurred in the RPC server. -. - -MessageId=1769 -Severity=Success -Facility=System -SymbolicName=RPC_S_FP_DIV_ZERO -Language=Bulgarian -RPC_S_FP_DIV_ZERO - A floating-point operation at the RPC server caused a division by zero. -. - -MessageId=1770 -Severity=Success -Facility=System -SymbolicName=RPC_S_FP_UNDERFLOW -Language=Bulgarian -RPC_S_FP_UNDERFLOW - A floating-point underflow occurred at the RPC server. -. - -MessageId=1771 -Severity=Success -Facility=System -SymbolicName=RPC_S_FP_OVERFLOW -Language=Bulgarian -RPC_S_FP_OVERFLOW - A floating-point overflow occurred at the RPC server. -. - -MessageId=1772 -Severity=Success -Facility=System -SymbolicName=RPC_X_NO_MORE_ENTRIES -Language=Bulgarian -RPC_X_NO_MORE_ENTRIES - The list of RPC servers available for the binding of auto handles has been exhausted. -. - -MessageId=1773 -Severity=Success -Facility=System -SymbolicName=RPC_X_SS_CHAR_TRANS_OPEN_FAIL -Language=Bulgarian -RPC_X_SS_CHAR_TRANS_OPEN_FAIL - Unable to open the character translation table file. -. - -MessageId=1774 -Severity=Success -Facility=System -SymbolicName=RPC_X_SS_CHAR_TRANS_SHORT_FILE -Language=Bulgarian -RPC_X_SS_CHAR_TRANS_SHORT_FILE - The file containing the character translation table has fewer than 512 bytes. -. - -MessageId=1775 -Severity=Success -Facility=System -SymbolicName=RPC_X_SS_IN_NULL_CONTEXT -Language=Bulgarian -RPC_X_SS_IN_NULL_CONTEXT - A null context handle was passed from the client to the host during a remote procedure call. -. - -MessageId=1777 -Severity=Success -Facility=System -SymbolicName=RPC_X_SS_CONTEXT_DAMAGED -Language=Bulgarian -RPC_X_SS_CONTEXT_DAMAGED - The context handle changed during a remote procedure call. -. - -MessageId=1778 -Severity=Success -Facility=System -SymbolicName=RPC_X_SS_HANDLES_MISMATCH -Language=Bulgarian -RPC_X_SS_HANDLES_MISMATCH - The binding handles passed to a remote procedure call do not match. -. - -MessageId=1779 -Severity=Success -Facility=System -SymbolicName=RPC_X_SS_CANNOT_GET_CALL_HANDLE -Language=Bulgarian -RPC_X_SS_CANNOT_GET_CALL_HANDLE - The stub is unable to get the remote procedure call handle. -. - -MessageId=1780 -Severity=Success -Facility=System -SymbolicName=RPC_X_NULL_REF_POINTER -Language=Bulgarian -RPC_X_NULL_REF_POINTER - A null reference pointer was passed to the stub. -. - -MessageId=1781 -Severity=Success -Facility=System -SymbolicName=RPC_X_ENUM_VALUE_OUT_OF_RANGE -Language=Bulgarian -RPC_X_ENUM_VALUE_OUT_OF_RANGE - The enumeration value is out of range. -. - -MessageId=1782 -Severity=Success -Facility=System -SymbolicName=RPC_X_BYTE_COUNT_TOO_SMALL -Language=Bulgarian -RPC_X_BYTE_COUNT_TOO_SMALL - The byte count is too small. -. - -MessageId=1783 -Severity=Success -Facility=System -SymbolicName=RPC_X_BAD_STUB_DATA -Language=Bulgarian -RPC_X_BAD_STUB_DATA - The stub received bad data. -. - -MessageId=1784 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_USER_BUFFER -Language=Bulgarian -ERROR_INVALID_USER_BUFFER - The supplied user buffer is not valid for the requested operation. -. - -MessageId=1785 -Severity=Success -Facility=System -SymbolicName=ERROR_UNRECOGNIZED_MEDIA -Language=Bulgarian -ERROR_UNRECOGNIZED_MEDIA - The disk media is not recognized. It may not be formatted. -. - -MessageId=1786 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_TRUST_LSA_SECRET -Language=Bulgarian -ERROR_NO_TRUST_LSA_SECRET - The workstation does not have a trust secret. -. - -MessageId=1787 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_TRUST_SAM_ACCOUNT -Language=Bulgarian -ERROR_NO_TRUST_SAM_ACCOUNT - The security database on the server does not have a computer account for this workstation trust relationship. -. - -MessageId=1788 -Severity=Success -Facility=System -SymbolicName=ERROR_TRUSTED_DOMAIN_FAILURE -Language=Bulgarian -ERROR_TRUSTED_DOMAIN_FAILURE - The trust relationship between the primary domain and the trusted domain failed. -. - -MessageId=1789 -Severity=Success -Facility=System -SymbolicName=ERROR_TRUSTED_RELATIONSHIP_FAILURE -Language=Bulgarian -ERROR_TRUSTED_RELATIONSHIP_FAILURE - The trust relationship between this workstation and the primary domain failed. -. - -MessageId=1790 -Severity=Success -Facility=System -SymbolicName=ERROR_TRUST_FAILURE -Language=Bulgarian -ERROR_TRUST_FAILURE - The network logon failed. -. - -MessageId=1791 -Severity=Success -Facility=System -SymbolicName=RPC_S_CALL_IN_PROGRESS -Language=Bulgarian -RPC_S_CALL_IN_PROGRESS - A remote procedure call is already in progress for this thread. -. - -MessageId=1792 -Severity=Success -Facility=System -SymbolicName=ERROR_NETLOGON_NOT_STARTED -Language=Bulgarian -ERROR_NETLOGON_NOT_STARTED - An attempt was made to logon, but the network logon service was not started. -. - -MessageId=1793 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCOUNT_EXPIRED -Language=Bulgarian -ERROR_ACCOUNT_EXPIRED - The user's account has expired. -. - -MessageId=1794 -Severity=Success -Facility=System -SymbolicName=ERROR_REDIRECTOR_HAS_OPEN_HANDLES -Language=Bulgarian -ERROR_REDIRECTOR_HAS_OPEN_HANDLES - The redirector is in use and cannot be unloaded. -. - -MessageId=1795 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_DRIVER_ALREADY_INSTALLED -Language=Bulgarian -ERROR_PRINTER_DRIVER_ALREADY_INSTALLED - The specified printer driver is already installed. -. - -MessageId=1796 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_PORT -Language=Bulgarian -ERROR_UNKNOWN_PORT - The specified port is unknown. -. - -MessageId=1797 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_PRINTER_DRIVER -Language=Bulgarian -ERROR_UNKNOWN_PRINTER_DRIVER - The printer driver is unknown. -. - -MessageId=1798 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_PRINTPROCESSOR -Language=Bulgarian -ERROR_UNKNOWN_PRINTPROCESSOR - The print processor is unknown. -. - -MessageId=1799 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SEPARATOR_FILE -Language=Bulgarian -ERROR_INVALID_SEPARATOR_FILE - The specified separator file is invalid. -. - -MessageId=1800 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PRIORITY -Language=Bulgarian -ERROR_INVALID_PRIORITY - The specified priority is invalid. -. - -MessageId=1801 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PRINTER_NAME -Language=Bulgarian -ERROR_INVALID_PRINTER_NAME - The printer name is invalid. -. - -MessageId=1802 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_ALREADY_EXISTS -Language=Bulgarian -ERROR_PRINTER_ALREADY_EXISTS - The printer already exists. -. - -MessageId=1803 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PRINTER_COMMAND -Language=Bulgarian -ERROR_INVALID_PRINTER_COMMAND - The printer command is invalid. -. - -MessageId=1804 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DATATYPE -Language=Bulgarian -ERROR_INVALID_DATATYPE - The specified datatype is invalid. -. - -MessageId=1805 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ENVIRONMENT -Language=Bulgarian -ERROR_INVALID_ENVIRONMENT - The environment specified is invalid. -. - -MessageId=1806 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_MORE_BINDINGS -Language=Bulgarian -RPC_S_NO_MORE_BINDINGS - There are no more bindings. -. - -MessageId=1807 -Severity=Success -Facility=System -SymbolicName=ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT -Language=Bulgarian -ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT - The account used is an interdomain trust account. Use your global user account or local user account to access this server. -. - -MessageId=1808 -Severity=Success -Facility=System -SymbolicName=ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT -Language=Bulgarian -ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT - The account used is a computer account. Use your global user account or local user account to access this server. -. - -MessageId=1809 -Severity=Success -Facility=System -SymbolicName=ERROR_NOLOGON_SERVER_TRUST_ACCOUNT -Language=Bulgarian -ERROR_NOLOGON_SERVER_TRUST_ACCOUNT - The account used is a server trust account. Use your global user account or local user account to access this server. -. - -MessageId=1810 -Severity=Success -Facility=System -SymbolicName=ERROR_DOMAIN_TRUST_INCONSISTENT -Language=Bulgarian -ERROR_DOMAIN_TRUST_INCONSISTENT - The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain. -. - -MessageId=1811 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVER_HAS_OPEN_HANDLES -Language=Bulgarian -ERROR_SERVER_HAS_OPEN_HANDLES - The server is in use and cannot be unloaded. -. - -MessageId=1812 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_DATA_NOT_FOUND -Language=Bulgarian -ERROR_RESOURCE_DATA_NOT_FOUND - The specified image file did not contain a resource section. -. - -MessageId=1813 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_TYPE_NOT_FOUND -Language=Bulgarian -ERROR_RESOURCE_TYPE_NOT_FOUND - The specified resource type cannot be found in the image file. -. - -MessageId=1814 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_NAME_NOT_FOUND -Language=Bulgarian -ERROR_RESOURCE_NAME_NOT_FOUND - The specified resource name cannot be found in the image file. -. - -MessageId=1815 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_LANG_NOT_FOUND -Language=Bulgarian -ERROR_RESOURCE_LANG_NOT_FOUND - The specified resource language ID cannot be found in the image file. -. - -MessageId=1816 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_ENOUGH_QUOTA -Language=Bulgarian -ERROR_NOT_ENOUGH_QUOTA - Not enough quota is available to process this command. -. - -MessageId=1817 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_INTERFACES -Language=Bulgarian -RPC_S_NO_INTERFACES - No interfaces have been registered. -. - -MessageId=1818 -Severity=Success -Facility=System -SymbolicName=RPC_S_CALL_CANCELLED -Language=Bulgarian -RPC_S_CALL_CANCELLED - The remote procedure call was cancelled. -. - -MessageId=1819 -Severity=Success -Facility=System -SymbolicName=RPC_S_BINDING_INCOMPLETE -Language=Bulgarian -RPC_S_BINDING_INCOMPLETE - The binding handle does not contain all required information. -. - -MessageId=1820 -Severity=Success -Facility=System -SymbolicName=RPC_S_COMM_FAILURE -Language=Bulgarian -RPC_S_COMM_FAILURE - A communications failure occurred during a remote procedure call. -. - -MessageId=1821 -Severity=Success -Facility=System -SymbolicName=RPC_S_UNSUPPORTED_AUTHN_LEVEL -Language=Bulgarian -RPC_S_UNSUPPORTED_AUTHN_LEVEL - The requested authentication level is not supported. -. - -MessageId=1822 -Severity=Success -Facility=System -SymbolicName=RPC_S_NO_PRINC_NAME -Language=Bulgarian -RPC_S_NO_PRINC_NAME - No principal name registered. -. - -MessageId=1823 -Severity=Success -Facility=System -SymbolicName=RPC_S_NOT_RPC_ERROR -Language=Bulgarian -RPC_S_NOT_RPC_ERROR - The error specified is not a valid Windows RPC error code. -. - -MessageId=1824 -Severity=Success -Facility=System -SymbolicName=RPC_S_UUID_LOCAL_ONLY -Language=Bulgarian -RPC_S_UUID_LOCAL_ONLY - A UUID that is valid only on this computer has been allocated. -. - -MessageId=1825 -Severity=Success -Facility=System -SymbolicName=RPC_S_SEC_PKG_ERROR -Language=Bulgarian -RPC_S_SEC_PKG_ERROR - A security package specific error occurred. -. - -MessageId=1826 -Severity=Success -Facility=System -SymbolicName=RPC_S_NOT_CANCELLED -Language=Bulgarian -RPC_S_NOT_CANCELLED - Thread is not canceled. -. - -MessageId=1827 -Severity=Success -Facility=System -SymbolicName=RPC_X_INVALID_ES_ACTION -Language=Bulgarian -RPC_X_INVALID_ES_ACTION - Invalid operation on the encoding/decoding handle. -. - -MessageId=1828 -Severity=Success -Facility=System -SymbolicName=RPC_X_WRONG_ES_VERSION -Language=Bulgarian -RPC_X_WRONG_ES_VERSION - Incompatible version of the serializing package. -. - -MessageId=1829 -Severity=Success -Facility=System -SymbolicName=RPC_X_WRONG_STUB_VERSION -Language=Bulgarian -RPC_X_WRONG_STUB_VERSION - Incompatible version of the RPC stub. -. - -MessageId=1830 -Severity=Success -Facility=System -SymbolicName=RPC_X_INVALID_PIPE_OBJECT -Language=Bulgarian -RPC_X_INVALID_PIPE_OBJECT - The RPC pipe object is invalid or corrupted. -. - -MessageId=1831 -Severity=Success -Facility=System -SymbolicName=RPC_X_WRONG_PIPE_ORDER -Language=Bulgarian -RPC_X_WRONG_PIPE_ORDER - An invalid operation was attempted on an RPC pipe object. -. - -MessageId=1832 -Severity=Success -Facility=System -SymbolicName=RPC_X_WRONG_PIPE_VERSION -Language=Bulgarian -RPC_X_WRONG_PIPE_VERSION - Unsupported RPC pipe version. -. - -MessageId=1898 -Severity=Success -Facility=System -SymbolicName=RPC_S_GROUP_MEMBER_NOT_FOUND -Language=Bulgarian -RPC_S_GROUP_MEMBER_NOT_FOUND - The group member was not found. -. - -MessageId=1899 -Severity=Success -Facility=System -SymbolicName=EPT_S_CANT_CREATE -Language=Bulgarian -EPT_S_CANT_CREATE - The endpoint mapper database entry could not be created. -. - -MessageId=1900 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_OBJECT -Language=Bulgarian -RPC_S_INVALID_OBJECT - The object universal unique identifier (UUID) is the nil UUID. -. - -MessageId=1901 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_TIME -Language=Bulgarian -ERROR_INVALID_TIME - The specified time is invalid. -. - -MessageId=1902 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_FORM_NAME -Language=Bulgarian -ERROR_INVALID_FORM_NAME - The specified form name is invalid. -. - -MessageId=1903 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_FORM_SIZE -Language=Bulgarian -ERROR_INVALID_FORM_SIZE - The specified form size is invalid. -. - -MessageId=1904 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_WAITING -Language=Bulgarian -ERROR_ALREADY_WAITING - The specified printer handle is already being waited on -. - -MessageId=1905 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_DELETED -Language=Bulgarian -ERROR_PRINTER_DELETED - The specified printer has been deleted. -. - -MessageId=1906 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PRINTER_STATE -Language=Bulgarian -ERROR_INVALID_PRINTER_STATE - The state of the printer is invalid. -. - -MessageId=1907 -Severity=Success -Facility=System -SymbolicName=ERROR_PASSWORD_MUST_CHANGE -Language=Bulgarian -ERROR_PASSWORD_MUST_CHANGE - The user's password must be changed before logging on the first time. -. - -MessageId=1908 -Severity=Success -Facility=System -SymbolicName=ERROR_DOMAIN_CONTROLLER_NOT_FOUND -Language=Bulgarian -ERROR_DOMAIN_CONTROLLER_NOT_FOUND - Could not find the domain controller for this domain. -. - -MessageId=1909 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCOUNT_LOCKED_OUT -Language=Bulgarian -ERROR_ACCOUNT_LOCKED_OUT - The referenced account is currently locked out and may not be used to log on. -. - -MessageId=1910 -Severity=Success -Facility=System -SymbolicName=OR_INVALID_OXID -Language=Bulgarian -OR_INVALID_OXID - The object exporter specified was not found. -. - -MessageId=1911 -Severity=Success -Facility=System -SymbolicName=OR_INVALID_OID -Language=Bulgarian -OR_INVALID_OID - The object specified was not found. -. - -MessageId=1912 -Severity=Success -Facility=System -SymbolicName=OR_INVALID_SET -Language=Bulgarian -OR_INVALID_SET - The object resolver set specified was not found. -. - -MessageId=1913 -Severity=Success -Facility=System -SymbolicName=RPC_S_SEND_INCOMPLETE -Language=Bulgarian -RPC_S_SEND_INCOMPLETE - Some data remains to be sent in the request buffer. -. - -MessageId=1914 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_ASYNC_HANDLE -Language=Bulgarian -RPC_S_INVALID_ASYNC_HANDLE - Invalid asynchronous remote procedure call handle. -. - -MessageId=1915 -Severity=Success -Facility=System -SymbolicName=RPC_S_INVALID_ASYNC_CALL -Language=Bulgarian -RPC_S_INVALID_ASYNC_CALL - Invalid asynchronous RPC call handle for this operation. -. - -MessageId=1916 -Severity=Success -Facility=System -SymbolicName=RPC_X_PIPE_CLOSED -Language=Bulgarian -RPC_X_PIPE_CLOSED - The RPC pipe object has already been closed. -. - -MessageId=1917 -Severity=Success -Facility=System -SymbolicName=RPC_X_PIPE_DISCIPLINE_ERROR -Language=Bulgarian -RPC_X_PIPE_DISCIPLINE_ERROR - The RPC call completed before all pipes were processed. -. - -MessageId=1918 -Severity=Success -Facility=System -SymbolicName=RPC_X_PIPE_EMPTY -Language=Bulgarian -RPC_X_PIPE_EMPTY - No more data is available from the RPC pipe. -. - -MessageId=1919 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SITENAME -Language=Bulgarian -ERROR_NO_SITENAME - No site name is available for this machine. -. - -MessageId=1920 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_ACCESS_FILE -Language=Bulgarian -ERROR_CANT_ACCESS_FILE - The file cannot be accessed by the system. -. - -MessageId=1921 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_RESOLVE_FILENAME -Language=Bulgarian -ERROR_CANT_RESOLVE_FILENAME - The name of the file cannot be resolved by the system. -. - -MessageId=1922 -Severity=Success -Facility=System -SymbolicName=RPC_S_ENTRY_TYPE_MISMATCH -Language=Bulgarian -RPC_S_ENTRY_TYPE_MISMATCH - The entry is not of the expected type. -. - -MessageId=1923 -Severity=Success -Facility=System -SymbolicName=RPC_S_NOT_ALL_OBJS_EXPORTED -Language=Bulgarian -RPC_S_NOT_ALL_OBJS_EXPORTED - Not all object UUIDs could be exported to the specified entry. -. - -MessageId=1924 -Severity=Success -Facility=System -SymbolicName=RPC_S_INTERFACE_NOT_EXPORTED -Language=Bulgarian -RPC_S_INTERFACE_NOT_EXPORTED - Interface could not be exported to the specified entry. -. - -MessageId=1925 -Severity=Success -Facility=System -SymbolicName=RPC_S_PROFILE_NOT_ADDED -Language=Bulgarian -RPC_S_PROFILE_NOT_ADDED - The specified profile entry could not be added. -. - -MessageId=1926 -Severity=Success -Facility=System -SymbolicName=RPC_S_PRF_ELT_NOT_ADDED -Language=Bulgarian -RPC_S_PRF_ELT_NOT_ADDED - The specified profile element could not be added. -. - -MessageId=1927 -Severity=Success -Facility=System -SymbolicName=RPC_S_PRF_ELT_NOT_REMOVED -Language=Bulgarian -RPC_S_PRF_ELT_NOT_REMOVED - The specified profile element could not be removed. -. - -MessageId=1928 -Severity=Success -Facility=System -SymbolicName=RPC_S_GRP_ELT_NOT_ADDED -Language=Bulgarian -RPC_S_GRP_ELT_NOT_ADDED - The group element could not be added. -. - -MessageId=1929 -Severity=Success -Facility=System -SymbolicName=RPC_S_GRP_ELT_NOT_REMOVED -Language=Bulgarian -RPC_S_GRP_ELT_NOT_REMOVED - The group element could not be removed. -. - -MessageId=1930 -Severity=Success -Facility=System -SymbolicName=ERROR_KM_DRIVER_BLOCKED -Language=Bulgarian -ERROR_KM_DRIVER_BLOCKED - The printer driver is not compatible with a policy enabled on your computer that blocks NT 4.0 drivers. -. - -MessageId=1931 -Severity=Success -Facility=System -SymbolicName=ERROR_CONTEXT_EXPIRED -Language=Bulgarian -ERROR_CONTEXT_EXPIRED - The context has expired and can no longer be used. -. - -MessageId=1932 -Severity=Success -Facility=System -SymbolicName=ERROR_PER_USER_TRUST_QUOTA_EXCEEDED -Language=Bulgarian -ERROR_PER_USER_TRUST_QUOTA_EXCEEDED - The current user's delegated trust creation quota has been exceeded. -. - -MessageId=1933 -Severity=Success -Facility=System -SymbolicName=ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED -Language=Bulgarian -ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED - The total delegated trust creation quota has been exceeded. -. - -MessageId=1934 -Severity=Success -Facility=System -SymbolicName=ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED -Language=Bulgarian -ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED - The current user's delegated trust deletion quota has been exceeded. -. - -MessageId=2000 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PIXEL_FORMAT -Language=Bulgarian -ERROR_INVALID_PIXEL_FORMAT - The pixel format is invalid. -. - -MessageId=2001 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_DRIVER -Language=Bulgarian -ERROR_BAD_DRIVER - The specified driver is invalid. -. - -MessageId=2002 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_WINDOW_STYLE -Language=Bulgarian -ERROR_INVALID_WINDOW_STYLE - The window style or class attribute is invalid for this operation. -. - -MessageId=2003 -Severity=Success -Facility=System -SymbolicName=ERROR_METAFILE_NOT_SUPPORTED -Language=Bulgarian -ERROR_METAFILE_NOT_SUPPORTED - The requested metafile operation is not supported. -. - -MessageId=2004 -Severity=Success -Facility=System -SymbolicName=ERROR_TRANSFORM_NOT_SUPPORTED -Language=Bulgarian -ERROR_TRANSFORM_NOT_SUPPORTED - The requested transformation operation is not supported. -. - -MessageId=2005 -Severity=Success -Facility=System -SymbolicName=ERROR_CLIPPING_NOT_SUPPORTED -Language=Bulgarian -ERROR_CLIPPING_NOT_SUPPORTED - The requested clipping operation is not supported. -. - -MessageId=2010 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_CMM -Language=Bulgarian -ERROR_INVALID_CMM - The specified color management module is invalid. -. - -MessageId=2011 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PROFILE -Language=Bulgarian -ERROR_INVALID_PROFILE - The specified color profile is invalid. -. - -MessageId=2012 -Severity=Success -Facility=System -SymbolicName=ERROR_TAG_NOT_FOUND -Language=Bulgarian -ERROR_TAG_NOT_FOUND - The specified tag was not found. -. - -MessageId=2013 -Severity=Success -Facility=System -SymbolicName=ERROR_TAG_NOT_PRESENT -Language=Bulgarian -ERROR_TAG_NOT_PRESENT - A required tag is not present. -. - -MessageId=2014 -Severity=Success -Facility=System -SymbolicName=ERROR_DUPLICATE_TAG -Language=Bulgarian -ERROR_DUPLICATE_TAG - The specified tag is already present. -. - -MessageId=2015 -Severity=Success -Facility=System -SymbolicName=ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE -Language=Bulgarian -ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE - The specified color profile is not associated with any device. -. - -MessageId=2016 -Severity=Success -Facility=System -SymbolicName=ERROR_PROFILE_NOT_FOUND -Language=Bulgarian -ERROR_PROFILE_NOT_FOUND - The specified color profile was not found. -. - -MessageId=2017 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_COLORSPACE -Language=Bulgarian -ERROR_INVALID_COLORSPACE - The specified color space is invalid. -. - -MessageId=2018 -Severity=Success -Facility=System -SymbolicName=ERROR_ICM_NOT_ENABLED -Language=Bulgarian -ERROR_ICM_NOT_ENABLED - Image Color Management is not enabled. -. - -MessageId=2019 -Severity=Success -Facility=System -SymbolicName=ERROR_DELETING_ICM_XFORM -Language=Bulgarian -ERROR_DELETING_ICM_XFORM - There was an error while deleting the color transform. -. - -MessageId=2020 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_TRANSFORM -Language=Bulgarian -ERROR_INVALID_TRANSFORM - The specified color transform is invalid. -. - -MessageId=2021 -Severity=Success -Facility=System -SymbolicName=ERROR_COLORSPACE_MISMATCH -Language=Bulgarian -ERROR_COLORSPACE_MISMATCH - The specified transform does not match the bitmap's color space. -. - -MessageId=2022 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_COLORINDEX -Language=Bulgarian -ERROR_INVALID_COLORINDEX - The specified named color index is not present in the profile. -. - -MessageId=2108 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTED_OTHER_PASSWORD -Language=Bulgarian -ERROR_CONNECTED_OTHER_PASSWORD - The network connection was made successfully, but the user had to be prompted for a password other than the one originally specified. -. - -MessageId=2109 -Severity=Success -Facility=System -SymbolicName=ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT -Language=Bulgarian -ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT - The network connection was made successfully using default credentials. -. - -MessageId=2202 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_USERNAME -Language=Bulgarian -ERROR_BAD_USERNAME - The specified username is invalid. -. - -MessageId=2250 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_CONNECTED -Language=Bulgarian -ERROR_NOT_CONNECTED - This network connection does not exist. -. - -MessageId=2401 -Severity=Success -Facility=System -SymbolicName=ERROR_OPEN_FILES -Language=Bulgarian -ERROR_OPEN_FILES - This network connection has files open or requests pending. -. - -MessageId=2402 -Severity=Success -Facility=System -SymbolicName=ERROR_ACTIVE_CONNECTIONS -Language=Bulgarian -ERROR_ACTIVE_CONNECTIONS - Active connections still exist. -. - -MessageId=2404 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_IN_USE -Language=Bulgarian -ERROR_DEVICE_IN_USE - The device is in use by an active process and cannot be disconnected. -. - -MessageId=3000 -Severity=Success -Facility=System -SymbolicName=ERROR_UNKNOWN_PRINT_MONITOR -Language=Bulgarian -ERROR_UNKNOWN_PRINT_MONITOR - The specified print monitor is unknown. -. - -MessageId=3001 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_DRIVER_IN_USE -Language=Bulgarian -ERROR_PRINTER_DRIVER_IN_USE - The specified printer driver is currently in use. -. - -MessageId=3002 -Severity=Success -Facility=System -SymbolicName=ERROR_SPOOL_FILE_NOT_FOUND -Language=Bulgarian -ERROR_SPOOL_FILE_NOT_FOUND - The spool file was not found. -. - -MessageId=3003 -Severity=Success -Facility=System -SymbolicName=ERROR_SPL_NO_STARTDOC -Language=Bulgarian -ERROR_SPL_NO_STARTDOC - A StartDocPrinter call was not issued. -. - -MessageId=3004 -Severity=Success -Facility=System -SymbolicName=ERROR_SPL_NO_ADDJOB -Language=Bulgarian -ERROR_SPL_NO_ADDJOB - An AddJob call was not issued. -. - -MessageId=3005 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED -Language=Bulgarian -ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED - The specified print processor has already been installed. -. - -MessageId=3006 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINT_MONITOR_ALREADY_INSTALLED -Language=Bulgarian -ERROR_PRINT_MONITOR_ALREADY_INSTALLED - The specified print monitor has already been installed. -. - -MessageId=3007 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PRINT_MONITOR -Language=Bulgarian -ERROR_INVALID_PRINT_MONITOR - The specified print monitor does not have the required functions. -. - -MessageId=3008 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINT_MONITOR_IN_USE -Language=Bulgarian -ERROR_PRINT_MONITOR_IN_USE - The specified print monitor is currently in use. -. - -MessageId=3009 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_HAS_JOBS_QUEUED -Language=Bulgarian -ERROR_PRINTER_HAS_JOBS_QUEUED - The requested operation is not allowed when there are jobs queued to the printer. -. - -MessageId=3010 -Severity=Success -Facility=System -SymbolicName=ERROR_SUCCESS_REBOOT_REQUIRED -Language=Bulgarian -ERROR_SUCCESS_REBOOT_REQUIRED - The requested operation is successful. Changes will not be effective until the system is rebooted. -. - -MessageId=3011 -Severity=Success -Facility=System -SymbolicName=ERROR_SUCCESS_RESTART_REQUIRED -Language=Bulgarian -ERROR_SUCCESS_RESTART_REQUIRED - The requested operation is successful. Changes will not be effective until the service is restarted. -. - -MessageId=3012 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_NOT_FOUND -Language=Bulgarian -ERROR_PRINTER_NOT_FOUND - No printers were found. -. - -MessageId=3013 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_DRIVER_WARNED -Language=Bulgarian -ERROR_PRINTER_DRIVER_WARNED - The printer driver is known to be unreliable. -. - -MessageId=3014 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTER_DRIVER_BLOCKED -Language=Bulgarian -ERROR_PRINTER_DRIVER_BLOCKED - The printer driver is known to harm the system. -. - -MessageId=3100 -Severity=Success -Facility=System -SymbolicName=ERROR_XML_UNDEFINED_ENTITY -Language=Bulgarian -ERROR_XML_UNDEFINED_ENTITY - The XML contains an entity reference to an undefined entity. -. - -MessageId=3101 -Severity=Success -Facility=System -SymbolicName=ERROR_XML_MALFORMED_ENTITY -Language=Bulgarian -ERROR_XML_MALFORMED_ENTITY - The XML contains a malformed entity reference. -. - -MessageId=3102 -Severity=Success -Facility=System -SymbolicName=ERROR_XML_CHAR_NOT_IN_RANGE -Language=Bulgarian -ERROR_XML_CHAR_NOT_IN_RANGE - The XML contains a character which is not permitted in XML. -. - -MessageId=3200 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_EXTERNAL_PROXY -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_EXTERNAL_PROXY - The manifest contained a duplicate definition for external proxy stub %1 at (%1:%2,%3) -. - -MessageId=3201 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_ASSEMBLY_REFERENCE -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_ASSEMBLY_REFERENCE - The manifest already contains a reference to %4 - a second reference was found at (%1:%2,%3) -. - -MessageId=3202 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_INVALID_ASSEMBLY_REFERENCE -Language=Bulgarian -ERROR_PCM_COMPILER_INVALID_ASSEMBLY_REFERENCE - The assembly reference at (%1:%2,%3) is invalid. -. - -MessageId=3203 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_INVALID_ASSEMBLY_DEFINITION -Language=Bulgarian -ERROR_PCM_COMPILER_INVALID_ASSEMBLY_DEFINITION - The assembly definition at (%1:%2,%3) is invalid. -. - -MessageId=3204 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_WINDOW_CLASS -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_WINDOW_CLASS - The manifest already contained the window class %4, found a second declaration at (%1:%2,%3) -. - -MessageId=3205 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_PROGID -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_PROGID - The manifest already declared the progId %4, found a second declaration at (%1:%2,%3) -. - -MessageId=3206 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_NOINHERIT -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_NOINHERIT - Only one noInherit tag may be present in a manifest, found a second tag at (%1:%2,%3) -. - -MessageId=3207 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_NOINHERITABLE -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_NOINHERITABLE - Only one noInheritable tag may be present in a manifest, found a second tag at (%1:%2,%3) -. - -MessageId=3208 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_COM_CLASS -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_COM_CLASS - The manifest contained a duplicate declaration of COM class %4 at (%1:%2,%3) -. - -MessageId=3209 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_FILE_NAME -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_FILE_NAME - The manifest already declared the file %4, a second definition was found at (%1:%2,%3) -. - -MessageId=3210 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_CLR_SURROGATE -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_CLR_SURROGATE - CLR surrogate %1 was already defined, second definition at (%1:%2,%3) is invalid. -. - -MessageId=3211 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_TYPE_LIBRARY -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_TYPE_LIBRARY - Type library %1 was already defined, second definition at (%1:%2,%3) is invalid. -. - -MessageId=3212 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_PROXY_STUB -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_PROXY_STUB - Proxy stub definition %1 was already defined, second definition at (%1:%2,%3) is invalid. -. - -MessageId=3213 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_CATEGORY_NAME -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_CATEGORY_NAME - Category friendly name %4 was already used, second definition was found at (%1:%2,%3) is invalid. -. - -MessageId=3214 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_DUPLICATE_TOP_LEVEL_IDENTITY_FOUND -Language=Bulgarian -ERROR_PCM_COMPILER_DUPLICATE_TOP_LEVEL_IDENTITY_FOUND - Only one top-level assemblyIdentity tag may be present in a manifest. A second tag with identity %4 was found at (%1:%2,%3) -. - -MessageId=3215 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_UNKNOWN_ROOT_ELEMENT -Language=Bulgarian -ERROR_PCM_COMPILER_UNKNOWN_ROOT_ELEMENT - The root element for a manifest found at (%1:%2,%3) was not expected or was of the wrong version. -. - -MessageId=3216 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_INVALID_ELEMENT -Language=Bulgarian -ERROR_PCM_COMPILER_INVALID_ELEMENT - The element found at (%1:%2,%3) was not expected according to the manifest schema. -. - -MessageId=3217 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_MISSING_REQUIRED_ATTRIBUTE -Language=Bulgarian -ERROR_PCM_COMPILER_MISSING_REQUIRED_ATTRIBUTE - The element found at (%1:%2,%3) was missing the required attribute '%4'. See the manifest schema for more information -. - -MessageId=3218 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_INVALID_ATTRIBUTE_VALUE -Language=Bulgarian -ERROR_PCM_COMPILER_INVALID_ATTRIBUTE_VALUE - The attribute value %4 at (%1:%2,%3) was invalid according to the schema. -. - -MessageId=3219 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_COMPILER_UNEXPECTED_PCDATA -Language=Bulgarian -ERROR_PCM_COMPILER_UNEXPECTED_PCDATA - PCDATA or CDATA found at (%1:%2,%3) in the source document was not expected in the parent element %4. -. - -MessageId=3220 -Severity=Success -Facility=System -SymbolicName=ERROR_PCM_DUPLICATE_STRING_TABLE_ENT -Language=Bulgarian -ERROR_PCM_DUPLICATE_STRING_TABLE_ENT - The string table entry with culture %4, name %5, and value '%6' at (%1:%2,%3) duplicated a previous entry. -. - -MessageId=4000 -Severity=Success -Facility=System -SymbolicName=ERROR_WINS_INTERNAL -Language=Bulgarian -ERROR_WINS_INTERNAL - WINS encountered an error while processing the command. -. - -MessageId=4001 -Severity=Success -Facility=System -SymbolicName=ERROR_CAN_NOT_DEL_LOCAL_WINS -Language=Bulgarian -ERROR_CAN_NOT_DEL_LOCAL_WINS - The local WINS cannot be deleted. -. - -MessageId=4002 -Severity=Success -Facility=System -SymbolicName=ERROR_STATIC_INIT -Language=Bulgarian -ERROR_STATIC_INIT - The importation from the file failed. -. - -MessageId=4003 -Severity=Success -Facility=System -SymbolicName=ERROR_INC_BACKUP -Language=Bulgarian -ERROR_INC_BACKUP - The backup failed. Was a full backup done before? -. - -MessageId=4004 -Severity=Success -Facility=System -SymbolicName=ERROR_FULL_BACKUP -Language=Bulgarian -ERROR_FULL_BACKUP - The backup failed. Check the directory to which you are backing the database. -. - -MessageId=4005 -Severity=Success -Facility=System -SymbolicName=ERROR_REC_NON_EXISTENT -Language=Bulgarian -ERROR_REC_NON_EXISTENT - The name does not exist in the WINS database. -. - -MessageId=4006 -Severity=Success -Facility=System -SymbolicName=ERROR_RPL_NOT_ALLOWED -Language=Bulgarian -ERROR_RPL_NOT_ALLOWED - Replication with a nonconfigured partner is not allowed. -. - -MessageId=4100 -Severity=Success -Facility=System -SymbolicName=ERROR_DHCP_ADDRESS_CONFLICT -Language=Bulgarian -ERROR_DHCP_ADDRESS_CONFLICT - The DHCP client has obtained an IP address that is already in use on the network. The local interface will be disabled until the DHCP client can obtain a new address. -. - -MessageId=4200 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_GUID_NOT_FOUND -Language=Bulgarian -ERROR_WMI_GUID_NOT_FOUND - The GUID passed was not recognized as valid by a WMI data provider. -. - -MessageId=4201 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_INSTANCE_NOT_FOUND -Language=Bulgarian -ERROR_WMI_INSTANCE_NOT_FOUND - The instance name passed was not recognized as valid by a WMI data provider. -. - -MessageId=4202 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_ITEMID_NOT_FOUND -Language=Bulgarian -ERROR_WMI_ITEMID_NOT_FOUND - The data item ID passed was not recognized as valid by a WMI data provider. -. - -MessageId=4203 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_TRY_AGAIN -Language=Bulgarian -ERROR_WMI_TRY_AGAIN - The WMI request could not be completed and should be retried. -. - -MessageId=4204 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_DP_NOT_FOUND -Language=Bulgarian -ERROR_WMI_DP_NOT_FOUND - The WMI data provider could not be located. -. - -MessageId=4205 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_UNRESOLVED_INSTANCE_REF -Language=Bulgarian -ERROR_WMI_UNRESOLVED_INSTANCE_REF - The WMI data provider references an instance set that has not been registered. -. - -MessageId=4206 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_ALREADY_ENABLED -Language=Bulgarian -ERROR_WMI_ALREADY_ENABLED - The WMI data block or event notification has already been enabled. -. - -MessageId=4207 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_GUID_DISCONNECTED -Language=Bulgarian -ERROR_WMI_GUID_DISCONNECTED - The WMI data block is no longer available. -. - -MessageId=4208 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_SERVER_UNAVAILABLE -Language=Bulgarian -ERROR_WMI_SERVER_UNAVAILABLE - The WMI data service is not available. -. - -MessageId=4209 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_DP_FAILED -Language=Bulgarian -ERROR_WMI_DP_FAILED - The WMI data provider failed to carry out the request. -. - -MessageId=4210 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_INVALID_MOF -Language=Bulgarian -ERROR_WMI_INVALID_MOF - The WMI MOF information is not valid. -. - -MessageId=4211 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_INVALID_REGINFO -Language=Bulgarian -ERROR_WMI_INVALID_REGINFO - The WMI registration information is not valid. -. - -MessageId=4212 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_ALREADY_DISABLED -Language=Bulgarian -ERROR_WMI_ALREADY_DISABLED - The WMI data block or event notification has already been disabled. -. - -MessageId=4213 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_READ_ONLY -Language=Bulgarian -ERROR_WMI_READ_ONLY - The WMI data item or data block is read only. -. - -MessageId=4214 -Severity=Success -Facility=System -SymbolicName=ERROR_WMI_SET_FAILURE -Language=Bulgarian -ERROR_WMI_SET_FAILURE - The WMI data item or data block could not be changed. -. - -MessageId=4300 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MEDIA -Language=Bulgarian -ERROR_INVALID_MEDIA - The media identifier does not represent a valid medium. -. - -MessageId=4301 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LIBRARY -Language=Bulgarian -ERROR_INVALID_LIBRARY - The library identifier does not represent a valid library. -. - -MessageId=4302 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MEDIA_POOL -Language=Bulgarian -ERROR_INVALID_MEDIA_POOL - The media pool identifier does not represent a valid media pool. -. - -MessageId=4303 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVE_MEDIA_MISMATCH -Language=Bulgarian -ERROR_DRIVE_MEDIA_MISMATCH - The drive and medium are not compatible or exist in different libraries. -. - -MessageId=4304 -Severity=Success -Facility=System -SymbolicName=ERROR_MEDIA_OFFLINE -Language=Bulgarian -ERROR_MEDIA_OFFLINE - The medium currently exists in an offline library and must be online to perform this operation. -. - -MessageId=4305 -Severity=Success -Facility=System -SymbolicName=ERROR_LIBRARY_OFFLINE -Language=Bulgarian -ERROR_LIBRARY_OFFLINE - The operation cannot be performed on an offline library. -. - -MessageId=4306 -Severity=Success -Facility=System -SymbolicName=ERROR_EMPTY -Language=Bulgarian -ERROR_EMPTY - The library, drive, or media pool is empty. -. - -MessageId=4307 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_EMPTY -Language=Bulgarian -ERROR_NOT_EMPTY - The library, drive, or media pool must be empty to perform this operation. -. - -MessageId=4308 -Severity=Success -Facility=System -SymbolicName=ERROR_MEDIA_UNAVAILABLE -Language=Bulgarian -ERROR_MEDIA_UNAVAILABLE - No media is currently available in this media pool or library. -. - -MessageId=4309 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_DISABLED -Language=Bulgarian -ERROR_RESOURCE_DISABLED - A resource required for this operation is disabled. -. - -MessageId=4310 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_CLEANER -Language=Bulgarian -ERROR_INVALID_CLEANER - The media identifier does not represent a valid cleaner. -. - -MessageId=4311 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_CLEAN -Language=Bulgarian -ERROR_UNABLE_TO_CLEAN - The drive cannot be cleaned or does not support cleaning. -. - -MessageId=4312 -Severity=Success -Facility=System -SymbolicName=ERROR_OBJECT_NOT_FOUND -Language=Bulgarian -ERROR_OBJECT_NOT_FOUND - The object identifier does not represent a valid object. -. - -MessageId=4313 -Severity=Success -Facility=System -SymbolicName=ERROR_DATABASE_FAILURE -Language=Bulgarian -ERROR_DATABASE_FAILURE - Unable to read from or write to the database. -. - -MessageId=4314 -Severity=Success -Facility=System -SymbolicName=ERROR_DATABASE_FULL -Language=Bulgarian -ERROR_DATABASE_FULL - The database is full. -. - -MessageId=4315 -Severity=Success -Facility=System -SymbolicName=ERROR_MEDIA_INCOMPATIBLE -Language=Bulgarian -ERROR_MEDIA_INCOMPATIBLE - The medium is not compatible with the device or media pool. -. - -MessageId=4316 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_NOT_PRESENT -Language=Bulgarian -ERROR_RESOURCE_NOT_PRESENT - The resource required for this operation does not exist. -. - -MessageId=4317 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_OPERATION -Language=Bulgarian -ERROR_INVALID_OPERATION - The operation identifier is not valid. -. - -MessageId=4318 -Severity=Success -Facility=System -SymbolicName=ERROR_MEDIA_NOT_AVAILABLE -Language=Bulgarian -ERROR_MEDIA_NOT_AVAILABLE - The media is not mounted or ready for use. -. - -MessageId=4319 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_NOT_AVAILABLE -Language=Bulgarian -ERROR_DEVICE_NOT_AVAILABLE - The device is not ready for use. -. - -MessageId=4320 -Severity=Success -Facility=System -SymbolicName=ERROR_REQUEST_REFUSED -Language=Bulgarian -ERROR_REQUEST_REFUSED - The operator or administrator has refused the request. -. - -MessageId=4321 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DRIVE_OBJECT -Language=Bulgarian -ERROR_INVALID_DRIVE_OBJECT - The drive identifier does not represent a valid drive. -. - -MessageId=4322 -Severity=Success -Facility=System -SymbolicName=ERROR_LIBRARY_FULL -Language=Bulgarian -ERROR_LIBRARY_FULL - Library is full. No slot is available for use. -. - -MessageId=4323 -Severity=Success -Facility=System -SymbolicName=ERROR_MEDIUM_NOT_ACCESSIBLE -Language=Bulgarian -ERROR_MEDIUM_NOT_ACCESSIBLE - The transport cannot access the medium. -. - -MessageId=4324 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_LOAD_MEDIUM -Language=Bulgarian -ERROR_UNABLE_TO_LOAD_MEDIUM - Unable to load the medium into the drive. -. - -MessageId=4325 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_INVENTORY_DRIVE -Language=Bulgarian -ERROR_UNABLE_TO_INVENTORY_DRIVE - Unable to retrieve status about the drive. -. - -MessageId=4326 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_INVENTORY_SLOT -Language=Bulgarian -ERROR_UNABLE_TO_INVENTORY_SLOT - Unable to retrieve status about the slot. -. - -MessageId=4327 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_INVENTORY_TRANSPORT -Language=Bulgarian -ERROR_UNABLE_TO_INVENTORY_TRANSPORT - Unable to retrieve status about the transport. -. - -MessageId=4328 -Severity=Success -Facility=System -SymbolicName=ERROR_TRANSPORT_FULL -Language=Bulgarian -ERROR_TRANSPORT_FULL - Cannot use the transport because it is already in use. -. - -MessageId=4329 -Severity=Success -Facility=System -SymbolicName=ERROR_CONTROLLING_IEPORT -Language=Bulgarian -ERROR_CONTROLLING_IEPORT - Unable to open or close the inject/eject port. -. - -MessageId=4330 -Severity=Success -Facility=System -SymbolicName=ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA -Language=Bulgarian -ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA - Unable to eject the media because it is in a drive. -. - -MessageId=4331 -Severity=Success -Facility=System -SymbolicName=ERROR_CLEANER_SLOT_SET -Language=Bulgarian -ERROR_CLEANER_SLOT_SET - A cleaner slot is already reserved. -. - -MessageId=4332 -Severity=Success -Facility=System -SymbolicName=ERROR_CLEANER_SLOT_NOT_SET -Language=Bulgarian -ERROR_CLEANER_SLOT_NOT_SET - A cleaner slot is not reserved. -. - -MessageId=4333 -Severity=Success -Facility=System -SymbolicName=ERROR_CLEANER_CARTRIDGE_SPENT -Language=Bulgarian -ERROR_CLEANER_CARTRIDGE_SPENT - The cleaner cartridge has performed the maximum number of drive cleanings. -. - -MessageId=4334 -Severity=Success -Facility=System -SymbolicName=ERROR_UNEXPECTED_OMID -Language=Bulgarian -ERROR_UNEXPECTED_OMID - Unexpected on-medium identifier. -. - -MessageId=4335 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_DELETE_LAST_ITEM -Language=Bulgarian -ERROR_CANT_DELETE_LAST_ITEM - The last remaining item in this group or resource cannot be deleted. -. - -MessageId=4336 -Severity=Success -Facility=System -SymbolicName=ERROR_MESSAGE_EXCEEDS_MAX_SIZE -Language=Bulgarian -ERROR_MESSAGE_EXCEEDS_MAX_SIZE - The message provided exceeds the maximum size allowed for this parameter. -. - -MessageId=4337 -Severity=Success -Facility=System -SymbolicName=ERROR_VOLUME_CONTAINS_SYS_FILES -Language=Bulgarian -ERROR_VOLUME_CONTAINS_SYS_FILES - The volume contains system or paging files. -. - -MessageId=4338 -Severity=Success -Facility=System -SymbolicName=ERROR_INDIGENOUS_TYPE -Language=Bulgarian -ERROR_INDIGENOUS_TYPE - The media type cannot be removed from this library since at least one drive in the library reports it can support this media type. -. - -MessageId=4339 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SUPPORTING_DRIVES -Language=Bulgarian -ERROR_NO_SUPPORTING_DRIVES - This offline media cannot be mounted on this system since no enabled drives are present which can be used. -. - -MessageId=4340 -Severity=Success -Facility=System -SymbolicName=ERROR_CLEANER_CARTRIDGE_INSTALLED -Language=Bulgarian -ERROR_CLEANER_CARTRIDGE_INSTALLED - A cleaner cartridge is present in the tape library. -. - -MessageId=4350 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_OFFLINE -Language=Bulgarian -ERROR_FILE_OFFLINE - The remote storage service was not able to recall the file. -. - -MessageId=4351 -Severity=Success -Facility=System -SymbolicName=ERROR_REMOTE_STORAGE_NOT_ACTIVE -Language=Bulgarian -ERROR_REMOTE_STORAGE_NOT_ACTIVE - The remote storage service is not operational at this time. -. - -MessageId=4352 -Severity=Success -Facility=System -SymbolicName=ERROR_REMOTE_STORAGE_MEDIA_ERROR -Language=Bulgarian -ERROR_REMOTE_STORAGE_MEDIA_ERROR - The remote storage service encountered a media error. -. - -MessageId=4390 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_A_REPARSE_POINT -Language=Bulgarian -ERROR_NOT_A_REPARSE_POINT - The file or directory is not a reparse point. -. - -MessageId=4391 -Severity=Success -Facility=System -SymbolicName=ERROR_REPARSE_ATTRIBUTE_CONFLICT -Language=Bulgarian -ERROR_REPARSE_ATTRIBUTE_CONFLICT - The reparse point attribute cannot be set because it conflicts with an existing attribute. -. - -MessageId=4392 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_REPARSE_DATA -Language=Bulgarian -ERROR_INVALID_REPARSE_DATA - The data present in the reparse point buffer is invalid. -. - -MessageId=4393 -Severity=Success -Facility=System -SymbolicName=ERROR_REPARSE_TAG_INVALID -Language=Bulgarian -ERROR_REPARSE_TAG_INVALID - The tag present in the reparse point buffer is invalid. -. - -MessageId=4394 -Severity=Success -Facility=System -SymbolicName=ERROR_REPARSE_TAG_MISMATCH -Language=Bulgarian -ERROR_REPARSE_TAG_MISMATCH - There is a mismatch between the tag specified in the request and the tag present in the reparse point. -. - -MessageId=4500 -Severity=Success -Facility=System -SymbolicName=ERROR_VOLUME_NOT_SIS_ENABLED -Language=Bulgarian -ERROR_VOLUME_NOT_SIS_ENABLED - Single Instance Storage is not available on this volume. -. - -MessageId=5001 -Severity=Success -Facility=System -SymbolicName=ERROR_DEPENDENT_RESOURCE_EXISTS -Language=Bulgarian -ERROR_DEPENDENT_RESOURCE_EXISTS - The cluster resource cannot be moved to another group because other resources are dependent on it. -. - -MessageId=5002 -Severity=Success -Facility=System -SymbolicName=ERROR_DEPENDENCY_NOT_FOUND -Language=Bulgarian -ERROR_DEPENDENCY_NOT_FOUND - The cluster resource dependency cannot be found. -. - -MessageId=5003 -Severity=Success -Facility=System -SymbolicName=ERROR_DEPENDENCY_ALREADY_EXISTS -Language=Bulgarian -ERROR_DEPENDENCY_ALREADY_EXISTS - The cluster resource cannot be made dependent on the specified resource because it is already dependent. -. - -MessageId=5004 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_NOT_ONLINE -Language=Bulgarian -ERROR_RESOURCE_NOT_ONLINE - The cluster resource is not online. -. - -MessageId=5005 -Severity=Success -Facility=System -SymbolicName=ERROR_HOST_NODE_NOT_AVAILABLE -Language=Bulgarian -ERROR_HOST_NODE_NOT_AVAILABLE - A cluster node is not available for this operation. -. - -MessageId=5006 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_NOT_AVAILABLE -Language=Bulgarian -ERROR_RESOURCE_NOT_AVAILABLE - The cluster resource is not available. -. - -MessageId=5007 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_NOT_FOUND -Language=Bulgarian -ERROR_RESOURCE_NOT_FOUND - The cluster resource could not be found. -. - -MessageId=5008 -Severity=Success -Facility=System -SymbolicName=ERROR_SHUTDOWN_CLUSTER -Language=Bulgarian -ERROR_SHUTDOWN_CLUSTER - The cluster is being shut down. -. - -MessageId=5009 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_EVICT_ACTIVE_NODE -Language=Bulgarian -ERROR_CANT_EVICT_ACTIVE_NODE - A cluster node cannot be evicted from the cluster unless the node is down. -. - -MessageId=5010 -Severity=Success -Facility=System -SymbolicName=ERROR_OBJECT_ALREADY_EXISTS -Language=Bulgarian -ERROR_OBJECT_ALREADY_EXISTS - The object already exists. -. - -MessageId=5011 -Severity=Success -Facility=System -SymbolicName=ERROR_OBJECT_IN_LIST -Language=Bulgarian -ERROR_OBJECT_IN_LIST - The object is already in the list. -. - -MessageId=5012 -Severity=Success -Facility=System -SymbolicName=ERROR_GROUP_NOT_AVAILABLE -Language=Bulgarian -ERROR_GROUP_NOT_AVAILABLE - The cluster group is not available for any new requests. -. - -MessageId=5013 -Severity=Success -Facility=System -SymbolicName=ERROR_GROUP_NOT_FOUND -Language=Bulgarian -ERROR_GROUP_NOT_FOUND - The cluster group could not be found. -. - -MessageId=5014 -Severity=Success -Facility=System -SymbolicName=ERROR_GROUP_NOT_ONLINE -Language=Bulgarian -ERROR_GROUP_NOT_ONLINE - The operation could not be completed because the cluster group is not online. -. - -MessageId=5015 -Severity=Success -Facility=System -SymbolicName=ERROR_HOST_NODE_NOT_RESOURCE_OWNER -Language=Bulgarian -ERROR_HOST_NODE_NOT_RESOURCE_OWNER - The cluster node is not the owner of the resource. -. - -MessageId=5016 -Severity=Success -Facility=System -SymbolicName=ERROR_HOST_NODE_NOT_GROUP_OWNER -Language=Bulgarian -ERROR_HOST_NODE_NOT_GROUP_OWNER - The cluster node is not the owner of the group. -. - -MessageId=5017 -Severity=Success -Facility=System -SymbolicName=ERROR_RESMON_CREATE_FAILED -Language=Bulgarian -ERROR_RESMON_CREATE_FAILED - The cluster resource could not be created in the specified resource monitor. -. - -MessageId=5018 -Severity=Success -Facility=System -SymbolicName=ERROR_RESMON_ONLINE_FAILED -Language=Bulgarian -ERROR_RESMON_ONLINE_FAILED - The cluster resource could not be brought online by the resource monitor. -. - -MessageId=5019 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_ONLINE -Language=Bulgarian -ERROR_RESOURCE_ONLINE - The operation could not be completed because the cluster resource is online. -. - -MessageId=5020 -Severity=Success -Facility=System -SymbolicName=ERROR_QUORUM_RESOURCE -Language=Bulgarian -ERROR_QUORUM_RESOURCE - The cluster resource could not be deleted or brought offline because it is the quorum resource. -. - -MessageId=5021 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_QUORUM_CAPABLE -Language=Bulgarian -ERROR_NOT_QUORUM_CAPABLE - The cluster could not make the specified resource a quorum resource because it is not capable of being a quorum resource. -. - -MessageId=5022 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_SHUTTING_DOWN -Language=Bulgarian -ERROR_CLUSTER_SHUTTING_DOWN - The cluster software is shutting down. -. - -MessageId=5023 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_STATE -Language=Bulgarian -ERROR_INVALID_STATE - The group or resource is not in the correct state to perform the requested operation. -. - -MessageId=5024 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_PROPERTIES_STORED -Language=Bulgarian -ERROR_RESOURCE_PROPERTIES_STORED - The properties were stored but not all changes will take effect until the next time the resource is brought online. -. - -MessageId=5025 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_QUORUM_CLASS -Language=Bulgarian -ERROR_NOT_QUORUM_CLASS - The cluster could not make the specified resource a quorum resource because it does not belong to a shared storage class. -. - -MessageId=5026 -Severity=Success -Facility=System -SymbolicName=ERROR_CORE_RESOURCE -Language=Bulgarian -ERROR_CORE_RESOURCE - The cluster resource could not be deleted since it is a core resource. -. - -MessageId=5027 -Severity=Success -Facility=System -SymbolicName=ERROR_QUORUM_RESOURCE_ONLINE_FAILED -Language=Bulgarian -ERROR_QUORUM_RESOURCE_ONLINE_FAILED - The quorum resource failed to come online. -. - -MessageId=5028 -Severity=Success -Facility=System -SymbolicName=ERROR_QUORUMLOG_OPEN_FAILED -Language=Bulgarian -ERROR_QUORUMLOG_OPEN_FAILED - The quorum log could not be created or mounted successfully. -. - -MessageId=5029 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTERLOG_CORRUPT -Language=Bulgarian -ERROR_CLUSTERLOG_CORRUPT - The cluster log is corrupt. -. - -MessageId=5030 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE -Language=Bulgarian -ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE - The record could not be written to the cluster log since it exceeds the maximum size. -. - -MessageId=5031 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE -Language=Bulgarian -ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE - The cluster log exceeds its maximum size. -. - -MessageId=5032 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND - No checkpoint record was found in the cluster log. -. - -MessageId=5033 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE -Language=Bulgarian -ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE - The minimum required disk space needed for logging is not available. -. - -MessageId=5034 -Severity=Success -Facility=System -SymbolicName=ERROR_QUORUM_OWNER_ALIVE -Language=Bulgarian -ERROR_QUORUM_OWNER_ALIVE - The cluster node failed to take control of the quorum resource because the resource is owned by another active node. -. - -MessageId=5035 -Severity=Success -Facility=System -SymbolicName=ERROR_NETWORK_NOT_AVAILABLE -Language=Bulgarian -ERROR_NETWORK_NOT_AVAILABLE - A cluster network is not available for this operation. -. - -MessageId=5036 -Severity=Success -Facility=System -SymbolicName=ERROR_NODE_NOT_AVAILABLE -Language=Bulgarian -ERROR_NODE_NOT_AVAILABLE - A cluster node is not available for this operation. -. - -MessageId=5037 -Severity=Success -Facility=System -SymbolicName=ERROR_ALL_NODES_NOT_AVAILABLE -Language=Bulgarian -ERROR_ALL_NODES_NOT_AVAILABLE - All cluster nodes must be running to perform this operation. -. - -MessageId=5038 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_FAILED -Language=Bulgarian -ERROR_RESOURCE_FAILED - A cluster resource failed. -. - -MessageId=5039 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_INVALID_NODE -Language=Bulgarian -ERROR_CLUSTER_INVALID_NODE - The cluster node is not valid. -. - -MessageId=5040 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_EXISTS -Language=Bulgarian -ERROR_CLUSTER_NODE_EXISTS - The cluster node already exists. -. - -MessageId=5041 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_JOIN_IN_PROGRESS -Language=Bulgarian -ERROR_CLUSTER_JOIN_IN_PROGRESS - A node is in the process of joining the cluster. -. - -MessageId=5042 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTER_NODE_NOT_FOUND - The cluster node was not found. -. - -MessageId=5043 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND - The cluster local node information was not found. -. - -MessageId=5044 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETWORK_EXISTS -Language=Bulgarian -ERROR_CLUSTER_NETWORK_EXISTS - The cluster network already exists. -. - -MessageId=5045 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETWORK_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTER_NETWORK_NOT_FOUND - The cluster network was not found. -. - -MessageId=5046 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETINTERFACE_EXISTS -Language=Bulgarian -ERROR_CLUSTER_NETINTERFACE_EXISTS - The cluster network interface already exists. -. - -MessageId=5047 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETINTERFACE_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTER_NETINTERFACE_NOT_FOUND - The cluster network interface was not found. -. - -MessageId=5048 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_INVALID_REQUEST -Language=Bulgarian -ERROR_CLUSTER_INVALID_REQUEST - The cluster request is not valid for this object. -. - -MessageId=5049 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_INVALID_NETWORK_PROVIDER -Language=Bulgarian -ERROR_CLUSTER_INVALID_NETWORK_PROVIDER - The cluster network provider is not valid. -. - -MessageId=5050 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_DOWN -Language=Bulgarian -ERROR_CLUSTER_NODE_DOWN - The cluster node is down. -. - -MessageId=5051 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_UNREACHABLE -Language=Bulgarian -ERROR_CLUSTER_NODE_UNREACHABLE - The cluster node is not reachable. -. - -MessageId=5052 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_NOT_MEMBER -Language=Bulgarian -ERROR_CLUSTER_NODE_NOT_MEMBER - The cluster node is not a member of the cluster. -. - -MessageId=5053 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS -Language=Bulgarian -ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS - A cluster join operation is not in progress. -. - -MessageId=5054 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_INVALID_NETWORK -Language=Bulgarian -ERROR_CLUSTER_INVALID_NETWORK - The cluster network is not valid. -. - -MessageId=5056 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_UP -Language=Bulgarian -ERROR_CLUSTER_NODE_UP - The cluster node is up. -. - -MessageId=5057 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_IPADDR_IN_USE -Language=Bulgarian -ERROR_CLUSTER_IPADDR_IN_USE - The cluster IP address is already in use. -. - -MessageId=5058 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_NOT_PAUSED -Language=Bulgarian -ERROR_CLUSTER_NODE_NOT_PAUSED - The cluster node is not paused. -. - -MessageId=5059 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NO_SECURITY_CONTEXT -Language=Bulgarian -ERROR_CLUSTER_NO_SECURITY_CONTEXT - No cluster security context is available. -. - -MessageId=5060 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETWORK_NOT_INTERNAL -Language=Bulgarian -ERROR_CLUSTER_NETWORK_NOT_INTERNAL - The cluster network is not configured for internal cluster communication. -. - -MessageId=5061 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_ALREADY_UP -Language=Bulgarian -ERROR_CLUSTER_NODE_ALREADY_UP - The cluster node is already up. -. - -MessageId=5062 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_ALREADY_DOWN -Language=Bulgarian -ERROR_CLUSTER_NODE_ALREADY_DOWN - The cluster node is already down. -. - -MessageId=5063 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETWORK_ALREADY_ONLINE -Language=Bulgarian -ERROR_CLUSTER_NETWORK_ALREADY_ONLINE - The cluster network is already online. -. - -MessageId=5064 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE -Language=Bulgarian -ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE - The cluster network is already offline. -. - -MessageId=5065 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_ALREADY_MEMBER -Language=Bulgarian -ERROR_CLUSTER_NODE_ALREADY_MEMBER - The cluster node is already a member of the cluster. -. - -MessageId=5066 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_LAST_INTERNAL_NETWORK -Language=Bulgarian -ERROR_CLUSTER_LAST_INTERNAL_NETWORK - The cluster network is the only one configured for internal cluster communication between two or more active cluster nodes. The internal communication capability cannot be removed from the network. -. - -MessageId=5067 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS -Language=Bulgarian -ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS - One or more cluster resources depend on the network to provide service to clients. The client access capability cannot be removed from the network. -. - -MessageId=5068 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_OPERATION_ON_QUORUM -Language=Bulgarian -ERROR_INVALID_OPERATION_ON_QUORUM - This operation cannot be performed on the cluster resource as it the quorum resource. You may not bring the quorum resource offline or modify its possible owners list. -. - -MessageId=5069 -Severity=Success -Facility=System -SymbolicName=ERROR_DEPENDENCY_NOT_ALLOWED -Language=Bulgarian -ERROR_DEPENDENCY_NOT_ALLOWED - The cluster quorum resource is not allowed to have any dependencies. -. - -MessageId=5070 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_PAUSED -Language=Bulgarian -ERROR_CLUSTER_NODE_PAUSED - The cluster node is paused. -. - -MessageId=5071 -Severity=Success -Facility=System -SymbolicName=ERROR_NODE_CANT_HOST_RESOURCE -Language=Bulgarian -ERROR_NODE_CANT_HOST_RESOURCE - The cluster resource cannot be brought online. The owner node cannot run this resource. -. - -MessageId=5072 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_NOT_READY -Language=Bulgarian -ERROR_CLUSTER_NODE_NOT_READY - The cluster node is not ready to perform the requested operation. -. - -MessageId=5073 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_SHUTTING_DOWN -Language=Bulgarian -ERROR_CLUSTER_NODE_SHUTTING_DOWN - The cluster node is shutting down. -. - -MessageId=5074 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_JOIN_ABORTED -Language=Bulgarian -ERROR_CLUSTER_JOIN_ABORTED - The cluster join operation was aborted. -. - -MessageId=5075 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_INCOMPATIBLE_VERSIONS -Language=Bulgarian -ERROR_CLUSTER_INCOMPATIBLE_VERSIONS - The cluster join operation failed due to incompatible software versions between the joining node and its sponsor. -. - -MessageId=5076 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED -Language=Bulgarian -ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED - This resource cannot be created because the cluster has reached the limit on the number of resources it can monitor. -. - -MessageId=5077 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED -Language=Bulgarian -ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED - The system configuration changed during the cluster join or form operation. The join or form operation was aborted. -. - -MessageId=5078 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND - The specified resource type was not found. -. - -MessageId=5079 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED -Language=Bulgarian -ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED - The specified node does not support a resource of this type. This may be due to version inconsistencies or due to the absence of the resource DLL on this node. -. - -MessageId=5080 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_RESNAME_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTER_RESNAME_NOT_FOUND - The specified resource name is supported by this resource DLL. This may be due to a bad (or changed) name supplied to the resource DLL. -. - -MessageId=5081 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED -Language=Bulgarian -ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED - No authentication package could be registered with the RPC server. -. - -MessageId=5082 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST -Language=Bulgarian -ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST - You cannot bring the group online because the owner of the group is not in the preferred list for the group. To change the owner node for the group, move the group. -. - -MessageId=5083 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_DATABASE_SEQMISMATCH -Language=Bulgarian -ERROR_CLUSTER_DATABASE_SEQMISMATCH - The join operation failed because the cluster database sequence number has changed or is incompatible with the locker node. This may happen during a join operation if the cluster database was changing during the join. -. - -MessageId=5084 -Severity=Success -Facility=System -SymbolicName=ERROR_RESMON_INVALID_STATE -Language=Bulgarian -ERROR_RESMON_INVALID_STATE - The resource monitor will not allow the fail operation to be performed while the resource is in its current state. This may happen if the resource is in a pending state. -. - -MessageId=5085 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_GUM_NOT_LOCKER -Language=Bulgarian -ERROR_CLUSTER_GUM_NOT_LOCKER - A non locker code got a request to reserve the lock for making global updates. -. - -MessageId=5086 -Severity=Success -Facility=System -SymbolicName=ERROR_QUORUM_DISK_NOT_FOUND -Language=Bulgarian -ERROR_QUORUM_DISK_NOT_FOUND - The quorum disk could not be located by the cluster service. -. - -MessageId=5087 -Severity=Success -Facility=System -SymbolicName=ERROR_DATABASE_BACKUP_CORRUPT -Language=Bulgarian -ERROR_DATABASE_BACKUP_CORRUPT - The backup up cluster database is possibly corrupt. -. - -MessageId=5088 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT -Language=Bulgarian -ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT - A DFS root already exists in this cluster node. -. - -MessageId=5089 -Severity=Success -Facility=System -SymbolicName=ERROR_RESOURCE_PROPERTY_UNCHANGEABLE -Language=Bulgarian -ERROR_RESOURCE_PROPERTY_UNCHANGEABLE - An attempt to modify a resource property failed because it conflicts with another existing property. -. - -MessageId=5890 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE -Language=Bulgarian -ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE - An operation was attempted that is incompatible with the current membership state of the node. -. - -MessageId=5891 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_QUORUMLOG_NOT_FOUND -Language=Bulgarian -ERROR_CLUSTER_QUORUMLOG_NOT_FOUND - The quorum resource does not contain the quorum log. -. - -MessageId=5892 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_MEMBERSHIP_HALT -Language=Bulgarian -ERROR_CLUSTER_MEMBERSHIP_HALT - The membership engine requested shutdown of the cluster service on this node. -. - -MessageId=5893 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_INSTANCE_ID_MISMATCH -Language=Bulgarian -ERROR_CLUSTER_INSTANCE_ID_MISMATCH - The join operation failed because the cluster instance ID of the joining node does not match the cluster instance ID of the sponsor node. -. - -MessageId=5894 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP -Language=Bulgarian -ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP - A matching network for the specified IP address could not be found. Please also specify a subnet mask and a cluster network. -. - -MessageId=5895 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH -Language=Bulgarian -ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH - The actual data type of the property did not match the expected data type of the property. -. - -MessageId=5896 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP -Language=Bulgarian -ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP - The cluster node was evicted from the cluster successfully, but the node was not cleaned up. Extended status information explaining why the node was not cleaned up is available. -. - -MessageId=5897 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_PARAMETER_MISMATCH -Language=Bulgarian -ERROR_CLUSTER_PARAMETER_MISMATCH - Two or more parameter values specified for a resource's properties are in conflict. -. - -MessageId=5898 -Severity=Success -Facility=System -SymbolicName=ERROR_NODE_CANNOT_BE_CLUSTERED -Language=Bulgarian -ERROR_NODE_CANNOT_BE_CLUSTERED - This computer cannot be made a member of a cluster. -. - -MessageId=5899 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_WRONG_OS_VERSION -Language=Bulgarian -ERROR_CLUSTER_WRONG_OS_VERSION - This computer cannot be made a member of a cluster because it does not have the correct version of Windows installed. -. - -MessageId=5900 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME -Language=Bulgarian -ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME - A cluster cannot be created with the specified cluster name because that cluster name is already in use. Specify a different name for the cluster. -. - -MessageId=5901 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSCFG_ALREADY_COMMITTED -Language=Bulgarian -ERROR_CLUSCFG_ALREADY_COMMITTED - The cluster configuration action has already been committed. -. - -MessageId=5902 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSCFG_ROLLBACK_FAILED -Language=Bulgarian -ERROR_CLUSCFG_ROLLBACK_FAILED - The cluster configuration action could not be rolled back. -. - -MessageId=5903 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT -Language=Bulgarian -ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT - The drive letter assigned to a system disk on one node conflicted with the driver letter assigned to a disk on another node. -. - -MessageId=5904 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_OLD_VERSION -Language=Bulgarian -ERROR_CLUSTER_OLD_VERSION - One or more nodes in the cluster are running a version of Windows that does not support this operation. -. - -MessageId=5905 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME -Language=Bulgarian -ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME - The name of the corresponding computer account doesn't match the Network Name for this resource. -. - -MessageId=5906 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_NO_NET_ADAPTERS -Language=Bulgarian -ERROR_CLUSTER_NO_NET_ADAPTERS - No network adapters are available. -. - -MessageId=5907 -Severity=Success -Facility=System -SymbolicName=ERROR_CLUSTER_POISONED -Language=Bulgarian -ERROR_CLUSTER_POISONED - The cluster node has been poisoned. -. - -MessageId=6000 -Severity=Success -Facility=System -SymbolicName=ERROR_ENCRYPTION_FAILED -Language=Bulgarian -ERROR_ENCRYPTION_FAILED - The specified file could not be encrypted. -. - -MessageId=6001 -Severity=Success -Facility=System -SymbolicName=ERROR_DECRYPTION_FAILED -Language=Bulgarian -ERROR_DECRYPTION_FAILED - The specified file could not be decrypted. -. - -MessageId=6002 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_ENCRYPTED -Language=Bulgarian -ERROR_FILE_ENCRYPTED - The specified file is encrypted and the user does not have the ability to decrypt it. -. - -MessageId=6003 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_RECOVERY_POLICY -Language=Bulgarian -ERROR_NO_RECOVERY_POLICY - There is no valid encryption recovery policy configured for this system. -. - -MessageId=6004 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_EFS -Language=Bulgarian -ERROR_NO_EFS - The required encryption driver is not loaded for this system. -. - -MessageId=6005 -Severity=Success -Facility=System -SymbolicName=ERROR_WRONG_EFS -Language=Bulgarian -ERROR_WRONG_EFS - The file was encrypted with a different encryption driver than is currently loaded. -. - -MessageId=6006 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_USER_KEYS -Language=Bulgarian -ERROR_NO_USER_KEYS - There are no EFS keys defined for the user. -. - -MessageId=6007 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_NOT_ENCRYPTED -Language=Bulgarian -ERROR_FILE_NOT_ENCRYPTED - The specified file is not encrypted. -. - -MessageId=6008 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_EXPORT_FORMAT -Language=Bulgarian -ERROR_NOT_EXPORT_FORMAT - The specified file is not in the defined EFS export format. -. - -MessageId=6009 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_READ_ONLY -Language=Bulgarian -ERROR_FILE_READ_ONLY - The specified file is read only. -. - -MessageId=6010 -Severity=Success -Facility=System -SymbolicName=ERROR_DIR_EFS_DISALLOWED -Language=Bulgarian -ERROR_DIR_EFS_DISALLOWED - The directory has been disabled for encryption. -. - -MessageId=6011 -Severity=Success -Facility=System -SymbolicName=ERROR_EFS_SERVER_NOT_TRUSTED -Language=Bulgarian -ERROR_EFS_SERVER_NOT_TRUSTED - The server is not trusted for remote encryption operation. -. - -MessageId=6012 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_RECOVERY_POLICY -Language=Bulgarian -ERROR_BAD_RECOVERY_POLICY - Recovery policy configured for this system contains invalid recovery certificate. -. - -MessageId=6013 -Severity=Success -Facility=System -SymbolicName=ERROR_EFS_ALG_BLOB_TOO_BIG -Language=Bulgarian -ERROR_EFS_ALG_BLOB_TOO_BIG - The encryption algorithm used on the source file needs a bigger key buffer than the one on the destination file. -. - -MessageId=6014 -Severity=Success -Facility=System -SymbolicName=ERROR_VOLUME_NOT_SUPPORT_EFS -Language=Bulgarian -ERROR_VOLUME_NOT_SUPPORT_EFS - The disk partition does not support file encryption. -. - -MessageId=6015 -Severity=Success -Facility=System -SymbolicName=ERROR_EFS_DISABLED -Language=Bulgarian -ERROR_EFS_DISABLED - This machine is disabled for file encryption. -. - -MessageId=6016 -Severity=Success -Facility=System -SymbolicName=ERROR_EFS_VERSION_NOT_SUPPORT -Language=Bulgarian -ERROR_EFS_VERSION_NOT_SUPPORT - A newer system is required to decrypt this encrypted file. -. - -MessageId=6118 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_BROWSER_SERVERS_FOUND -Language=Bulgarian -ERROR_NO_BROWSER_SERVERS_FOUND - The list of servers for this workgroup is not currently available. -. - -MessageId=6200 -Severity=Success -Facility=System -SymbolicName=SCHED_E_SERVICE_NOT_LOCALSYSTEM -Language=Bulgarian -SCHED_E_SERVICE_NOT_LOCALSYSTEM - The Task Scheduler service must be configured to run in the System account to function properly. Individual tasks may be configured to run in other accounts. -. - -MessageId=7001 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_WINSTATION_NAME_INVALID -Language=Bulgarian -ERROR_CTX_WINSTATION_NAME_INVALID - The specified session name is invalid. -. - -MessageId=7002 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_INVALID_PD -Language=Bulgarian -ERROR_CTX_INVALID_PD - The specified protocol driver is invalid. -. - -MessageId=7003 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_PD_NOT_FOUND -Language=Bulgarian -ERROR_CTX_PD_NOT_FOUND - The specified protocol driver was not found in the system path. -. - -MessageId=7004 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_WD_NOT_FOUND -Language=Bulgarian -ERROR_CTX_WD_NOT_FOUND - The specified terminal connection driver was not found in the system path. -. - -MessageId=7005 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY -Language=Bulgarian -ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY - A registry key for event logging could not be created for this session. -. - -MessageId=7006 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_SERVICE_NAME_COLLISION -Language=Bulgarian -ERROR_CTX_SERVICE_NAME_COLLISION - A service with the same name already exists on the system. -. - -MessageId=7007 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CLOSE_PENDING -Language=Bulgarian -ERROR_CTX_CLOSE_PENDING - A close operation is pending on the session. -. - -MessageId=7008 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_NO_OUTBUF -Language=Bulgarian -ERROR_CTX_NO_OUTBUF - There are no free output buffers available. -. - -MessageId=7009 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_MODEM_INF_NOT_FOUND -Language=Bulgarian -ERROR_CTX_MODEM_INF_NOT_FOUND - The MODEM.INF file was not found. -. - -MessageId=7010 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_INVALID_MODEMNAME -Language=Bulgarian -ERROR_CTX_INVALID_MODEMNAME - The modem name was not found in MODEM.INF. -. - -MessageId=7011 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_MODEM_RESPONSE_ERROR -Language=Bulgarian -ERROR_CTX_MODEM_RESPONSE_ERROR - The modem did not accept the command sent to it. Verify that the configured modem name matches the attached modem. -. - -MessageId=7012 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_MODEM_RESPONSE_TIMEOUT -Language=Bulgarian -ERROR_CTX_MODEM_RESPONSE_TIMEOUT - The modem did not respond to the command sent to it. Verify that the modem is properly cabled and powered on. -. - -MessageId=7013 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_MODEM_RESPONSE_NO_CARRIER -Language=Bulgarian -ERROR_CTX_MODEM_RESPONSE_NO_CARRIER - Carrier detect has failed or carrier has been dropped due to disconnect. -. - -MessageId=7014 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE -Language=Bulgarian -ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE - Dial tone not detected within the required time. Verify that the phone cable is properly attached and functional. -. - -MessageId=7015 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_MODEM_RESPONSE_BUSY -Language=Bulgarian -ERROR_CTX_MODEM_RESPONSE_BUSY - Busy signal detected at remote site on callback. -. - -MessageId=7016 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_MODEM_RESPONSE_VOICE -Language=Bulgarian -ERROR_CTX_MODEM_RESPONSE_VOICE - Voice detected at remote site on callback. -. - -MessageId=7017 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_TD_ERROR -Language=Bulgarian -ERROR_CTX_TD_ERROR - Transport driver error -. - -MessageId=7022 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_WINSTATION_NOT_FOUND -Language=Bulgarian -ERROR_CTX_WINSTATION_NOT_FOUND - The specified session cannot be found. -. - -MessageId=7023 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_WINSTATION_ALREADY_EXISTS -Language=Bulgarian -ERROR_CTX_WINSTATION_ALREADY_EXISTS - The specified session name is already in use. -. - -MessageId=7024 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_WINSTATION_BUSY -Language=Bulgarian -ERROR_CTX_WINSTATION_BUSY - The requested operation cannot be completed because the terminal connection is currently busy processing a connect, disconnect, reset, or delete operation. -. - -MessageId=7025 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_BAD_VIDEO_MODE -Language=Bulgarian -ERROR_CTX_BAD_VIDEO_MODE - An attempt has been made to connect to a session whose video mode is not supported by the current client. -. - -MessageId=7035 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_GRAPHICS_INVALID -Language=Bulgarian -ERROR_CTX_GRAPHICS_INVALID - The application attempted to enable DOS graphics mode. DOS graphics mode is not supported. -. - -MessageId=7037 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_LOGON_DISABLED -Language=Bulgarian -ERROR_CTX_LOGON_DISABLED - Your interactive logon privilege has been disabled. Please contact your administrator. -. - -MessageId=7038 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_NOT_CONSOLE -Language=Bulgarian -ERROR_CTX_NOT_CONSOLE - The requested operation can be performed only on the system console. This is most often the result of a driver or system DLL requiring direct console access. -. - -MessageId=7040 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CLIENT_QUERY_TIMEOUT -Language=Bulgarian -ERROR_CTX_CLIENT_QUERY_TIMEOUT - The client failed to respond to the server connect message. -. - -MessageId=7041 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CONSOLE_DISCONNECT -Language=Bulgarian -ERROR_CTX_CONSOLE_DISCONNECT - Disconnecting the console session is not supported. -. - -MessageId=7042 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CONSOLE_CONNECT -Language=Bulgarian -ERROR_CTX_CONSOLE_CONNECT - Reconnecting a disconnected session to the console is not supported. -. - -MessageId=7044 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_SHADOW_DENIED -Language=Bulgarian -ERROR_CTX_SHADOW_DENIED - The request to control another session remotely was denied. -. - -MessageId=7045 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_WINSTATION_ACCESS_DENIED -Language=Bulgarian -ERROR_CTX_WINSTATION_ACCESS_DENIED - The requested session access is denied. -. - -MessageId=7049 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_INVALID_WD -Language=Bulgarian -ERROR_CTX_INVALID_WD - The specified terminal connection driver is invalid. -. - -MessageId=7050 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_SHADOW_INVALID -Language=Bulgarian -ERROR_CTX_SHADOW_INVALID - The requested session cannot be controlled remotely. This may be because the session is disconnected or does not currently have a user logged on. -. - -MessageId=7051 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_SHADOW_DISABLED -Language=Bulgarian -ERROR_CTX_SHADOW_DISABLED - The requested session is not configured to allow remote control. -. - -MessageId=7052 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CLIENT_LICENSE_IN_USE -Language=Bulgarian -ERROR_CTX_CLIENT_LICENSE_IN_USE - Your request to connect to this Terminal Server has been rejected. Your Terminal Server client license number is currently being used by another user. Please call your system administrator to obtain a unique license number. -. - -MessageId=7053 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CLIENT_LICENSE_NOT_SET -Language=Bulgarian -ERROR_CTX_CLIENT_LICENSE_NOT_SET - Your request to connect to this Terminal Server has been rejected. Your Terminal Server client license number has not been entered for this copy of the Terminal Server client. Please contact your system administrator. -. - -MessageId=7054 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_LICENSE_NOT_AVAILABLE -Language=Bulgarian -ERROR_CTX_LICENSE_NOT_AVAILABLE - The system has reached its licensed logon limit. Please try again later. -. - -MessageId=7055 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_LICENSE_CLIENT_INVALID -Language=Bulgarian -ERROR_CTX_LICENSE_CLIENT_INVALID - The client you are using is not licensed to use this system. Your logon request is denied. -. - -MessageId=7056 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_LICENSE_EXPIRED -Language=Bulgarian -ERROR_CTX_LICENSE_EXPIRED - The system license has expired. Your logon request is denied. -. - -MessageId=7057 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_SHADOW_NOT_RUNNING -Language=Bulgarian -ERROR_CTX_SHADOW_NOT_RUNNING - Remote control could not be terminated because the specified session is not currently being remotely controlled. -. - -MessageId=7058 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE -Language=Bulgarian -ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE - The remote control of the console was terminated because the display mode was changed. Changing the display mode in a remote control session is not supported. -. - -MessageId=7059 -Severity=Success -Facility=System -SymbolicName=ERROR_ACTIVATION_COUNT_EXCEEDED -Language=Bulgarian -ERROR_ACTIVATION_COUNT_EXCEEDED - Activation has already been reset the maximum number of times for this installation. Your activation timer will not be cleared. -. - -MessageId=7060 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_WINSTATIONS_DISABLED -Language=Bulgarian -ERROR_CTX_WINSTATIONS_DISABLED - Remote logins are currently disabled. -. - -MessageId=7061 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED -Language=Bulgarian -ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED - You do not have the proper encryption level to access this Session. -. - -MessageId=7062 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_SESSION_IN_USE -Language=Bulgarian -ERROR_CTX_SESSION_IN_USE - The user %s\\%s is currently logged on to this computer. Only the current user or an administrator can log on to this computer. -. - -MessageId=7063 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_NO_FORCE_LOGOFF -Language=Bulgarian -ERROR_CTX_NO_FORCE_LOGOFF - The user %s\\%s is already logged on to the console of this computer. You do not have permission to log in at this time. To resolve this issue, contact %s\\%s and have them log off. -. - -MessageId=7064 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_ACCOUNT_RESTRICTION -Language=Bulgarian -ERROR_CTX_ACCOUNT_RESTRICTION - Unable to log you on because of an account restriction. -. - -MessageId=7065 -Severity=Success -Facility=System -SymbolicName=ERROR_RDP_PROTOCOL_ERROR -Language=Bulgarian -ERROR_RDP_PROTOCOL_ERROR - The RDP protocol component %2 detected an error in the protocol stream and has disconnected the client. -. - -MessageId=7066 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CDM_CONNECT -Language=Bulgarian -ERROR_CTX_CDM_CONNECT - The Client Drive Mapping Service Has Connected on Terminal Connection. -. - -MessageId=7067 -Severity=Success -Facility=System -SymbolicName=ERROR_CTX_CDM_DISCONNECT -Language=Bulgarian -ERROR_CTX_CDM_DISCONNECT - The Client Drive Mapping Service Has Disconnected on Terminal Connection. -. - -MessageId=8001 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_INVALID_API_SEQUENCE -Language=Bulgarian -FRS_ERR_INVALID_API_SEQUENCE - The file replication service API was called incorrectly. -. - -MessageId=8002 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_STARTING_SERVICE -Language=Bulgarian -FRS_ERR_STARTING_SERVICE - The file replication service cannot be started. -. - -MessageId=8003 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_STOPPING_SERVICE -Language=Bulgarian -FRS_ERR_STOPPING_SERVICE - The file replication service cannot be stopped. -. - -MessageId=8004 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_INTERNAL_API -Language=Bulgarian -FRS_ERR_INTERNAL_API - The file replication service API terminated the request. The event log may have more information. -. - -MessageId=8005 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_INTERNAL -Language=Bulgarian -FRS_ERR_INTERNAL - The file replication service terminated the request. The event log may have more information. -. - -MessageId=8006 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_SERVICE_COMM -Language=Bulgarian -FRS_ERR_SERVICE_COMM - The file replication service cannot be contacted. The event log may have more information. -. - -MessageId=8007 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_INSUFFICIENT_PRIV -Language=Bulgarian -FRS_ERR_INSUFFICIENT_PRIV - The file replication service cannot satisfy the request because the user has insufficient privileges. The event log may have more information. -. - -MessageId=8008 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_AUTHENTICATION -Language=Bulgarian -FRS_ERR_AUTHENTICATION - The file replication service cannot satisfy the request because authenticated RPC is not available. The event log may have more information. -. - -MessageId=8009 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_PARENT_INSUFFICIENT_PRIV -Language=Bulgarian -FRS_ERR_PARENT_INSUFFICIENT_PRIV - The file replication service cannot satisfy the request because the user has insufficient privileges on the domain controller. The event log may have more information. -. - -MessageId=8010 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_PARENT_AUTHENTICATION -Language=Bulgarian -FRS_ERR_PARENT_AUTHENTICATION - The file replication service cannot satisfy the request because authenticated RPC is not available on the domain controller. The event log may have more information. -. - -MessageId=8011 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_CHILD_TO_PARENT_COMM -Language=Bulgarian -FRS_ERR_CHILD_TO_PARENT_COMM - The file replication service cannot communicate with the file replication service on the domain controller. The event log may have more information. -. - -MessageId=8012 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_PARENT_TO_CHILD_COMM -Language=Bulgarian -FRS_ERR_PARENT_TO_CHILD_COMM - The file replication service on the domain controller cannot communicate with the file replication service on this computer. The event log may have more information. -. - -MessageId=8013 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_SYSVOL_POPULATE -Language=Bulgarian -FRS_ERR_SYSVOL_POPULATE - The file replication service cannot populate the system volume because of an internal error. The event log may have more information. -. - -MessageId=8014 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_SYSVOL_POPULATE_TIMEOUT -Language=Bulgarian -FRS_ERR_SYSVOL_POPULATE_TIMEOUT - The file replication service cannot populate the system volume because of an internal timeout. The event log may have more information. -. - -MessageId=8015 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_SYSVOL_IS_BUSY -Language=Bulgarian -FRS_ERR_SYSVOL_IS_BUSY - The file replication service cannot process the request. The system volume is busy with a previous request. -. - -MessageId=8016 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_SYSVOL_DEMOTE -Language=Bulgarian -FRS_ERR_SYSVOL_DEMOTE - The file replication service cannot stop replicating the system volume because of an internal error. The event log may have more information. -. - -MessageId=8017 -Severity=Success -Facility=System -SymbolicName=FRS_ERR_INVALID_SERVICE_PARAMETER -Language=Bulgarian -FRS_ERR_INVALID_SERVICE_PARAMETER - The file replication service detected an invalid parameter. -. - -MessageId=8200 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOT_INSTALLED -Language=Bulgarian -ERROR_DS_NOT_INSTALLED - An error occurred while installing the directory service. For more information, see the event log. -. - -MessageId=8201 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY -Language=Bulgarian -ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY - The directory service evaluated group memberships locally. -. - -MessageId=8202 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_ATTRIBUTE_OR_VALUE -Language=Bulgarian -ERROR_DS_NO_ATTRIBUTE_OR_VALUE - The specified directory service attribute or value does not exist. -. - -MessageId=8203 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_ATTRIBUTE_SYNTAX -Language=Bulgarian -ERROR_DS_INVALID_ATTRIBUTE_SYNTAX - The attribute syntax specified to the directory service is invalid. -. - -MessageId=8204 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED -Language=Bulgarian -ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED - The attribute type specified to the directory service is not defined. -. - -MessageId=8205 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS -Language=Bulgarian -ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS - The specified directory service attribute or value already exists. -. - -MessageId=8206 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BUSY -Language=Bulgarian -ERROR_DS_BUSY - The directory service is busy. -. - -MessageId=8207 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNAVAILABLE -Language=Bulgarian -ERROR_DS_UNAVAILABLE - The directory service is unavailable. -. - -MessageId=8208 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_RIDS_ALLOCATED -Language=Bulgarian -ERROR_DS_NO_RIDS_ALLOCATED - The directory service was unable to allocate a relative identifier. -. - -MessageId=8209 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_MORE_RIDS -Language=Bulgarian -ERROR_DS_NO_MORE_RIDS - The directory service has exhausted the pool of relative identifiers. -. - -MessageId=8210 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INCORRECT_ROLE_OWNER -Language=Bulgarian -ERROR_DS_INCORRECT_ROLE_OWNER - The requested operation could not be performed because the directory service is not the master for that type of operation. -. - -MessageId=8211 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_RIDMGR_INIT_ERROR -Language=Bulgarian -ERROR_DS_RIDMGR_INIT_ERROR - The directory service was unable to initialize the subsystem that allocates relative identifiers. -. - -MessageId=8212 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJ_CLASS_VIOLATION -Language=Bulgarian -ERROR_DS_OBJ_CLASS_VIOLATION - The requested operation did not satisfy one or more constraints associated with the class of the object. -. - -MessageId=8213 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_ON_NON_LEAF -Language=Bulgarian -ERROR_DS_CANT_ON_NON_LEAF - The directory service can perform the requested operation only on a leaf object. -. - -MessageId=8214 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_ON_RDN -Language=Bulgarian -ERROR_DS_CANT_ON_RDN - The directory service cannot perform the requested operation on the RDN attribute of an object. -. - -MessageId=8215 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOD_OBJ_CLASS -Language=Bulgarian -ERROR_DS_CANT_MOD_OBJ_CLASS - The directory service detected an attempt to modify the object class of an object. -. - -MessageId=8216 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CROSS_DOM_MOVE_ERROR -Language=Bulgarian -ERROR_DS_CROSS_DOM_MOVE_ERROR - The requested cross-domain move operation could not be performed. -. - -MessageId=8217 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GC_NOT_AVAILABLE -Language=Bulgarian -ERROR_DS_GC_NOT_AVAILABLE - Unable to contact the global catalog server. -. - -MessageId=8218 -Severity=Success -Facility=System -SymbolicName=ERROR_SHARED_POLICY -Language=Bulgarian -ERROR_SHARED_POLICY - The policy object is shared and can only be modified at the root. -. - -MessageId=8219 -Severity=Success -Facility=System -SymbolicName=ERROR_POLICY_OBJECT_NOT_FOUND -Language=Bulgarian -ERROR_POLICY_OBJECT_NOT_FOUND - The policy object does not exist. -. - -MessageId=8220 -Severity=Success -Facility=System -SymbolicName=ERROR_POLICY_ONLY_IN_DS -Language=Bulgarian -ERROR_POLICY_ONLY_IN_DS - The requested policy information is only in the directory service. -. - -MessageId=8221 -Severity=Success -Facility=System -SymbolicName=ERROR_PROMOTION_ACTIVE -Language=Bulgarian -ERROR_PROMOTION_ACTIVE - A domain controller promotion is currently active. -. - -MessageId=8222 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_PROMOTION_ACTIVE -Language=Bulgarian -ERROR_NO_PROMOTION_ACTIVE - A domain controller promotion is not currently active -. - -MessageId=8224 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OPERATIONS_ERROR -Language=Bulgarian -ERROR_DS_OPERATIONS_ERROR - An operations error occurred. -. - -MessageId=8225 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_PROTOCOL_ERROR -Language=Bulgarian -ERROR_DS_PROTOCOL_ERROR - A protocol error occurred. -. - -MessageId=8226 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_TIMELIMIT_EXCEEDED -Language=Bulgarian -ERROR_DS_TIMELIMIT_EXCEEDED - The time limit for this request was exceeded. -. - -MessageId=8227 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SIZELIMIT_EXCEEDED -Language=Bulgarian -ERROR_DS_SIZELIMIT_EXCEEDED - The size limit for this request was exceeded. -. - -MessageId=8228 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ADMIN_LIMIT_EXCEEDED -Language=Bulgarian -ERROR_DS_ADMIN_LIMIT_EXCEEDED - The administrative limit for this request was exceeded. -. - -MessageId=8229 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_COMPARE_FALSE -Language=Bulgarian -ERROR_DS_COMPARE_FALSE - The compare response was false. -. - -MessageId=8230 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_COMPARE_TRUE -Language=Bulgarian -ERROR_DS_COMPARE_TRUE - The compare response was true. -. - -MessageId=8231 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_AUTH_METHOD_NOT_SUPPORTED -Language=Bulgarian -ERROR_DS_AUTH_METHOD_NOT_SUPPORTED - The requested authentication method is not supported by the server. -. - -MessageId=8232 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_STRONG_AUTH_REQUIRED -Language=Bulgarian -ERROR_DS_STRONG_AUTH_REQUIRED - A more secure authentication method is required for this server. -. - -MessageId=8233 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INAPPROPRIATE_AUTH -Language=Bulgarian -ERROR_DS_INAPPROPRIATE_AUTH - Inappropriate authentication. -. - -MessageId=8234 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_AUTH_UNKNOWN -Language=Bulgarian -ERROR_DS_AUTH_UNKNOWN - The authentication mechanism is unknown. -. - -MessageId=8235 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_REFERRAL -Language=Bulgarian -ERROR_DS_REFERRAL - A referral was returned from the server. -. - -MessageId=8236 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNAVAILABLE_CRIT_EXTENSION -Language=Bulgarian -ERROR_DS_UNAVAILABLE_CRIT_EXTENSION - The server does not support the requested critical extension. -. - -MessageId=8237 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CONFIDENTIALITY_REQUIRED -Language=Bulgarian -ERROR_DS_CONFIDENTIALITY_REQUIRED - This request requires a secure connection. -. - -MessageId=8238 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INAPPROPRIATE_MATCHING -Language=Bulgarian -ERROR_DS_INAPPROPRIATE_MATCHING - Inappropriate matching. -. - -MessageId=8239 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CONSTRAINT_VIOLATION -Language=Bulgarian -ERROR_DS_CONSTRAINT_VIOLATION - A constraint violation occurred. -. - -MessageId=8240 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_SUCH_OBJECT -Language=Bulgarian -ERROR_DS_NO_SUCH_OBJECT - There is no such object on the server. -. - -MessageId=8241 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ALIAS_PROBLEM -Language=Bulgarian -ERROR_DS_ALIAS_PROBLEM - There is an alias problem. -. - -MessageId=8242 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_DN_SYNTAX -Language=Bulgarian -ERROR_DS_INVALID_DN_SYNTAX - An invalid dn syntax has been specified. -. - -MessageId=8243 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_IS_LEAF -Language=Bulgarian -ERROR_DS_IS_LEAF - The object is a leaf object. -. - -MessageId=8244 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ALIAS_DEREF_PROBLEM -Language=Bulgarian -ERROR_DS_ALIAS_DEREF_PROBLEM - There is an alias dereferencing problem. -. - -MessageId=8245 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNWILLING_TO_PERFORM -Language=Bulgarian -ERROR_DS_UNWILLING_TO_PERFORM - The server is unwilling to process the request. -. - -MessageId=8246 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LOOP_DETECT -Language=Bulgarian -ERROR_DS_LOOP_DETECT - A loop has been detected. -. - -MessageId=8247 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAMING_VIOLATION -Language=Bulgarian -ERROR_DS_NAMING_VIOLATION - There is a naming violation. -. - -MessageId=8248 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJECT_RESULTS_TOO_LARGE -Language=Bulgarian -ERROR_DS_OBJECT_RESULTS_TOO_LARGE - The result set is too large. -. - -MessageId=8249 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_AFFECTS_MULTIPLE_DSAS -Language=Bulgarian -ERROR_DS_AFFECTS_MULTIPLE_DSAS - The operation affects multiple DSAs -. - -MessageId=8250 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SERVER_DOWN -Language=Bulgarian -ERROR_DS_SERVER_DOWN - The server is not operational. -. - -MessageId=8251 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LOCAL_ERROR -Language=Bulgarian -ERROR_DS_LOCAL_ERROR - A local error has occurred. -. - -MessageId=8252 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ENCODING_ERROR -Language=Bulgarian -ERROR_DS_ENCODING_ERROR - An encoding error has occurred. -. - -MessageId=8253 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DECODING_ERROR -Language=Bulgarian -ERROR_DS_DECODING_ERROR - A decoding error has occurred. -. - -MessageId=8254 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_FILTER_UNKNOWN -Language=Bulgarian -ERROR_DS_FILTER_UNKNOWN - The search filter cannot be recognized. -. - -MessageId=8255 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_PARAM_ERROR -Language=Bulgarian -ERROR_DS_PARAM_ERROR - One or more parameters are illegal. -. - -MessageId=8256 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOT_SUPPORTED -Language=Bulgarian -ERROR_DS_NOT_SUPPORTED - The specified method is not supported. -. - -MessageId=8257 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_RESULTS_RETURNED -Language=Bulgarian -ERROR_DS_NO_RESULTS_RETURNED - No results were returned. -. - -MessageId=8258 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CONTROL_NOT_FOUND -Language=Bulgarian -ERROR_DS_CONTROL_NOT_FOUND - The specified control is not supported by the server. -. - -MessageId=8259 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CLIENT_LOOP -Language=Bulgarian -ERROR_DS_CLIENT_LOOP - A referral loop was detected by the client. -. - -MessageId=8260 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_REFERRAL_LIMIT_EXCEEDED -Language=Bulgarian -ERROR_DS_REFERRAL_LIMIT_EXCEEDED - The preset referral limit was exceeded. -. - -MessageId=8261 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SORT_CONTROL_MISSING -Language=Bulgarian -ERROR_DS_SORT_CONTROL_MISSING - The search requires a SORT control. -. - -MessageId=8262 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OFFSET_RANGE_ERROR -Language=Bulgarian -ERROR_DS_OFFSET_RANGE_ERROR - The search results exceed the offset range specified. -. - -MessageId=8301 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ROOT_MUST_BE_NC -Language=Bulgarian -ERROR_DS_ROOT_MUST_BE_NC - The root object must be the head of a naming context. The root object cannot have an instantiated parent. -. - -MessageId=8302 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ADD_REPLICA_INHIBITED -Language=Bulgarian -ERROR_DS_ADD_REPLICA_INHIBITED - The add replica operation cannot be performed. The naming context must be writeable in order to create the replica. -. - -MessageId=8303 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATT_NOT_DEF_IN_SCHEMA -Language=Bulgarian -ERROR_DS_ATT_NOT_DEF_IN_SCHEMA - A reference to an attribute that is not defined in the schema occurred. -. - -MessageId=8304 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MAX_OBJ_SIZE_EXCEEDED -Language=Bulgarian -ERROR_DS_MAX_OBJ_SIZE_EXCEEDED - The maximum size of an object has been exceeded. -. - -MessageId=8305 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJ_STRING_NAME_EXISTS -Language=Bulgarian -ERROR_DS_OBJ_STRING_NAME_EXISTS - An attempt was made to add an object to the directory with a name that is already in use. -. - -MessageId=8306 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA -Language=Bulgarian -ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA - An attempt was made to add an object of a class that does not have an RDN defined in the schema. -. - -MessageId=8307 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_RDN_DOESNT_MATCH_SCHEMA -Language=Bulgarian -ERROR_DS_RDN_DOESNT_MATCH_SCHEMA - An attempt was made to add an object using an RDN that is not the RDN defined in the schema. -. - -MessageId=8308 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_REQUESTED_ATTS_FOUND -Language=Bulgarian -ERROR_DS_NO_REQUESTED_ATTS_FOUND - None of the requested attributes were found on the objects. -. - -MessageId=8309 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_USER_BUFFER_TO_SMALL -Language=Bulgarian -ERROR_DS_USER_BUFFER_TO_SMALL - The user buffer is too small. -. - -MessageId=8310 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATT_IS_NOT_ON_OBJ -Language=Bulgarian -ERROR_DS_ATT_IS_NOT_ON_OBJ - The attribute specified in the operation is not present on the object. -. - -MessageId=8311 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ILLEGAL_MOD_OPERATION -Language=Bulgarian -ERROR_DS_ILLEGAL_MOD_OPERATION - Illegal modify operation. Some aspect of the modification is not permitted. -. - -MessageId=8312 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJ_TOO_LARGE -Language=Bulgarian -ERROR_DS_OBJ_TOO_LARGE - The specified object is too large. -. - -MessageId=8313 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BAD_INSTANCE_TYPE -Language=Bulgarian -ERROR_DS_BAD_INSTANCE_TYPE - The specified instance type is not valid. -. - -MessageId=8314 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MASTERDSA_REQUIRED -Language=Bulgarian -ERROR_DS_MASTERDSA_REQUIRED - The operation must be performed at a master DSA. -. - -MessageId=8315 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJECT_CLASS_REQUIRED -Language=Bulgarian -ERROR_DS_OBJECT_CLASS_REQUIRED - The object class attribute must be specified. -. - -MessageId=8316 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MISSING_REQUIRED_ATT -Language=Bulgarian -ERROR_DS_MISSING_REQUIRED_ATT - A required attribute is missing. -. - -MessageId=8317 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATT_NOT_DEF_FOR_CLASS -Language=Bulgarian -ERROR_DS_ATT_NOT_DEF_FOR_CLASS - An attempt was made to modify an object to include an attribute that is not legal for its class -. - -MessageId=8318 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATT_ALREADY_EXISTS -Language=Bulgarian -ERROR_DS_ATT_ALREADY_EXISTS - The specified attribute is already present on the object. -. - -MessageId=8320 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_ADD_ATT_VALUES -Language=Bulgarian -ERROR_DS_CANT_ADD_ATT_VALUES - The specified attribute is not present, or has no values. -. - -MessageId=8321 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SINGLE_VALUE_CONSTRAINT -Language=Bulgarian -ERROR_DS_SINGLE_VALUE_CONSTRAINT - Multiple values were specified for an attribute that can have only one value. -. - -MessageId=8322 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_RANGE_CONSTRAINT -Language=Bulgarian -ERROR_DS_RANGE_CONSTRAINT - A value for the attribute was not in the acceptable range of values. -. - -MessageId=8323 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATT_VAL_ALREADY_EXISTS -Language=Bulgarian -ERROR_DS_ATT_VAL_ALREADY_EXISTS - The specified value already exists. -. - -MessageId=8324 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_REM_MISSING_ATT -Language=Bulgarian -ERROR_DS_CANT_REM_MISSING_ATT - The attribute cannot be removed because it is not present on the object. -. - -MessageId=8325 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_REM_MISSING_ATT_VAL -Language=Bulgarian -ERROR_DS_CANT_REM_MISSING_ATT_VAL - The attribute value cannot be removed because it is not present on the object. -. - -MessageId=8326 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ROOT_CANT_BE_SUBREF -Language=Bulgarian -ERROR_DS_ROOT_CANT_BE_SUBREF - The specified root object cannot be a subref. -. - -MessageId=8327 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_CHAINING -Language=Bulgarian -ERROR_DS_NO_CHAINING - Chaining is not permitted. -. - -MessageId=8328 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_CHAINED_EVAL -Language=Bulgarian -ERROR_DS_NO_CHAINED_EVAL - Chained evaluation is not permitted. -. - -MessageId=8329 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_PARENT_OBJECT -Language=Bulgarian -ERROR_DS_NO_PARENT_OBJECT - The operation could not be performed because the object's parent is either uninstantiated or deleted. -. - -MessageId=8330 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_PARENT_IS_AN_ALIAS -Language=Bulgarian -ERROR_DS_PARENT_IS_AN_ALIAS - Having a parent that is an alias is not permitted. Aliases are leaf objects. -. - -MessageId=8331 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MIX_MASTER_AND_REPS -Language=Bulgarian -ERROR_DS_CANT_MIX_MASTER_AND_REPS - The object and parent must be of the same type, either both masters or both replicas. -. - -MessageId=8332 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CHILDREN_EXIST -Language=Bulgarian -ERROR_DS_CHILDREN_EXIST - The operation cannot be performed because child objects exist. This operation can only be performed on a leaf object. -. - -MessageId=8333 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJ_NOT_FOUND -Language=Bulgarian -ERROR_DS_OBJ_NOT_FOUND - Directory object not found. -. - -MessageId=8334 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ALIASED_OBJ_MISSING -Language=Bulgarian -ERROR_DS_ALIASED_OBJ_MISSING - The aliased object is missing. -. - -MessageId=8335 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BAD_NAME_SYNTAX -Language=Bulgarian -ERROR_DS_BAD_NAME_SYNTAX - The object name has bad syntax. -. - -MessageId=8336 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ALIAS_POINTS_TO_ALIAS -Language=Bulgarian -ERROR_DS_ALIAS_POINTS_TO_ALIAS - It is not permitted for an alias to refer to another alias. -. - -MessageId=8337 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_DEREF_ALIAS -Language=Bulgarian -ERROR_DS_CANT_DEREF_ALIAS - The alias cannot be dereferenced. -. - -MessageId=8338 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OUT_OF_SCOPE -Language=Bulgarian -ERROR_DS_OUT_OF_SCOPE - The operation is out of scope. -. - -MessageId=8339 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJECT_BEING_REMOVED -Language=Bulgarian -ERROR_DS_OBJECT_BEING_REMOVED - The operation cannot continue because the object is in the process of being removed. -. - -MessageId=8340 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_DELETE_DSA_OBJ -Language=Bulgarian -ERROR_DS_CANT_DELETE_DSA_OBJ - The DSA object cannot be deleted. -. - -MessageId=8341 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GENERIC_ERROR -Language=Bulgarian -ERROR_DS_GENERIC_ERROR - A directory service error has occurred. -. - -MessageId=8342 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DSA_MUST_BE_INT_MASTER -Language=Bulgarian -ERROR_DS_DSA_MUST_BE_INT_MASTER - The operation can only be performed on an internal master DSA object. -. - -MessageId=8343 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CLASS_NOT_DSA -Language=Bulgarian -ERROR_DS_CLASS_NOT_DSA - The object must be of class DSA. -. - -MessageId=8344 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INSUFF_ACCESS_RIGHTS -Language=Bulgarian -ERROR_DS_INSUFF_ACCESS_RIGHTS - Insufficient access rights to perform the operation. -. - -MessageId=8345 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ILLEGAL_SUPERIOR -Language=Bulgarian -ERROR_DS_ILLEGAL_SUPERIOR - The object cannot be added because the parent is not on the list of possible superiors. -. - -MessageId=8346 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATTRIBUTE_OWNED_BY_SAM -Language=Bulgarian -ERROR_DS_ATTRIBUTE_OWNED_BY_SAM - Access to the attribute is not permitted because the attribute is owned by the Security Accounts Manager (SAM). -. - -MessageId=8347 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_TOO_MANY_PARTS -Language=Bulgarian -ERROR_DS_NAME_TOO_MANY_PARTS - The name has too many parts. -. - -MessageId=8348 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_TOO_LONG -Language=Bulgarian -ERROR_DS_NAME_TOO_LONG - The name is too long. -. - -MessageId=8349 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_VALUE_TOO_LONG -Language=Bulgarian -ERROR_DS_NAME_VALUE_TOO_LONG - The name value is too long. -. - -MessageId=8350 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_UNPARSEABLE -Language=Bulgarian -ERROR_DS_NAME_UNPARSEABLE - The directory service encountered an error parsing a name. -. - -MessageId=8351 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_TYPE_UNKNOWN -Language=Bulgarian -ERROR_DS_NAME_TYPE_UNKNOWN - The directory service cannot get the attribute type for a name. -. - -MessageId=8352 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOT_AN_OBJECT -Language=Bulgarian -ERROR_DS_NOT_AN_OBJECT - The name does not identify an object; the name identifies a phantom. -. - -MessageId=8353 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SEC_DESC_TOO_SHORT -Language=Bulgarian -ERROR_DS_SEC_DESC_TOO_SHORT - The security descriptor is too short. -. - -MessageId=8354 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SEC_DESC_INVALID -Language=Bulgarian -ERROR_DS_SEC_DESC_INVALID - The security descriptor is invalid. -. - -MessageId=8355 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_DELETED_NAME -Language=Bulgarian -ERROR_DS_NO_DELETED_NAME - Failed to create name for deleted object. -. - -MessageId=8356 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SUBREF_MUST_HAVE_PARENT -Language=Bulgarian -ERROR_DS_SUBREF_MUST_HAVE_PARENT - The parent of a new subref must exist. -. - -MessageId=8357 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NCNAME_MUST_BE_NC -Language=Bulgarian -ERROR_DS_NCNAME_MUST_BE_NC - The object must be a naming context. -. - -MessageId=8358 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_ADD_SYSTEM_ONLY -Language=Bulgarian -ERROR_DS_CANT_ADD_SYSTEM_ONLY - It is not permitted to add an attribute which is owned by the system. -. - -MessageId=8359 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CLASS_MUST_BE_CONCRETE -Language=Bulgarian -ERROR_DS_CLASS_MUST_BE_CONCRETE - The class of the object must be structural; you cannot instantiate an abstract class. -. - -MessageId=8360 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_DMD -Language=Bulgarian -ERROR_DS_INVALID_DMD - The schema object could not be found. -. - -MessageId=8361 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJ_GUID_EXISTS -Language=Bulgarian -ERROR_DS_OBJ_GUID_EXISTS - A local object with this GUID (dead or alive) already exists. -. - -MessageId=8362 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOT_ON_BACKLINK -Language=Bulgarian -ERROR_DS_NOT_ON_BACKLINK - The operation cannot be performed on a back link. -. - -MessageId=8363 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_CROSSREF_FOR_NC -Language=Bulgarian -ERROR_DS_NO_CROSSREF_FOR_NC - The cross reference for the specified naming context could not be found. -. - -MessageId=8364 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SHUTTING_DOWN -Language=Bulgarian -ERROR_DS_SHUTTING_DOWN - The operation could not be performed because the directory service is shutting down. -. - -MessageId=8365 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNKNOWN_OPERATION -Language=Bulgarian -ERROR_DS_UNKNOWN_OPERATION - The directory service request is invalid. -. - -MessageId=8366 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_ROLE_OWNER -Language=Bulgarian -ERROR_DS_INVALID_ROLE_OWNER - The role owner attribute could not be read. -. - -MessageId=8367 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_COULDNT_CONTACT_FSMO -Language=Bulgarian -ERROR_DS_COULDNT_CONTACT_FSMO - The requested FSMO operation failed. The current FSMO holder could not be reached. -. - -MessageId=8368 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CROSS_NC_DN_RENAME -Language=Bulgarian -ERROR_DS_CROSS_NC_DN_RENAME - Modification of a DN across a naming context is not permitted. -. - -MessageId=8369 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOD_SYSTEM_ONLY -Language=Bulgarian -ERROR_DS_CANT_MOD_SYSTEM_ONLY - The attribute cannot be modified because it is owned by the system. -. - -MessageId=8370 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_REPLICATOR_ONLY -Language=Bulgarian -ERROR_DS_REPLICATOR_ONLY - Only the replicator can perform this function. -. - -MessageId=8371 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJ_CLASS_NOT_DEFINED -Language=Bulgarian -ERROR_DS_OBJ_CLASS_NOT_DEFINED - The specified class is not defined. -. - -MessageId=8372 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OBJ_CLASS_NOT_SUBCLASS -Language=Bulgarian -ERROR_DS_OBJ_CLASS_NOT_SUBCLASS - The specified class is not a subclass. -. - -MessageId=8373 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_REFERENCE_INVALID -Language=Bulgarian -ERROR_DS_NAME_REFERENCE_INVALID - The name reference is invalid. -. - -MessageId=8374 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CROSS_REF_EXISTS -Language=Bulgarian -ERROR_DS_CROSS_REF_EXISTS - A cross reference already exists. -. - -MessageId=8375 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_DEL_MASTER_CROSSREF -Language=Bulgarian -ERROR_DS_CANT_DEL_MASTER_CROSSREF - It is not permitted to delete a master cross reference. -. - -MessageId=8376 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD -Language=Bulgarian -ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD - Subtree notifications are only supported on NC heads. -. - -MessageId=8377 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX -Language=Bulgarian -ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX - Notification filter is too complex. -. - -MessageId=8378 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUP_RDN -Language=Bulgarian -ERROR_DS_DUP_RDN - Schema update failed: duplicate RDN. -. - -MessageId=8379 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUP_OID -Language=Bulgarian -ERROR_DS_DUP_OID - Schema update failed: duplicate OID -. - -MessageId=8380 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUP_MAPI_ID -Language=Bulgarian -ERROR_DS_DUP_MAPI_ID - Schema update failed: duplicate MAPI identifier. -. - -MessageId=8381 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUP_SCHEMA_ID_GUID -Language=Bulgarian -ERROR_DS_DUP_SCHEMA_ID_GUID - Schema update failed: duplicate schema-id GUID. -. - -MessageId=8382 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUP_LDAP_DISPLAY_NAME -Language=Bulgarian -ERROR_DS_DUP_LDAP_DISPLAY_NAME - Schema update failed: duplicate LDAP display name. -. - -MessageId=8383 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SEMANTIC_ATT_TEST -Language=Bulgarian -ERROR_DS_SEMANTIC_ATT_TEST - Schema update failed: range-lower less than range upper -. - -MessageId=8384 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SYNTAX_MISMATCH -Language=Bulgarian -ERROR_DS_SYNTAX_MISMATCH - Schema update failed: syntax mismatch -. - -MessageId=8385 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EXISTS_IN_MUST_HAVE -Language=Bulgarian -ERROR_DS_EXISTS_IN_MUST_HAVE - Schema deletion failed: attribute is used in must-contain -. - -MessageId=8386 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EXISTS_IN_MAY_HAVE -Language=Bulgarian -ERROR_DS_EXISTS_IN_MAY_HAVE - Schema deletion failed: attribute is used in may-contain -. - -MessageId=8387 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NONEXISTENT_MAY_HAVE -Language=Bulgarian -ERROR_DS_NONEXISTENT_MAY_HAVE - Schema update failed: attribute in may-contain does not exist -. - -MessageId=8388 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NONEXISTENT_MUST_HAVE -Language=Bulgarian -ERROR_DS_NONEXISTENT_MUST_HAVE - Schema update failed: attribute in must-contain does not exist -. - -MessageId=8389 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_AUX_CLS_TEST_FAIL -Language=Bulgarian -ERROR_DS_AUX_CLS_TEST_FAIL - Schema update failed: class in aux-class list does not exist or is not an auxiliary class -. - -MessageId=8390 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NONEXISTENT_POSS_SUP -Language=Bulgarian -ERROR_DS_NONEXISTENT_POSS_SUP - Schema update failed: class in poss-superiors does not exist -. - -MessageId=8391 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SUB_CLS_TEST_FAIL -Language=Bulgarian -ERROR_DS_SUB_CLS_TEST_FAIL - Schema update failed: class in subclassof list does not exist or does not satisfy hierarchy rules -. - -MessageId=8392 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BAD_RDN_ATT_ID_SYNTAX -Language=Bulgarian -ERROR_DS_BAD_RDN_ATT_ID_SYNTAX - Schema update failed: Rdn-Att-Id has wrong syntax -. - -MessageId=8393 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EXISTS_IN_AUX_CLS -Language=Bulgarian -ERROR_DS_EXISTS_IN_AUX_CLS - Schema deletion failed: class is used as auxiliary class -. - -MessageId=8394 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EXISTS_IN_SUB_CLS -Language=Bulgarian -ERROR_DS_EXISTS_IN_SUB_CLS - Schema deletion failed: class is used as sub class -. - -MessageId=8395 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EXISTS_IN_POSS_SUP -Language=Bulgarian -ERROR_DS_EXISTS_IN_POSS_SUP - Schema deletion failed: class is used as poss superior -. - -MessageId=8396 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_RECALCSCHEMA_FAILED -Language=Bulgarian -ERROR_DS_RECALCSCHEMA_FAILED - Schema update failed in recalculating validation cache. -. - -MessageId=8397 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_TREE_DELETE_NOT_FINISHED -Language=Bulgarian -ERROR_DS_TREE_DELETE_NOT_FINISHED - The tree deletion is not finished. -. - -MessageId=8398 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_DELETE -Language=Bulgarian -ERROR_DS_CANT_DELETE - The requested delete operation could not be performed. -. - -MessageId=8399 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATT_SCHEMA_REQ_ID -Language=Bulgarian -ERROR_DS_ATT_SCHEMA_REQ_ID - Cannot read the governs class identifier for the schema record. -. - -MessageId=8400 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BAD_ATT_SCHEMA_SYNTAX -Language=Bulgarian -ERROR_DS_BAD_ATT_SCHEMA_SYNTAX - The attribute schema has bad syntax. -. - -MessageId=8401 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_CACHE_ATT -Language=Bulgarian -ERROR_DS_CANT_CACHE_ATT - The attribute could not be cached. -. - -MessageId=8402 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_CACHE_CLASS -Language=Bulgarian -ERROR_DS_CANT_CACHE_CLASS - The class could not be cached. -. - -MessageId=8403 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_REMOVE_ATT_CACHE -Language=Bulgarian -ERROR_DS_CANT_REMOVE_ATT_CACHE - The attribute could not be removed from the cache. -. - -MessageId=8404 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_REMOVE_CLASS_CACHE -Language=Bulgarian -ERROR_DS_CANT_REMOVE_CLASS_CACHE - The class could not be removed from the cache. -. - -MessageId=8405 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_RETRIEVE_DN -Language=Bulgarian -ERROR_DS_CANT_RETRIEVE_DN - The distinguished name attribute could not be read. -. - -MessageId=8406 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MISSING_SUPREF -Language=Bulgarian -ERROR_DS_MISSING_SUPREF - No superior reference has been configured for the directory service. The directory service is therefore unable to issue referrals to objects outside this forest. -. - -MessageId=8407 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_RETRIEVE_INSTANCE -Language=Bulgarian -ERROR_DS_CANT_RETRIEVE_INSTANCE - The instance type attribute could not be retrieved. -. - -MessageId=8408 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CODE_INCONSISTENCY -Language=Bulgarian -ERROR_DS_CODE_INCONSISTENCY - An internal error has occurred. -. - -MessageId=8409 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DATABASE_ERROR -Language=Bulgarian -ERROR_DS_DATABASE_ERROR - A database error has occurred. -. - -MessageId=8410 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GOVERNSID_MISSING -Language=Bulgarian -ERROR_DS_GOVERNSID_MISSING - The attribute GOVERNSID is missing. -. - -MessageId=8411 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MISSING_EXPECTED_ATT -Language=Bulgarian -ERROR_DS_MISSING_EXPECTED_ATT - An expected attribute is missing. -. - -MessageId=8412 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NCNAME_MISSING_CR_REF -Language=Bulgarian -ERROR_DS_NCNAME_MISSING_CR_REF - The specified naming context is missing a cross reference. -. - -MessageId=8413 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SECURITY_CHECKING_ERROR -Language=Bulgarian -ERROR_DS_SECURITY_CHECKING_ERROR - A security checking error has occurred. -. - -MessageId=8414 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SCHEMA_NOT_LOADED -Language=Bulgarian -ERROR_DS_SCHEMA_NOT_LOADED - The schema is not loaded. -. - -MessageId=8415 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SCHEMA_ALLOC_FAILED -Language=Bulgarian -ERROR_DS_SCHEMA_ALLOC_FAILED - Schema allocation failed. Please check if the machine is running low on memory. -. - -MessageId=8416 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ATT_SCHEMA_REQ_SYNTAX -Language=Bulgarian -ERROR_DS_ATT_SCHEMA_REQ_SYNTAX - Failed to obtain the required syntax for the attribute schema. -. - -MessageId=8417 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GCVERIFY_ERROR -Language=Bulgarian -ERROR_DS_GCVERIFY_ERROR - The global catalog verification failed. The global catalog is not available or does not support the operation. Some part of the directory is currently not available. -. - -MessageId=8418 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SCHEMA_MISMATCH -Language=Bulgarian -ERROR_DS_DRA_SCHEMA_MISMATCH - The replication operation failed because of a schema mismatch between the servers involved. -. - -MessageId=8419 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_FIND_DSA_OBJ -Language=Bulgarian -ERROR_DS_CANT_FIND_DSA_OBJ - The DSA object could not be found. -. - -MessageId=8420 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_FIND_EXPECTED_NC -Language=Bulgarian -ERROR_DS_CANT_FIND_EXPECTED_NC - The naming context could not be found. -. - -MessageId=8421 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_FIND_NC_IN_CACHE -Language=Bulgarian -ERROR_DS_CANT_FIND_NC_IN_CACHE - The naming context could not be found in the cache. -. - -MessageId=8422 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_RETRIEVE_CHILD -Language=Bulgarian -ERROR_DS_CANT_RETRIEVE_CHILD - The child object could not be retrieved. -. - -MessageId=8423 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SECURITY_ILLEGAL_MODIFY -Language=Bulgarian -ERROR_DS_SECURITY_ILLEGAL_MODIFY - The modification was not permitted for security reasons. -. - -MessageId=8424 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_REPLACE_HIDDEN_REC -Language=Bulgarian -ERROR_DS_CANT_REPLACE_HIDDEN_REC - The operation cannot replace the hidden record. -. - -MessageId=8425 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BAD_HIERARCHY_FILE -Language=Bulgarian -ERROR_DS_BAD_HIERARCHY_FILE - The hierarchy file is invalid. -. - -MessageId=8426 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED -Language=Bulgarian -ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED - The attempt to build the hierarchy table failed. -. - -MessageId=8427 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CONFIG_PARAM_MISSING -Language=Bulgarian -ERROR_DS_CONFIG_PARAM_MISSING - The directory configuration parameter is missing from the registry. -. - -MessageId=8428 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_COUNTING_AB_INDICES_FAILED -Language=Bulgarian -ERROR_DS_COUNTING_AB_INDICES_FAILED - The attempt to count the address book indices failed. -. - -MessageId=8429 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED -Language=Bulgarian -ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED - The allocation of the hierarchy table failed. -. - -MessageId=8430 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INTERNAL_FAILURE -Language=Bulgarian -ERROR_DS_INTERNAL_FAILURE - The directory service encountered an internal failure. -. - -MessageId=8431 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNKNOWN_ERROR -Language=Bulgarian -ERROR_DS_UNKNOWN_ERROR - The directory service encountered an unknown failure. -. - -MessageId=8432 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ROOT_REQUIRES_CLASS_TOP -Language=Bulgarian -ERROR_DS_ROOT_REQUIRES_CLASS_TOP - A root object requires a class of 'top'. -. - -MessageId=8433 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_REFUSING_FSMO_ROLES -Language=Bulgarian -ERROR_DS_REFUSING_FSMO_ROLES - This directory server is shutting down, and cannot take ownership of new floating single-master operation roles. -. - -MessageId=8434 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MISSING_FSMO_SETTINGS -Language=Bulgarian -ERROR_DS_MISSING_FSMO_SETTINGS - The directory service is missing mandatory configuration information, and is unable to determine the ownership of floating single-master operation roles. -. - -MessageId=8435 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNABLE_TO_SURRENDER_ROLES -Language=Bulgarian -ERROR_DS_UNABLE_TO_SURRENDER_ROLES - The directory service was unable to transfer ownership of one or more floating single-master operation roles to other servers. -. - -MessageId=8436 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_GENERIC -Language=Bulgarian -ERROR_DS_DRA_GENERIC - The replication operation failed. -. - -MessageId=8437 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_INVALID_PARAMETER -Language=Bulgarian -ERROR_DS_DRA_INVALID_PARAMETER - An invalid parameter was specified for this replication operation. -. - -MessageId=8438 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_BUSY -Language=Bulgarian -ERROR_DS_DRA_BUSY - The directory service is too busy to complete the replication operation at this time. -. - -MessageId=8439 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_BAD_DN -Language=Bulgarian -ERROR_DS_DRA_BAD_DN - The distinguished name specified for this replication operation is invalid. -. - -MessageId=8440 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_BAD_NC -Language=Bulgarian -ERROR_DS_DRA_BAD_NC - The naming context specified for this replication operation is invalid. -. - -MessageId=8441 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_DN_EXISTS -Language=Bulgarian -ERROR_DS_DRA_DN_EXISTS - The distinguished name specified for this replication operation already exists. -. - -MessageId=8442 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_INTERNAL_ERROR -Language=Bulgarian -ERROR_DS_DRA_INTERNAL_ERROR - The replication system encountered an internal error. -. - -MessageId=8443 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_INCONSISTENT_DIT -Language=Bulgarian -ERROR_DS_DRA_INCONSISTENT_DIT - The replication operation encountered a database inconsistency. -. - -MessageId=8444 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_CONNECTION_FAILED -Language=Bulgarian -ERROR_DS_DRA_CONNECTION_FAILED - The server specified for this replication operation could not be contacted. -. - -MessageId=8445 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_BAD_INSTANCE_TYPE -Language=Bulgarian -ERROR_DS_DRA_BAD_INSTANCE_TYPE - The replication operation encountered an object with an invalid instance type. -. - -MessageId=8446 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_OUT_OF_MEM -Language=Bulgarian -ERROR_DS_DRA_OUT_OF_MEM - The replication operation failed to allocate memory. -. - -MessageId=8447 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_MAIL_PROBLEM -Language=Bulgarian -ERROR_DS_DRA_MAIL_PROBLEM - The replication operation encountered an error with the mail system. -. - -MessageId=8448 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_REF_ALREADY_EXISTS -Language=Bulgarian -ERROR_DS_DRA_REF_ALREADY_EXISTS - The replication reference information for the target server already exists. -. - -MessageId=8449 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_REF_NOT_FOUND -Language=Bulgarian -ERROR_DS_DRA_REF_NOT_FOUND - The replication reference information for the target server does not exist. -. - -MessageId=8450 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_OBJ_IS_REP_SOURCE -Language=Bulgarian -ERROR_DS_DRA_OBJ_IS_REP_SOURCE - The naming context cannot be removed because it is replicated to another server. -. - -MessageId=8451 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_DB_ERROR -Language=Bulgarian -ERROR_DS_DRA_DB_ERROR - The replication operation encountered a database error. -. - -MessageId=8452 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_NO_REPLICA -Language=Bulgarian -ERROR_DS_DRA_NO_REPLICA - The naming context is in the process of being removed or is not replicated from the specified server. -. - -MessageId=8453 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_ACCESS_DENIED -Language=Bulgarian -ERROR_DS_DRA_ACCESS_DENIED - Replication access was denied. -. - -MessageId=8454 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_NOT_SUPPORTED -Language=Bulgarian -ERROR_DS_DRA_NOT_SUPPORTED - The requested operation is not supported by this version of the directory service. -. - -MessageId=8455 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_RPC_CANCELLED -Language=Bulgarian -ERROR_DS_DRA_RPC_CANCELLED - The replication remote procedure call was cancelled. -. - -MessageId=8456 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SOURCE_DISABLED -Language=Bulgarian -ERROR_DS_DRA_SOURCE_DISABLED - The source server is currently rejecting replication requests. -. - -MessageId=8457 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SINK_DISABLED -Language=Bulgarian -ERROR_DS_DRA_SINK_DISABLED - The destination server is currently rejecting replication requests. -. - -MessageId=8458 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_NAME_COLLISION -Language=Bulgarian -ERROR_DS_DRA_NAME_COLLISION - The replication operation failed due to a collision of object names. -. - -MessageId=8459 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SOURCE_REINSTALLED -Language=Bulgarian -ERROR_DS_DRA_SOURCE_REINSTALLED - The replication source has been reinstalled. -. - -MessageId=8460 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_MISSING_PARENT -Language=Bulgarian -ERROR_DS_DRA_MISSING_PARENT - The replication operation failed because a required parent object is missing. -. - -MessageId=8461 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_PREEMPTED -Language=Bulgarian -ERROR_DS_DRA_PREEMPTED - The replication operation was preempted. -. - -MessageId=8462 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_ABANDON_SYNC -Language=Bulgarian -ERROR_DS_DRA_ABANDON_SYNC - The replication synchronization attempt was abandoned because of a lack of updates. -. - -MessageId=8463 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SHUTDOWN -Language=Bulgarian -ERROR_DS_DRA_SHUTDOWN - The replication operation was terminated because the system is shutting down. -. - -MessageId=8464 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET -Language=Bulgarian -ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET - Synchronization attempt failed because the destination DC is currently waiting to synchronize new partial attributes from source. This condition is normal if a recent schema change modified the partial attribute set. The destination partial attribute set is not a subset of the source partial attribute set. -. - -MessageId=8465 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA -Language=Bulgarian -ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA - The replication synchronization attempt failed because a master replica attempted to sync from a partial replica. -. - -MessageId=8466 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_EXTN_CONNECTION_FAILED -Language=Bulgarian -ERROR_DS_DRA_EXTN_CONNECTION_FAILED - The server specified for this replication operation was contacted, but that server was unable to contact an additional server needed to complete the operation. -. - -MessageId=8467 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INSTALL_SCHEMA_MISMATCH -Language=Bulgarian -ERROR_DS_INSTALL_SCHEMA_MISMATCH - The version of the Active Directory schema of the source forest is not compatible with the version of Active Directory on this computer. -. - -MessageId=8468 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUP_LINK_ID -Language=Bulgarian -ERROR_DS_DUP_LINK_ID - Schema update failed: An attribute with the same link identifier already exists. -. - -MessageId=8469 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_ERROR_RESOLVING -Language=Bulgarian -ERROR_DS_NAME_ERROR_RESOLVING - Name translation: Generic processing error. -. - -MessageId=8470 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_ERROR_NOT_FOUND -Language=Bulgarian -ERROR_DS_NAME_ERROR_NOT_FOUND - Name translation: Could not find the name or insufficient right to see name. -. - -MessageId=8471 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_ERROR_NOT_UNIQUE -Language=Bulgarian -ERROR_DS_NAME_ERROR_NOT_UNIQUE - Name translation: Input name mapped to more than one output name. -. - -MessageId=8472 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_ERROR_NO_MAPPING -Language=Bulgarian -ERROR_DS_NAME_ERROR_NO_MAPPING - Name translation: Input name found, but not the associated output format. -. - -MessageId=8473 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_ERROR_DOMAIN_ONLY -Language=Bulgarian -ERROR_DS_NAME_ERROR_DOMAIN_ONLY - Name translation: Unable to resolve completely, only the domain was found. -. - -MessageId=8474 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING -Language=Bulgarian -ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING - Name translation: Unable to perform purely syntactical mapping at the client without going out to the wire. -. - -MessageId=8475 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CONSTRUCTED_ATT_MOD -Language=Bulgarian -ERROR_DS_CONSTRUCTED_ATT_MOD - Modification of a constructed attribute is not allowed. -. - -MessageId=8476 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_WRONG_OM_OBJ_CLASS -Language=Bulgarian -ERROR_DS_WRONG_OM_OBJ_CLASS - The OM-Object-Class specified is incorrect for an attribute with the specified syntax. -. - -MessageId=8477 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_REPL_PENDING -Language=Bulgarian -ERROR_DS_DRA_REPL_PENDING - The replication request has been posted; waiting for reply. -. - -MessageId=8478 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DS_REQUIRED -Language=Bulgarian -ERROR_DS_DS_REQUIRED - The requested operation requires a directory service, and none was available. -. - -MessageId=8479 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_LDAP_DISPLAY_NAME -Language=Bulgarian -ERROR_DS_INVALID_LDAP_DISPLAY_NAME - The LDAP display name of the class or attribute contains non-ASCII characters. -. - -MessageId=8480 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NON_BASE_SEARCH -Language=Bulgarian -ERROR_DS_NON_BASE_SEARCH - The requested search operation is only supported for base searches. -. - -MessageId=8481 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_RETRIEVE_ATTS -Language=Bulgarian -ERROR_DS_CANT_RETRIEVE_ATTS - The search failed to retrieve attributes from the database. -. - -MessageId=8482 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_BACKLINK_WITHOUT_LINK -Language=Bulgarian -ERROR_DS_BACKLINK_WITHOUT_LINK - The schema update operation tried to add a backward link attribute that has no corresponding forward link. -. - -MessageId=8483 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EPOCH_MISMATCH -Language=Bulgarian -ERROR_DS_EPOCH_MISMATCH - Source and destination of a cross domain move do not agree on the object's epoch number. Either source or destination does not have the latest version of the object. -. - -MessageId=8484 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SRC_NAME_MISMATCH -Language=Bulgarian -ERROR_DS_SRC_NAME_MISMATCH - Source and destination of a cross domain move do not agree on the object's current name. Either source or destination does not have the latest version of the object. -. - -MessageId=8485 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SRC_AND_DST_NC_IDENTICAL -Language=Bulgarian -ERROR_DS_SRC_AND_DST_NC_IDENTICAL - Source and destination of a cross domain move operation are identical. Caller should use local move operation instead of cross domain move operation. -. - -MessageId=8486 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DST_NC_MISMATCH -Language=Bulgarian -ERROR_DS_DST_NC_MISMATCH - Source and destination for a cross domain move are not in agreement on the naming contexts in the forest. Either source or destination does not have the latest version of the Partitions container. -. - -MessageId=8487 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC -Language=Bulgarian -ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC - Destination of a cross domain move is not authoritative for the destination naming context. -. - -MessageId=8488 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SRC_GUID_MISMATCH -Language=Bulgarian -ERROR_DS_SRC_GUID_MISMATCH - Source and destination of a cross domain move do not agree on the identity of the source object. Either source or destination does not have the latest version of the source object. -. - -MessageId=8489 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOVE_DELETED_OBJECT -Language=Bulgarian -ERROR_DS_CANT_MOVE_DELETED_OBJECT - Object being moved across domains is already known to be deleted by the destination server. The source server does not have the latest version of the source object. -. - -MessageId=8490 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_PDC_OPERATION_IN_PROGRESS -Language=Bulgarian -ERROR_DS_PDC_OPERATION_IN_PROGRESS - Another operation, which requires exclusive access to the PDC PSMO, is already in progress. -. - -MessageId=8491 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD -Language=Bulgarian -ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD - A cross domain move operation failed such that the two versions of the moved object exist - one each in the source and destination domains. The destination object needs to be removed to restore the system to a consistent state. -. - -MessageId=8492 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION -Language=Bulgarian -ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION - This object may not be moved across domain boundaries either because cross domain moves for this class are disallowed, or the object has some special characteristics, e.g.: trust account or restricted RID, which prevent its move. -. - -MessageId=8493 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS -Language=Bulgarian -ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS - Can't move objects with memberships across domain boundaries as once moved, this would violate the membership conditions of the account group. Remove the object from any account group memberships and retry. -. - -MessageId=8494 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NC_MUST_HAVE_NC_PARENT -Language=Bulgarian -ERROR_DS_NC_MUST_HAVE_NC_PARENT - A naming context head must be the immediate child of another naming context head, not of an interior node. -. - -MessageId=8495 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE -Language=Bulgarian -ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE - The directory cannot validate the proposed naming context name because it does not hold a replica of the naming context above the proposed naming context. Please ensure that the domain naming master role is held by a server that is configured as a global catalog server, and that the server is up to date with its replication partners. (Applies only to Windows 2000 Domain Naming masters) -. - -MessageId=8496 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DST_DOMAIN_NOT_NATIVE -Language=Bulgarian -ERROR_DS_DST_DOMAIN_NOT_NATIVE - Destination domain must be in native mode. -. - -MessageId=8497 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER -Language=Bulgarian -ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER - The operation cannot be performed because the server does not have an infrastructure container in the domain of interest. -. - -MessageId=8498 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOVE_ACCOUNT_GROUP -Language=Bulgarian -ERROR_DS_CANT_MOVE_ACCOUNT_GROUP - Cross-domain move of non-empty account groups is not allowed. -. - -MessageId=8499 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOVE_RESOURCE_GROUP -Language=Bulgarian -ERROR_DS_CANT_MOVE_RESOURCE_GROUP - Cross-domain move of non-empty resource groups is not allowed. -. - -MessageId=8500 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_SEARCH_FLAG -Language=Bulgarian -ERROR_DS_INVALID_SEARCH_FLAG - The search flags for the attribute are invalid. The ANR bit is valid only on attributes of Unicode or Teletex strings. -. - -MessageId=8501 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_TREE_DELETE_ABOVE_NC -Language=Bulgarian -ERROR_DS_NO_TREE_DELETE_ABOVE_NC - Tree deletions starting at an object which has an NC head as a descendant are not allowed. -. - -MessageId=8502 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE -Language=Bulgarian -ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE - The directory service failed to lock a tree in preparation for a tree deletion because the tree was in use. -. - -MessageId=8503 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE -Language=Bulgarian -ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE - The directory service failed to identify the list of objects to delete while attempting a tree deletion. -. - -MessageId=8504 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SAM_INIT_FAILURE -Language=Bulgarian -ERROR_DS_SAM_INIT_FAILURE - Security Accounts Manager initialization failed because of the following error: %1. -Error Status: 0x%2. Click OK to shut down the system and reboot into Directory Services Restore Mode. Check the event log for detailed information. -. - -MessageId=8505 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SENSITIVE_GROUP_VIOLATION -Language=Bulgarian -ERROR_DS_SENSITIVE_GROUP_VIOLATION - Only an administrator can modify the membership list of an administrative group. -. - -MessageId=8506 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOD_PRIMARYGROUPID -Language=Bulgarian -ERROR_DS_CANT_MOD_PRIMARYGROUPID - Cannot change the primary group ID of a domain controller account. -. - -MessageId=8507 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD -Language=Bulgarian -ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD - An attempt is made to modify the base schema. -. - -MessageId=8508 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NONSAFE_SCHEMA_CHANGE -Language=Bulgarian -ERROR_DS_NONSAFE_SCHEMA_CHANGE - Adding a new mandatory attribute to an existing class, deleting a mandatory attribute from an existing class, or adding an optional attribute to the special class Top that is not a backlink attribute (directly or through inheritance, for example, by adding or deleting an auxiliary class) is not allowed. -. - -MessageId=8509 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SCHEMA_UPDATE_DISALLOWED -Language=Bulgarian -ERROR_DS_SCHEMA_UPDATE_DISALLOWED - Schema update is not allowed on this DC because the DC is not the schema FSMO Role Owner. -. - -MessageId=8510 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_CREATE_UNDER_SCHEMA -Language=Bulgarian -ERROR_DS_CANT_CREATE_UNDER_SCHEMA - An object of this class cannot be created under the schema container. You can only create attribute-schema and class-schema objects under the schema container. -. - -MessageId=8511 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INSTALL_NO_SRC_SCH_VERSION -Language=Bulgarian -ERROR_DS_INSTALL_NO_SRC_SCH_VERSION - The replica/child install failed to get the objectVersion attribute on the schema container on the source DC. Either the attribute is missing on the schema container or the credentials supplied do not have permission to read it. -. - -MessageId=8512 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE -Language=Bulgarian -ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE - The replica/child install failed to read the objectVersion attribute in the SCHEMA section of the file schema.ini in the system32 directory. -. - -MessageId=8513 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_GROUP_TYPE -Language=Bulgarian -ERROR_DS_INVALID_GROUP_TYPE - The specified group type is invalid. -. - -MessageId=8514 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN -Language=Bulgarian -ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN - Cannot nest global groups in a mixed domain if the group is security-enabled. -. - -MessageId=8515 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN -Language=Bulgarian -ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN - Cannot nest local groups in a mixed domain if the group is security-enabled. -. - -MessageId=8516 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER -Language=Bulgarian -ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER - A global group cannot have a local group as a member. -. - -MessageId=8517 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER -Language=Bulgarian -ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER - A global group cannot have a universal group as a member. -. - -MessageId=8518 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER -Language=Bulgarian -ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER - A universal group cannot have a local group as a member. -. - -MessageId=8519 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER -Language=Bulgarian -ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER - A global group cannot have a cross-domain member. -. - -MessageId=8520 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER -Language=Bulgarian -ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER - A local group cannot have another cross-domain local group as a member. -. - -MessageId=8521 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_HAVE_PRIMARY_MEMBERS -Language=Bulgarian -ERROR_DS_HAVE_PRIMARY_MEMBERS - A group with primary members cannot change to a security-disabled group. -. - -MessageId=8522 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_STRING_SD_CONVERSION_FAILED -Language=Bulgarian -ERROR_DS_STRING_SD_CONVERSION_FAILED - The schema cache load failed to convert the string default SD on a class-schema object. -. - -MessageId=8523 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAMING_MASTER_GC -Language=Bulgarian -ERROR_DS_NAMING_MASTER_GC - Only DSAs configured to be Global Catalog servers should be allowed to hold the Domain Naming Master FSMO role. (Applies only to Windows 2000 servers) -. - -MessageId=8524 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LOOKUP_FAILURE -Language=Bulgarian -ERROR_DS_LOOKUP_FAILURE - The DSA operation is unable to proceed because of a DNS lookup failure. -. - -MessageId=8525 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_COULDNT_UPDATE_SPNS -Language=Bulgarian -ERROR_DS_COULDNT_UPDATE_SPNS - While processing a change to the DNS Host Name for an object, the Service Principal Name values could not be kept in sync. -. - -MessageId=8526 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_RETRIEVE_SD -Language=Bulgarian -ERROR_DS_CANT_RETRIEVE_SD - The Security Descriptor attribute could not be read. -. - -MessageId=8527 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_KEY_NOT_UNIQUE -Language=Bulgarian -ERROR_DS_KEY_NOT_UNIQUE - The object requested was not found, but an object with that key was found. -. - -MessageId=8528 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_WRONG_LINKED_ATT_SYNTAX -Language=Bulgarian -ERROR_DS_WRONG_LINKED_ATT_SYNTAX - The syntax of the linked attributed being added is incorrect. Forward links can only have syntax 2.5.5.1, 2.5.5.7, and 2.5.5.14, and backlinks can only have syntax 2.5.5.1. -. - -MessageId=8529 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD -Language=Bulgarian -ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD - Security Account Manager needs to get the boot password. -. - -MessageId=8530 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY -Language=Bulgarian -ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY - Security Account Manager needs to get the boot key from floppy disk. -. - -MessageId=8531 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_START -Language=Bulgarian -ERROR_DS_CANT_START - Directory Service cannot start. -. - -MessageId=8532 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INIT_FAILURE -Language=Bulgarian -ERROR_DS_INIT_FAILURE - Directory Services could not start. -. - -MessageId=8533 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION -Language=Bulgarian -ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION - The connection between client and server requires packet privacy or better. -. - -MessageId=8534 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SOURCE_DOMAIN_IN_FOREST -Language=Bulgarian -ERROR_DS_SOURCE_DOMAIN_IN_FOREST - The source domain may not be in the same forest as destination. -. - -MessageId=8535 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST -Language=Bulgarian -ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST - The destination domain must be in the forest. -. - -MessageId=8536 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED -Language=Bulgarian -ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED - The operation requires that destination domain auditing be enabled. -. - -MessageId=8537 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN -Language=Bulgarian -ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN - The operation couldn't locate a DC for the source domain. -. - -MessageId=8538 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER -Language=Bulgarian -ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER - The source object must be a group or user. -. - -MessageId=8539 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SRC_SID_EXISTS_IN_FOREST -Language=Bulgarian -ERROR_DS_SRC_SID_EXISTS_IN_FOREST - The source object's SID already exists in destination forest. -. - -MessageId=8540 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH -Language=Bulgarian -ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH - The source and destination object must be of the same type. -. - -MessageId=8541 -Severity=Success -Facility=System -SymbolicName=ERROR_SAM_INIT_FAILURE -Language=Bulgarian -ERROR_SAM_INIT_FAILURE - Security Accounts Manager initialization failed because of the following error: %1. -Error Status: 0x%2. Click OK to shut down the system and reboot into Safe Mode. Check the event log for detailed information. -. - -MessageId=8542 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SCHEMA_INFO_SHIP -Language=Bulgarian -ERROR_DS_DRA_SCHEMA_INFO_SHIP - Schema information could not be included in the replication request. -. - -MessageId=8543 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_SCHEMA_CONFLICT -Language=Bulgarian -ERROR_DS_DRA_SCHEMA_CONFLICT - The replication operation could not be completed due to a schema incompatibility. -. - -MessageId=8544 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT -Language=Bulgarian -ERROR_DS_DRA_EARLIER_SCHEMA_CONLICT - The replication operation could not be completed due to a previous schema incompatibility. -. - -MessageId=8545 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_OBJ_NC_MISMATCH -Language=Bulgarian -ERROR_DS_DRA_OBJ_NC_MISMATCH - The replication update could not be applied because either the source or the destination has not yet received information regarding a recent cross-domain move operation. -. - -MessageId=8546 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NC_STILL_HAS_DSAS -Language=Bulgarian -ERROR_DS_NC_STILL_HAS_DSAS - The requested domain could not be deleted because there exist domain controllers that still host this domain. -. - -MessageId=8547 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GC_REQUIRED -Language=Bulgarian -ERROR_DS_GC_REQUIRED - The requested operation can be performed only on a global catalog server. -. - -MessageId=8548 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY -Language=Bulgarian -ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY - A local group can only be a member of other local groups in the same domain. -. - -MessageId=8549 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS -Language=Bulgarian -ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS - Foreign security principals cannot be members of universal groups. -. - -MessageId=8550 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_ADD_TO_GC -Language=Bulgarian -ERROR_DS_CANT_ADD_TO_GC - The attribute is not allowed to be replicated to the GC because of security reasons. -. - -MessageId=8551 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_CHECKPOINT_WITH_PDC -Language=Bulgarian -ERROR_DS_NO_CHECKPOINT_WITH_PDC - The checkpoint with the PDC could not be taken because there are too many modifications being processed currently. -. - -MessageId=8552 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SOURCE_AUDITING_NOT_ENABLED -Language=Bulgarian -ERROR_DS_SOURCE_AUDITING_NOT_ENABLED - The operation requires that source domain auditing be enabled. -. - -MessageId=8553 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC -Language=Bulgarian -ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC - Security principal objects can only be created inside domain naming contexts. -. - -MessageId=8554 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_NAME_FOR_SPN -Language=Bulgarian -ERROR_DS_INVALID_NAME_FOR_SPN - A Service Principal Name (SPN) could not be constructed because the provided hostname is not in the necessary format. -. - -MessageId=8555 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS -Language=Bulgarian -ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS - A Filter was passed that uses constructed attributes. -. - -MessageId=8556 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_UNICODEPWD_NOT_IN_QUOTES -Language=Bulgarian -ERROR_DS_UNICODEPWD_NOT_IN_QUOTES - The unicodePwd attribute value must be enclosed in double quotes. -. - -MessageId=8557 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED -Language=Bulgarian -ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED - Your computer could not be joined to the domain. You have exceeded the maximum number of computer accounts you are allowed to create in this domain. Contact your system administrator to have this limit reset or increased. -. - -MessageId=8558 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MUST_BE_RUN_ON_DST_DC -Language=Bulgarian -ERROR_DS_MUST_BE_RUN_ON_DST_DC - For security reasons, the operation must be run on the destination DC. -. - -MessageId=8559 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER -Language=Bulgarian -ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER - For security reasons, the source DC must be NT4SP4 or greater. -. - -MessageId=8560 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ -Language=Bulgarian -ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ - Critical Directory Service System objects cannot be deleted during tree delete operations. The tree delete may have been partially performed. -. - -MessageId=8561 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INIT_FAILURE_CONSOLE -Language=Bulgarian -ERROR_DS_INIT_FAILURE_CONSOLE - Directory Services could not start because of the following error: %1. -Error Status: 0x%2. Please click OK to shutdown the system. You can use the recovery console to diagnose the system further. -. - -MessageId=8562 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SAM_INIT_FAILURE_CONSOLE -Language=Bulgarian -ERROR_DS_SAM_INIT_FAILURE_CONSOLE - Security Accounts Manager initialization failed because of the following error: %1. -Error Status: 0x%2. Please click OK to shutdown the system. You can use the recovery console to diagnose the system further. -. - -MessageId=8563 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_FOREST_VERSION_TOO_HIGH -Language=Bulgarian -ERROR_DS_FOREST_VERSION_TOO_HIGH - The version of the operating system installed is incompatible with the current forest functional level. You must upgrade to a new version of the operating system before this server can become a domain controller in this forest. -. - -MessageId=8564 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DOMAIN_VERSION_TOO_HIGH -Language=Bulgarian -ERROR_DS_DOMAIN_VERSION_TOO_HIGH - The version of the operating system installed is incompatible with the current domain functional level. You must upgrade to a new version of the operating system before this server can become a domain controller in this domain. -. - -MessageId=8565 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_FOREST_VERSION_TOO_LOW -Language=Bulgarian -ERROR_DS_FOREST_VERSION_TOO_LOW - This version of the operating system installed on this server no longer supports the current forest functional level. You must raise the forest functional level before this server can become a domain controller in this forest. -. - -MessageId=8566 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DOMAIN_VERSION_TOO_LOW -Language=Bulgarian -ERROR_DS_DOMAIN_VERSION_TOO_LOW - This version of the operating system installed on this server no longer supports the current domain functional level. You must raise the domain functional level before this server can become a domain controller in this domain. -. - -MessageId=8567 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INCOMPATIBLE_VERSION -Language=Bulgarian -ERROR_DS_INCOMPATIBLE_VERSION - The version of the operating system installed on this server is incompatible with the functional level of the domain or forest. -. - -MessageId=8568 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LOW_DSA_VERSION -Language=Bulgarian -ERROR_DS_LOW_DSA_VERSION - The functional level of the domain (or forest) cannot be raised to the requested value, because there exist one or more domain controllers in the domain (or forest) that are at a lower incompatible functional level. -. - -MessageId=8569 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN -Language=Bulgarian -ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN - The forest functional level cannot be raised to the requested level since one or more domains are still in mixed domain mode. All domains in the forest must be in native mode before you can raise the forest functional level. -. - -MessageId=8570 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOT_SUPPORTED_SORT_ORDER -Language=Bulgarian -ERROR_DS_NOT_SUPPORTED_SORT_ORDER - The sort order requested is not supported. -. - -MessageId=8571 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_NOT_UNIQUE -Language=Bulgarian -ERROR_DS_NAME_NOT_UNIQUE - The requested name already exists as a unique identifier. -. - -MessageId=8572 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 -Language=Bulgarian -ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 - The machine account was created pre-NT4. The account needs to be recreated. -. - -MessageId=8573 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_OUT_OF_VERSION_STORE -Language=Bulgarian -ERROR_DS_OUT_OF_VERSION_STORE - The database is out of version store. -. - -MessageId=8574 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INCOMPATIBLE_CONTROLS_USED -Language=Bulgarian -ERROR_DS_INCOMPATIBLE_CONTROLS_USED - Unable to continue operation because multiple conflicting controls were used. -. - -MessageId=8575 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_REF_DOMAIN -Language=Bulgarian -ERROR_DS_NO_REF_DOMAIN - Unable to find a valid security descriptor reference domain for this partition. -. - -MessageId=8576 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_RESERVED_LINK_ID -Language=Bulgarian -ERROR_DS_RESERVED_LINK_ID - Schema update failed: The link identifier is reserved. -. - -MessageId=8577 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LINK_ID_NOT_AVAILABLE -Language=Bulgarian -ERROR_DS_LINK_ID_NOT_AVAILABLE - Schema update failed: There are no link identifiers available. -. - -MessageId=8578 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER -Language=Bulgarian -ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER - An account group cannot have a universal group as a member. -. - -MessageId=8579 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE -Language=Bulgarian -ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE - Rename or move operations on naming context heads or read-only objects are not allowed. -. - -MessageId=8580 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC -Language=Bulgarian -ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC - Move operations on objects in the schema naming context are not allowed. -. - -MessageId=8581 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG -Language=Bulgarian -ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG - A system flag has been set on the object and does not allow the object to be moved or renamed. -. - -MessageId=8582 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_MODIFYDN_WRONG_GRANDPARENT -Language=Bulgarian -ERROR_DS_MODIFYDN_WRONG_GRANDPARENT - This object is not allowed to change its grandparent container. Moves are not forbidden on this object, but are restricted to sibling containers. -. - -MessageId=8583 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NAME_ERROR_TRUST_REFERRAL -Language=Bulgarian -ERROR_DS_NAME_ERROR_TRUST_REFERRAL - Unable to resolve completely, a referral to another forest is generated. -. - -MessageId=8584 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER -Language=Bulgarian -ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER - The requested action is not supported on standard server. -. - -MessageId=8585 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD -Language=Bulgarian -ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD - Could not access a partition of the Active Directory located on a remote server. Make sure at least one server is running for the partition in question. -. - -MessageId=8586 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 -Language=Bulgarian -ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 - The directory cannot validate the proposed naming context (or partition) name because it does not hold a replica nor can it contact a replica of the naming context above the proposed naming context. Please ensure that the parent naming context is properly registered in DNS, and at least one replica of this naming context is reachable by the Domain Naming master. -. - -MessageId=8587 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_THREAD_LIMIT_EXCEEDED -Language=Bulgarian -ERROR_DS_THREAD_LIMIT_EXCEEDED - The thread limit for this request was exceeded. -. - -MessageId=8588 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NOT_CLOSEST -Language=Bulgarian -ERROR_DS_NOT_CLOSEST - The Global catalog server is not in the closet site. -. - -MessageId=8589 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF -Language=Bulgarian -ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF - The DS cannot derive a service principal name (SPN) with which to mutually authenticate the target server because the corresponding server object in the local DS database has no serverReference attribute. -. - -MessageId=8590 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_SINGLE_USER_MODE_FAILED -Language=Bulgarian -ERROR_DS_SINGLE_USER_MODE_FAILED - The Directory Service failed to enter single user mode. -. - -MessageId=8591 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NTDSCRIPT_SYNTAX_ERROR -Language=Bulgarian -ERROR_DS_NTDSCRIPT_SYNTAX_ERROR - The Directory Service cannot parse the script because of a syntax error. -. - -MessageId=8592 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NTDSCRIPT_PROCESS_ERROR -Language=Bulgarian -ERROR_DS_NTDSCRIPT_PROCESS_ERROR - The Directory Service cannot process the script because of an error. -. - -MessageId=8593 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DIFFERENT_REPL_EPOCHS -Language=Bulgarian -ERROR_DS_DIFFERENT_REPL_EPOCHS - The directory service cannot perform the requested operation because the servers involved are of different replication epochs (which is usually related to a domain rename that is in progress). -. - -MessageId=8594 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRS_EXTENSIONS_CHANGED -Language=Bulgarian -ERROR_DS_DRS_EXTENSIONS_CHANGED - The directory service binding must be renegotiated due to a change in the server extensions information. -. - -MessageId=8595 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR -Language=Bulgarian -ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR - Operation not allowed on a disabled cross ref. -. - -MessageId=8596 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_NO_MSDS_INTID -Language=Bulgarian -ERROR_DS_NO_MSDS_INTID - Schema update failed: No values for msDS-IntId are available. -. - -MessageId=8597 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUP_MSDS_INTID -Language=Bulgarian -ERROR_DS_DUP_MSDS_INTID - Schema update failed: Duplicate msDS-IntId. Retry the operation. -. - -MessageId=8598 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EXISTS_IN_RDNATTID -Language=Bulgarian -ERROR_DS_EXISTS_IN_RDNATTID - Schema deletion failed: attribute is used in rDNAttID. -. - -MessageId=8599 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_AUTHORIZATION_FAILED -Language=Bulgarian -ERROR_DS_AUTHORIZATION_FAILED - The directory service failed to authorize the request. -. - -MessageId=8600 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INVALID_SCRIPT -Language=Bulgarian -ERROR_DS_INVALID_SCRIPT - The Directory Service cannot process the script because it is invalid. -. - -MessageId=8601 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_REMOTE_CROSSREF_OP_FAILED -Language=Bulgarian -ERROR_DS_REMOTE_CROSSREF_OP_FAILED - The remote create cross reference operation failed on the Domain Naming Master FSMO. The operation's error is in the extended data. -. - -MessageId=8602 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CROSS_REF_BUSY -Language=Bulgarian -ERROR_DS_CROSS_REF_BUSY - A cross reference is in use locally with the same name. -. - -MessageId=8603 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN -Language=Bulgarian -ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN - The DS cannot derive a service principal name (SPN) with which to mutually authenticate the target server because the server's domain has been deleted from the forest. -. - -MessageId=8604 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC -Language=Bulgarian -ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC - Writeable NCs prevent this DC from demoting. -. - -MessageId=8605 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DUPLICATE_ID_FOUND -Language=Bulgarian -ERROR_DS_DUPLICATE_ID_FOUND - The requested object has a non-unique identifier and cannot be retrieved. -. - -MessageId=8606 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT -Language=Bulgarian -ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT - Insufficient attributes were given to create an object. This object may not exist because it may have been deleted and already garbage collected. -. - -MessageId=8607 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_GROUP_CONVERSION_ERROR -Language=Bulgarian -ERROR_DS_GROUP_CONVERSION_ERROR - The group cannot be converted due to attribute restrictions on the requested group type. -. - -MessageId=8608 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOVE_APP_BASIC_GROUP -Language=Bulgarian -ERROR_DS_CANT_MOVE_APP_BASIC_GROUP - Cross-domain move of non-empty basic application groups is not allowed. -. - -MessageId=8609 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_CANT_MOVE_APP_QUERY_GROUP -Language=Bulgarian -ERROR_DS_CANT_MOVE_APP_QUERY_GROUP - Cross-domain move on non-empty query based application groups is not allowed. -. - -MessageId=8610 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_ROLE_NOT_VERIFIED -Language=Bulgarian -ERROR_DS_ROLE_NOT_VERIFIED - The role owner could not be verified because replication of its partition has not occurred recently. -. - -MessageId=8611 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL -Language=Bulgarian -ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL - The target container for a redirection of a well-known object container cannot already be a special container. -. - -MessageId=8612 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DOMAIN_RENAME_IN_PROGRESS -Language=Bulgarian -ERROR_DS_DOMAIN_RENAME_IN_PROGRESS - The Directory Service cannot perform the requested operation because a domain rename operation is in progress. -. - -MessageId=8613 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_EXISTING_AD_CHILD_NC -Language=Bulgarian -ERROR_DS_EXISTING_AD_CHILD_NC - The Active Directory detected an Active Directory child partition below the requested new partition name. The Active Directory's partition hierarchy must be created in a top-down method. -. - -MessageId=8614 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_REPL_LIFETIME_EXCEEDED -Language=Bulgarian -ERROR_DS_REPL_LIFETIME_EXCEEDED - The Active Directory cannot replicate with this server because the time since the last replication with this server has exceeded the tombstone lifetime. -. - -MessageId=8615 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER -Language=Bulgarian -ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER - The requested operation is not allowed on an object under the system container. -. - -MessageId=8616 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_LDAP_SEND_QUEUE_FULL -Language=Bulgarian -ERROR_DS_LDAP_SEND_QUEUE_FULL - The LDAP servers network send queue has filled up because the client is not processing the results of it's requests fast enough. No more requests will be processed until the client catches up. If the client does not catch up then it will be disconnected. -. - -MessageId=8617 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_DRA_OUT_SCHEDULE_WINDOW -Language=Bulgarian -ERROR_DS_DRA_OUT_SCHEDULE_WINDOW - The scheduled replication did not take place because the system was too busy to execute the request within the schedule window. The replication queue is overloaded. Consider reducing the number of partners or decreasing the scheduled replication frequency. -. - -MessageId=9001 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_FORMAT_ERROR -Language=Bulgarian -DNS_ERROR_RCODE_FORMAT_ERROR - DNS server unable to interpret format. -. - -MessageId=9002 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_SERVER_FAILURE -Language=Bulgarian -DNS_ERROR_RCODE_SERVER_FAILURE - DNS server failure. -. - -MessageId=9003 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_NAME_ERROR -Language=Bulgarian -DNS_ERROR_RCODE_NAME_ERROR - DNS name does not exist. -. - -MessageId=9004 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_NOT_IMPLEMENTED -Language=Bulgarian -DNS_ERROR_RCODE_NOT_IMPLEMENTED - DNS request not supported by name server. -. - -MessageId=9005 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_REFUSED -Language=Bulgarian -DNS_ERROR_RCODE_REFUSED - DNS operation refused. -. - -MessageId=9006 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_YXDOMAIN -Language=Bulgarian -DNS_ERROR_RCODE_YXDOMAIN - DNS name that ought not exist, does exist. -. - -MessageId=9007 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_YXRRSET -Language=Bulgarian -DNS_ERROR_RCODE_YXRRSET - DNS RR set that ought not exist, does exist. -. - -MessageId=9008 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_NXRRSET -Language=Bulgarian -DNS_ERROR_RCODE_NXRRSET - DNS RR set that ought to exist, does not exist. -. - -MessageId=9009 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_NOTAUTH -Language=Bulgarian -DNS_ERROR_RCODE_NOTAUTH - DNS server not authoritative for zone. -. - -MessageId=9010 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_NOTZONE -Language=Bulgarian -DNS_ERROR_RCODE_NOTZONE - DNS name in update or prereq is not in zone. -. - -MessageId=9016 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_BADSIG -Language=Bulgarian -DNS_ERROR_RCODE_BADSIG - DNS signature failed to verify. -. - -MessageId=9017 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_BADKEY -Language=Bulgarian -DNS_ERROR_RCODE_BADKEY - DNS bad key. -. - -MessageId=9018 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE_BADTIME -Language=Bulgarian -DNS_ERROR_RCODE_BADTIME - DNS signature validity expired. -. - -MessageId=9501 -Severity=Success -Facility=System -SymbolicName=DNS_INFO_NO_RECORDS -Language=Bulgarian -DNS_INFO_NO_RECORDS - No records found for given DNS query. -. - -MessageId=9502 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_BAD_PACKET -Language=Bulgarian -DNS_ERROR_BAD_PACKET - Bad DNS packet. -. - -MessageId=9503 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NO_PACKET -Language=Bulgarian -DNS_ERROR_NO_PACKET - No DNS packet. -. - -MessageId=9504 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RCODE -Language=Bulgarian -DNS_ERROR_RCODE - DNS error, check rcode. -. - -MessageId=9505 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_UNSECURE_PACKET -Language=Bulgarian -DNS_ERROR_UNSECURE_PACKET - Unsecured DNS packet. -. - -MessageId=9551 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INVALID_TYPE -Language=Bulgarian -DNS_ERROR_INVALID_TYPE - Invalid DNS type. -. - -MessageId=9552 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INVALID_IP_ADDRESS -Language=Bulgarian -DNS_ERROR_INVALID_IP_ADDRESS - Invalid IP address. -. - -MessageId=9553 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INVALID_PROPERTY -Language=Bulgarian -DNS_ERROR_INVALID_PROPERTY - Invalid property. -. - -MessageId=9554 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_TRY_AGAIN_LATER -Language=Bulgarian -DNS_ERROR_TRY_AGAIN_LATER - Try DNS operation again later. -. - -MessageId=9555 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NOT_UNIQUE -Language=Bulgarian -DNS_ERROR_NOT_UNIQUE - Record for given name and type is not unique. -. - -MessageId=9556 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NON_RFC_NAME -Language=Bulgarian -DNS_ERROR_NON_RFC_NAME - DNS name does not comply with RFC specifications. -. - -MessageId=9557 -Severity=Success -Facility=System -SymbolicName=DNS_STATUS_FQDN -Language=Bulgarian -DNS_STATUS_FQDN - DNS name is a fully-qualified DNS name. -. - -MessageId=9558 -Severity=Success -Facility=System -SymbolicName=DNS_STATUS_DOTTED_NAME -Language=Bulgarian -DNS_STATUS_DOTTED_NAME - DNS name is dotted (multi-label). -. - -MessageId=9559 -Severity=Success -Facility=System -SymbolicName=DNS_STATUS_SINGLE_PART_NAME -Language=Bulgarian -DNS_STATUS_SINGLE_PART_NAME - DNS name is a single-part name. -. - -MessageId=9560 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INVALID_NAME_CHAR -Language=Bulgarian -DNS_ERROR_INVALID_NAME_CHAR - DSN name contains an invalid character. -. - -MessageId=9561 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NUMERIC_NAME -Language=Bulgarian -DNS_ERROR_NUMERIC_NAME - DNS name is entirely numeric. -. - -MessageId=9562 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER -Language=Bulgarian -DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER - The operation requested is not permitted on a DNS root server. -. - -MessageId=9563 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION -Language=Bulgarian -DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION - The record could not be created because this part of the DNS namespace has been delegated to another server. -. - -MessageId=9564 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_CANNOT_FIND_ROOT_HINTS -Language=Bulgarian -DNS_ERROR_CANNOT_FIND_ROOT_HINTS - The DNS server could not find a set of root hints. -. - -MessageId=9565 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INCONSISTENT_ROOT_HINTS -Language=Bulgarian -DNS_ERROR_INCONSISTENT_ROOT_HINTS - The DNS server found root hints but they were not consistent across all adapters. -. - -MessageId=9601 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_DOES_NOT_EXIST -Language=Bulgarian -DNS_ERROR_ZONE_DOES_NOT_EXIST - DNS zone does not exist. -. - -MessageId=9602 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NO_ZONE_INFO -Language=Bulgarian -DNS_ERROR_NO_ZONE_INFO - DNS zone information not available. -. - -MessageId=9603 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INVALID_ZONE_OPERATION -Language=Bulgarian -DNS_ERROR_INVALID_ZONE_OPERATION - Invalid operation for DNS zone. -. - -MessageId=9604 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_CONFIGURATION_ERROR -Language=Bulgarian -DNS_ERROR_ZONE_CONFIGURATION_ERROR - Invalid DNS zone configuration. -. - -MessageId=9605 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_HAS_NO_SOA_RECORD -Language=Bulgarian -DNS_ERROR_ZONE_HAS_NO_SOA_RECORD - DNS zone has no start of authority (SOA) record. -. - -MessageId=9606 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_HAS_NO_NS_RECORDS -Language=Bulgarian -DNS_ERROR_ZONE_HAS_NO_NS_RECORDS - DNS zone has no name server (NS) record. -. - -MessageId=9607 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_LOCKED -Language=Bulgarian -DNS_ERROR_ZONE_LOCKED - DNS zone is locked. -. - -MessageId=9608 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_CREATION_FAILED -Language=Bulgarian -DNS_ERROR_ZONE_CREATION_FAILED - DNS zone creation failed. -. - -MessageId=9609 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_ALREADY_EXISTS -Language=Bulgarian -DNS_ERROR_ZONE_ALREADY_EXISTS - DNS zone already exists. -. - -MessageId=9610 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_AUTOZONE_ALREADY_EXISTS -Language=Bulgarian -DNS_ERROR_AUTOZONE_ALREADY_EXISTS - DNS automatic zone already exists. -. - -MessageId=9611 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INVALID_ZONE_TYPE -Language=Bulgarian -DNS_ERROR_INVALID_ZONE_TYPE - Invalid DNS zone type. -. - -MessageId=9612 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP -Language=Bulgarian -DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP - Secondary DNS zone requires master IP address. -. - -MessageId=9613 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_NOT_SECONDARY -Language=Bulgarian -DNS_ERROR_ZONE_NOT_SECONDARY - DNS zone not secondary. -. - -MessageId=9614 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NEED_SECONDARY_ADDRESSES -Language=Bulgarian -DNS_ERROR_NEED_SECONDARY_ADDRESSES - Need secondary IP address. -. - -MessageId=9615 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_WINS_INIT_FAILED -Language=Bulgarian -DNS_ERROR_WINS_INIT_FAILED - WINS initialization failed. -. - -MessageId=9616 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NEED_WINS_SERVERS -Language=Bulgarian -DNS_ERROR_NEED_WINS_SERVERS - Need WINS servers. -. - -MessageId=9617 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NBSTAT_INIT_FAILED -Language=Bulgarian -DNS_ERROR_NBSTAT_INIT_FAILED - NBTSTAT initialization call failed. -. - -MessageId=9618 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_SOA_DELETE_INVALID -Language=Bulgarian -DNS_ERROR_SOA_DELETE_INVALID - Invalid delete of start of authority (SOA) -. - -MessageId=9619 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_FORWARDER_ALREADY_EXISTS -Language=Bulgarian -DNS_ERROR_FORWARDER_ALREADY_EXISTS - A conditional forwarding zone already exists for that name. -. - -MessageId=9620 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_REQUIRES_MASTER_IP -Language=Bulgarian -DNS_ERROR_ZONE_REQUIRES_MASTER_IP - This zone must be configured with one or more master DNS server IP addresses. -. - -MessageId=9621 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_ZONE_IS_SHUTDOWN -Language=Bulgarian -DNS_ERROR_ZONE_IS_SHUTDOWN - The operation cannot be performed because this zone is shutdown. -. - -MessageId=9651 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_PRIMARY_REQUIRES_DATAFILE -Language=Bulgarian -DNS_ERROR_PRIMARY_REQUIRES_DATAFILE - Primary DNS zone requires datafile. -. - -MessageId=9652 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_INVALID_DATAFILE_NAME -Language=Bulgarian -DNS_ERROR_INVALID_DATAFILE_NAME - Invalid datafile name for DNS zone. -. - -MessageId=9653 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DATAFILE_OPEN_FAILURE -Language=Bulgarian -DNS_ERROR_DATAFILE_OPEN_FAILURE - Failed to open datafile for DNS zone. -. - -MessageId=9654 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_FILE_WRITEBACK_FAILED -Language=Bulgarian -DNS_ERROR_FILE_WRITEBACK_FAILED - Failed to write datafile for DNS zone. -. - -MessageId=9655 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DATAFILE_PARSING -Language=Bulgarian -DNS_ERROR_DATAFILE_PARSING - Failure while reading datafile for DNS zone. -. - -MessageId=9701 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RECORD_DOES_NOT_EXIST -Language=Bulgarian -DNS_ERROR_RECORD_DOES_NOT_EXIST - DNS record does not exist. -. - -MessageId=9702 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RECORD_FORMAT -Language=Bulgarian -DNS_ERROR_RECORD_FORMAT - DNS record format error. -. - -MessageId=9703 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NODE_CREATION_FAILED -Language=Bulgarian -DNS_ERROR_NODE_CREATION_FAILED - Node creation failure in DNS. -. - -MessageId=9704 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_UNKNOWN_RECORD_TYPE -Language=Bulgarian -DNS_ERROR_UNKNOWN_RECORD_TYPE - Unknown DNS record type. -. - -MessageId=9705 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RECORD_TIMED_OUT -Language=Bulgarian -DNS_ERROR_RECORD_TIMED_OUT - DNS record timed out. -. - -MessageId=9706 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NAME_NOT_IN_ZONE -Language=Bulgarian -DNS_ERROR_NAME_NOT_IN_ZONE - Name not in DNS zone. -. - -MessageId=9707 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_CNAME_LOOP -Language=Bulgarian -DNS_ERROR_CNAME_LOOP - CNAME loop detected. -. - -MessageId=9708 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NODE_IS_CNAME -Language=Bulgarian -DNS_ERROR_NODE_IS_CNAME - Node is a CNAME DNS record. -. - -MessageId=9709 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_CNAME_COLLISION -Language=Bulgarian -DNS_ERROR_CNAME_COLLISION - A CNAME record already exists for given name. -. - -MessageId=9710 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT -Language=Bulgarian -DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT - Record only at DNS zone root. -. - -MessageId=9711 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_RECORD_ALREADY_EXISTS -Language=Bulgarian -DNS_ERROR_RECORD_ALREADY_EXISTS - DNS record already exists. -. - -MessageId=9712 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_SECONDARY_DATA -Language=Bulgarian -DNS_ERROR_SECONDARY_DATA - Secondary DNS zone data error. -. - -MessageId=9713 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NO_CREATE_CACHE_DATA -Language=Bulgarian -DNS_ERROR_NO_CREATE_CACHE_DATA - Could not create DNS cache data. -. - -MessageId=9714 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NAME_DOES_NOT_EXIST -Language=Bulgarian -DNS_ERROR_NAME_DOES_NOT_EXIST - DNS name does not exist. -. - -MessageId=9715 -Severity=Success -Facility=System -SymbolicName=DNS_WARNING_PTR_CREATE_FAILED -Language=Bulgarian -DNS_WARNING_PTR_CREATE_FAILED - Could not create pointer (PTR) record. -. - -MessageId=9716 -Severity=Success -Facility=System -SymbolicName=DNS_WARNING_DOMAIN_UNDELETED -Language=Bulgarian -DNS_WARNING_DOMAIN_UNDELETED - DNS domain was undeleted. -. - -MessageId=9717 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DS_UNAVAILABLE -Language=Bulgarian -DNS_ERROR_DS_UNAVAILABLE - The directory service is unavailable. -. - -MessageId=9718 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DS_ZONE_ALREADY_EXISTS -Language=Bulgarian -DNS_ERROR_DS_ZONE_ALREADY_EXISTS - DNS zone already exists in the directory service. -. - -MessageId=9719 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE -Language=Bulgarian -DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE - DNS server not creating or reading the boot file for the directory service integrated DNS zone. -. - -MessageId=9751 -Severity=Success -Facility=System -SymbolicName=DNS_INFO_AXFR_COMPLETE -Language=Bulgarian -DNS_INFO_AXFR_COMPLETE - DNS AXFR (zone transfer) complete. -. - -MessageId=9752 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_AXFR -Language=Bulgarian -DNS_ERROR_AXFR - DNS zone transfer failed. -. - -MessageId=9753 -Severity=Success -Facility=System -SymbolicName=DNS_INFO_ADDED_LOCAL_WINS -Language=Bulgarian -DNS_INFO_ADDED_LOCAL_WINS - Added local WINS server. -. - -MessageId=9801 -Severity=Success -Facility=System -SymbolicName=DNS_STATUS_CONTINUE_NEEDED -Language=Bulgarian -DNS_STATUS_CONTINUE_NEEDED - Secure update call needs to continue update request. -. - -MessageId=9851 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NO_TCPIP -Language=Bulgarian -DNS_ERROR_NO_TCPIP - TCP/IP network protocol not installed. -. - -MessageId=9852 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_NO_DNS_SERVERS -Language=Bulgarian -DNS_ERROR_NO_DNS_SERVERS - No DNS servers configured for local system. -. - -MessageId=9901 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DP_DOES_NOT_EXIST -Language=Bulgarian -DNS_ERROR_DP_DOES_NOT_EXIST - The specified directory partition does not exist. -. - -MessageId=9902 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DP_ALREADY_EXISTS -Language=Bulgarian -DNS_ERROR_DP_ALREADY_EXISTS - The specified directory partition already exists. -. - -MessageId=9903 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DP_NOT_ENLISTED -Language=Bulgarian -DNS_ERROR_DP_NOT_ENLISTED - The DNS server is not enlisted in the specified directory partition. -. - -MessageId=9904 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DP_ALREADY_ENLISTED -Language=Bulgarian -DNS_ERROR_DP_ALREADY_ENLISTED - The DNS server is already enlisted in the specified directory partition. -. - -MessageId=9905 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DP_NOT_AVAILABLE -Language=Bulgarian -DNS_ERROR_DP_NOT_AVAILABLE - The directory partition is not available at this time. Please wait a few minutes and try again. -. - -MessageId=9906 -Severity=Success -Facility=System -SymbolicName=DNS_ERROR_DP_FSMO_ERROR -Language=Bulgarian -DNS_ERROR_DP_FSMO_ERROR - The application directory partition operation failed. The domain controller holding the domain naming master role is down or unable to service the request or is not running Windows Server 2003. -. - -MessageId=10004 -Severity=Success -Facility=System -SymbolicName=WSAEINTR -Language=Bulgarian -WSAEINTR - A blocking operation was interrupted by a call to WSACancelBlockingCall. -. - -MessageId=10009 -Severity=Success -Facility=System -SymbolicName=WSAEBADF -Language=Bulgarian -WSAEBADF - The file handle supplied is not valid. -. - -MessageId=10013 -Severity=Success -Facility=System -SymbolicName=WSAEACCES -Language=Bulgarian -WSAEACCES - An attempt was made to access a socket in a way forbidden by its access permissions. -. - -MessageId=10014 -Severity=Success -Facility=System -SymbolicName=WSAEFAULT -Language=Bulgarian -WSAEFAULT - The system detected an invalid pointer address in attempting to use a pointer argument in a call. -. - -MessageId=10022 -Severity=Success -Facility=System -SymbolicName=WSAEINVAL -Language=Bulgarian -WSAEINVAL - An invalid argument was supplied. -. - -MessageId=10024 -Severity=Success -Facility=System -SymbolicName=WSAEMFILE -Language=Bulgarian -WSAEMFILE - Too many open sockets. -. - -MessageId=10035 -Severity=Success -Facility=System -SymbolicName=WSAEWOULDBLOCK -Language=Bulgarian -WSAEWOULDBLOCK - A non-blocking socket operation could not be completed immediately. -. - -MessageId=10036 -Severity=Success -Facility=System -SymbolicName=WSAEINPROGRESS -Language=Bulgarian -WSAEINPROGRESS - A blocking operation is currently executing. -. - -MessageId=10037 -Severity=Success -Facility=System -SymbolicName=WSAEALREADY -Language=Bulgarian -WSAEALREADY - An operation was attempted on a non-blocking socket that already had an operation in progress. -. - -MessageId=10038 -Severity=Success -Facility=System -SymbolicName=WSAENOTSOCK -Language=Bulgarian -WSAENOTSOCK - An operation was attempted on something that is not a socket. -. - -MessageId=10039 -Severity=Success -Facility=System -SymbolicName=WSAEDESTADDRREQ -Language=Bulgarian -WSAEDESTADDRREQ - A required address was omitted from an operation on a socket. -. - -MessageId=10040 -Severity=Success -Facility=System -SymbolicName=WSAEMSGSIZE -Language=Bulgarian -WSAEMSGSIZE - A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. -. - -MessageId=10041 -Severity=Success -Facility=System -SymbolicName=WSAEPROTOTYPE -Language=Bulgarian -WSAEPROTOTYPE - A protocol was specified in the socket function call that does not support the semantics of the socket type requested. -. - -MessageId=10042 -Severity=Success -Facility=System -SymbolicName=WSAENOPROTOOPT -Language=Bulgarian -WSAENOPROTOOPT - An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call. -. - -MessageId=10043 -Severity=Success -Facility=System -SymbolicName=WSAEPROTONOSUPPORT -Language=Bulgarian -WSAEPROTONOSUPPORT - The requested protocol has not been configured into the system, or no implementation for it exists. -. - -MessageId=10044 -Severity=Success -Facility=System -SymbolicName=WSAESOCKTNOSUPPORT -Language=Bulgarian -WSAESOCKTNOSUPPORT - The support for the specified socket type does not exist in this address family. -. - -MessageId=10045 -Severity=Success -Facility=System -SymbolicName=WSAEOPNOTSUPP -Language=Bulgarian -WSAEOPNOTSUPP - The attempted operation is not supported for the type of object referenced. -. - -MessageId=10046 -Severity=Success -Facility=System -SymbolicName=WSAEPFNOSUPPORT -Language=Bulgarian -WSAEPFNOSUPPORT - The protocol family has not been configured into the system or no implementation for it exists. -. - -MessageId=10047 -Severity=Success -Facility=System -SymbolicName=WSAEAFNOSUPPORT -Language=Bulgarian -WSAEAFNOSUPPORT - An address incompatible with the requested protocol was used. -. - -MessageId=10048 -Severity=Success -Facility=System -SymbolicName=WSAEADDRINUSE -Language=Bulgarian -WSAEADDRINUSE - Only one usage of each socket address (protocol/network address/port) is normally permitted. -. - -MessageId=10049 -Severity=Success -Facility=System -SymbolicName=WSAEADDRNOTAVAIL -Language=Bulgarian -WSAEADDRNOTAVAIL - The requested address is not valid in its context. -. - -MessageId=10050 -Severity=Success -Facility=System -SymbolicName=WSAENETDOWN -Language=Bulgarian -WSAENETDOWN - A socket operation encountered a dead network. -. - -MessageId=10051 -Severity=Success -Facility=System -SymbolicName=WSAENETUNREACH -Language=Bulgarian -WSAENETUNREACH - A socket operation was attempted to an unreachable network. -. - -MessageId=10052 -Severity=Success -Facility=System -SymbolicName=WSAENETRESET -Language=Bulgarian -WSAENETRESET - The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress. -. - -MessageId=10053 -Severity=Success -Facility=System -SymbolicName=WSAECONNABORTED -Language=Bulgarian -WSAECONNABORTED - An established connection was aborted by the software in your host machine. -. - -MessageId=10054 -Severity=Success -Facility=System -SymbolicName=WSAECONNRESET -Language=Bulgarian -WSAECONNRESET - An existing connection was forcibly closed by the remote host. -. - -MessageId=10055 -Severity=Success -Facility=System -SymbolicName=WSAENOBUFS -Language=Bulgarian -WSAENOBUFS - An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full. -. - -MessageId=10056 -Severity=Success -Facility=System -SymbolicName=WSAEISCONN -Language=Bulgarian -WSAEISCONN - A connect request was made on an already connected socket. -. - -MessageId=10057 -Severity=Success -Facility=System -SymbolicName=WSAENOTCONN -Language=Bulgarian -WSAENOTCONN - A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. -. - -MessageId=10058 -Severity=Success -Facility=System -SymbolicName=WSAESHUTDOWN -Language=Bulgarian -WSAESHUTDOWN - A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call. -. - -MessageId=10059 -Severity=Success -Facility=System -SymbolicName=WSAETOOMANYREFS -Language=Bulgarian -WSAETOOMANYREFS - Too many references to some kernel object. -. - -MessageId=10060 -Severity=Success -Facility=System -SymbolicName=WSAETIMEDOUT -Language=Bulgarian -WSAETIMEDOUT - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. -. - -MessageId=10061 -Severity=Success -Facility=System -SymbolicName=WSAECONNREFUSED -Language=Bulgarian -WSAECONNREFUSED - No connection could be made because the target machine actively refused it. -. - -MessageId=10062 -Severity=Success -Facility=System -SymbolicName=WSAELOOP -Language=Bulgarian -WSAELOOP - Cannot translate name. -. - -MessageId=10063 -Severity=Success -Facility=System -SymbolicName=WSAENAMETOOLONG -Language=Bulgarian -WSAENAMETOOLONG - Name component or name was too long. -. - -MessageId=10064 -Severity=Success -Facility=System -SymbolicName=WSAEHOSTDOWN -Language=Bulgarian -WSAEHOSTDOWN - A socket operation failed because the destination host was down. -. - -MessageId=10065 -Severity=Success -Facility=System -SymbolicName=WSAEHOSTUNREACH -Language=Bulgarian -WSAEHOSTUNREACH - A socket operation was attempted to an unreachable host. -. - -MessageId=10066 -Severity=Success -Facility=System -SymbolicName=WSAENOTEMPTY -Language=Bulgarian -WSAENOTEMPTY - Cannot remove a directory that is not empty. -. - -MessageId=10067 -Severity=Success -Facility=System -SymbolicName=WSAEPROCLIM -Language=Bulgarian -WSAEPROCLIM - A Windows Sockets implementation may have a limit on the number of applications that may use it simultaneously. -. - -MessageId=10068 -Severity=Success -Facility=System -SymbolicName=WSAEUSERS -Language=Bulgarian -WSAEUSERS - Ran out of quota. -. - -MessageId=10069 -Severity=Success -Facility=System -SymbolicName=WSAEDQUOT -Language=Bulgarian -WSAEDQUOT - Ran out of disk quota. -. - -MessageId=10070 -Severity=Success -Facility=System -SymbolicName=WSAESTALE -Language=Bulgarian -WSAESTALE - File handle reference is no longer available. -. - -MessageId=10071 -Severity=Success -Facility=System -SymbolicName=WSAEREMOTE -Language=Bulgarian -WSAEREMOTE - Item is not available locally. -. - -MessageId=10091 -Severity=Success -Facility=System -SymbolicName=WSASYSNOTREADY -Language=Bulgarian -WSASYSNOTREADY - WSAStartup cannot function at this time because the underlying system it uses to provide network services is currently unavailable. -. - -MessageId=10092 -Severity=Success -Facility=System -SymbolicName=WSAVERNOTSUPPORTED -Language=Bulgarian -WSAVERNOTSUPPORTED - The Windows Sockets version requested is not supported. -. - -MessageId=10093 -Severity=Success -Facility=System -SymbolicName=WSANOTINITIALISED -Language=Bulgarian -WSANOTINITIALISED - Either the application has not called WSAStartup, or WSAStartup failed. -. - -MessageId=10101 -Severity=Success -Facility=System -SymbolicName=WSAEDISCON -Language=Bulgarian -WSAEDISCON - Returned by WSARecv or WSARecvFrom to indicate the remote party has initiated a graceful shutdown sequence. -. - -MessageId=10102 -Severity=Success -Facility=System -SymbolicName=WSAENOMORE -Language=Bulgarian -WSAENOMORE - No more results can be returned by WSALookupServiceNext. -. - -MessageId=10103 -Severity=Success -Facility=System -SymbolicName=WSAECANCELLED -Language=Bulgarian -WSAECANCELLED - A call to WSALookupServiceEnd was made while this call was still processing. The call has been canceled. -. - -MessageId=10104 -Severity=Success -Facility=System -SymbolicName=WSAEINVALIDPROCTABLE -Language=Bulgarian -WSAEINVALIDPROCTABLE - The procedure call table is invalid. -. - -MessageId=10105 -Severity=Success -Facility=System -SymbolicName=WSAEINVALIDPROVIDER -Language=Bulgarian -WSAEINVALIDPROVIDER - The requested service provider is invalid. -. - -MessageId=10106 -Severity=Success -Facility=System -SymbolicName=WSAEPROVIDERFAILEDINIT -Language=Bulgarian -WSAEPROVIDERFAILEDINIT - The requested service provider could not be loaded or initialized. -. - -MessageId=10107 -Severity=Success -Facility=System -SymbolicName=WSASYSCALLFAILURE -Language=Bulgarian -WSASYSCALLFAILURE - A system call that should never fail has failed. -. - -MessageId=10108 -Severity=Success -Facility=System -SymbolicName=WSASERVICE_NOT_FOUND -Language=Bulgarian -WSASERVICE_NOT_FOUND - No such service is known. The service cannot be found in the specified name space. -. - -MessageId=10109 -Severity=Success -Facility=System -SymbolicName=WSATYPE_NOT_FOUND -Language=Bulgarian -WSATYPE_NOT_FOUND - The specified class was not found. -. - -MessageId=10110 -Severity=Success -Facility=System -SymbolicName=WSA_E_NO_MORE -Language=Bulgarian -WSA_E_NO_MORE - No more results can be returned by WSALookupServiceNext. -. - -MessageId=10111 -Severity=Success -Facility=System -SymbolicName=WSA_E_CANCELLED -Language=Bulgarian -WSA_E_CANCELLED - A call to WSALookupServiceEnd was made while this call was still processing. The call has been canceled. -. - -MessageId=10112 -Severity=Success -Facility=System -SymbolicName=WSAEREFUSED -Language=Bulgarian -WSAEREFUSED - A database query failed because it was actively refused. -. - -MessageId=11001 -Severity=Success -Facility=System -SymbolicName=WSAHOST_NOT_FOUND -Language=Bulgarian -WSAHOST_NOT_FOUND - No such host is known. -. - -MessageId=11002 -Severity=Success -Facility=System -SymbolicName=WSATRY_AGAIN -Language=Bulgarian -WSATRY_AGAIN - This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server. -. - -MessageId=11003 -Severity=Success -Facility=System -SymbolicName=WSANO_RECOVERY -Language=Bulgarian -WSANO_RECOVERY - A non-recoverable error occurred during a database lookup. -. - -MessageId=11004 -Severity=Success -Facility=System -SymbolicName=WSANO_DATA -Language=Bulgarian -WSANO_DATA - The requested name is valid, but no data of the requested type was found. -. - -MessageId=11005 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_RECEIVERS -Language=Bulgarian -WSA_QOS_RECEIVERS - At least one reserve has arrived. -. - -MessageId=11006 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_SENDERS -Language=Bulgarian -WSA_QOS_SENDERS - At least one path has arrived. -. - -MessageId=11007 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_NO_SENDERS -Language=Bulgarian -WSA_QOS_NO_SENDERS - There are no senders. -. - -MessageId=11008 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_NO_RECEIVERS -Language=Bulgarian -WSA_QOS_NO_RECEIVERS - There are no receivers. -. - -MessageId=11009 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_REQUEST_CONFIRMED -Language=Bulgarian -WSA_QOS_REQUEST_CONFIRMED - Reserve has been confirmed. -. - -MessageId=11010 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_ADMISSION_FAILURE -Language=Bulgarian -WSA_QOS_ADMISSION_FAILURE - Error due to lack of resources. -. - -MessageId=11011 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_POLICY_FAILURE -Language=Bulgarian -WSA_QOS_POLICY_FAILURE - Rejected for administrative reasons - bad credentials. -. - -MessageId=11012 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_BAD_STYLE -Language=Bulgarian -WSA_QOS_BAD_STYLE - Unknown or conflicting style. -. - -MessageId=11013 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_BAD_OBJECT -Language=Bulgarian -WSA_QOS_BAD_OBJECT - Problem with some part of the filterspec or providerspecific buffer in general. -. - -MessageId=11014 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_TRAFFIC_CTRL_ERROR -Language=Bulgarian -WSA_QOS_TRAFFIC_CTRL_ERROR - Problem with some part of the flowspec. -. - -MessageId=11015 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_GENERIC_ERROR -Language=Bulgarian -WSA_QOS_GENERIC_ERROR - General QOS error. -. - -MessageId=11016 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_ESERVICETYPE -Language=Bulgarian -WSA_QOS_ESERVICETYPE - An invalid or unrecognized service type was found in the flowspec. -. - -MessageId=11017 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EFLOWSPEC -Language=Bulgarian -WSA_QOS_EFLOWSPEC - An invalid or inconsistent flowspec was found in the QOS structure. -. - -MessageId=11018 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EPROVSPECBUF -Language=Bulgarian -WSA_QOS_EPROVSPECBUF - Invalid QOS provider-specific buffer. -. - -MessageId=11019 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EFILTERSTYLE -Language=Bulgarian -WSA_QOS_EFILTERSTYLE - An invalid QOS filter style was used. -. - -MessageId=11020 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EFILTERTYPE -Language=Bulgarian -WSA_QOS_EFILTERTYPE - An invalid QOS filter type was used. -. - -MessageId=11021 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EFILTERCOUNT -Language=Bulgarian -WSA_QOS_EFILTERCOUNT - An incorrect number of QOS FILTERSPECs were specified in the FLOWDESCRIPTOR. -. - -MessageId=11022 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EOBJLENGTH -Language=Bulgarian -WSA_QOS_EOBJLENGTH - An object with an invalid ObjectLength field was specified in the QOS provider-specific buffer. -. - -MessageId=11023 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EFLOWCOUNT -Language=Bulgarian -WSA_QOS_EFLOWCOUNT - An incorrect number of flow descriptors was specified in the QOS structure. -. - -MessageId=11024 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EUNKNOWNPSOBJ -Language=Bulgarian -WSA_QOS_EUNKNOWNPSOBJ - An unrecognized object was found in the QOS provider-specific buffer. -. - -MessageId=11025 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EPOLICYOBJ -Language=Bulgarian -WSA_QOS_EPOLICYOBJ - An invalid policy object was found in the QOS provider-specific buffer. -. - -MessageId=11026 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EFLOWDESC -Language=Bulgarian -WSA_QOS_EFLOWDESC - An invalid QOS flow descriptor was found in the flow descriptor list. -. - -MessageId=11027 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EPSFLOWSPEC -Language=Bulgarian -WSA_QOS_EPSFLOWSPEC - An invalid or inconsistent flowspec was found in the QOS provider-specific buffer. -. - -MessageId=11028 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_EPSFILTERSPEC -Language=Bulgarian -WSA_QOS_EPSFILTERSPEC - An invalid FILTERSPEC was found in the QOS provider-specific buffer. -. - -MessageId=11029 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_ESDMODEOBJ -Language=Bulgarian -WSA_QOS_ESDMODEOBJ - An invalid shape discard mode object was found in the QOS provider-specific buffer. -. - -MessageId=11030 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_ESHAPERATEOBJ -Language=Bulgarian -WSA_QOS_ESHAPERATEOBJ - An invalid shaping rate object was found in the QOS provider-specific buffer. -. - -MessageId=11031 -Severity=Success -Facility=System -SymbolicName=WSA_QOS_RESERVED_PETYPE -Language=Bulgarian -WSA_QOS_RESERVED_PETYPE - A reserved policy element was found in the QOS provider-specific buffer. -. - -MessageId=12000 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_IO_COMPLETE -Language=Bulgarian -ERROR_FLT_IO_COMPLETE - The IO was completed by a filter. -. - -MessageId=12001 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_BUFFER_TOO_SMALL -Language=Bulgarian -ERROR_FLT_BUFFER_TOO_SMALL - The buffer is too small to contain the entry. No information has been written to the buffer. -. - -MessageId=12002 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_NO_HANDLER_DEFINED -Language=Bulgarian -ERROR_FLT_NO_HANDLER_DEFINED - A handler was not defined by the filter for this operation. -. - -MessageId=12003 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_CONTEXT_ALREADY_DEFINED -Language=Bulgarian -ERROR_FLT_CONTEXT_ALREADY_DEFINED - A context is already defined for this object. -. - -MessageId=12004 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST -Language=Bulgarian -ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST - Asynchronous requests are not valid for this operation. -. - -MessageId=12005 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_DISALLOW_FAST_IO -Language=Bulgarian -ERROR_FLT_DISALLOW_FAST_IO - Disallow the Fast IO path for this operation. -. - -MessageId=12006 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_INVALID_NAME_REQUEST -Language=Bulgarian -ERROR_FLT_INVALID_NAME_REQUEST - An invalid name request was made. The name requested cannot be retrieved at this time. -. - -MessageId=12007 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_NOT_SAFE_TO_POST_OPERATION -Language=Bulgarian -ERROR_FLT_NOT_SAFE_TO_POST_OPERATION - Posting this operation to a worker thread for further processing is not safe at this time because it could lead to a system deadlock. -. - -MessageId=12008 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_NOT_INITIALIZED -Language=Bulgarian -ERROR_FLT_NOT_INITIALIZED - The Filter Manager was not initialized when a filter tried to register. Make sure that the Filter Manager is getting loaded as a driver. -. - -MessageId=12009 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_FILTER_NOT_READY -Language=Bulgarian -ERROR_FLT_FILTER_NOT_READY - The filter is not ready for attachment to volumes because it has not finished initializing (FltStartFiltering has not been called). -. - -MessageId=12010 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_POST_OPERATION_CLEANUP -Language=Bulgarian -ERROR_FLT_POST_OPERATION_CLEANUP - The filter must cleanup any operation specific context at this time because it is being removed from the system before the operation is completed by the lower drivers. -. - -MessageId=12011 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_INTERNAL_ERROR -Language=Bulgarian -ERROR_FLT_INTERNAL_ERROR - The Filter Manager had an internal error from which it cannot recover, therefore the operation has been failed. This is usually the result of a filter returning an invalid value from a pre-operation callback. -. - -MessageId=12012 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_DELETING_OBJECT -Language=Bulgarian -ERROR_FLT_DELETING_OBJECT - The object specified for this action is in the process of being deleted, therefore the action requested cannot be completed at this time. -. - -MessageId=12013 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_MUST_BE_NONPAGED_POOL -Language=Bulgarian -ERROR_FLT_MUST_BE_NONPAGED_POOL - Non-paged pool must be used for this type of context. -. - -MessageId=12014 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_DUPLICATE_ENTRY -Language=Bulgarian -ERROR_FLT_DUPLICATE_ENTRY - A duplicate handler definition has been provided for an operation. -. - -MessageId=12015 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_CBDQ_DISABLED -Language=Bulgarian -ERROR_FLT_CBDQ_DISABLED - The callback data queue has been disabled. -. - -MessageId=12016 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_DO_NOT_ATTACH -Language=Bulgarian -ERROR_FLT_DO_NOT_ATTACH - Do not attach the filter to the volume at this time. -. - -MessageId=12017 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_DO_NOT_DETACH -Language=Bulgarian -ERROR_FLT_DO_NOT_DETACH - Do not detach the filter from the volume at this time. -. - -MessageId=12018 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_INSTANCE_ALTITUDE_COLLISION -Language=Bulgarian -ERROR_FLT_INSTANCE_ALTITUDE_COLLISION - An instance already exists at this altitude on the volume specified. -. - -MessageId=12019 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_INSTANCE_NAME_COLLISION -Language=Bulgarian -ERROR_FLT_INSTANCE_NAME_COLLISION - An instance already exists with this name on the volume specified. -. - -MessageId=12020 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_FILTER_NOT_FOUND -Language=Bulgarian -ERROR_FLT_FILTER_NOT_FOUND - The system could not find the filter specified. -. - -MessageId=12021 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_VOLUME_NOT_FOUND -Language=Bulgarian -ERROR_FLT_VOLUME_NOT_FOUND - The system could not find the volume specified. -. - -MessageId=12022 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_INSTANCE_NOT_FOUND -Language=Bulgarian -ERROR_FLT_INSTANCE_NOT_FOUND - The system could not find the instance specified. -. - -MessageId=12023 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND -Language=Bulgarian -ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND - No registered context allocation definition was found for the given request. -. - -MessageId=12024 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_INVALID_CONTEXT_REGISTRATION -Language=Bulgarian -ERROR_FLT_INVALID_CONTEXT_REGISTRATION - An invalid parameter was specified during context registration. -. - -MessageId=12025 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_NAME_CACHE_MISS -Language=Bulgarian -ERROR_FLT_NAME_CACHE_MISS - The name requested was not found in Filter Manager's name cache and could not be retrieved from the file system. -. - -MessageId=12026 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_NO_DEVICE_OBJECT -Language=Bulgarian -ERROR_FLT_NO_DEVICE_OBJECT - The requested device object does not exist for the given volume. -. - -MessageId=12027 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_VOLUME_ALREADY_MOUNTED -Language=Bulgarian -ERROR_FLT_VOLUME_ALREADY_MOUNTED - The specified volume is already mounted. -. - -MessageId=12028 -Severity=Success -Facility=System -SymbolicName=ERROR_FLT_NO_WAITER_FOR_REPLY -Language=Bulgarian -ERROR_FLT_NO_WAITER_FOR_REPLY - No waiter is present for the filter's reply to this message. -. - -MessageId=13000 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_QM_POLICY_EXISTS -Language=Bulgarian -ERROR_IPSEC_QM_POLICY_EXISTS - The specified quick mode policy already exists. -. - -MessageId=13001 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_QM_POLICY_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_QM_POLICY_NOT_FOUND - The specified quick mode policy was not found. -. - -MessageId=13002 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_QM_POLICY_IN_USE -Language=Bulgarian -ERROR_IPSEC_QM_POLICY_IN_USE - The specified quick mode policy is being used. -. - -MessageId=13003 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_POLICY_EXISTS -Language=Bulgarian -ERROR_IPSEC_MM_POLICY_EXISTS - The specified main mode policy already exists. -. - -MessageId=13004 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_POLICY_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_MM_POLICY_NOT_FOUND - The specified main mode policy was not found. -. - -MessageId=13005 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_POLICY_IN_USE -Language=Bulgarian -ERROR_IPSEC_MM_POLICY_IN_USE - The specified main mode policy is being used. -. - -MessageId=13006 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_FILTER_EXISTS -Language=Bulgarian -ERROR_IPSEC_MM_FILTER_EXISTS - The specified main mode filter already exists. -. - -MessageId=13007 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_FILTER_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_MM_FILTER_NOT_FOUND - The specified main mode filter was not found. -. - -MessageId=13008 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_TRANSPORT_FILTER_EXISTS -Language=Bulgarian -ERROR_IPSEC_TRANSPORT_FILTER_EXISTS - The specified transport mode filter already exists. -. - -MessageId=13009 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND - The specified transport mode filter does not exist. -. - -MessageId=13010 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_AUTH_EXISTS -Language=Bulgarian -ERROR_IPSEC_MM_AUTH_EXISTS - The specified main mode authentication list exists. -. - -MessageId=13011 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_AUTH_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_MM_AUTH_NOT_FOUND - The specified main mode authentication list was not found. -. - -MessageId=13012 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_AUTH_IN_USE -Language=Bulgarian -ERROR_IPSEC_MM_AUTH_IN_USE - The specified quick mode policy is being used. -. - -MessageId=13013 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND - The specified main mode policy was not found. -. - -MessageId=13014 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND - The specified quick mode policy was not found. -. - -MessageId=13015 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND - The manifest file contains one or more syntax errors. -. - -MessageId=13016 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_TUNNEL_FILTER_EXISTS -Language=Bulgarian -ERROR_IPSEC_TUNNEL_FILTER_EXISTS - The application attempted to activate a disabled activation context. -. - -MessageId=13017 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND -Language=Bulgarian -ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND - The requested lookup key was not found in any active activation context. -. - -MessageId=13018 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_FILTER_PENDING_DELETION -Language=Bulgarian -ERROR_IPSEC_MM_FILTER_PENDING_DELETION - The Main Mode filter is pending deletion. -. - -MessageId=13019 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION -Language=Bulgarian -ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION - The transport filter is pending deletion. -. - -MessageId=13020 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION -Language=Bulgarian -ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION - The tunnel filter is pending deletion. -. - -MessageId=13021 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_POLICY_PENDING_DELETION -Language=Bulgarian -ERROR_IPSEC_MM_POLICY_PENDING_DELETION - The Main Mode policy is pending deletion. -. - -MessageId=13022 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_MM_AUTH_PENDING_DELETION -Language=Bulgarian -ERROR_IPSEC_MM_AUTH_PENDING_DELETION - The Main Mode authentication bundle is pending deletion. -. - -MessageId=13023 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_QM_POLICY_PENDING_DELETION -Language=Bulgarian -ERROR_IPSEC_QM_POLICY_PENDING_DELETION - The Quick Mode policy is pending deletion. -. - -MessageId=13024 -Severity=Success -Facility=System -SymbolicName=WARNING_IPSEC_MM_POLICY_PRUNED -Language=Bulgarian -WARNING_IPSEC_MM_POLICY_PRUNED - The Main Mode policy was successfully added, but some of the requested offers are not supported. -. - -MessageId=13025 -Severity=Success -Facility=System -SymbolicName=WARNING_IPSEC_QM_POLICY_PRUNED -Language=Bulgarian -WARNING_IPSEC_QM_POLICY_PRUNED - The Quick Mode policy was successfully added, but some of the requested offers are not supported. -. - -MessageId=13801 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_AUTH_FAIL -Language=Bulgarian -ERROR_IPSEC_IKE_AUTH_FAIL - IKE authentication credentials are unacceptable. -. - -MessageId=13802 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_ATTRIB_FAIL -Language=Bulgarian -ERROR_IPSEC_IKE_ATTRIB_FAIL - IKE security attributes are unacceptable. -. - -MessageId=13803 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NEGOTIATION_PENDING -Language=Bulgarian -ERROR_IPSEC_IKE_NEGOTIATION_PENDING - IKE Negotiation in progress. -. - -MessageId=13804 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR -Language=Bulgarian -ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR - General processing error. -. - -MessageId=13805 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_TIMED_OUT -Language=Bulgarian -ERROR_IPSEC_IKE_TIMED_OUT - Negotiation timed out. -. - -MessageId=13806 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NO_CERT -Language=Bulgarian -ERROR_IPSEC_IKE_NO_CERT - IKE failed to find valid machine certificate. -. - -MessageId=13807 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_SA_DELETED -Language=Bulgarian -ERROR_IPSEC_IKE_SA_DELETED - IKE SA deleted by peer before establishment completed. -. - -MessageId=13808 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_SA_REAPED -Language=Bulgarian -ERROR_IPSEC_IKE_SA_REAPED - IKE SA deleted before establishment completed. -. - -MessageId=13809 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_MM_ACQUIRE_DROP -Language=Bulgarian -ERROR_IPSEC_IKE_MM_ACQUIRE_DROP - Negotiation request sat in Queue too long. -. - -MessageId=13810 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_QM_ACQUIRE_DROP -Language=Bulgarian -ERROR_IPSEC_IKE_QM_ACQUIRE_DROP - Negotiation request sat in Queue too long. -. - -MessageId=13811 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_QUEUE_DROP_MM -Language=Bulgarian -ERROR_IPSEC_IKE_QUEUE_DROP_MM - Negotiation request sat in Queue too long. -. - -MessageId=13812 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM -Language=Bulgarian -ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM - Negotiation request sat in Queue too long. -. - -MessageId=13813 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_DROP_NO_RESPONSE -Language=Bulgarian -ERROR_IPSEC_IKE_DROP_NO_RESPONSE - No response from peer. -. - -MessageId=13814 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_MM_DELAY_DROP -Language=Bulgarian -ERROR_IPSEC_IKE_MM_DELAY_DROP - Negotiation took too long. -. - -MessageId=13815 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_QM_DELAY_DROP -Language=Bulgarian -ERROR_IPSEC_IKE_QM_DELAY_DROP - Negotiation took too long. -. - -MessageId=13816 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_ERROR -Language=Bulgarian -ERROR_IPSEC_IKE_ERROR - Unknown error occurred. -. - -MessageId=13817 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_CRL_FAILED -Language=Bulgarian -ERROR_IPSEC_IKE_CRL_FAILED - Certificate Revocation Check failed. -. - -MessageId=13818 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_KEY_USAGE -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_KEY_USAGE - Invalid certificate key usage. -. - -MessageId=13819 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_CERT_TYPE -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_CERT_TYPE - Invalid certificate type. -. - -MessageId=13820 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NO_PRIVATE_KEY -Language=Bulgarian -ERROR_IPSEC_IKE_NO_PRIVATE_KEY - No private key associated with machine certificate. -. - -MessageId=13822 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_DH_FAIL -Language=Bulgarian -ERROR_IPSEC_IKE_DH_FAIL - Failure in Diffie-Hellman computation. -. - -MessageId=13824 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_HEADER -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_HEADER - Invalid header. -. - -MessageId=13825 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NO_POLICY -Language=Bulgarian -ERROR_IPSEC_IKE_NO_POLICY - No policy configured. -. - -MessageId=13826 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_SIGNATURE -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_SIGNATURE - Failed to verify signature. -. - -MessageId=13827 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_KERBEROS_ERROR -Language=Bulgarian -ERROR_IPSEC_IKE_KERBEROS_ERROR - Failed to authenticate using Kerberos. -. - -MessageId=13828 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NO_PUBLIC_KEY -Language=Bulgarian -ERROR_IPSEC_IKE_NO_PUBLIC_KEY - Peer's certificate did not have a public key. -. - -MessageId=13829 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR - Error processing error payload. -. - -MessageId=13830 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_SA -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_SA - Error processing SA payload. -. - -MessageId=13831 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_PROP -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_PROP - Error processing Proposal payload. -. - -MessageId=13832 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_TRANS -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_TRANS - Error processing Transform payload. -. - -MessageId=13833 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_KE -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_KE - Error processing KE payload. -. - -MessageId=13834 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_ID -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_ID - Error processing ID payload. -. - -MessageId=13835 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_CERT -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_CERT - Error processing Cert payload. -. - -MessageId=13836 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ - Error processing Certificate Request payload. -. - -MessageId=13837 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_HASH -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_HASH - Error processing Hash payload. -. - -MessageId=13838 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_SIG -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_SIG - Error processing Signature payload. -. - -MessageId=13839 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_NONCE -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_NONCE - Error processing Nonce payload. -. - -MessageId=13840 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY - Error processing Notify payload. -. - -MessageId=13841 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_DELETE -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_DELETE - Error processing Delete Payload. -. - -MessageId=13842 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR -Language=Bulgarian -ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR - Error processing VendorId payload. -. - -MessageId=13843 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_PAYLOAD -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_PAYLOAD - Invalid payload received. -. - -MessageId=13844 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_LOAD_SOFT_SA -Language=Bulgarian -ERROR_IPSEC_IKE_LOAD_SOFT_SA - Soft SA loaded. -. - -MessageId=13845 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN -Language=Bulgarian -ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN - Soft SA torn down. -. - -MessageId=13846 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_COOKIE -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_COOKIE - Invalid cookie received.. -. - -MessageId=13847 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NO_PEER_CERT -Language=Bulgarian -ERROR_IPSEC_IKE_NO_PEER_CERT - Peer failed to send valid machine certificate. -. - -MessageId=13848 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_PEER_CRL_FAILED -Language=Bulgarian -ERROR_IPSEC_IKE_PEER_CRL_FAILED - Certification Revocation check of peer's certificate failed. -. - -MessageId=13849 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_POLICY_CHANGE -Language=Bulgarian -ERROR_IPSEC_IKE_POLICY_CHANGE - New policy invalidated SAs formed with old policy. -. - -MessageId=13850 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NO_MM_POLICY -Language=Bulgarian -ERROR_IPSEC_IKE_NO_MM_POLICY - There is no available Main Mode IKE policy. -. - -MessageId=13851 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NOTCBPRIV -Language=Bulgarian -ERROR_IPSEC_IKE_NOTCBPRIV - Failed to enabled TCB privilege. -. - -MessageId=13852 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_SECLOADFAIL -Language=Bulgarian -ERROR_IPSEC_IKE_SECLOADFAIL - Failed to load SECURITY.DLL. -. - -MessageId=13853 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_FAILSSPINIT -Language=Bulgarian -ERROR_IPSEC_IKE_FAILSSPINIT - Failed to obtain security function table dispatch address from SSPI. -. - -MessageId=13854 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_FAILQUERYSSP -Language=Bulgarian -ERROR_IPSEC_IKE_FAILQUERYSSP - Failed to query Kerberos package to obtain max token size. -. - -MessageId=13855 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_SRVACQFAIL -Language=Bulgarian -ERROR_IPSEC_IKE_SRVACQFAIL - Failed to obtain Kerberos server credentials for ISAKMP/ERROR_IPSEC_IKE service. Kerberos authentication will not function. The most likely reason for this is lack of domain membership. This is normal if your computer is a member of a workgroup. -. - -MessageId=13856 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_SRVQUERYCRED -Language=Bulgarian -ERROR_IPSEC_IKE_SRVQUERYCRED - Failed to determine SSPI principal name for ISAKMP/ERROR_IPSEC_IKE service (QueryCredentialsAttributes). -. - -MessageId=13857 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_GETSPIFAIL -Language=Bulgarian -ERROR_IPSEC_IKE_GETSPIFAIL - Failed to obtain new SPI for the inbound SA from IPSec driver. The most common cause for this is that the driver does not have the correct filter. Check your policy to verify the filters. -. - -MessageId=13858 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_FILTER -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_FILTER - Given filter is invalid. -. - -MessageId=13859 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_OUT_OF_MEMORY -Language=Bulgarian -ERROR_IPSEC_IKE_OUT_OF_MEMORY - Memory allocation failed. -. - -MessageId=13860 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED -Language=Bulgarian -ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED - Failed to add Security Association to IPSec Driver. The most common cause for this is if the IKE negotiation took too long to complete. If the problem persists, reduce the load on the faulting machine. -. - -MessageId=13861 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_POLICY -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_POLICY - Invalid policy. -. - -MessageId=13862 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_UNKNOWN_DOI -Language=Bulgarian -ERROR_IPSEC_IKE_UNKNOWN_DOI - Invalid DOI. -. - -MessageId=13863 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_SITUATION -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_SITUATION - Invalid situation. -. - -MessageId=13864 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_DH_FAILURE -Language=Bulgarian -ERROR_IPSEC_IKE_DH_FAILURE - Diffie-Hellman failure. -. - -MessageId=13865 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_GROUP -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_GROUP - Invalid Diffie-Hellman group. -. - -MessageId=13866 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_ENCRYPT -Language=Bulgarian -ERROR_IPSEC_IKE_ENCRYPT - Error encrypting payload. -. - -MessageId=13867 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_DECRYPT -Language=Bulgarian -ERROR_IPSEC_IKE_DECRYPT - Error decrypting payload. -. - -MessageId=13868 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_POLICY_MATCH -Language=Bulgarian -ERROR_IPSEC_IKE_POLICY_MATCH - Policy match error. -. - -MessageId=13869 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_UNSUPPORTED_ID -Language=Bulgarian -ERROR_IPSEC_IKE_UNSUPPORTED_ID - Unsupported ID. -. - -MessageId=13870 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_HASH -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_HASH - Hash verification failed. -. - -MessageId=13871 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_HASH_ALG -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_HASH_ALG - Invalid hash algorithm. -. - -MessageId=13872 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_HASH_SIZE -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_HASH_SIZE - Invalid hash size. -. - -MessageId=13873 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG - Invalid encryption algorithm. -. - -MessageId=13874 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_AUTH_ALG -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_AUTH_ALG - Invalid authentication algorithm. -. - -MessageId=13875 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_SIG -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_SIG - Invalid certificate signature. -. - -MessageId=13876 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_LOAD_FAILED -Language=Bulgarian -ERROR_IPSEC_IKE_LOAD_FAILED - Load failed. -. - -MessageId=13877 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_RPC_DELETE -Language=Bulgarian -ERROR_IPSEC_IKE_RPC_DELETE - Deleted via RPC call. -. - -MessageId=13878 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_BENIGN_REINIT -Language=Bulgarian -ERROR_IPSEC_IKE_BENIGN_REINIT - Temporary state created to perform reinit. This is not a real failure. -. - -MessageId=13879 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY - The lifetime value received in the Responder Lifetime Notify is below the Windows 2000 configured minimum value. Please fix the policy on the peer machine. -. - -MessageId=13881 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN -Language=Bulgarian -ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN - Key length in certificate is too small for configured security requirements. -. - -MessageId=13882 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_MM_LIMIT -Language=Bulgarian -ERROR_IPSEC_IKE_MM_LIMIT - Max number of established MM SAs to peer exceeded. -. - -MessageId=13883 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NEGOTIATION_DISABLED -Language=Bulgarian -ERROR_IPSEC_IKE_NEGOTIATION_DISABLED - IKE received a policy that disables negotiation. -. - -MessageId=13884 -Severity=Success -Facility=System -SymbolicName=ERROR_IPSEC_IKE_NEG_STATUS_END -Language=Bulgarian -ERROR_IPSEC_IKE_NEG_STATUS_END - ERROR_IPSEC_IKE_NEG_STATUS_END -. - -MessageId=14000 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_SECTION_NOT_FOUND -Language=Bulgarian -ERROR_SXS_SECTION_NOT_FOUND - The requested section was not present in the activation context. -. - -MessageId=14001 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_CANT_GEN_ACTCTX -Language=Bulgarian -ERROR_SXS_CANT_GEN_ACTCTX - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. -. - -MessageId=14002 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_INVALID_ACTCTXDATA_FORMAT -Language=Bulgarian -ERROR_SXS_INVALID_ACTCTXDATA_FORMAT - The application binding data format is invalid. -. - -MessageId=14003 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_ASSEMBLY_NOT_FOUND -Language=Bulgarian -ERROR_SXS_ASSEMBLY_NOT_FOUND - The referenced assembly is not installed on your system. -. - -MessageId=14004 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_MANIFEST_FORMAT_ERROR -Language=Bulgarian -ERROR_SXS_MANIFEST_FORMAT_ERROR - The manifest file does not begin with the required tag and format information. -. - -MessageId=14005 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_MANIFEST_PARSE_ERROR -Language=Bulgarian -ERROR_SXS_MANIFEST_PARSE_ERROR - The manifest file contains one or more syntax errors. -. - -MessageId=14006 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_ACTIVATION_CONTEXT_DISABLED -Language=Bulgarian -ERROR_SXS_ACTIVATION_CONTEXT_DISABLED - The application attempted to activate a disabled activation context. -. - -MessageId=14007 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_KEY_NOT_FOUND -Language=Bulgarian -ERROR_SXS_KEY_NOT_FOUND - The requested lookup key was not found in any active activation context. -. - -MessageId=14008 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_VERSION_CONFLICT -Language=Bulgarian -ERROR_SXS_VERSION_CONFLICT - A component version required by the application conflicts with another component version already active. -. - -MessageId=14009 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_WRONG_SECTION_TYPE -Language=Bulgarian -ERROR_SXS_WRONG_SECTION_TYPE - The type requested activation context section does not match the query API used. -. - -MessageId=14010 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_THREAD_QUERIES_DISABLED -Language=Bulgarian -ERROR_SXS_THREAD_QUERIES_DISABLED - Lack of system resources has required isolated activation to be disabled for the current thread of execution. -. - -MessageId=14011 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET -Language=Bulgarian -ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET - An attempt to set the process default activation context failed because the process default activation context was already set. -. - -MessageId=14012 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_UNKNOWN_ENCODING_GROUP -Language=Bulgarian -ERROR_SXS_UNKNOWN_ENCODING_GROUP - The encoding group identifier specified is not recognized. -. - -MessageId=14013 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_UNKNOWN_ENCODING -Language=Bulgarian -ERROR_SXS_UNKNOWN_ENCODING - The encoding requested is not recognized. -. - -MessageId=14014 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_INVALID_XML_NAMESPACE_URI -Language=Bulgarian -ERROR_SXS_INVALID_XML_NAMESPACE_URI - The manifest contains a reference to an invalid URI. -. - -MessageId=14015 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED -Language=Bulgarian -ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED - The application manifest contains a reference to a dependent assembly which is not installed. -. - -MessageId=14016 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED -Language=Bulgarian -ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED - The manifest for an assembly used by the application has a reference to a dependent assembly which is not installed. -. - -MessageId=14017 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE -Language=Bulgarian -ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE - The manifest contains an attribute for the assembly identity which is not valid. -. - -MessageId=14018 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE -Language=Bulgarian -ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE - The manifest is missing the required default namespace specification on the assembly element. -. - -MessageId=14019 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE -Language=Bulgarian -ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE - The manifest has a default namespace specified on the assembly element but its value is not \"urn:schemas-microsoft-com:asm.v1\". -. - -MessageId=14020 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT -Language=Bulgarian -ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT - The private manifest probe has crossed the reparse-point-associated path. -. - -MessageId=14021 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_DUPLICATE_DLL_NAME -Language=Bulgarian -ERROR_SXS_DUPLICATE_DLL_NAME - Two or more components referenced directly or indirectly by the application manifest have files by the same name. -. - -MessageId=14022 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME -Language=Bulgarian -ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME - Two or more components referenced directly or indirectly by the application manifest have window classes with the same name. -. - -MessageId=14023 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_DUPLICATE_CLSID -Language=Bulgarian -ERROR_SXS_DUPLICATE_CLSID - Two or more components referenced directly or indirectly by the application manifest have the same COM server CLSIDs. -. - -MessageId=14024 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_DUPLICATE_IID -Language=Bulgarian -ERROR_SXS_DUPLICATE_IID - Two or more components referenced directly or indirectly by the application manifest have proxies for the same COM interface IIDs. -. - -MessageId=14025 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_DUPLICATE_TLBID -Language=Bulgarian -ERROR_SXS_DUPLICATE_TLBID - Two or more components referenced directly or indirectly by the application manifest have the same COM type library TLBIDs. -. - -MessageId=14026 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_DUPLICATE_PROGID -Language=Bulgarian -ERROR_SXS_DUPLICATE_PROGID - Two or more components referenced directly or indirectly by the application manifest have the same COM ProgIDs. -. - -MessageId=14027 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_DUPLICATE_ASSEMBLY_NAME -Language=Bulgarian -ERROR_SXS_DUPLICATE_ASSEMBLY_NAME - Two or more components referenced directly or indirectly by the application manifest are different versions of the same component which is not permitted. -. - -MessageId=14028 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_FILE_HASH_MISMATCH -Language=Bulgarian -ERROR_SXS_FILE_HASH_MISMATCH - A component's file does not match the verification information present in the component manifest. -. - -MessageId=14029 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_POLICY_PARSE_ERROR -Language=Bulgarian -ERROR_SXS_POLICY_PARSE_ERROR - The policy manifest contains one or more syntax errors. -. - -MessageId=14030 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MISSINGQUOTE -Language=Bulgarian -ERROR_SXS_XML_E_MISSINGQUOTE - Manifest Parse Error : A string literal was expected, but no opening quote character was found. -. - -MessageId=14031 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_COMMENTSYNTAX -Language=Bulgarian -ERROR_SXS_XML_E_COMMENTSYNTAX - Manifest Parse Error : Incorrect syntax was used in a comment. -. - -MessageId=14032 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_BADSTARTNAMECHAR -Language=Bulgarian -ERROR_SXS_XML_E_BADSTARTNAMECHAR - Manifest Parse Error : A name was started with an invalid character. -. - -MessageId=14033 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_BADNAMECHAR -Language=Bulgarian -ERROR_SXS_XML_E_BADNAMECHAR - Manifest Parse Error : A name contained an invalid character. -. - -MessageId=14034 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_BADCHARINSTRING -Language=Bulgarian -ERROR_SXS_XML_E_BADCHARINSTRING - Manifest Parse Error : A string literal contained an invalid character. -. - -MessageId=14035 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_XMLDECLSYNTAX -Language=Bulgarian -ERROR_SXS_XML_E_XMLDECLSYNTAX - Manifest Parse Error : Invalid syntax for an XML declaration. -. - -MessageId=14036 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_BADCHARDATA -Language=Bulgarian -ERROR_SXS_XML_E_BADCHARDATA - Manifest Parse Error : An invalid character was found in text content. -. - -MessageId=14037 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MISSINGWHITESPACE -Language=Bulgarian -ERROR_SXS_XML_E_MISSINGWHITESPACE - Manifest Parse Error : Required white space was missing. -. - -MessageId=14038 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_EXPECTINGTAGEND -Language=Bulgarian -ERROR_SXS_XML_E_EXPECTINGTAGEND - Manifest Parse Error : The character '>' was expected. -. - -MessageId=14039 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MISSINGSEMICOLON -Language=Bulgarian -ERROR_SXS_XML_E_MISSINGSEMICOLON - Manifest Parse Error : A semi colon character was expected. -. - -MessageId=14040 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNBALANCEDPAREN -Language=Bulgarian -ERROR_SXS_XML_E_UNBALANCEDPAREN - Manifest Parse Error : Unbalanced parentheses. -. - -MessageId=14041 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INTERNALERROR -Language=Bulgarian -ERROR_SXS_XML_E_INTERNALERROR - Manifest Parse Error : Internal error. -. - -MessageId=14042 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE -Language=Bulgarian -ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE - Manifest Parse Error : White space is not allowed at this location. -. - -MessageId=14043 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INCOMPLETE_ENCODING -Language=Bulgarian -ERROR_SXS_XML_E_INCOMPLETE_ENCODING - Manifest Parse Error : End of file reached in invalid state for current encoding. -. - -MessageId=14044 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MISSING_PAREN -Language=Bulgarian -ERROR_SXS_XML_E_MISSING_PAREN - Manifest Parse Error : Missing parenthesis. -. - -MessageId=14045 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE -Language=Bulgarian -ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE - Manifest Parse Error : A single or double closing quote character (\' or \") is missing. -. - -MessageId=14046 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MULTIPLE_COLONS -Language=Bulgarian -ERROR_SXS_XML_E_MULTIPLE_COLONS - Manifest Parse Error : Multiple colons are not allowed in a name. -. - -MessageId=14047 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALID_DECIMAL -Language=Bulgarian -ERROR_SXS_XML_E_INVALID_DECIMAL - Manifest Parse Error : Invalid character for decimal digit. -. - -MessageId=14048 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALID_HEXIDECIMAL -Language=Bulgarian -ERROR_SXS_XML_E_INVALID_HEXIDECIMAL - Manifest Parse Error : Invalid character for hexadecimal digit. -. - -MessageId=14049 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALID_UNICODE -Language=Bulgarian -ERROR_SXS_XML_E_INVALID_UNICODE - Manifest Parse Error : Invalid Unicode character value for this platform. -. - -MessageId=14050 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK -Language=Bulgarian -ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK - Manifest Parse Error : Expecting white space or '?'. -. - -MessageId=14051 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNEXPECTEDENDTAG -Language=Bulgarian -ERROR_SXS_XML_E_UNEXPECTEDENDTAG - Manifest Parse Error : End tag was not expected at this location. -. - -MessageId=14052 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNCLOSEDTAG -Language=Bulgarian -ERROR_SXS_XML_E_UNCLOSEDTAG - Manifest Parse Error : The following tags were not closed: %1. -. - -MessageId=14053 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_DUPLICATEATTRIBUTE -Language=Bulgarian -ERROR_SXS_XML_E_DUPLICATEATTRIBUTE - Manifest Parse Error : Duplicate attribute. -. - -MessageId=14054 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MULTIPLEROOTS -Language=Bulgarian -ERROR_SXS_XML_E_MULTIPLEROOTS - Manifest Parse Error : Only one top level element is allowed in an XML document. -. - -MessageId=14055 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALIDATROOTLEVEL -Language=Bulgarian -ERROR_SXS_XML_E_INVALIDATROOTLEVEL - Manifest Parse Error : Invalid at the top level of the document. -. - -MessageId=14056 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_BADXMLDECL -Language=Bulgarian -ERROR_SXS_XML_E_BADXMLDECL - Manifest Parse Error : Invalid XML declaration. -. - -MessageId=14057 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MISSINGROOT -Language=Bulgarian -ERROR_SXS_XML_E_MISSINGROOT - Manifest Parse Error : XML document must have a top level element. -. - -MessageId=14058 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNEXPECTEDEOF -Language=Bulgarian -ERROR_SXS_XML_E_UNEXPECTEDEOF - Manifest Parse Error : Unexpected end of file. -. - -MessageId=14059 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_BADPEREFINSUBSET -Language=Bulgarian -ERROR_SXS_XML_E_BADPEREFINSUBSET - Manifest Parse Error : Parameter entities cannot be used inside markup declarations in an internal subset. -. - -MessageId=14060 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNCLOSEDSTARTTAG -Language=Bulgarian -ERROR_SXS_XML_E_UNCLOSEDSTARTTAG - Manifest Parse Error : Element was not closed. -. - -MessageId=14061 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNCLOSEDENDTAG -Language=Bulgarian -ERROR_SXS_XML_E_UNCLOSEDENDTAG - Manifest Parse Error : End element was missing the character '>'. -. - -MessageId=14062 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNCLOSEDSTRING -Language=Bulgarian -ERROR_SXS_XML_E_UNCLOSEDSTRING - Manifest Parse Error : A string literal was not closed. -. - -MessageId=14063 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNCLOSEDCOMMENT -Language=Bulgarian -ERROR_SXS_XML_E_UNCLOSEDCOMMENT - Manifest Parse Error : A comment was not closed. -. - -MessageId=14064 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNCLOSEDDECL -Language=Bulgarian -ERROR_SXS_XML_E_UNCLOSEDDECL - Manifest Parse Error : A declaration was not closed. -. - -MessageId=14065 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNCLOSEDCDATA -Language=Bulgarian -ERROR_SXS_XML_E_UNCLOSEDCDATA - Manifest Parse Error : A CDATA section was not closed. -. - -MessageId=14066 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_RESERVEDNAMESPACE -Language=Bulgarian -ERROR_SXS_XML_E_RESERVEDNAMESPACE - Manifest Parse Error : The namespace prefix is not allowed to start with the reserved string \"xml\". -. - -MessageId=14067 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALIDENCODING -Language=Bulgarian -ERROR_SXS_XML_E_INVALIDENCODING - Manifest Parse Error : System does not support the specified encoding. -. - -MessageId=14068 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALIDSWITCH -Language=Bulgarian -ERROR_SXS_XML_E_INVALIDSWITCH - Manifest Parse Error : Switch from current encoding to specified encoding not supported. -. - -MessageId=14069 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_BADXMLCASE -Language=Bulgarian -ERROR_SXS_XML_E_BADXMLCASE - Manifest Parse Error : The name 'xml' is reserved and must be lower case. -. - -MessageId=14070 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALID_STANDALONE -Language=Bulgarian -ERROR_SXS_XML_E_INVALID_STANDALONE - Manifest Parse Error : The standalone attribute must have the value 'yes' or 'no'. -. - -MessageId=14071 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_UNEXPECTED_STANDALONE -Language=Bulgarian -ERROR_SXS_XML_E_UNEXPECTED_STANDALONE - Manifest Parse Error : The standalone attribute cannot be used in external entities. -. - -MessageId=14072 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_INVALID_VERSION -Language=Bulgarian -ERROR_SXS_XML_E_INVALID_VERSION - Manifest Parse Error : Invalid version number. -. - -MessageId=14073 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_XML_E_MISSINGEQUALS -Language=Bulgarian -ERROR_SXS_XML_E_MISSINGEQUALS - Manifest Parse Error : Missing equals sign between attribute and attribute value. -. - -MessageId=14074 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_PROTECTION_RECOVERY_FAILED -Language=Bulgarian -ERROR_SXS_PROTECTION_RECOVERY_FAILED - Assembly Protection Error: Unable to recover the specified assembly. -. - -MessageId=14075 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT -Language=Bulgarian -ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT - Assembly Protection Error: The public key for an assembly was too short to be allowed. -. - -MessageId=14076 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_PROTECTION_CATALOG_NOT_VALID -Language=Bulgarian -ERROR_SXS_PROTECTION_CATALOG_NOT_VALID - Assembly Protection Error: The catalog for an assembly is not valid, or does not match the assembly's manifest. -. - -MessageId=14077 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_UNTRANSLATABLE_HRESULT -Language=Bulgarian -ERROR_SXS_UNTRANSLATABLE_HRESULT - An HRESULT could not be translated to a corresponding Win32 error code. -. - -MessageId=14078 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING -Language=Bulgarian -ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING - Assembly Protection Error: The catalog for an assembly is missing. -. - -MessageId=14079 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE -Language=Bulgarian -ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE - The supplied assembly identity is missing one or more attributes which must be present in this context. -. - -MessageId=14080 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME -Language=Bulgarian -ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME - The supplied assembly identity has one or more attribute names that contain characters not permitted in XML names. -. - -MessageId=14081 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_ASSEMBLY_MISSING -Language=Bulgarian -ERROR_SXS_ASSEMBLY_MISSING - The referenced assembly could not be found. -. - -MessageId=14082 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_CORRUPT_ACTIVATION_STACK -Language=Bulgarian -ERROR_SXS_CORRUPT_ACTIVATION_STACK - The activation context activation stack for the running thread of execution is corrupt. -. - -MessageId=14083 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_CORRUPTION -Language=Bulgarian -ERROR_SXS_CORRUPTION - The application isolation metadata for this process or thread has become corrupt. -. - -MessageId=14084 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_EARLY_DEACTIVATION -Language=Bulgarian -ERROR_SXS_EARLY_DEACTIVATION - The activation context being deactivated is not the most recently activated one. -. - -MessageId=14085 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_INVALID_DEACTIVATION -Language=Bulgarian -ERROR_SXS_INVALID_DEACTIVATION - The activation context being deactivated is not active for the current thread of execution. -. - -MessageId=14086 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_MULTIPLE_DEACTIVATION -Language=Bulgarian -ERROR_SXS_MULTIPLE_DEACTIVATION - The activation context being deactivated has already been deactivated. -. - -MessageId=14087 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_PROCESS_TERMINATION_REQUESTED -Language=Bulgarian -ERROR_SXS_PROCESS_TERMINATION_REQUESTED - A component used by the isolation facility has requested to terminate the process. -. - -MessageId=14088 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_RELEASE_ACTIVATION_CONTEXT -Language=Bulgarian -ERROR_SXS_RELEASE_ACTIVATION_CONTEXT - A kernel mode component is releasing a reference on an activation context. -. - -MessageId=14089 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY -Language=Bulgarian -ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY - The activation context of system default assembly could not be generated. -. - -MessageId=14090 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE -Language=Bulgarian -ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE - The value of an attribute in an identity is not within the legal range. -. - -MessageId=14091 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME -Language=Bulgarian -ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME - The name of an attribute in an identity is not within the legal range. -. - -MessageId=14092 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE -Language=Bulgarian -ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE - An identity contains two definitions for the same attribute. -. - -MessageId=14093 -Severity=Success -Facility=System -SymbolicName=ERROR_SXS_IDENTITY_PARSE_ERROR -Language=Bulgarian -ERROR_SXS_IDENTITY_PARSE_ERROR - The identity string is malformed. This may be due to a trailing comma, more than two unnamed attributes, missing attribute name or missing attribute value. -. - -MessageId=15000 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_INVALID_CHANNEL_PATH -Language=Bulgarian -ERROR_EVT_INVALID_CHANNEL_PATH - The specified channel path is invalid. See extended error info for more details. -. - -MessageId=15001 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_INVALID_QUERY -Language=Bulgarian -ERROR_EVT_INVALID_QUERY - The specified query is invalid. See extended error info for more details. -. - -MessageId=15002 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_PUBLISHER_MANIFEST_NOT_FOUND -Language=Bulgarian -ERROR_EVT_PUBLISHER_MANIFEST_NOT_FOUND - The publisher did indicate they have a manifest/resource but a manifest/resource could not be found. -. - -MessageId=15003 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_PUBLISHER_MANIFEST_NOT_SPECIFIED -Language=Bulgarian -ERROR_EVT_PUBLISHER_MANIFEST_NOT_SPECIFIED - The publisher does not have a manifest and is performing an operation which requires they have a manifest. -. - -MessageId=15004 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_NO_REGISTERED_TEMPLATE -Language=Bulgarian -ERROR_EVT_NO_REGISTERED_TEMPLATE - There is no registered template for specified event id. -. - -MessageId=15005 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_EVENT_CHANNEL_MISMATCH -Language=Bulgarian -ERROR_EVT_EVENT_CHANNEL_MISMATCH - The specified event was declared in the manifest to go a different channel than the one this publisher handle is bound to. -. - -MessageId=15006 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_UNEXPECTED_VALUE_TYPE -Language=Bulgarian -ERROR_EVT_UNEXPECTED_VALUE_TYPE - The type of a specified substitution value does not match the type expected from the template definition. -. - -MessageId=15007 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_UNEXPECTED_NUM_VALUES -Language=Bulgarian -ERROR_EVT_UNEXPECTED_NUM_VALUES - The number of specified substitution values does not match the number expected from the template definition. -. - -MessageId=15008 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_CHANNEL_NOT_FOUND -Language=Bulgarian -ERROR_EVT_CHANNEL_NOT_FOUND - The specified channel could not be found. Check channel configuration. -. - -MessageId=15009 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_MALFORMED_XML_TEXT -Language=Bulgarian -ERROR_EVT_MALFORMED_XML_TEXT - The specified xml text was not well-formed. See Extended Error for more details. -. - -MessageId=15010 -Severity=Success -Facility=System -SymbolicName=ERROR_EVT_CHANNEL_PATH_TOO_GENERAL -Language=Bulgarian -ERROR_EVT_CHANNEL_PATH_TOO_GENERAL - The specified channel path selects more than one instance of a channel. The operation requires that only one channel be selected. It may be necessary to scope channel path to version / publicKeyToken to select only one instance. -. - - -; Facility=WIN32 - -MessageId=0x000E -Severity=Warning -Facility=WIN32 -SymbolicName=E_OUTOFMEMORY -Language=Bulgarian -E_OUTOFMEMORY - Out of memory -. - -MessageId=0x0057 -Severity=Warning -Facility=WIN32 -SymbolicName=E_INVALIDARG -Language=Bulgarian -E_INVALIDARG - One or more arguments are invalid -. - -MessageId=0x0006 -Severity=Warning -Facility=WIN32 -SymbolicName=E_HANDLE -Language=Bulgarian -E_POINTER - Invalid handle -. - -MessageId=0x0005 -Severity=Warning -Facility=WIN32 -SymbolicName=E_ACCESSDENIED -Language=Bulgarian -E_ACCESSDENIED - WIN32 access denied error -. - - -; Facility=ITF - -MessageId=0x0000 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_OLEVERB -Language=Bulgarian -OLE_E_OLEVERB - Invalid OLEVERB structure -. - -MessageId=0x0001 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_ADVF -Language=Bulgarian -OLE_E_ADVF - Invalid advise flags -. - -MessageId=0x0002 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_ENUM_NOMORE -Language=Bulgarian -OLE_E_ENUM_NOMORE - Can't enumerate any more, because the associated data is missing -. - -MessageId=0x0003 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_ADVISENOTSUPPORTED -Language=Bulgarian -OLE_E_ADVISENOTSUPPORTED - This implementation doesn't take advises -. - -MessageId=0x0004 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_NOCONNECTION -Language=Bulgarian -OLE_E_NOCONNECTION - There is no connection for this connection ID -. - -MessageId=0x0005 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_NOTRUNNING -Language=Bulgarian -OLE_E_NOTRUNNING - Need to run the object to perform this operation -. - -MessageId=0x0006 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_NOCACHE -Language=Bulgarian -OLE_E_NOCACHE - There is no cache to operate on -. - -MessageId=0x0007 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_BLANK -Language=Bulgarian -OLE_E_BLANK - Uninitialized object -. - -MessageId=0x0008 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_CLASSDIFF -Language=Bulgarian -OLE_E_CLASSDIFF - Linked object's source class has changed -. - -MessageId=0x0009 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_CANT_GETMONIKER -Language=Bulgarian -OLE_E_CANT_GETMONIKER - Not able to get the moniker of the object -. - -MessageId=0x000A -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_CANT_BINDTOSOURCE -Language=Bulgarian -OLE_E_CANT_BINDTOSOURCE - Not able to bind to the source -. - -MessageId=0x000B -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_STATIC -Language=Bulgarian -OLE_E_STATIC - Object is static; operation not allowed -. - -MessageId=0x000C -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_PROMPTSAVECANCELLED -Language=Bulgarian -OLE_E_PROMPTSAVECANCELLED - User canceled out of save dialog -. - -MessageId=0x000D -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_INVALIDRECT -Language=Bulgarian -OLE_E_INVALIDRECT - Invalid rectangle -. - -MessageId=0x000E -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_WRONGCOMPOBJ -Language=Bulgarian -OLE_E_WRONGCOMPOBJ - compobj.dll is too old for the ole2.dll initialized -. - -MessageId=0x000F -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_INVALIDHWND -Language=Bulgarian -OLE_E_INVALIDHWND - Invalid window handle -. - -MessageId=0x0010 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_NOT_INPLACEACTIVE -Language=Bulgarian -OLE_E_NOT_INPLACEACTIVE - Object is not in any of the inplace active states -. - -MessageId=0x0011 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_CANTCONVERT -Language=Bulgarian -OLE_E_CANTCONVERT - Not able to convert object -. - -MessageId=0x0012 -Severity=Warning -Facility=ITF -SymbolicName=OLE_E_NOSTORAGE -Language=Bulgarian -OLE_E_NOSTORAGE - Not able to perform the operation because object is not given storage yet -. - -MessageId=0x0064 -Severity=Warning -Facility=ITF -SymbolicName=DV_E_FORMATETC -Language=Bulgarian -DV_E_FORMATETC - Invalid FORMATETC structure -. - -MessageId=0x0065 -Severity=Warning -Facility=ITF -SymbolicName=DV_E_DVTARGETDEVICE -Language=Bulgarian -DV_E_DVTARGETDEVICE - Invalid DVTARGETDEVICE structure -. - -MessageId=0x0066 -Severity=Warning -Facility=ITF -SymbolicName=DV_E_STGMEDIUM -Language=Bulgarian -DV_E_STGMEDIUM - Invalid STDGMEDIUM structure -. - -MessageId=0x0067 -Severity=Warning -Facility=ITF -SymbolicName=DV_E_STATDATA -Language=Bulgarian -DV_E_STATDATA - Invalid STATDATA structure -. - -MessageId=0x0068 -Severity=Warning -Facility=ITF -SymbolicName=DV_E_LINDEX -Language=Bulgarian -DV_E_LINDEX - Invalid lindex -. - -MessageId=0x0069 -Severity=Warning -Facility=ITF -SymbolicName=DV_E_TYMED -Language=Bulgarian -DV_E_TYMED - Invalid tymed -. - -MessageId=0x006A -Severity=Warning -Facility=ITF -SymbolicName=DV_E_CLIPFORMAT -Language=Bulgarian -DV_E_CLIPFORMAT - Invalid clipboard format -. - -MessageId=0x006B -Severity=Warning -Facility=ITF -SymbolicName=DV_E_DVASPECT -Language=Bulgarian -DV_E_DVASPECT - Invalid aspect(s) -. - -MessageId=0x006C -Severity=Warning -Facility=ITF -SymbolicName=DV_E_DVTARGETDEVICE_SIZE -Language=Bulgarian -DV_E_DVTARGETDEVICE_SIZE - tdSize parameter of the DVTARGETDEVICE structure is invalid -. - -MessageId=0x006D -Severity=Warning -Facility=ITF -SymbolicName=DV_E_NOIVIEWOBJECT -Language=Bulgarian -DV_E_NOIVIEWOBJECT - Object doesn't support IViewObject interface -. - -MessageId=0x0100 -Severity=Warning -Facility=ITF -SymbolicName=DRAGDROP_E_NOTREGISTERED -Language=Bulgarian -DRAGDROP_E_NOTREGISTERED - Trying to revoke a drop target that has not been registered -. - -MessageId=0x0101 -Severity=Warning -Facility=ITF -SymbolicName=DRAGDROP_E_ALREADYREGISTERED -Language=Bulgarian -DRAGDROP_E_ALREADYREGISTERED - This window has already been registered as a drop target -. - -MessageId=0x0102 -Severity=Warning -Facility=ITF -SymbolicName=DRAGDROP_E_INVALIDHWND -Language=Bulgarian -DRAGDROP_E_INVALIDHWND - Invalid window handle -. - -MessageId=0x0110 -Severity=Warning -Facility=ITF -SymbolicName=CLASS_E_NOAGGREGATION -Language=Bulgarian -CLASS_E_NOAGGREGATION - Class does not support aggregation (or class object is remote) -. - -MessageId=0x0111 -Severity=Warning -Facility=ITF -SymbolicName=CLASS_E_CLASSNOTAVAILABLE -Language=Bulgarian -CLASS_E_CLASSNOTAVAILABLE - ClassFactory cannot supply requested class -. - -MessageId=0x0112 -Severity=Warning -Facility=ITF -SymbolicName=CLASS_E_NOTLICENSED -Language=Bulgarian -CLASS_E_NOTLICENSED - Class is not licensed for use -. - -; EOF -; -; kernel32.mc MESSAGE resources for kernel32.dll -; - -MessageIdTypedef=ULONG - -SeverityNames=(Success=0x0:STATUS_SEVERITY_SUCCESS - Informational=0x1:STATUS_SEVERITY_INFORMATIONAL - Warning=0x2:STATUS_SEVERITY_WARNING - Error=0x3:STATUS_SEVERITY_ERROR - ) - -FacilityNames=(System=0x0:FACILITY_SYSTEM - ITF=0x4:FACILITY_ITF - WIN32=0x7:FACILITY_GENERAL - ) - -LanguageNames=(Bulgarian=0x419:MSG00419) - - -; -; message definitions -; - -; Facility=System - -MessageId=0 -Severity=Success -Facility=System -SymbolicName=ERROR_SUCCESS -Language=Bulgarian -ERROR_SUCCESS - . -. - -MessageId=1 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_FUNCTION -Language=Bulgarian -ERROR_INVALID_FUNCTION - . -. - -MessageId=2 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_NOT_FOUND -Language=Bulgarian -ERROR_FILE_NOT_FOUND - . -. - -MessageId=3 -Severity=Success -Facility=System -SymbolicName=ERROR_PATH_NOT_FOUND -Language=Bulgarian -ERROR_PATH_NOT_FOUND - . -. - -MessageId=4 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_OPEN_FILES -Language=Bulgarian -ERROR_TOO_MANY_OPEN_FILES - . -. - -MessageId=5 -Severity=Success -Facility=System -SymbolicName=ERROR_ACCESS_DENIED -Language=Bulgarian -ERROR_ACCESS_DENIED - . -. - -MessageId=6 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_HANDLE -Language=Bulgarian -ERROR_INVALID_HANDLE - . -. - -MessageId=7 -Severity=Success -Facility=System -SymbolicName=ERROR_ARENA_TRASHED -Language=Bulgarian -ERROR_ARENA_TRASHED - The storage control blocks were destroyed. -. - -MessageId=8 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_ENOUGH_MEMORY -Language=Bulgarian -ERROR_NOT_ENOUGH_MEMORY - Not enough storage is available to process this command. -. - -MessageId=9 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_BLOCK -Language=Bulgarian -ERROR_INVALID_BLOCK - The storage control block address is invalid. -. - -MessageId=10 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_ENVIRONMENT -Language=Bulgarian -ERROR_BAD_ENVIRONMENT - . -. - -MessageId=11 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_FORMAT -Language=Bulgarian -ERROR_BAD_FORMAT - . -. - -MessageId=12 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ACCESS -Language=Bulgarian -ERROR_INVALID_ACCESS - . -. - -MessageId=13 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DATA -Language=Bulgarian -ERROR_INVALID_DATA - . -. - -MessageId=14 -Severity=Success -Facility=System -SymbolicName=ERROR_OUTOFMEMORY -Language=Bulgarian -ERROR_OUTOFMEMORY - Not enough storage is available to complete this operation. -. - -MessageId=15 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_DRIVE -Language=Bulgarian -ERROR_INVALID_DRIVE - . -. - -MessageId=16 -Severity=Success -Facility=System -SymbolicName=ERROR_CURRENT_DIRECTORY -Language=Bulgarian -ERROR_CURRENT_DIRECTORY - . -. - -MessageId=17 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_SAME_DEVICE -Language=Bulgarian -ERROR_NOT_SAME_DEVICE - . -. - -MessageId=18 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MORE_FILES -Language=Bulgarian -ERROR_NO_MORE_FILES - . -. - -MessageId=19 -Severity=Success -Facility=System -SymbolicName=ERROR_WRITE_PROTECT -Language=Bulgarian -ERROR_WRITE_PROTECT - . -. - -MessageId=20 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_UNIT -Language=Bulgarian -ERROR_BAD_UNIT - . -. - -MessageId=21 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_READY -Language=Bulgarian -ERROR_NOT_READY - . -. - -MessageId=22 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_COMMAND -Language=Bulgarian -ERROR_BAD_COMMAND - . -. - -MessageId=23 -Severity=Success -Facility=System -SymbolicName=ERROR_CRC -Language=Bulgarian -ERROR_CRC - ( (crc)). -. - -MessageId=24 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_LENGTH -Language=Bulgarian -ERROR_BAD_LENGTH - , . -. - -MessageId=25 -Severity=Success -Facility=System -SymbolicName=ERROR_SEEK -Language=Bulgarian -ERROR_SEEK - . -. - -MessageId=26 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_DOS_DISK -Language=Bulgarian -ERROR_NOT_DOS_DISK - . -. - -MessageId=27 -Severity=Success -Facility=System -SymbolicName=ERROR_SECTOR_NOT_FOUND -Language=Bulgarian -ERROR_SECTOR_NOT_FOUND - (). -. - -MessageId=28 -Severity=Success -Facility=System -SymbolicName=ERROR_OUT_OF_PAPER -Language=Bulgarian -ERROR_OUT_OF_PAPER - . -. - -MessageId=29 -Severity=Success -Facility=System -SymbolicName=ERROR_WRITE_FAULT -Language=Bulgarian -ERROR_WRITE_FAULT - . -. - -MessageId=30 -Severity=Success -Facility=System -SymbolicName=ERROR_READ_FAULT -Language=Bulgarian -ERROR_READ_FAULT - .. - -MessageId=31 -Severity=Success -Facility=System -SymbolicName=ERROR_GEN_FAILURE -Language=Bulgarian -ERROR_GEN_FAILURE - A device attached to the system is not functioning. -. - -MessageId=32 -Severity=Success -Facility=System -SymbolicName=ERROR_SHARING_VIOLATION -Language=Bulgarian -ERROR_SHARING_VIOLATION - The process cannot access the file because it is being used by another process. -. - -MessageId=33 -Severity=Success -Facility=System -SymbolicName=ERROR_LOCK_VIOLATION -Language=Bulgarian -ERROR_LOCK_VIOLATION - The process cannot access the file because another process has locked a portion of the file. -. - -MessageId=34 -Severity=Success -Facility=System -SymbolicName=ERROR_WRONG_DISK -Language=Bulgarian -ERROR_WRONG_DISK - The wrong diskette is in the drive. Insert %2 (Volume Serial Number: %3) into drive %1. -. - -MessageId=36 -Severity=Success -Facility=System -SymbolicName=ERROR_SHARING_BUFFER_EXCEEDED -Language=Bulgarian -ERROR_SHARING_BUFFER_EXCEEDED - Too many files opened for sharing. -. - -MessageId=38 -Severity=Success -Facility=System -SymbolicName=ERROR_HANDLE_EOF -Language=Bulgarian -ERROR_HANDLE_EOF - Reached the end of the file. -. - -MessageId=39 -Severity=Success -Facility=System -SymbolicName=ERROR_HANDLE_DISK_FULL -Language=Bulgarian -ERROR_HANDLE_DISK_FULL - . -. - -MessageId=50 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_SUPPORTED -Language=Bulgarian -ERROR_NOT_SUPPORTED - . -. - -MessageId=51 -Severity=Success -Facility=System -SymbolicName=ERROR_REM_NOT_LIST -Language=Bulgarian -ERROR_REM_NOT_LIST - Windows cannot find the network path. Verify that the network path is correct and the destination computer is not busy or turned off. If Windows still cannot find the network path, contact your network administrator. -. - -MessageId=52 -Severity=Success -Facility=System -SymbolicName=ERROR_DUP_NAME -Language=Bulgarian -ERROR_DUP_NAME - You were not connected because a duplicate name exists on the network. Go to System in the Control Panel to change the computer name and try again. -. - -MessageId=53 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_NETPATH -Language=Bulgarian -ERROR_BAD_NETPATH - . -. - -MessageId=54 -Severity=Success -Facility=System -SymbolicName=ERROR_NETWORK_BUSY -Language=Bulgarian -ERROR_NETWORK_BUSY - . -. - -MessageId=55 -Severity=Success -Facility=System -SymbolicName=ERROR_DEV_NOT_EXIST -Language=Bulgarian -ERROR_DEV_NOT_EXIST - The specified network resource or device is no longer available. -. - -MessageId=56 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_CMDS -Language=Bulgarian -ERROR_TOO_MANY_CMDS - The network BIOS command limit has been reached. -. - -MessageId=57 -Severity=Success -Facility=System -SymbolicName=ERROR_ADAP_HDW_ERR -Language=Bulgarian -ERROR_ADAP_HDW_ERR - A network adapter hardware error occurred. -. - -MessageId=58 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_NET_RESP -Language=Bulgarian -ERROR_BAD_NET_RESP - The specified server cannot perform the requested operation. -. - -MessageId=59 -Severity=Success -Facility=System -SymbolicName=ERROR_UNEXP_NET_ERR -Language=Bulgarian -ERROR_UNEXP_NET_ERR - An unexpected network error occurred. -. - -MessageId=60 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_REM_ADAP -Language=Bulgarian -ERROR_BAD_REM_ADAP - The remote adapter is not compatible. -. - -MessageId=61 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINTQ_FULL -Language=Bulgarian -ERROR_PRINTQ_FULL - The printer queue is full. -. - -MessageId=62 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SPOOL_SPACE -Language=Bulgarian -ERROR_NO_SPOOL_SPACE - Space to store the file waiting to be printed is not available on the server. -. - -MessageId=63 -Severity=Success -Facility=System -SymbolicName=ERROR_PRINT_CANCELLED -Language=Bulgarian -ERROR_PRINT_CANCELLED - Your file waiting to be printed was deleted. -. - -MessageId=64 -Severity=Success -Facility=System -SymbolicName=ERROR_NETNAME_DELETED -Language=Bulgarian -ERROR_NETNAME_DELETED - The specified network name is no longer available. -. - -MessageId=65 -Severity=Success -Facility=System -SymbolicName=ERROR_NETWORK_ACCESS_DENIED -Language=Bulgarian -ERROR_NETWORK_ACCESS_DENIED - Network access is denied. -. - -MessageId=66 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_DEV_TYPE -Language=Bulgarian -ERROR_BAD_DEV_TYPE - The network resource type is not correct. -. - -MessageId=67 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_NET_NAME -Language=Bulgarian -ERROR_BAD_NET_NAME - . -. - -MessageId=68 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_NAMES -Language=Bulgarian -ERROR_TOO_MANY_NAMES - The name limit for the local computer network adapter card was exceeded. -. - -MessageId=69 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_SESS -Language=Bulgarian -ERROR_TOO_MANY_SESS - The network BIOS session limit was exceeded. -. - -MessageId=70 -Severity=Success -Facility=System -SymbolicName=ERROR_SHARING_PAUSED -Language=Bulgarian -ERROR_SHARING_PAUSED - The remote server has been paused or is in the process of being started. -. - -MessageId=71 -Severity=Success -Facility=System -SymbolicName=ERROR_REQ_NOT_ACCEP -Language=Bulgarian -ERROR_REQ_NOT_ACCEP - No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept. -. - -MessageId=72 -Severity=Success -Facility=System -SymbolicName=ERROR_REDIR_PAUSED -Language=Bulgarian -ERROR_REDIR_PAUSED - The specified printer or disk device has been paused. -. - -MessageId=80 -Severity=Success -Facility=System -SymbolicName=ERROR_FILE_EXISTS -Language=Bulgarian -ERROR_FILE_EXISTS - . -. - -MessageId=82 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_MAKE -Language=Bulgarian -ERROR_CANNOT_MAKE - . -. - -MessageId=83 -Severity=Success -Facility=System -SymbolicName=ERROR_FAIL_I24 -Language=Bulgarian -ERROR_FAIL_I24 - Fail on INT 24. -. - -MessageId=84 -Severity=Success -Facility=System -SymbolicName=ERROR_OUT_OF_STRUCTURES -Language=Bulgarian -ERROR_OUT_OF_STRUCTURES - Storage to process this request is not available. -. - -MessageId=85 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_ASSIGNED -Language=Bulgarian -ERROR_ALREADY_ASSIGNED - The local device name is already in use. -. - -MessageId=86 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PASSWORD -Language=Bulgarian -ERROR_INVALID_PASSWORD - The specified network password is not correct. -. - -MessageId=87 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PARAMETER -Language=Bulgarian -ERROR_INVALID_PARAMETER - . -. - -MessageId=88 -Severity=Success -Facility=System -SymbolicName=ERROR_NET_WRITE_FAULT -Language=Bulgarian -ERROR_NET_WRITE_FAULT - A write fault occurred on the network. -. - -MessageId=89 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_PROC_SLOTS -Language=Bulgarian -ERROR_NO_PROC_SLOTS - The system cannot start another process at this time. -. - -MessageId=100 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_SEMAPHORES -Language=Bulgarian -ERROR_TOO_MANY_SEMAPHORES - Cannot create another system semaphore. -. - -MessageId=101 -Severity=Success -Facility=System -SymbolicName=ERROR_EXCL_SEM_ALREADY_OWNED -Language=Bulgarian -ERROR_EXCL_SEM_ALREADY_OWNED - The exclusive semaphore is owned by another process. -. - -MessageId=102 -Severity=Success -Facility=System -SymbolicName=ERROR_SEM_IS_SET -Language=Bulgarian -ERROR_SEM_IS_SET - The semaphore is set and cannot be closed. -. - -MessageId=103 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_SEM_REQUESTS -Language=Bulgarian -ERROR_TOO_MANY_SEM_REQUESTS - The semaphore cannot be set again. -. - -MessageId=104 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_AT_INTERRUPT_TIME -Language=Bulgarian -ERROR_INVALID_AT_INTERRUPT_TIME - Cannot request exclusive semaphores at interrupt time. -. - -MessageId=105 -Severity=Success -Facility=System -SymbolicName=ERROR_SEM_OWNER_DIED -Language=Bulgarian -ERROR_SEM_OWNER_DIED - The previous ownership of this semaphore has ended. -. - -MessageId=106 -Severity=Success -Facility=System -SymbolicName=ERROR_SEM_USER_LIMIT -Language=Bulgarian -ERROR_SEM_USER_LIMIT - %1. -. - -MessageId=107 -Severity=Success -Facility=System -SymbolicName=ERROR_DISK_CHANGE -Language=Bulgarian -ERROR_DISK_CHANGE - The program stopped because an alternate diskette was not inserted. -. - -MessageId=108 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVE_LOCKED -Language=Bulgarian -ERROR_DRIVE_LOCKED - The disk is in use or locked by another process. -. - -MessageId=109 -Severity=Success -Facility=System -SymbolicName=ERROR_BROKEN_PIPE -Language=Bulgarian -ERROR_BROKEN_PIPE - The pipe has been ended. -. - -MessageId=110 -Severity=Success -Facility=System -SymbolicName=ERROR_OPEN_FAILED -Language=Bulgarian -ERROR_OPEN_FAILED - . -. - -MessageId=111 -Severity=Success -Facility=System -SymbolicName=ERROR_BUFFER_OVERFLOW -Language=Bulgarian -ERROR_BUFFER_OVERFLOW - . -. - -MessageId=112 -Severity=Success -Facility=System -SymbolicName=ERROR_DISK_FULL -Language=Bulgarian -ERROR_DISK_FULL - There is not enough space on the disk. -. - -MessageId=113 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MORE_SEARCH_HANDLES -Language=Bulgarian -ERROR_NO_MORE_SEARCH_HANDLES - No more internal file identifiers available. -. - -MessageId=114 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_TARGET_HANDLE -Language=Bulgarian -ERROR_INVALID_TARGET_HANDLE - The target internal file identifier is incorrect. -. - -MessageId=117 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_CATEGORY -Language=Bulgarian -ERROR_INVALID_CATEGORY - The IOCTL call made by the application program is not correct. -. - -MessageId=118 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_VERIFY_SWITCH -Language=Bulgarian -ERROR_INVALID_VERIFY_SWITCH - The verify-on-write switch parameter value is not correct. -. - -MessageId=119 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_DRIVER_LEVEL -Language=Bulgarian -ERROR_BAD_DRIVER_LEVEL - The system does not support the command requested. -. - -MessageId=120 -Severity=Success -Facility=System -SymbolicName=ERROR_CALL_NOT_IMPLEMENTED -Language=Bulgarian -ERROR_CALL_NOT_IMPLEMENTED - . -. - -MessageId=121 -Severity=Success -Facility=System -SymbolicName=ERROR_SEM_TIMEOUT -Language=Bulgarian -ERROR_SEM_TIMEOUT - The semaphore timeout period has expired. -. - -MessageId=122 -Severity=Success -Facility=System -SymbolicName=ERROR_INSUFFICIENT_BUFFER -Language=Bulgarian -ERROR_INSUFFICIENT_BUFFER - The data area passed to a system call is too small. -. - -MessageId=123 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_NAME -Language=Bulgarian -ERROR_INVALID_NAME - , . -. - -MessageId=124 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LEVEL -Language=Bulgarian -ERROR_INVALID_LEVEL - The system call level is not correct. -. - -MessageId=125 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_VOLUME_LABEL -Language=Bulgarian -ERROR_NO_VOLUME_LABEL - . -. - -MessageId=126 -Severity=Success -Facility=System -SymbolicName=ERROR_MOD_NOT_FOUND -Language=Bulgarian -ERROR_MOD_NOT_FOUND - . -. - -MessageId=127 -Severity=Success -Facility=System -SymbolicName=ERROR_PROC_NOT_FOUND -Language=Bulgarian -ERROR_PROC_NOT_FOUND - . -. - -MessageId=128 -Severity=Success -Facility=System -SymbolicName=ERROR_WAIT_NO_CHILDREN -Language=Bulgarian -ERROR_WAIT_NO_CHILDREN - There are no child processes to wait for. -. - -MessageId=129 -Severity=Success -Facility=System -SymbolicName=ERROR_CHILD_NOT_COMPLETE -Language=Bulgarian -ERROR_CHILD_NOT_COMPLETE - %1 Win32. -. - -MessageId=130 -Severity=Success -Facility=System -SymbolicName=ERROR_DIRECT_ACCESS_HANDLE -Language=Bulgarian -ERROR_DIRECT_ACCESS_HANDLE - Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O. -. - -MessageId=131 -Severity=Success -Facility=System -SymbolicName=ERROR_NEGATIVE_SEEK -Language=Bulgarian -ERROR_NEGATIVE_SEEK - An attempt was made to move the file pointer before the beginning of the file. -. - -MessageId=132 -Severity=Success -Facility=System -SymbolicName=ERROR_SEEK_ON_DEVICE -Language=Bulgarian -ERROR_SEEK_ON_DEVICE - The file pointer cannot be set on the specified device or file. -. - -MessageId=133 -Severity=Success -Facility=System -SymbolicName=ERROR_IS_JOIN_TARGET -Language=Bulgarian -ERROR_IS_JOIN_TARGET - A JOIN or SUBST command cannot be used for a drive that contains previously joined drives. -. - -MessageId=134 -Severity=Success -Facility=System -SymbolicName=ERROR_IS_JOINED -Language=Bulgarian -ERROR_IS_JOINED - An attempt was made to use a JOIN or SUBST command on a drive that has already been joined. -. - -MessageId=135 -Severity=Success -Facility=System -SymbolicName=ERROR_IS_SUBSTED -Language=Bulgarian -ERROR_IS_SUBSTED - An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted. -. - -MessageId=136 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_JOINED -Language=Bulgarian -ERROR_NOT_JOINED - The system tried to delete the JOIN of a drive that is not joined. -. - -MessageId=137 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_SUBSTED -Language=Bulgarian -ERROR_NOT_SUBSTED - The system tried to delete the substitution of a drive that is not substituted. -. - -MessageId=138 -Severity=Success -Facility=System -SymbolicName=ERROR_JOIN_TO_JOIN -Language=Bulgarian -ERROR_JOIN_TO_JOIN - The system tried to join a drive to a directory on a joined drive. -. - -MessageId=139 -Severity=Success -Facility=System -SymbolicName=ERROR_SUBST_TO_SUBST -Language=Bulgarian -ERROR_SUBST_TO_SUBST - The system tried to substitute a drive to a directory on a substituted drive. -. - -MessageId=140 -Severity=Success -Facility=System -SymbolicName=ERROR_JOIN_TO_SUBST -Language=Bulgarian -ERROR_JOIN_TO_SUBST - The system tried to join a drive to a directory on a substituted drive. -. - -MessageId=141 -Severity=Success -Facility=System -SymbolicName=ERROR_SUBST_TO_JOIN -Language=Bulgarian -ERROR_SUBST_TO_JOIN - The system tried to SUBST a drive to a directory on a joined drive. -. - -MessageId=142 -Severity=Success -Facility=System -SymbolicName=ERROR_BUSY_DRIVE -Language=Bulgarian -ERROR_BUSY_DRIVE - The system cannot perform a JOIN or SUBST at this time. -. - -MessageId=143 -Severity=Success -Facility=System -SymbolicName=ERROR_SAME_DRIVE -Language=Bulgarian -ERROR_SAME_DRIVE - The system cannot join or substitute a drive to or for a directory on the same drive. -. - -MessageId=144 -Severity=Success -Facility=System -SymbolicName=ERROR_DIR_NOT_ROOT -Language=Bulgarian -ERROR_DIR_NOT_ROOT - The directory is not a subdirectory of the root directory. -. - -MessageId=145 -Severity=Success -Facility=System -SymbolicName=ERROR_DIR_NOT_EMPTY -Language=Bulgarian -ERROR_DIR_NOT_EMPTY - . -. - -MessageId=146 -Severity=Success -Facility=System -SymbolicName=ERROR_IS_SUBST_PATH -Language=Bulgarian -ERROR_IS_SUBST_PATH - The path specified is being used in a substitute. -. - -MessageId=147 -Severity=Success -Facility=System -SymbolicName=ERROR_IS_JOIN_PATH -Language=Bulgarian -ERROR_IS_JOIN_PATH - Not enough resources are available to process this command. -. - -MessageId=148 -Severity=Success -Facility=System -SymbolicName=ERROR_PATH_BUSY -Language=Bulgarian -ERROR_PATH_BUSY - . -. - -MessageId=149 -Severity=Success -Facility=System -SymbolicName=ERROR_IS_SUBST_TARGET -Language=Bulgarian -ERROR_IS_SUBST_TARGET - An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute. -. - -MessageId=150 -Severity=Success -Facility=System -SymbolicName=ERROR_SYSTEM_TRACE -Language=Bulgarian -ERROR_SYSTEM_TRACE - System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed. -. - -MessageId=151 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_EVENT_COUNT -Language=Bulgarian -ERROR_INVALID_EVENT_COUNT - The number of specified semaphore events for DosMuxSemWait is not correct. -. - -MessageId=152 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_MUXWAITERS -Language=Bulgarian -ERROR_TOO_MANY_MUXWAITERS - DosMuxSemWait did not execute; too many semaphores are already set. -. - -MessageId=153 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LIST_FORMAT -Language=Bulgarian -ERROR_INVALID_LIST_FORMAT - The DosMuxSemWait list is not correct. -. - -MessageId=154 -Severity=Success -Facility=System -SymbolicName=ERROR_LABEL_TOO_LONG -Language=Bulgarian -ERROR_LABEL_TOO_LONG - The volume label you entered exceeds the label character limit of the target file system. -. - -MessageId=155 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_TCBS -Language=Bulgarian -ERROR_TOO_MANY_TCBS - . -. - -MessageId=156 -Severity=Success -Facility=System -SymbolicName=ERROR_SIGNAL_REFUSED -Language=Bulgarian -ERROR_SIGNAL_REFUSED - The recipient process has refused the signal. -. - -MessageId=157 -Severity=Success -Facility=System -SymbolicName=ERROR_DISCARDED -Language=Bulgarian -ERROR_DISCARDED - The segment is already discarded and cannot be locked. -. - -MessageId=158 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_LOCKED -Language=Bulgarian -ERROR_NOT_LOCKED - The segment is already unlocked. -. - -MessageId=159 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_THREADID_ADDR -Language=Bulgarian -ERROR_BAD_THREADID_ADDR - The address for the thread ID is not correct. -. - -MessageId=160 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_ARGUMENTS -Language=Bulgarian -ERROR_BAD_ARGUMENTS - The argument string passed to DosExecPgm is not correct. -. - -MessageId=161 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_PATHNAME -Language=Bulgarian -ERROR_BAD_PATHNAME - . -. - -MessageId=162 -Severity=Success -Facility=System -SymbolicName=ERROR_SIGNAL_PENDING -Language=Bulgarian -ERROR_SIGNAL_PENDING - A signal is already pending. -. - -MessageId=164 -Severity=Success -Facility=System -SymbolicName=ERROR_MAX_THRDS_REACHED -Language=Bulgarian -ERROR_MAX_THRDS_REACHED - No more threads can be created in the system. -. - -MessageId=167 -Severity=Success -Facility=System -SymbolicName=ERROR_LOCK_FAILED -Language=Bulgarian -ERROR_LOCK_FAILED - Unable to lock a region of a file. -. - -MessageId=170 -Severity=Success -Facility=System -SymbolicName=ERROR_BUSY -Language=Bulgarian -ERROR_BUSY - . -. - -MessageId=173 -Severity=Success -Facility=System -SymbolicName=ERROR_CANCEL_VIOLATION -Language=Bulgarian -ERROR_CANCEL_VIOLATION - A lock request was not outstanding for the supplied cancel region. -. - -MessageId=174 -Severity=Success -Facility=System -SymbolicName=ERROR_ATOMIC_LOCKS_NOT_SUPPORTED -Language=Bulgarian -ERROR_ATOMIC_LOCKS_NOT_SUPPORTED - The file system does not support atomic changes to the lock type. -. - -MessageId=180 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SEGMENT_NUMBER -Language=Bulgarian -ERROR_INVALID_SEGMENT_NUMBER - The system detected a segment number that was not correct. -. - -MessageId=182 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ORDINAL -Language=Bulgarian -ERROR_INVALID_ORDINAL - %1. -. - -MessageId=183 -Severity=Success -Facility=System -SymbolicName=ERROR_ALREADY_EXISTS -Language=Bulgarian -ERROR_ALREADY_EXISTS - Cannot create a file when that file already exists. -. - -MessageId=186 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_FLAG_NUMBER -Language=Bulgarian -ERROR_INVALID_FLAG_NUMBER - The flag passed is not correct. -. - -MessageId=187 -Severity=Success -Facility=System -SymbolicName=ERROR_SEM_NOT_FOUND -Language=Bulgarian -ERROR_SEM_NOT_FOUND - The specified system semaphore name was not found. -. - -MessageId=188 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_STARTING_CODESEG -Language=Bulgarian -ERROR_INVALID_STARTING_CODESEG - %1. -. - -MessageId=189 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_STACKSEG -Language=Bulgarian -ERROR_INVALID_STACKSEG - %1. -. - -MessageId=190 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MODULETYPE -Language=Bulgarian -ERROR_INVALID_MODULETYPE - %1. -. - -MessageId=191 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_EXE_SIGNATURE -Language=Bulgarian -ERROR_INVALID_EXE_SIGNATURE - %1 Win32. -. - -MessageId=192 -Severity=Success -Facility=System -SymbolicName=ERROR_EXE_MARKED_INVALID -Language=Bulgarian -ERROR_EXE_MARKED_INVALID - %1. -. - -MessageId=193 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_EXE_FORMAT -Language=Bulgarian -ERROR_BAD_EXE_FORMAT - %1 Win32 . -. - -MessageId=194 -Severity=Success -Facility=System -SymbolicName=ERROR_ITERATED_DATA_EXCEEDS_64k -Language=Bulgarian -ERROR_ITERATED_DATA_EXCEEDS_64k - %1. -. - -MessageId=195 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_MINALLOCSIZE -Language=Bulgarian -ERROR_INVALID_MINALLOCSIZE - %1. -. - -MessageId=196 -Severity=Success -Facility=System -SymbolicName=ERROR_DYNLINK_FROM_INVALID_RING -Language=Bulgarian -ERROR_DYNLINK_FROM_INVALID_RING - The operating system cannot run this application program. -. - -MessageId=197 -Severity=Success -Facility=System -SymbolicName=ERROR_IOPL_NOT_ENABLED -Language=Bulgarian -ERROR_IOPL_NOT_ENABLED - The operating system is not presently configured to run this application. -. - -MessageId=198 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SEGDPL -Language=Bulgarian -ERROR_INVALID_SEGDPL - %1. -. - -MessageId=199 -Severity=Success -Facility=System -SymbolicName=ERROR_AUTODATASEG_EXCEEDS_64k -Language=Bulgarian -ERROR_AUTODATASEG_EXCEEDS_64k - The operating system cannot run this application program. -. - -MessageId=200 -Severity=Success -Facility=System -SymbolicName=ERROR_RING2SEG_MUST_BE_MOVABLE -Language=Bulgarian -ERROR_RING2SEG_MUST_BE_MOVABLE - The code segment cannot be greater than or equal to 64K. -. - -MessageId=201 -Severity=Success -Facility=System -SymbolicName=ERROR_RELOC_CHAIN_XEEDS_SEGLIM -Language=Bulgarian -ERROR_RELOC_CHAIN_XEEDS_SEGLIM - %1. -. - -MessageId=202 -Severity=Success -Facility=System -SymbolicName=ERROR_INFLOOP_IN_RELOC_CHAIN -Language=Bulgarian -ERROR_INFLOOP_IN_RELOC_CHAIN - %1. -. - -MessageId=203 -Severity=Success -Facility=System -SymbolicName=ERROR_ENVVAR_NOT_FOUND -Language=Bulgarian -ERROR_ENVVAR_NOT_FOUND - The system could not find the environment option that was entered. -. - -MessageId=205 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_SIGNAL_SENT -Language=Bulgarian -ERROR_NO_SIGNAL_SENT - No process in the command subtree has a signal handler. -. - -MessageId=206 -Severity=Success -Facility=System -SymbolicName=ERROR_FILENAME_EXCED_RANGE -Language=Bulgarian -ERROR_FILENAME_EXCED_RANGE - . -. - -MessageId=207 -Severity=Success -Facility=System -SymbolicName=ERROR_RING2_STACK_IN_USE -Language=Bulgarian -ERROR_RING2_STACK_IN_USE - The ring 2 stack is in use. -. - -MessageId=208 -Severity=Success -Facility=System -SymbolicName=ERROR_META_EXPANSION_TOO_LONG -Language=Bulgarian -ERROR_META_EXPANSION_TOO_LONG - The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified. -. - -MessageId=209 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_SIGNAL_NUMBER -Language=Bulgarian -ERROR_INVALID_SIGNAL_NUMBER - The signal being posted is not correct. -. - -MessageId=210 -Severity=Success -Facility=System -SymbolicName=ERROR_THREAD_1_INACTIVE -Language=Bulgarian -ERROR_THREAD_1_INACTIVE - The signal handler cannot be set. -. - -MessageId=212 -Severity=Success -Facility=System -SymbolicName=ERROR_LOCKED -Language=Bulgarian -ERROR_LOCKED - The segment is locked and cannot be reallocated. -. - -MessageId=214 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_MODULES -Language=Bulgarian -ERROR_TOO_MANY_MODULES - Too many dynamic-link modules are attached to this program or dynamic-link module. -. - -MessageId=215 -Severity=Success -Facility=System -SymbolicName=ERROR_NESTING_NOT_ALLOWED -Language=Bulgarian -ERROR_NESTING_NOT_ALLOWED - Cannot nest calls to LoadModule. -. - -MessageId=216 -Severity=Success -Facility=System -SymbolicName=ERROR_EXE_MACHINE_TYPE_MISMATCH -Language=Bulgarian -ERROR_EXE_MACHINE_TYPE_MISMATCH - The image file %1 is valid, but is for a machine type other than the current machine. -. - -MessageId=217 -Severity=Success -Facility=System -SymbolicName=ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY -Language=Bulgarian -ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY - The image file %1 is signed, unable to modify. -. - -MessageId=218 -Severity=Success -Facility=System -SymbolicName=ERRO_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY -Language=Bulgarian -ERRO_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY - The image file %1 is strong signed, unable to modify. -. - -MessageId=230 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_PIPE -Language=Bulgarian -ERROR_BAD_PIPE - The pipe state is invalid. -. - -MessageId=231 -Severity=Success -Facility=System -SymbolicName=ERROR_PIPE_BUSY -Language=Bulgarian -ERROR_PIPE_BUSY - All pipe instances are busy. -. - -MessageId=232 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_DATA -Language=Bulgarian -ERROR_NO_DATA - The pipe is being closed. -. - -MessageId=233 -Severity=Success -Facility=System -SymbolicName=ERROR_PIPE_NOT_CONNECTED -Language=Bulgarian -ERROR_PIPE_NOT_CONNECTED - No process is on the other end of the pipe. -. - -MessageId=234 -Severity=Success -Facility=System -SymbolicName=ERROR_MORE_DATA -Language=Bulgarian -ERROR_MORE_DATA - . -. - -MessageId=240 -Severity=Success -Facility=System -SymbolicName=ERROR_VC_DISCONNECTED -Language=Bulgarian -ERROR_VC_DISCONNECTED - . -. - -MessageId=254 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_EA_NAME -Language=Bulgarian -ERROR_INVALID_EA_NAME - The specified extended attribute name was invalid. -. - -MessageId=255 -Severity=Success -Facility=System -SymbolicName=ERROR_EA_LIST_INCONSISTENT -Language=Bulgarian -ERROR_EA_LIST_INCONSISTENT - . -. - -MessageId=258 -Severity=Success -Facility=System -SymbolicName=WAIT_TIMEOUT -Language=Bulgarian -WAIT_TIMEOUT - The wait operation timed out. -. - -MessageId=259 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MORE_ITEMS -Language=Bulgarian -ERROR_NO_MORE_ITEMS - No more data is available. -. - -MessageId=266 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_COPY -Language=Bulgarian -ERROR_CANNOT_COPY - . -. - -MessageId=267 -Severity=Success -Facility=System -SymbolicName=ERROR_DIRECTORY -Language=Bulgarian -ERROR_DIRECTORY - . -. - -MessageId=275 -Severity=Success -Facility=System -SymbolicName=ERROR_EAS_DIDNT_FIT -Language=Bulgarian -ERROR_EAS_DIDNT_FIT - The extended attributes did not fit in the buffer. -. - -MessageId=276 -Severity=Success -Facility=System -SymbolicName=ERROR_EA_FILE_CORRUPT -Language=Bulgarian -ERROR_EA_FILE_CORRUPT - The extended attribute file on the mounted file system is corrupt. -. - -MessageId=277 -Severity=Success -Facility=System -SymbolicName=ERROR_EA_TABLE_FULL -Language=Bulgarian -ERROR_EA_TABLE_FULL - The extended attribute table file is full. -. - -MessageId=278 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_EA_HANDLE -Language=Bulgarian -ERROR_INVALID_EA_HANDLE - The specified extended attribute handle is invalid. -. - -MessageId=282 -Severity=Success -Facility=System -SymbolicName=ERROR_EAS_NOT_SUPPORTED -Language=Bulgarian -ERROR_EAS_NOT_SUPPORTED - . -. - -MessageId=288 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_OWNER -Language=Bulgarian -ERROR_NOT_OWNER - Attempt to release mutex not owned by caller. -. - -MessageId=298 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_POSTS -Language=Bulgarian -ERROR_TOO_MANY_POSTS - Too many posts were made to a semaphore. -. - -MessageId=299 -Severity=Success -Facility=System -SymbolicName=ERROR_PARTIAL_COPY -Language=Bulgarian -ERROR_PARTIAL_COPY - Only part of a ReadProcessMemory or WriteProcessMemory request was completed. -. - -MessageId=300 -Severity=Success -Facility=System -SymbolicName=ERROR_OPLOCK_NOT_GRANTED -Language=Bulgarian -ERROR_OPLOCK_NOT_GRANTED - The oplock request is denied. -. - -MessageId=301 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_OPLOCK_PROTOCOL -Language=Bulgarian -ERROR_INVALID_OPLOCK_PROTOCOL - An invalid oplock acknowledgment was received by the system. -. - -MessageId=302 -Severity=Success -Facility=System -SymbolicName=ERROR_DISK_TOO_FRAGMENTED -Language=Bulgarian -ERROR_DISK_TOO_FRAGMENTED - The volume is too fragmented to complete this operation. -. - -MessageId=303 -Severity=Success -Facility=System -SymbolicName=ERROR_DELETE_PENDING -Language=Bulgarian -ERROR_DELETE_PENDING - The file cannot be opened because it is in the process of being deleted. -. - -MessageId=317 -Severity=Success -Facility=System -SymbolicName=ERROR_MR_MID_NOT_FOUND -Language=Bulgarian -ERROR_MR_MID_NOT_FOUND - The system cannot find message text for message number 0x%1 in the message file for %2. -. - -MessageId=318 -Severity=Success -Facility=System -SymbolicName=ERROR_SCOPE_NOT_FOUND -Language=Bulgarian -ERROR_SCOPE_NOT_FOUND - The scope specified was not found. -. - -MessageId=487 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_ADDRESS -Language=Bulgarian -ERROR_INVALID_ADDRESS - Attempt to access invalid address. -. - -MessageId=534 -Severity=Success -Facility=System -SymbolicName=ERROR_ARITHMETIC_OVERFLOW -Language=Bulgarian -ERROR_ARITHMETIC_OVERFLOW - Arithmetic result exceeded 32 bits. -. - -MessageId=535 -Severity=Success -Facility=System -SymbolicName=ERROR_PIPE_CONNECTED -Language=Bulgarian -ERROR_PIPE_CONNECTED - There is a process on other end of the pipe. -. - -MessageId=536 -Severity=Success -Facility=System -SymbolicName=ERROR_PIPE_LISTENING -Language=Bulgarian -ERROR_PIPE_LISTENING - Waiting for a process to open the other end of the pipe. -. - -MessageId=537 -Severity=Success -Facility=System -SymbolicName=ERROR_ACPI_ERROR -Language=Bulgarian -ERROR_ACPI_ERROR - ACPI. -. - -MessageId=538 -Severity=Success -Facility=System -SymbolicName=ERROR_ABIOS_ERROR -Language=Bulgarian -ERROR_ABIOS_ERROR - ABIOS. -. - -MessageId=539 -Severity=Success -Facility=System -SymbolicName=ERROR_WX86_WARNING -Language=Bulgarian -ERROR_WX86_WARNING - A warning occurred in the WX86 subsystem. -. - -MessageId=540 -Severity=Success -Facility=System -SymbolicName=ERROR_WX86_ERROR -Language=Bulgarian -ERROR_WX86_ERROR - WX86. -. - -MessageId=541 -Severity=Success -Facility=System -SymbolicName=ERROR_TIMER_NOT_CANCELED -Language=Bulgarian -ERROR_TIMER_NOT_CANCELED - An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated APC routine. -. - -MessageId=542 -Severity=Success -Facility=System -SymbolicName=ERROR_UNWIND -Language=Bulgarian -ERROR_UNWIND - Unwind exception code. -. - -MessageId=543 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_STACK -Language=Bulgarian -ERROR_BAD_STACK - An invalid or unaligned stack was encountered during an unwind operation. -. - -MessageId=544 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_UNWIND_TARGET -Language=Bulgarian -ERROR_INVALID_UNWIND_TARGET - An invalid unwind target was encountered during an unwind operation. -. - -MessageId=545 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PORT_ATTRIBUTES -Language=Bulgarian -ERROR_INVALID_PORT_ATTRIBUTES - Invalid Object Attributes specified to NtCreatePort or invalid Port Attributes specified to NtConnectPort -. - -MessageId=546 -Severity=Success -Facility=System -SymbolicName=ERROR_PORT_MESSAGE_TOO_LONG -Language=Bulgarian -ERROR_PORT_MESSAGE_TOO_LONG - Length of message passed to NtRequestPort or NtRequestWaitReplyPort was longer than the maximum message allowed by the port. -. - -MessageId=547 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_QUOTA_LOWER -Language=Bulgarian -ERROR_INVALID_QUOTA_LOWER - An attempt was made to lower a quota limit below the current usage. -. - -MessageId=548 -Severity=Success -Facility=System -SymbolicName=ERROR_DEVICE_ALREADY_ATTACHED -Language=Bulgarian -ERROR_DEVICE_ALREADY_ATTACHED - An attempt was made to attach to a device that was already attached to another device. -. - -MessageId=549 -Severity=Success -Facility=System -SymbolicName=ERROR_INSTRUCTION_MISALIGNMENT -Language=Bulgarian -ERROR_INSTRUCTION_MISALIGNMENT - An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references. -. - -MessageId=550 -Severity=Success -Facility=System -SymbolicName=ERROR_PROFILING_NOT_STARTED -Language=Bulgarian -ERROR_PROFILING_NOT_STARTED - Profiling not started. -. - -MessageId=551 -Severity=Success -Facility=System -SymbolicName=ERROR_PROFILING_NOT_STOPPED -Language=Bulgarian -ERROR_PROFILING_NOT_STOPPED - Profiling not stopped. -. - -MessageId=552 -Severity=Success -Facility=System -SymbolicName=ERROR_COULD_NOT_INTERPRET -Language=Bulgarian -ERROR_COULD_NOT_INTERPRET - The passed ACL did not contain the minimum required information. -. - -MessageId=553 -Severity=Success -Facility=System -SymbolicName=ERROR_PROFILING_AT_LIMIT -Language=Bulgarian -ERROR_PROFILING_AT_LIMIT - The number of active profiling objects is at the maximum and no more may be started. -. - -MessageId=554 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_WAIT -Language=Bulgarian -ERROR_CANT_WAIT - Used to indicate that an operation cannot continue without blocking for I/O. -. - -MessageId=555 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_TERMINATE_SELF -Language=Bulgarian -ERROR_CANT_TERMINATE_SELF - Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process. -. - -MessageId=556 -Severity=Success -Facility=System -SymbolicName=ERROR_UNEXPECTED_MM_CREATE_ERR -Language=Bulgarian -ERROR_UNEXPECTED_MM_CREATE_ERR - If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception. -. - -MessageId=557 -Severity=Success -Facility=System -SymbolicName=ERROR_UNEXPECTED_MM_MAP_ERROR -Language=Bulgarian -ERROR_UNEXPECTED_MM_MAP_ERROR - If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception. -. - -MessageId=558 -Severity=Success -Facility=System -SymbolicName=ERROR_UNEXPECTED_MM_EXTEND_ERR -Language=Bulgarian -ERROR_UNEXPECTED_MM_EXTEND_ERR - If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter. In this case information is lost, however, the filter correctly handles the exception. -. - -MessageId=559 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_FUNCTION_TABLE -Language=Bulgarian -ERROR_BAD_FUNCTION_TABLE - A malformed function table was encountered during an unwind operation. -. - -MessageId=560 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_GUID_TRANSLATION -Language=Bulgarian -ERROR_NO_GUID_TRANSLATION - Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system. This causes the protection attempt to fail, which may cause a file creation attempt to fail. -. - -MessageId=561 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LDT_SIZE -Language=Bulgarian -ERROR_INVALID_LDT_SIZE - Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors. -. - -MessageId=563 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LDT_OFFSET -Language=Bulgarian -ERROR_INVALID_LDT_OFFSET - Indicates that the starting value for the LDT information was not an integral multiple of the selector size. -. - -MessageId=564 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_LDT_DESCRIPTOR -Language=Bulgarian -ERROR_INVALID_LDT_DESCRIPTOR - Indicates that the user supplied an invalid descriptor when trying to set up Ldt descriptors. -. - -MessageId=565 -Severity=Success -Facility=System -SymbolicName=ERROR_TOO_MANY_THREADS -Language=Bulgarian -ERROR_TOO_MANY_THREADS - Indicates a process has too many threads to perform the requested action. For example, assignment of a primary token may only be performed when a process has zero or one threads. -. - -MessageId=566 -Severity=Success -Facility=System -SymbolicName=ERROR_THREAD_NOT_IN_PROCESS -Language=Bulgarian -ERROR_THREAD_NOT_IN_PROCESS - An attempt was made to operate on a thread within a specific process, but the thread specified is not in the process specified. -. - -MessageId=567 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGEFILE_QUOTA_EXCEEDED -Language=Bulgarian -ERROR_PAGEFILE_QUOTA_EXCEEDED - Page file quota was exceeded. -. - -MessageId=568 -Severity=Success -Facility=System -SymbolicName=ERROR_LOGON_SERVER_CONFLICT -Language=Bulgarian -ERROR_LOGON_SERVER_CONFLICT - The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role. -. - -MessageId=569 -Severity=Success -Facility=System -SymbolicName=ERROR_SYNCHRONIZATION_REQUIRED -Language=Bulgarian -ERROR_SYNCHRONIZATION_REQUIRED - The SAM database on a Windows Server is significantly out of synchronization with the copy on the Domain Controller. A complete synchronization is required. -. - -MessageId=570 -Severity=Success -Facility=System -SymbolicName=ERROR_NET_OPEN_FAILED -Language=Bulgarian -ERROR_NET_OPEN_FAILED - The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routines. -. - -MessageId=571 -Severity=Success -Facility=System -SymbolicName=ERROR_IO_PRIVILEGE_FAILED -Language=Bulgarian -ERROR_IO_PRIVILEGE_FAILED - The I/O permissions for the process could not be changed. -. - -MessageId=572 -Severity=Success -Facility=System -SymbolicName=ERROR_CONTROL_C_EXIT -Language=Bulgarian -ERROR_CONTROL_C_EXIT - The application terminated as a result of a CTRL+C. -. - -MessageId=573 -Severity=Success -Facility=System -SymbolicName=ERROR_MISSING_SYSTEMFILE -Language=Bulgarian -ERROR_MISSING_SYSTEMFILE - The required system file %hs is bad or missing. -. - -MessageId=574 -Severity=Success -Facility=System -SymbolicName=ERROR_UNHANDLED_EXCEPTION -Language=Bulgarian -ERROR_UNHANDLED_EXCEPTION - The exception %s (0x%08lx) occurred in the application at location 0x%08lx. -. - -MessageId=575 -Severity=Success -Facility=System -SymbolicName=ERROR_APP_INIT_FAILURE -Language=Bulgarian -ERROR_APP_INIT_FAILURE - The application failed to initialize properly (0x%lx). Click on OK to terminate the application. -. - -MessageId=576 -Severity=Success -Facility=System -SymbolicName=ERROR_PAGEFILE_CREATE_FAILED -Language=Bulgarian -ERROR_PAGEFILE_CREATE_FAILED - The creation of the paging file %hs failed (%lx). The requested size was %ld. -. - -MessageId=578 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_PAGEFILE -Language=Bulgarian -ERROR_NO_PAGEFILE - No paging file was specified in the system configuration. -. - -MessageId=579 -Severity=Success -Facility=System -SymbolicName=ERROR_ILLEGAL_FLOAT_CONTEXT -Language=Bulgarian -ERROR_ILLEGAL_FLOAT_CONTEXT - A real-mode application issued a floating-point instruction and floating-point hardware is not present. -. - -MessageId=580 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_EVENT_PAIR -Language=Bulgarian -ERROR_NO_EVENT_PAIR - An event pair synchronization operation was performed using the thread specific client/server event pair object, but no event pair object was associated with the thread. -. - -MessageId=581 -Severity=Success -Facility=System -SymbolicName=ERROR_DOMAIN_CTRLR_CONFIG_ERROR -Language=Bulgarian -ERROR_DOMAIN_CTRLR_CONFIG_ERROR - A Windows Server has an incorrect configuration. -. - -MessageId=582 -Severity=Success -Facility=System -SymbolicName=ERROR_ILLEGAL_CHARACTER -Language=Bulgarian -ERROR_ILLEGAL_CHARACTER - An illegal character was encountered. For a multi-byte character set this includes a lead byte without a succeeding trail byte. For the Unicode character set this includes the characters 0xFFFF and 0xFFFE. -. - -MessageId=583 -Severity=Success -Facility=System -SymbolicName=ERROR_UNDEFINED_CHARACTER -Language=Bulgarian -ERROR_UNDEFINED_CHARACTER - The Unicode character is not defined in the Unicode character set installed on the system. -. - -MessageId=584 -Severity=Success -Facility=System -SymbolicName=ERROR_FLOPPY_VOLUME -Language=Bulgarian -ERROR_FLOPPY_VOLUME - The paging file cannot be created on a floppy diskette. -. - -MessageId=585 -Severity=Success -Facility=System -SymbolicName=ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT -Language=Bulgarian -ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT - The system bios failed to connect a system interrupt to the device or bus for which the device is connected. -. - -MessageId=586 -Severity=Success -Facility=System -SymbolicName=ERROR_BACKUP_CONTROLLER -Language=Bulgarian -ERROR_BACKUP_CONTROLLER - This operation is only allowed for the Primary Domain Controller of the domain. -. - -MessageId=587 -Severity=Success -Facility=System -SymbolicName=ERROR_MUTANT_LIMIT_EXCEEDED -Language=Bulgarian -ERROR_MUTANT_LIMIT_EXCEEDED - An attempt was made to acquire a mutant such that its maximum count would have been exceeded. -. - -MessageId=588 -Severity=Success -Facility=System -SymbolicName=ERROR_FS_DRIVER_REQUIRED -Language=Bulgarian -ERROR_FS_DRIVER_REQUIRED - A volume has been accessed for which a file system driver is required that has not yet been loaded. -. - -MessageId=589 -Severity=Success -Facility=System -SymbolicName=ERROR_CANNOT_LOAD_REGISTRY_FILE -Language=Bulgarian -ERROR_CANNOT_LOAD_REGISTRY_FILE - The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable. -. - -MessageId=590 -Severity=Success -Facility=System -SymbolicName=ERROR_DEBUG_ATTACH_FAILED -Language=Bulgarian -ERROR_DEBUG_ATTACH_FAILED - An unexpected failure occurred while processing a DebugActiveProcess API request. You may choose OK to terminate the process, or Cancel to ignore the error. -. - -MessageId=591 -Severity=Success -Facility=System -SymbolicName=ERROR_SYSTEM_PROCESS_TERMINATED -Language=Bulgarian -ERROR_SYSTEM_PROCESS_TERMINATED - The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down. -. - -MessageId=592 -Severity=Success -Facility=System -SymbolicName=ERROR_DATA_NOT_ACCEPTED -Language=Bulgarian -ERROR_DATA_NOT_ACCEPTED - The TDI client could not handle the data received during an indication. -. - -MessageId=593 -Severity=Success -Facility=System -SymbolicName=ERROR_VDM_HARD_ERROR -Language=Bulgarian -ERROR_VDM_HARD_ERROR - NTVDM encountered a hard error. -. - -MessageId=594 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVER_CANCEL_TIMEOUT -Language=Bulgarian -ERROR_DRIVER_CANCEL_TIMEOUT - The driver %hs failed to complete a cancelled I/O request in the allotted time. -. - -MessageId=595 -Severity=Success -Facility=System -SymbolicName=ERROR_REPLY_MESSAGE_MISMATCH -Language=Bulgarian -ERROR_REPLY_MESSAGE_MISMATCH - An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message. -. - -MessageId=596 -Severity=Success -Facility=System -SymbolicName=ERROR_LOST_WRITEBEHIND_DATA -Language=Bulgarian -ERROR_LOST_WRITEBEHIND_DATA - Windows was unable to save all the data for the file %hs. The data has been lost. This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere. -. - -MessageId=597 -Severity=Success -Facility=System -SymbolicName=ERROR_CLIENT_SERVER_PARAMETERS_INVALID -Language=Bulgarian -ERROR_CLIENT_SERVER_PARAMETERS_INVALID - The parameter(s) passed to the server in the client/server shared memory window were invalid. Too much data may have been put in the shared memory window. -. - -MessageId=598 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_TINY_STREAM -Language=Bulgarian -ERROR_NOT_TINY_STREAM - The stream is not a tiny stream. -. - -MessageId=599 -Severity=Success -Facility=System -SymbolicName=ERROR_STACK_OVERFLOW_READ -Language=Bulgarian -ERROR_STACK_OVERFLOW_READ - The request must be handled by the stack overflow code. -. - -MessageId=600 -Severity=Success -Facility=System -SymbolicName=ERROR_CONVERT_TO_LARGE -Language=Bulgarian -ERROR_CONVERT_TO_LARGE - Internal OFS status codes indicating how an allocation operation is handled. Either it is retried after the containing onode is moved or the extent stream is converted to a large stream. -. - -MessageId=601 -Severity=Success -Facility=System -SymbolicName=ERROR_FOUND_OUT_OF_SCOPE -Language=Bulgarian -ERROR_FOUND_OUT_OF_SCOPE - The attempt to find the object found an object matching by ID on the volume but it is out of the scope of the handle used for the operation. -. - -MessageId=602 -Severity=Success -Facility=System -SymbolicName=ERROR_ALLOCATE_BUCKET -Language=Bulgarian -ERROR_ALLOCATE_BUCKET - The bucket array must be grown. Retry transaction after doing so. -. - -MessageId=603 -Severity=Success -Facility=System -SymbolicName=ERROR_MARSHALL_OVERFLOW -Language=Bulgarian -ERROR_MARSHALL_OVERFLOW - The user/kernel marshalling buffer has overflowed. -. - -MessageId=604 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_VARIANT -Language=Bulgarian -ERROR_INVALID_VARIANT - The supplied variant structure contains invalid data. -. - -MessageId=605 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_COMPRESSION_BUFFER -Language=Bulgarian -ERROR_BAD_COMPRESSION_BUFFER - The specified buffer contains ill-formed data. -. - -MessageId=606 -Severity=Success -Facility=System -SymbolicName=ERROR_AUDIT_FAILED -Language=Bulgarian -ERROR_AUDIT_FAILED - An attempt to generate a security audit failed. -. - -MessageId=607 -Severity=Success -Facility=System -SymbolicName=ERROR_TIMER_RESOLUTION_NOT_SET -Language=Bulgarian -ERROR_TIMER_RESOLUTION_NOT_SET - The timer resolution was not previously set by the current process. -. - -MessageId=608 -Severity=Success -Facility=System -SymbolicName=ERROR_INSUFFICIENT_LOGON_INFO -Language=Bulgarian -ERROR_INSUFFICIENT_LOGON_INFO - There is insufficient account information to log you on. -. - -MessageId=609 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_DLL_ENTRYPOINT -Language=Bulgarian -ERROR_BAD_DLL_ENTRYPOINT - The dynamic link library %hs is not written correctly. The stack pointer has been left in an inconsistent state. The entrypoint should be declared as WINAPI or STDCALL. Select YES to fail the DLL load. Select NO to continue execution. Selecting NO may cause the application to operate incorrectly. -. - -MessageId=610 -Severity=Success -Facility=System -SymbolicName=ERROR_BAD_SERVICE_ENTRYPOINT -Language=Bulgarian -ERROR_BAD_SERVICE_ENTRYPOINT - The %hs service is not written correctly. The stack pointer has been left in an inconsistent state. The callback entrypoint should be declared as WINAPI or STDCALL. Selecting OK will cause the service to continue operation. However, the service process may operate incorrectly. -. - -MessageId=611 -Severity=Success -Facility=System -SymbolicName=ERROR_IP_ADDRESS_CONFLICT1 -Language=Bulgarian -ERROR_IP_ADDRESS_CONFLICT1 - There is an IP address conflict with another system on the network -. - -MessageId=612 -Severity=Success -Facility=System -SymbolicName=ERROR_IP_ADDRESS_CONFLICT2 -Language=Bulgarian -ERROR_IP_ADDRESS_CONFLICT2 - There is an IP address conflict with another system on the network -. - -MessageId=613 -Severity=Success -Facility=System -SymbolicName=ERROR_REGISTRY_QUOTA_LIMIT -Language=Bulgarian -ERROR_REGISTRY_QUOTA_LIMIT - The system has reached the maximum size allowed for the system part of the registry. Additional storage requests will be ignored. -. - -MessageId=614 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_CALLBACK_ACTIVE -Language=Bulgarian -ERROR_NO_CALLBACK_ACTIVE - A callback return system service cannot be executed when no callback is active. -. - -MessageId=615 -Severity=Success -Facility=System -SymbolicName=ERROR_PWD_TOO_SHORT -Language=Bulgarian -ERROR_PWD_TOO_SHORT - The password provided is too short to meet the policy of your user account. Please choose a longer password. -. - -MessageId=616 -Severity=Success -Facility=System -SymbolicName=ERROR_PWD_TOO_RECENT -Language=Bulgarian -ERROR_PWD_TOO_RECENT - The policy of your user account does not allow you to change passwords too frequently. This is done to prevent users from changing back to a familiar, but potentially discovered, password. If you feel your password has been compromised then please contact your administrator immediately to have a new one assigned. -. - -MessageId=617 -Severity=Success -Facility=System -SymbolicName=ERROR_PWD_HISTORY_CONFLICT -Language=Bulgarian -ERROR_PWD_HISTORY_CONFLICT - You have attempted to change your password to one that you have used in the past. The policy of your user account does not allow this. Please select a password that you have not previously used. -. - -MessageId=618 -Severity=Success -Facility=System -SymbolicName=ERROR_UNSUPPORTED_COMPRESSION -Language=Bulgarian -ERROR_UNSUPPORTED_COMPRESSION - The specified compression format is unsupported. -. - -MessageId=619 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_HW_PROFILE -Language=Bulgarian -ERROR_INVALID_HW_PROFILE - The specified hardware profile configuration is invalid. -. - -MessageId=620 -Severity=Success -Facility=System -SymbolicName=ERROR_INVALID_PLUGPLAY_DEVICE_PATH -Language=Bulgarian -ERROR_INVALID_PLUGPLAY_DEVICE_PATH - The specified Plug and Play registry device path is invalid. -. - -MessageId=621 -Severity=Success -Facility=System -SymbolicName=ERROR_QUOTA_LIST_INCONSISTENT -Language=Bulgarian -ERROR_QUOTA_LIST_INCONSISTENT - The specified quota list is internally inconsistent with its descriptor. -. - -MessageId=622 -Severity=Success -Facility=System -SymbolicName=ERROR_EVALUATION_EXPIRATION -Language=Bulgarian -ERROR_EVALUATION_EXPIRATION - The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour. To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product. -. - -MessageId=623 -Severity=Success -Facility=System -SymbolicName=ERROR_ILLEGAL_DLL_RELOCATION -Language=Bulgarian -ERROR_ILLEGAL_DLL_RELOCATION - The system DLL %hs was relocated in memory. The application will not run properly. The relocation occurred because the DLL %hs occupied an address range reserved for Windows system DLLs. The vendor supplying the DLL should be contacted for a new DLL. -. - -MessageId=624 -Severity=Success -Facility=System -SymbolicName=ERROR_DLL_INIT_FAILED_LOGOFF -Language=Bulgarian -ERROR_DLL_INIT_FAILED_LOGOFF - The application failed to initialize because the window station is shutting down. -. - -MessageId=625 -Severity=Success -Facility=System -SymbolicName=ERROR_VALIDATE_CONTINUE -Language=Bulgarian -ERROR_VALIDATE_CONTINUE - The validation process needs to continue on to the next step. -. - -MessageId=626 -Severity=Success -Facility=System -SymbolicName=ERROR_NO_MORE_MATCHES -Language=Bulgarian -ERROR_NO_MORE_MATCHES - There are no more matches for the current index enumeration. -. - -MessageId=627 -Severity=Success -Facility=System -SymbolicName=ERROR_RANGE_LIST_CONFLICT -Language=Bulgarian -ERROR_RANGE_LIST_CONFLICT - The range could not be added to the range list because of a conflict. -. - -MessageId=628 -Severity=Success -Facility=System -SymbolicName=ERROR_SERVER_SID_MISMATCH -Language=Bulgarian -ERROR_SERVER_SID_MISMATCH - The server process is running under a SID different than that required by client. -. - -MessageId=629 -Severity=Success -Facility=System -SymbolicName=ERROR_CANT_ENABLE_DENY_ONLY -Language=Bulgarian -ERROR_CANT_ENABLE_DENY_ONLY - A group marked use for deny only cannot be enabled. -. - -MessageId=630 -Severity=Success -Facility=System -SymbolicName=ERROR_FLOAT_MULTIPLE_FAULTS -Language=Bulgarian -ERROR_FLOAT_MULTIPLE_FAULTS - Multiple floating point faults. -. - -MessageId=631 -Severity=Success -Facility=System -SymbolicName=ERROR_FLOAT_MULTIPLE_TRAPS -Language=Bulgarian -ERROR_FLOAT_MULTIPLE_TRAPS - Multiple floating point traps. -. - -MessageId=632 -Severity=Success -Facility=System -SymbolicName=ERROR_NOINTERFACE -Language=Bulgarian -ERROR_NOINTERFACE - The requested interface is not supported. -. - -MessageId=633 -Severity=Success -Facility=System -SymbolicName=ERROR_DRIVER_FAILED_SLEEP -Language=Bulgarian -ERROR_DRIVER_FAILED_SLEEP - The driver %hs does not support standby mode. Updating this driver may allow the system to go to standby mode. -. - -MessageId=634 -Severity=Success -Facility=System -SymbolicName=ERROR_CORRUPT_SYSTEM_FILE -Language=Bulgarian -ERROR_CORRUPT_SYSTEM_FILE - The system file %1 has become corrupt and has been replaced. -. - -MessageId=635 -Severity=Success -Facility=System -SymbolicName=ERROR_COMMITMENT_MINIMUM -Language=Bulgarian -ERROR_COMMITMENT_MINIMUM - Your system is low on virtual memory. Windows is increasing the size of your virtual memory paging file. During this process, memory requests for some applications may be denied. For more information, see Help. -. - -MessageId=636 -Severity=Success -Facility=System -SymbolicName=ERROR_PNP_RESTART_ENUMERATION -Language=Bulgarian -ERROR_PNP_RESTART_ENUMERATION - A device was removed so enumeration must be restarted. -. - -MessageId=637 -Severity=Success -Facility=System -SymbolicName=ERROR_SYSTEM_IMAGE_BAD_SIGNATURE -Language=Bulgarian -ERROR_SYSTEM_IMAGE_BAD_SIGNATURE - The system image %s is not properly signed. The file has been replaced with the signed file. The system has been shut down. -. - -MessageId=638 -Severity=Success -Facility=System -SymbolicName=ERROR_PNP_REBOOT_REQUIRED -Language=Bulgarian -ERROR_PNP_REBOOT_REQUIRED - Device will not start without a reboot. -. - -MessageId=639 -Severity=Success -Facility=System -SymbolicName=ERROR_INSUFFICIENT_POWER -Language=Bulgarian -ERROR_INSUFFICIENT_POWER - There is not enough power to complete the requested operation. -. - -MessageId=641 -Severity=Success -Facility=System -SymbolicName=ERROR_SYSTEM_SHUTDOWN -Language=Bulgarian -ERROR_SYSTEM_SHUTDOWN - The system is in the process of shutting down. -. - -MessageId=642 -Severity=Success -Facility=System -SymbolicName=ERROR_PORT_NOT_SET -Language=Bulgarian -ERROR_PORT_NOT_SET - An attempt to remove a processes DebugPort was made, but a port was not already associated with the process. -. - -MessageId=643 -Severity=Success -Facility=System -SymbolicName=ERROR_DS_VERSION_CHECK_FAILURE -Language=Bulgarian -ERROR_DS_VERSION_CHECK_FAILURE - This version of Windows is not compatible with the behavior version of directory forest, domain or domain controller. -. - -MessageId=644 -Severity=Success -Facility=System -SymbolicName=ERROR_RANGE_NOT_FOUND -Language=Bulgarian -ERROR_RANGE_NOT_FOUND - The specified range could not be found in the range list. -. - -MessageId=646 -Severity=Success -Facility=System -SymbolicName=ERROR_NOT_SAFE_MODE_DRIVER -Language=Bulgarian -ERROR_NOT_SAFE_MODE_DRIVER - The driver was not loaded because the system is booting into safe mode. -. - -MessageId=647 -Severity=Success -Facility=System -SymbolicName=ERROR_FAILED_DRIVER_ENTRY -Language=Bulgarian -ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed it's initialization call. +ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed its initialization call. . MessageId=648 diff --git a/reactos/dll/win32/kernel32/lang/de-DE.mc b/reactos/dll/win32/kernel32/lang/de-DE.mc index 04d9f804689..13c1381a7e7 100644 --- a/reactos/dll/win32/kernel32/lang/de-DE.mc +++ b/reactos/dll/win32/kernel32/lang/de-DE.mc @@ -101,7 +101,7 @@ Severity=Success Facility=System SymbolicName=ERROR_INVALID_BLOCK Language=German -ERROR_INVALID_BLOCK - Die Speicherkontrolladdresse ist ungltig. +ERROR_INVALID_BLOCK - Die Speicherkontrolladresse ist ungltig. . MessageId=10 @@ -885,7 +885,7 @@ Severity=Success Facility=System SymbolicName=ERROR_SUBST_TO_SUBST Language=German -ERROR_SUBST_TO_SUBST -Das System versuchte ein Verzeichnis zu einem Laufwerk auf einen gesubsteten Laufwerk zu substen. +ERROR_SUBST_TO_SUBST - Das System versuchte ein Verzeichnis zu einem Laufwerk auf einen gesubsteten Laufwerk zu substen. . MessageId=140 @@ -965,7 +965,7 @@ Severity=Success Facility=System SymbolicName=ERROR_IS_SUBST_TARGET Language=German -ERROR_IS_SUBST_TARGET - Es wurde versucht, von einem Laufwerk zu substen oder zu joinen das schon gesubst ist. +ERROR_IS_SUBST_TARGET - Es wurde versucht, von einem Laufwerk zu substen oder zu joinen, das schon gesubst ist. . MessageId=150 @@ -1093,7 +1093,7 @@ Severity=Success Facility=System SymbolicName=ERROR_BUSY Language=German -ERROR_BUSY - Die angeforderte Ressource wird beutzt. +ERROR_BUSY - Die angeforderte Ressource wird benutzt. . MessageId=173 @@ -1109,7 +1109,7 @@ Severity=Success Facility=System SymbolicName=ERROR_ATOMIC_LOCKS_NOT_SUPPORTED Language=German -ERROR_ATOMIC_LOCKS_NOT_SUPPORTED - Das Dateisysten untersttzt keine ununterbrechbaren Sperrungen. +ERROR_ATOMIC_LOCKS_NOT_SUPPORTED - Das Dateisysten untersttzt keine nicht unterbrechbaren Sperren. . MessageId=180 @@ -1229,7 +1229,7 @@ Severity=Success Facility=System SymbolicName=ERROR_IOPL_NOT_ENABLED Language=German -ERROR_IOPL_NOT_ENABLED - Das Betriebssystem ist zur Zeit nicht konfiguiert, um dieses Programm auszufhren. +ERROR_IOPL_NOT_ENABLED - Das Betriebssystem ist zur Zeit nicht konfiguriert, um dieses Programm auszufhren. . MessageId=198 @@ -1277,7 +1277,7 @@ Severity=Success Facility=System SymbolicName=ERROR_ENVVAR_NOT_FOUND Language=German -ERROR_ENVVAR_NOT_FOUND - Das System konnte die Umgebungs-Option, die eingegeben wurde, nicht finden. +ERROR_ENVVAR_NOT_FOUND - Das System konnte die Umgebungsvariable, die eingegeben wurde, nicht finden. . MessageId=205 @@ -1309,7 +1309,7 @@ Severity=Success Facility=System SymbolicName=ERROR_META_EXPANSION_TOO_LONG Language=German -ERROR_META_EXPANSION_TOO_LONG - Es wurden zu viele Platzhalter, wie ? oder *, eingegeben. +ERROR_META_EXPANSION_TOO_LONG - Es wurden zu viele Platzhalter wie ? oder * eingegeben. . MessageId=209 @@ -1341,7 +1341,7 @@ Severity=Success Facility=System SymbolicName=ERROR_TOO_MANY_MODULES Language=German -ERROR_TOO_MANY_MODULES - Es werden zu viele DLLs von diesem Programm oder DLL benutzt. +ERROR_TOO_MANY_MODULES - Es werden zu viele DLLs von diesem Programm oder dieser DLL benutzt. . MessageId=215 @@ -1653,7 +1653,7 @@ Severity=Success Facility=System SymbolicName=ERROR_TIMER_NOT_CANCELED Language=German -ERROR_TIMER_NOT_CANCELED - Es wurde der Versuch gemacht, einen Timer zu setzen oder zu lschen, der nicht dem Aufrufer gehrt. +ERROR_TIMER_NOT_CANCELED - Es wurde der Versuch unternommen, einen Timer zu setzen oder zu lschen, der nicht dem Aufrufer gehrt. . MessageId=542 @@ -1717,7 +1717,7 @@ Severity=Success Facility=System SymbolicName=ERROR_INSTRUCTION_MISALIGNMENT Language=German -ERROR_INSTRUCTION_MISALIGNMENT - Es wurde versucht, einen Befehl an einer nicht angeschlossenen Adresse auzufhren, was dieses System nicht untersttzt. +ERROR_INSTRUCTION_MISALIGNMENT - Es wurde versucht, einen Befehl an einer nicht angeschlossenen Adresse auszufhren, was dieses System nicht untersttzt. . MessageId=550 @@ -1861,7 +1861,7 @@ Severity=Success Facility=System SymbolicName=ERROR_LOGON_SERVER_CONFLICT Language=German -ERROR_LOGON_SERVER_CONFLICT - Der Netlogon-Dienst kann nicht starten weil ein anderer Netlogon-Dienst mit der gleichen Rolle lauft und ein Domnen-Konflikt auftritt. +ERROR_LOGON_SERVER_CONFLICT - Der Netlogon-Dienst kann nicht starten, weil ein anderer Netlogon-Dienst mit der gleichen Rolle luft und ein Domnen-Konflikt auftritt. . MessageId=569 @@ -1965,7 +1965,7 @@ Severity=Success Facility=System SymbolicName=ERROR_ILLEGAL_CHARACTER Language=German -ERROR_ILLEGAL_CHARACTER - Es wurde ein illegales Zeichen gefunden. Fr einen Multi-Byte-Zeichensatz schliet dies ein Fhrungs-Byte ohne ein fogendes Anschluss-Byte ein. Fr den Unicode-Zeichensatz schliet dies die Zeichen 0xFFFF und 0xFFFE ein. +ERROR_ILLEGAL_CHARACTER - Es wurde ein ungltiges Zeichen gefunden. Fr einen Multi-Byte-Zeichensatz schliet dies ein Fhrungs-Byte ohne ein folgendes Anschluss-Byte ein. Fr den Unicode-Zeichensatz schliet dies die Zeichen 0xFFFF und 0xFFFE ein. . MessageId=583 @@ -1989,7 +1989,7 @@ Severity=Success Facility=System SymbolicName=ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT Language=German -ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT - Das System-BIOS konnte einen Systeminterupt nicht an das Gert oder dessen Bus verbinden. +ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT - Das System-BIOS konnte einen Systeminterrupt nicht an das Gert oder dessen Bus weiterleiten. . MessageId=586 @@ -2021,7 +2021,7 @@ Severity=Success Facility=System SymbolicName=ERROR_CANNOT_LOAD_REGISTRY_FILE Language=German -ERROR_CANNOT_LOAD_REGISTRY_FILE - Die Registrierungsdatenbank kann den Zweig nicht laden: %hs, sein Log oder die Alternative. Sie ist korrupt, fehlt oder ist nicht beschreibbar. +ERROR_CANNOT_LOAD_REGISTRY_FILE - Die Registrierungsdatenbank kann den Zweig nicht laden: %hs, sein Log oder die Alternative. Sie ist beschdigt, fehlt oder ist nicht beschreibbar. . MessageId=590 @@ -2109,7 +2109,7 @@ Severity=Success Facility=System SymbolicName=ERROR_CONVERT_TO_LARGE Language=German -ERROR_CONVERT_TO_LARGE - Interne OFS-Statuscodes zeigen an, dass eine Allokation behandelt wird. Either es ist retried after the containing onode ist moved oder the extent Stream ist converted to ein lang Stream. +ERROR_CONVERT_TO_LARGE - Interne OFS-Statuscodes zeigen an, dass eine Allokation behandelt wird. Entweder wird es erneut versucht, nachdem der kontaktierende Knoten verschoben wurde, oder der erweiterte Stream wird in einen langen Stream konvertiert. . MessageId=601 @@ -2117,7 +2117,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FOUND_OUT_OF_SCOPE Language=German -ERROR_FOUND_OUT_OF_SCOPE - Der Versuch to find the Objekt gefunden ein Objekt matching von ID on der datentrger aber es ist out von the bereich von the Handle used fr the Operation. +ERROR_FOUND_OUT_OF_SCOPE - Ein Objekt, das der ID des Datentrgers entspricht, wurde gefunden, aber es ist auerhalb des Bereichs fr das Handle fr diesen Vorgang. . MessageId=602 @@ -2125,7 +2125,7 @@ Severity=Success Facility=System SymbolicName=ERROR_ALLOCATE_BUCKET Language=German -ERROR_ALLOCATE_BUCKET - The bucket array must be grown. Retry transaction after doing so. +ERROR_ALLOCATE_BUCKET - Das Bucketarray muss vergrert werden. Versuchen Sie es anschlieend erneut. . MessageId=603 @@ -2165,7 +2165,7 @@ Severity=Success Facility=System SymbolicName=ERROR_TIMER_RESOLUTION_NOT_SET Language=German -ERROR_TIMER_RESOLUTION_NOT_SET - Die Auflsung des Zeitgebers wurde vorher nicht vom aktuellen Ptozess gesetzt. +ERROR_TIMER_RESOLUTION_NOT_SET - Die Auflsung des Zeitgebers wurde vorher nicht vom aktuellen Prozess gesetzt. . MessageId=608 @@ -2173,7 +2173,7 @@ Severity=Success Facility=System SymbolicName=ERROR_INSUFFICIENT_LOGON_INFO Language=German -ERROR_INSUFFICIENT_LOGON_INFO - Es gibt zu wenig Account-Informationen um sich einzuloggen. +ERROR_INSUFFICIENT_LOGON_INFO - Es gibt zu wenig Account-Informationen, um sich einzuloggen. . MessageId=609 @@ -2181,7 +2181,7 @@ Severity=Success Facility=System SymbolicName=ERROR_BAD_DLL_ENTRYPOINT Language=German -ERROR_BAD_DLL_ENTRYPOINT - Die DLL %hs wurde nicht korrekt geschrieben. Der Stack-Zeiger wurde in einem unvereinbaren Status gelassen. The entrypoint should be declared as WINAPI or STDCALL. Select YES to fail the DLL load. Select NO to continue execution. Selecting NO may cause the Programm to operate incorrectly. +ERROR_BAD_DLL_ENTRYPOINT - Die DLL %hs wurde nicht korrekt geschrieben. Der Stack-Zeiger wurde in einem unvereinbaren Status gelassen. Der Einstiegspunkt sollte als WINAPI oder STDCALL deklariert werden. Whlen Sie JA aus, um das Laden der DLL abzubrechen. Whlen sie NEIN aus, um die Ausfhrung fortzusetzen. Die Auswahl von NEIN knnte dazu fhren, dass das Programm nicht richtig funktioniert. . MessageId=610 @@ -2189,7 +2189,7 @@ Severity=Success Facility=System SymbolicName=ERROR_BAD_SERVICE_ENTRYPOINT Language=German -ERROR_BAD_SERVICE_ENTRYPOINT - Der %hs-Dienst wurde nicht korrekt geschrieben. Der Stack-Zeiger wurde in einem unvereinbaren Status gelassen. The callback entrypoint should be declared as WINAPI oder STDCALL. Selecting OK will cause the service to continue Operation. However, the service Prozess may operate incorrectly. +ERROR_BAD_SERVICE_ENTRYPOINT - Der %hs-Dienst wurde nicht korrekt geschrieben. Der Stack-Zeiger wurde in einem unvereinbaren Status gelassen. Der Callback-Einstiegspunkt sollte als WINAPI oder STDCALL deklariert werden. Die Auswahl OK wird die Ausfhrung des Prozesses fortsetzen. Der Dienstprozess knnte jedoch fehlerhaft arbeiten. . MessageId=611 @@ -2213,7 +2213,7 @@ Severity=Success Facility=System SymbolicName=ERROR_REGISTRY_QUOTA_LIMIT Language=German -ERROR_REGISTRY_QUOTA_LIMIT - Der Systemteil der Registierungsdatenbank erreichte seine maximale Gre. Weitere Speicheranforderungen werden ignoriert. +ERROR_REGISTRY_QUOTA_LIMIT - Der Systemteil der Registrierungsdatenbank erreichte seine maximale Gre. Weitere Speicheranforderungen werden ignoriert. . MessageId=614 @@ -2245,7 +2245,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PWD_HISTORY_CONFLICT Language=German -ERROR_PWD_HISTORY_CONFLICT - Das Passwort wurde schon einaml benutzt, was in den Richtlinien verboten ist. +ERROR_PWD_HISTORY_CONFLICT - Das Passwort wurde schon einmal benutzt, was in den Richtlinien verboten ist. . MessageId=618 @@ -2317,7 +2317,7 @@ Severity=Success Facility=System SymbolicName=ERROR_NO_MORE_MATCHES Language=German -ERROR_NO_MORE_MATCHES - There are no more matches for the current index enumeration. +ERROR_NO_MORE_MATCHES - Es gibt keine weiteren bereinstimmungen fr die derzeitige Indexaufzhlung. . MessageId=627 @@ -2325,7 +2325,7 @@ Severity=Success Facility=System SymbolicName=ERROR_RANGE_LIST_CONFLICT Language=German -ERROR_RANGE_LIST_CONFLICT - The range could not be added to the range list because of a conflict. +ERROR_RANGE_LIST_CONFLICT - Der Bereich konnte wegen eines Konflikts nicht in die Bereichsliste bernommen werden. . MessageId=628 @@ -2333,7 +2333,7 @@ Severity=Success Facility=System SymbolicName=ERROR_SERVER_SID_MISMATCH Language=German -ERROR_SERVER_SID_MISMATCH - The server process is running under a SID different than that required by client. +ERROR_SERVER_SID_MISMATCH - Der Serverprozess luft unter einer SID, die sich von der vom Client angeforderten unterscheidet. . MessageId=629 @@ -2349,7 +2349,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FLOAT_MULTIPLE_FAULTS Language=German -ERROR_FLOAT_MULTIPLE_FAULTS - Multiple floating point faults. +ERROR_FLOAT_MULTIPLE_FAULTS - Mehrere Fliekommafehler. . MessageId=631 @@ -2357,7 +2357,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FLOAT_MULTIPLE_TRAPS Language=German -ERROR_FLOAT_MULTIPLE_TRAPS - Multiple floating point traps. +ERROR_FLOAT_MULTIPLE_TRAPS - Mehrere Fliekommafallen. . MessageId=632 @@ -2365,7 +2365,7 @@ Severity=Success Facility=System SymbolicName=ERROR_NOINTERFACE Language=German -ERROR_NOINTERFACE - The requested interface is not supported. +ERROR_NOINTERFACE - Das angeforderte Interface wird nicht untersttzt. . MessageId=633 @@ -2373,7 +2373,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DRIVER_FAILED_SLEEP Language=German -ERROR_DRIVER_FAILED_SLEEP - The driver %hs does not support standby mode. Updating this driver may allow the system to go to standby mode. +ERROR_DRIVER_FAILED_SLEEP - Der Treiber %hs untersttzt keinen Stromsparmodus. Die Aktualisierung des Treibers knnte dem System den Stromsparmodus ermglichen. . MessageId=634 @@ -2381,7 +2381,7 @@ Severity=Success Facility=System SymbolicName=ERROR_CORRUPT_SYSTEM_FILE Language=German -ERROR_CORRUPT_SYSTEM_FILE - The system file %1 has become corrupt and has been replaced. +ERROR_CORRUPT_SYSTEM_FILE - Die Systemdatei %1 wurde beschdigt und ausgewechselt. . MessageId=635 @@ -2389,7 +2389,7 @@ Severity=Success Facility=System SymbolicName=ERROR_COMMITMENT_MINIMUM Language=German -ERROR_COMMITMENT_MINIMUM - Your system is low on virtual memory. ReactOS is increasing the size of your virtual memory paging file. During this process, memory requests for some applications may be denied. For more information, see Help. +ERROR_COMMITMENT_MINIMUM - Ihr System hat nur noch wenig virtuellen Speicher. ReactOS vergrert ihre Pagingdatei. Whrend dieses Vorgangs knnten Speicheranfragen von Anwendungen abgelehnt werden. Fr weitere Informationen siehe Hilfe. . MessageId=636 @@ -2397,7 +2397,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PNP_RESTART_ENUMERATION Language=German -ERROR_PNP_RESTART_ENUMERATION - A device was removed so enumeration must be restarted. +ERROR_PNP_RESTART_ENUMERATION - Ein Gert wurde entfernt, so dass die Nummerierung neu gestartet werden muss. . MessageId=637 @@ -2405,7 +2405,7 @@ Severity=Success Facility=System SymbolicName=ERROR_SYSTEM_IMAGE_BAD_SIGNATURE Language=German -ERROR_SYSTEM_IMAGE_BAD_SIGNATURE - The system image %s is not properly signed. The file has been replaced with the signed file. The system has been shut down. +ERROR_SYSTEM_IMAGE_BAD_SIGNATURE - Das Systemabbild %s wurde nicht korrekt signiert. Die Datei wurde mit der signierten Datei ersetzt. Das System wurde heruntergefahren. . MessageId=638 @@ -2413,7 +2413,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PNP_REBOOT_REQUIRED Language=German -ERROR_PNP_REBOOT_REQUIRED - Device will not start without a reboot. +ERROR_PNP_REBOOT_REQUIRED - Das Gert wird ohne einen Neustart nicht gestartet werden. . MessageId=639 @@ -2421,7 +2421,7 @@ Severity=Success Facility=System SymbolicName=ERROR_INSUFFICIENT_POWER Language=German -ERROR_INSUFFICIENT_POWER - There is not enough power to complete the requested operation. +ERROR_INSUFFICIENT_POWER - Es gibt nicht genug Strom, um den angeforderten Vorgang abzuschlieen. . MessageId=641 @@ -2429,7 +2429,7 @@ Severity=Success Facility=System SymbolicName=ERROR_SYSTEM_SHUTDOWN Language=German -ERROR_SYSTEM_SHUTDOWN - The system is in the process of shutting down. +ERROR_SYSTEM_SHUTDOWN - Das System wird heruntergefahren. . MessageId=642 @@ -2437,7 +2437,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PORT_NOT_SET Language=German -ERROR_PORT_NOT_SET - An attempt to remove a processes DebugPort was made, but a port was not already associated with the process. +ERROR_PORT_NOT_SET - Ein Versuch, den DebugPort eines Prozesses zu entfernen, wurde unternommen, aber dem Prozess war noch kein solcher Port zugewiesen. . MessageId=643 @@ -2453,7 +2453,7 @@ Severity=Success Facility=System SymbolicName=ERROR_RANGE_NOT_FOUND Language=German -ERROR_RANGE_NOT_FOUND - The specified range could not be found in the range list. +ERROR_RANGE_NOT_FOUND - Der angegebene Bereich konnte nicht in der Bereichsliste gefunden werden. . MessageId=646 @@ -2461,7 +2461,7 @@ Severity=Success Facility=System SymbolicName=ERROR_NOT_SAFE_MODE_DRIVER Language=German -ERROR_NOT_SAFE_MODE_DRIVER - The driver was not loaded because the system is booting into safe mode. +ERROR_NOT_SAFE_MODE_DRIVER - Der Treiber wurde nicht geladen, da das System im sicheren Modus gestartet wird. . MessageId=647 @@ -2469,7 +2469,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FAILED_DRIVER_ENTRY Language=German -ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed it's initialization call. +ERROR_FAILED_DRIVER_ENTRY - Der Treiber wurde nicht geladen, weil sein Initialisierungsaufruf fehlschlug. . MessageId=648 @@ -2477,7 +2477,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DEVICE_ENUMERATION_ERROR Language=German -ERROR_DEVICE_ENUMERATION_ERROR - The \"%hs\" encountered an error while applying power or reading the device configuration. This may be caused by a failure of your hardware or by a poor connection. +ERROR_DEVICE_ENUMERATION_ERROR - Es ist ein Fehler mit \"%hs\" bei der Stromversorgung oder bei der Prfung der Gerteeigenschaften aufgetreten. Dies knnte an einem Hardwarefehler oder an einer schlechten Verbindung liegen. . MessageId=649 @@ -2485,7 +2485,7 @@ Severity=Success Facility=System SymbolicName=ERROR_MOUNT_POINT_NOT_RESOLVED Language=German -ERROR_MOUNT_POINT_NOT_RESOLVED - The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached. +ERROR_MOUNT_POINT_NOT_RESOLVED - Der Erstellvorgang ist fehlgeschlagen, da der Name mindestens einen Mountpunkt enthielt, der auf eine Partition zeigt, an die das angegebene Gert nicht angehngt ist. . MessageId=650 @@ -2493,7 +2493,7 @@ Severity=Success Facility=System SymbolicName=ERROR_INVALID_DEVICE_OBJECT_PARAMETER Language=German -ERROR_INVALID_DEVICE_OBJECT_PARAMETER - The device object parameter is either not a valid device object or is not attached to the volume specified by the file name. +ERROR_INVALID_DEVICE_OBJECT_PARAMETER - Der Gerteparameter ist entweder kein gltiges Gert oder nicht an den im Dateinamen angegebenen Datentrger angehngt. . MessageId=651 @@ -2501,7 +2501,7 @@ Severity=Success Facility=System SymbolicName=ERROR_MCA_OCCURED Language=German -ERROR_MCA_OCCURED - A Machine Check Error has occurred. Please check the system eventlog for additional information. +ERROR_MCA_OCCURED - Ein Computerprffehler ist aufgetreten. Bitte berprfen Sie die Ereignisanzeige fr weitere Informationen. . MessageId=652 @@ -2509,7 +2509,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DRIVER_DATABASE_ERROR Language=German -ERROR_DRIVER_DATABASE_ERROR - There was error [%2] processing the driver database. +ERROR_DRIVER_DATABASE_ERROR - Fehler [%2] ist beim Verarbeiten der Gertedatenbank aufgetreten. . MessageId=653 @@ -2517,7 +2517,7 @@ Severity=Success Facility=System SymbolicName=ERROR_SYSTEM_HIVE_TOO_LARGE Language=German -ERROR_SYSTEM_HIVE_TOO_LARGE - System hive size has exceeded its limit. +ERROR_SYSTEM_HIVE_TOO_LARGE - Die Gre des Systemzweiges hat ihre Grenze berschritten. . MessageId=654 @@ -2525,7 +2525,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DRIVER_FAILED_PRIOR_UNLOAD Language=German -ERROR_DRIVER_FAILED_PRIOR_UNLOAD - The driver could not be loaded because a previous version of the driver is still in memory. +ERROR_DRIVER_FAILED_PRIOR_UNLOAD - Der Treiber konnte nicht geladen werden, da sich eine frhere Version des Treibers noch im Speicher befindet. . MessageId=655 @@ -2533,7 +2533,7 @@ Severity=Success Facility=System SymbolicName=ERROR_VOLSNAP_PREPARE_HIBERNATE Language=German -ERROR_VOLSNAP_PREPARE_HIBERNATE - Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation. +ERROR_VOLSNAP_PREPARE_HIBERNATE - Bitte warten Sie, whrend der Schattenkopiedienst das Laufwerk %hs auf den Ruhezustand vorbereitet. . MessageId=656 @@ -2549,7 +2549,7 @@ Severity=Success Facility=System SymbolicName=ERROR_HUNG_DISPLAY_DRIVER_THREAD Language=German -ERROR_HUNG_DISPLAY_DRIVER_THREAD - The %hs display driver has stopped working normally. Save your work and reboot the system to restore full display functionality. The next time you reboot the machine a dialog will be displayed giving you a chance to report this failure to Microsoft. +ERROR_HUNG_DISPLAY_DRIVER_THREAD - Der Anzeigetreiber %hs funktioniert nicht mehr normal. Speichern Sie Ihre Daten und starten Sie das System neu, um die volle Anzeigefunktionalitt wiederherzustellen. Beim nchsten Start des Computers wird ein Dialog erscheinen, der es Ihnen ermglicht, Microsoft diesen Fehler zu melden. . MessageId=665 @@ -2557,7 +2557,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FILE_SYSTEM_LIMITATION Language=German -ERROR_FILE_SYSTEM_LIMITATION - The requested operation could not be completed due to a file system limitation. +ERROR_FILE_SYSTEM_LIMITATION - Der angeforderte Vorgang wurde wegen Einschrnkungen des Dateisystems nicht ausgefhrt. . MessageId=668 @@ -2573,7 +2573,7 @@ Severity=Success Facility=System SymbolicName=ERROR_VERIFIER_STOP Language=German -ERROR_VERIFIER_STOP - Application verifier has found an error in the current process. +ERROR_VERIFIER_STOP - Die Anwendungsprfung hat einen Fehler in dem laufenden Prozess festgestellt. . MessageId=670 @@ -2589,7 +2589,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PNP_BAD_MPS_TABLE Language=German -ERROR_PNP_BAD_MPS_TABLE - A device is missing in the system BIOS MPS table. This device will not be used. Please contact your system vendor for system BIOS update. +ERROR_PNP_BAD_MPS_TABLE - Ein Gert fehlt in der BIOS-MPS-Tabelle. Dieses Gert wird nicht verwendet. Bitte kontaktieren Sie den Hersteller Ihres Systems fr eine Aktualisierung des BIOS. . MessageId=672 @@ -2597,7 +2597,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PNP_TRANSLATION_FAILED Language=German -ERROR_PNP_TRANSLATION_FAILED - A translator failed to translate resources. +ERROR_PNP_TRANSLATION_FAILED - Ein bersetzer konnte Ressourcen nicht bersetzen. . MessageId=673 @@ -2605,7 +2605,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PNP_IRQ_TRANSLATION_FAILED Language=German -ERROR_PNP_IRQ_TRANSLATION_FAILED - A IRQ translator failed to translate resources. +ERROR_PNP_IRQ_TRANSLATION_FAILED - Ein IRQ-bersetzer konnte Ressourcen nicht bersetzen. . MessageId=674 @@ -2613,7 +2613,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PNP_INVALID_ID Language=German -ERROR_PNP_INVALID_ID - Driver %2 returned invalid ID for a child device (%3). +ERROR_PNP_INVALID_ID - Der Treiber %2 gab eine ungltige ID fr ein Kindgert (%3) zurck. . MessageId=675 @@ -2621,7 +2621,7 @@ Severity=Success Facility=System SymbolicName=ERROR_WAKE_SYSTEM_DEBUGGER Language=German -ERROR_WAKE_SYSTEM_DEBUGGER - The system debugger was awakened by an interrupt. +ERROR_WAKE_SYSTEM_DEBUGGER - Der Systemdebugger wurde mittels Interrupt erweckt. . MessageId=676 @@ -2629,7 +2629,7 @@ Severity=Success Facility=System SymbolicName=ERROR_HANDLES_CLOSED Language=German -ERROR_HANDLES_CLOSED - Handles to objects have been automatically closed as a result of the requested operation. +ERROR_HANDLES_CLOSED - Handles auf Objekte wurden als Ergebnis des angeforderten Vorgangs automatisch geschlossen. . MessageId=677 @@ -2637,7 +2637,7 @@ Severity=Success Facility=System SymbolicName=ERROR_EXTRANEOUS_INFORMATION Language=German -ERROR_EXTRANEOUS_INFORMATION - he specified access control list (ACL) contained more information than was expected. +ERROR_EXTRANEOUS_INFORMATION - Die angegebene Zugangskontrollliste (ACL) beinhaltete mehr Informationen als erwartet. . MessageId=678 @@ -2669,7 +2669,7 @@ Severity=Success Facility=System SymbolicName=ERROR_STOPPED_ON_SYMLINK Language=German -ERROR_STOPPED_ON_SYMLINK - The create operation stopped after reaching a symbolic link. +ERROR_STOPPED_ON_SYMLINK - Die Erzeugung wurde beim Erreichen eines symbolischen Verweises beendet. . MessageId=682 @@ -2677,7 +2677,7 @@ Severity=Success Facility=System SymbolicName=ERROR_LONGJUMP Language=German -ERROR_LONGJUMP - A long jump has been executed. +ERROR_LONGJUMP - Ein langer Sprung wurde ausgefhrt. . MessageId=683 @@ -2685,7 +2685,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PLUGPLAY_QUERY_VETOED Language=German -ERROR_PLUGPLAY_QUERY_VETOED - The Plug and Play query operation was not successful. +ERROR_PLUGPLAY_QUERY_VETOED - Der Plug-and-Play-Vorgang war nicht erfolgreich. . MessageId=684 @@ -2701,7 +2701,7 @@ Severity=Success Facility=System SymbolicName=ERROR_REGISTRY_HIVE_RECOVERED Language=German -ERROR_REGISTRY_HIVE_RECOVERED - Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost. +ERROR_REGISTRY_HIVE_RECOVERED - Der Registryzweig (Datei) %hs war defekt und wurde wiederhergestellt. Es knnten Daten verloren gegangen sein. . MessageId=686 @@ -2709,7 +2709,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DLL_MIGHT_BE_INSECURE Language=German -ERROR_DLL_MIGHT_BE_INSECURE - The application is attempting to run executable code from the module %hs. This may be insecure. An alternative, %hs, is available. Should the application use the secure module %hs? +ERROR_DLL_MIGHT_BE_INSECURE - Die Anwendung versucht, ausfhrbaren Code aus dem Modul %hs zu laden. Dies knnte unsicher sein. Eine Alternative, %hs, ist verfgbar. Soll die Anwendung das sichere Modul %hs nutzen? . MessageId=687 @@ -2717,7 +2717,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DLL_MIGHT_BE_INCOMPATIBLE Language=German -ERROR_DLL_MIGHT_BE_INCOMPATIBLE - The application is loading executable code from the module %hs. This is secure, but may be incompatible with previous releases of the operating system. An alternative, %hs, is available. Should the application use the secure module %hs? +ERROR_DLL_MIGHT_BE_INCOMPATIBLE - Die Anwendung versucht, ausfhrbaren Code aus dem Modul %hs zu laden. Dies ist sicher, aber knnte mit frheren Versionen des Betriebssystems inkompatibel sein. Eine Alternative, %hs, ist verfgbar. Soll die Anwendung das sichere Modul %hs nutzen? . MessageId=688 @@ -2725,7 +2725,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_EXCEPTION_NOT_HANDLED Language=German -ERROR_DBG_EXCEPTION_NOT_HANDLED - Debugger did not handle the exception. +ERROR_DBG_EXCEPTION_NOT_HANDLED - Der Debugger behandelte die Ausnahme nicht. . MessageId=689 @@ -2733,7 +2733,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_REPLY_LATER Language=German -ERROR_DBG_REPLY_LATER - Debugger will reply later. +ERROR_DBG_REPLY_LATER - Der Debugger wird spter antworten. . MessageId=690 @@ -2741,7 +2741,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE Language=German -ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE - Debugger can not provide handle. +ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE - Der Debugger kann das Handle nicht bereitstellen. . MessageId=691 @@ -2749,7 +2749,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_TERMINATE_THREAD Language=German -ERROR_DBG_TERMINATE_THREAD - Debugger terminated thread. +ERROR_DBG_TERMINATE_THREAD - Der Debugger hat den Thread terminiert. . MessageId=692 @@ -2757,7 +2757,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_TERMINATE_PROCESS Language=German -ERROR_DBG_TERMINATE_PROCESS - Debugger terminated process. +ERROR_DBG_TERMINATE_PROCESS - Der Debugger hat den Prozess terminiert. . MessageId=693 @@ -2765,7 +2765,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_CONTROL_C Language=German -ERROR_DBG_CONTROL_C - Debugger got control C. +ERROR_DBG_CONTROL_C - Der Debugger erhielt Strg-C. . MessageId=694 @@ -2773,7 +2773,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_PRINTEXCEPTION_C Language=German -ERROR_DBG_PRINTEXCEPTION_C - Debugger printed exception on control C. +ERROR_DBG_PRINTEXCEPTION_C - Der Debugger gab fr Strg-C eine Ausnahme aus. . MessageId=695 @@ -2781,7 +2781,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_RIPEXCEPTION Language=German -ERROR_DBG_RIPEXCEPTION - Debugger received RIP exception. +ERROR_DBG_RIPEXCEPTION - Der Debugger erhielt eine RIP-Ausnahme. . MessageId=696 @@ -2789,7 +2789,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_CONTROL_BREAK Language=German -ERROR_DBG_CONTROL_BREAK - Debugger received control break. +ERROR_DBG_CONTROL_BREAK - Der Debugger erhielt Strg-Pause. . MessageId=697 @@ -2805,7 +2805,7 @@ Severity=Success Facility=System SymbolicName=ERROR_OBJECT_NAME_EXISTS Language=German -ERROR_OBJECT_NAME_EXISTS - An attempt was made to create an object and the object name already existed. +ERROR_OBJECT_NAME_EXISTS - Ein Versuch wurde unternommen, ein Objekt zu erzeugen, und der Name des Objekts existierte bereits. . MessageId=699 @@ -2837,7 +2837,7 @@ Severity=Success Facility=System SymbolicName=ERROR_SEGMENT_NOTIFICATION Language=German -ERROR_SEGMENT_NOTIFICATION - A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image. An exception is raised so a debugger can load, unload or track symbols and breakpoints within these 16-bit segments. +ERROR_SEGMENT_NOTIFICATION - Eine virtuelle DOS-Maschine (VDM) ldt, entldt oder verschiebt ein MS-DOS- oder Win16-Programmsegmentabbild. Eine Ausnahme wird bereitgestellt, so dass ein Debugger Symbole und Haltepunkte innerhalb dieser 16-Bit-Segmente laden, entladen oder verfolgen kann. . MessageId=703 @@ -2869,7 +2869,7 @@ Severity=Success Facility=System SymbolicName=ERROR_IMAGE_MACHINE_TYPE_MISMATCH Language=German -ERROR_IMAGE_MACHINE_TYPE_MISMATCH - The image file %hs is valid, but is for a machine type other than the current machine. Select OK to continue, or CANCEL to fail the DLL load. +ERROR_IMAGE_MACHINE_TYPE_MISMATCH - Das Abbild %hs ist gltig, aber es ist fr einen anderen Gertetypen bestimmt. Whlen Sie OK zum Fortfahren oder ABBRECHEN aus, um das Laden der DLL abzubrechen. . MessageId=707 @@ -2877,7 +2877,7 @@ Severity=Success Facility=System SymbolicName=ERROR_RECEIVE_PARTIAL Language=German -ERROR_RECEIVE_PARTIAL - The network transport returned partial data to its client. The remaining data will be sent later. +ERROR_RECEIVE_PARTIAL - Der Netzwerktransport gab Teildaten an den Client weiter. Die verbleibenden Daten werden spter gesendet. . MessageId=708 @@ -2917,7 +2917,7 @@ Severity=Success Facility=System SymbolicName=ERROR_CHECKING_FILE_SYSTEM Language=German -ERROR_CHECKING_FILE_SYSTEM - Checking file system on %wZ. +ERROR_CHECKING_FILE_SYSTEM - Prfe Dateisystem auf %wZ. . MessageId=714 @@ -2925,7 +2925,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PREDEFINED_HANDLE Language=German -ERROR_PREDEFINED_HANDLE - The specified registry key is referenced by a predefined handle. +ERROR_PREDEFINED_HANDLE - Der angegebene Registryschlssel wird von einem vordefinierten Handle referenziert. . MessageId=715 @@ -2941,7 +2941,7 @@ Severity=Success Facility=System SymbolicName=ERROR_WAS_LOCKED Language=German -ERROR_WAS_LOCKED - One of the pages to lock was already locked. +ERROR_WAS_LOCKED - Eine der zu schlieenden Seiten war bereits verschlossen. . MessageId=720 @@ -2949,7 +2949,7 @@ Severity=Success Facility=System SymbolicName=ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE Language=German -ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE - The image file %hs is valid, but is for a machine type other than the current machine. +ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE - Das Abbild %hs ist gltig, aber fr einen anderen Gertetypen bestimmt. . MessageId=721 @@ -2997,7 +2997,7 @@ Severity=Success Facility=System SymbolicName=ERROR_HIBERNATED Language=German -ERROR_HIBERNATED - The system was put into hibernation. +ERROR_HIBERNATED - Das System wurde in den Ruhezustand versetzt. . MessageId=727 @@ -3005,7 +3005,7 @@ Severity=Success Facility=System SymbolicName=ERROR_RESUME_HIBERNATION Language=German -ERROR_RESUME_HIBERNATION - The system was resumed from hibernation. +ERROR_RESUME_HIBERNATION - Das System wurde aus dem Ruhezustand fortgesetzt. . MessageId=728 @@ -3013,7 +3013,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FIRMWARE_UPDATED Language=German -ERROR_FIRMWARE_UPDATED - ReactOS has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3]. +ERROR_FIRMWARE_UPDATED - ReactOS hat festgestellt, dass die Systemfirmware (BIOS) aktualisiert wurde [voriges Firmwaredatum = %2, aktuelles Firmwaredatum = %3]. . MessageId=729 @@ -3029,7 +3029,7 @@ Severity=Success Facility=System SymbolicName=ERROR_WAKE_SYSTEM Language=German -ERROR_WAKE_SYSTEM - The system has awoken +ERROR_WAKE_SYSTEM - Das System ist erwacht . MessageId=741 @@ -3053,7 +3053,7 @@ Severity=Success Facility=System SymbolicName=ERROR_VOLUME_MOUNTED Language=German -ERROR_VOLUME_MOUNTED - A new volume has been mounted by a file system. +ERROR_VOLUME_MOUNTED - Ein neuer Datentrger wurde durch ein Dateisystem gemountet. . MessageId=744 @@ -3133,7 +3133,7 @@ Severity=Success Facility=System SymbolicName=ERROR_CRASH_DUMP Language=German -ERROR_CRASH_DUMP - Crash dump exists in paging file. +ERROR_CRASH_DUMP - Absturzabbild existiert in Pagetabelle. . MessageId=754 @@ -3141,7 +3141,7 @@ Severity=Success Facility=System SymbolicName=ERROR_BUFFER_ALL_ZEROS Language=German -ERROR_BUFFER_ALL_ZEROS - Specified buffer contains all zeros. +ERROR_BUFFER_ALL_ZEROS - Der angegebene Puffer enthlt nur Nullen. . MessageId=755 @@ -3181,7 +3181,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PROCESS_NOT_IN_JOB Language=German -ERROR_PROCESS_NOT_IN_JOB - The specified process is not part of a job. +ERROR_PROCESS_NOT_IN_JOB - Der angegebene Prozess ist nicht Teil eines Auftrags. . MessageId=760 @@ -3189,7 +3189,7 @@ Severity=Success Facility=System SymbolicName=ERROR_PROCESS_IN_JOB Language=German -ERROR_PROCESS_IN_JOB - The specified process is part of a job. +ERROR_PROCESS_IN_JOB - Der angegebene Prozess ist Teil eines Auftrags. . MessageId=761 @@ -3197,7 +3197,7 @@ Severity=Success Facility=System SymbolicName=ERROR_VOLSNAP_HIBERNATE_READY Language=German -ERROR_VOLSNAP_HIBERNATE_READY - The system is now ready for hibernation. +ERROR_VOLSNAP_HIBERNATE_READY - Das System ist nun fr den Ruhezustand bereit. . MessageId=762 @@ -3237,7 +3237,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_EXCEPTION_HANDLED Language=German -ERROR_DBG_EXCEPTION_HANDLED - Debugger handled exception. +ERROR_DBG_EXCEPTION_HANDLED - Der Debugger hat eine Ausnahme behandelt. . MessageId=767 @@ -3245,7 +3245,7 @@ Severity=Success Facility=System SymbolicName=ERROR_DBG_CONTINUE Language=German -ERROR_DBG_CONTINUE - Debugger continued +ERROR_DBG_CONTINUE - Debugger fortgesetzt . MessageId=768 @@ -3261,7 +3261,7 @@ Severity=Success Facility=System SymbolicName=ERROR_COMPRESSION_DISABLED Language=German -ERROR_COMPRESSION_DISABLED - Compression is disabled for this volume. +ERROR_COMPRESSION_DISABLED - Komprimierung ist fr diesen Datentrger deaktiviert. . MessageId=770 @@ -3301,7 +3301,7 @@ Severity=Success Facility=System SymbolicName=ERROR_ERRORS_ENCOUNTERED Language=German -ERROR_ERRORS_ENCOUNTERED - One or more errors occurred while processing the request. +ERROR_ERRORS_ENCOUNTERED - Ein oder mehrere Fehler sind beim Verarbeiten der Anfrage aufgetreten. . MessageId=775 @@ -3309,7 +3309,7 @@ Severity=Success Facility=System SymbolicName=ERROR_NOT_CAPABLE Language=German -ERROR_NOT_CAPABLE - The implementation is not capable of performing the request. +ERROR_NOT_CAPABLE - Die Implementierung ist nicht in der Lage, die Anfrage zu verarbeiten. . MessageId=776 @@ -3325,7 +3325,7 @@ Severity=Success Facility=System SymbolicName=ERROR_VERSION_PARSE_ERROR Language=German -ERROR_VERSION_PARSE_ERROR - A version number could not be parsed. +ERROR_VERSION_PARSE_ERROR - Eine Versionsnummer konnte nicht ausgelesen werden. . MessageId=778 @@ -3333,7 +3333,7 @@ Severity=Success Facility=System SymbolicName=ERROR_BADSTARTPOSITION Language=German -ERROR_BADSTARTPOSITION - The iterator's start position is invalid. +ERROR_BADSTARTPOSITION - Die Startposition des Iterators ist ungltig. . MessageId=994 @@ -3341,7 +3341,7 @@ Severity=Success Facility=System SymbolicName=ERROR_EA_ACCESS_DENIED Language=German -ERROR_EA_ACCESS_DENIED - Access to the extended attribute was denied. +ERROR_EA_ACCESS_DENIED - Zugriff auf das erweiterte Attribut wurde verweigert. . MessageId=995 @@ -3373,7 +3373,7 @@ Severity=Success Facility=System SymbolicName=ERROR_NOACCESS Language=German -ERROR_NOACCESS - Invalid access to memory location. +ERROR_NOACCESS - Ungltiger Zugriff auf Speicheradresse. . MessageId=999 @@ -3389,7 +3389,7 @@ Severity=Success Facility=System SymbolicName=ERROR_STACK_OVERFLOW Language=German -ERROR_STACK_OVERFLOW - Recursion too deep; the stack overflowed. +ERROR_STACK_OVERFLOW - Rekursion zu tief; Stapelberlauf. . MessageId=1002 @@ -3405,7 +3405,7 @@ Severity=Success Facility=System SymbolicName=ERROR_CAN_NOT_COMPLETE Language=German -ERROR_CAN_NOT_COMPLETE - Cannot complete this function. +ERROR_CAN_NOT_COMPLETE - Kann diese Funktion nicht beenden. . MessageId=1004 @@ -3413,7 +3413,7 @@ Severity=Success Facility=System SymbolicName=ERROR_INVALID_FLAGS Language=German -ERROR_INVALID_FLAGS - Invalid flags. +ERROR_INVALID_FLAGS - Ungltige Flags. . MessageId=1005 diff --git a/reactos/dll/win32/kernel32/lang/pl-PL.mc b/reactos/dll/win32/kernel32/lang/pl-PL.mc index 440c01f2c09..fade0b86145 100644 --- a/reactos/dll/win32/kernel32/lang/pl-PL.mc +++ b/reactos/dll/win32/kernel32/lang/pl-PL.mc @@ -2471,7 +2471,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FAILED_DRIVER_ENTRY Language=English -ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed it's initialization call. +ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed its initialization call. . MessageId=648 diff --git a/reactos/dll/win32/kernel32/lang/ru-RU.mc b/reactos/dll/win32/kernel32/lang/ru-RU.mc index b92b1be1493..89dc623a7ef 100644 --- a/reactos/dll/win32/kernel32/lang/ru-RU.mc +++ b/reactos/dll/win32/kernel32/lang/ru-RU.mc @@ -2469,7 +2469,7 @@ Severity=Success Facility=System SymbolicName=ERROR_FAILED_DRIVER_ENTRY Language=Russian -ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed it's initialization call. +ERROR_FAILED_DRIVER_ENTRY - The driver was not loaded because it failed its initialization call. . MessageId=648 diff --git a/reactos/dll/win32/netshell/lang/it-IT.rc b/reactos/dll/win32/netshell/lang/it-IT.rc index 5084bd727d3..330fbb88484 100644 --- a/reactos/dll/win32/netshell/lang/it-IT.rc +++ b/reactos/dll/win32/netshell/lang/it-IT.rc @@ -21,12 +21,11 @@ END IDD_STATUS DIALOGEX DISCARDABLE 0, 0, 200, 280 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Allgemein" +CAPTION "Generale" FONT 8, "MS Shell Dlg" BEGIN END - IDD_LAN_NETSTATUS DIALOGEX DISCARDABLE 0, 0, 200,180 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION CAPTION "Generale" @@ -74,10 +73,10 @@ END IDD_LAN_NETSTATUSDETAILS DIALOGEX DISCARDABLE 0, 0, 200,200 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Network Connection Details" +CAPTION "Dettagli della connessione di rete" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Network Connection &Details:", -1, 15, 9, 170, 12 + LTEXT "Dettagli della connessione di &rete:", -1, 15, 9, 170, 12 CONTROL "", IDC_DETAILS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 25, 170, 130 PUSHBUTTON "&Close", IDC_CLOSE, 125, 165, 62, 14 END @@ -90,7 +89,7 @@ BEGIN IDS_DEF_GATEWAY "Default Gateway" IDS_DHCP_SERVER "DHCP Server" IDS_LEASE_OBTAINED "Indirizzo ottenuto" - IDS_LEASE_EXPIRES "Indirizzo con scadenza" + IDS_LEASE_EXPIRES "Scadenza indirizzo" IDS_DNS_SERVERS "DNS Servers" IDS_WINS_SERVERS "WINS Servers" IDS_PROPERTY "Propriet" @@ -116,6 +115,7 @@ BEGIN IDS_NET_REPAIR "Ripara" IDS_NET_CREATELINK "Crea collegamento" IDS_NET_DELETE "Cancella" + IDS_NET_RENAME "Rinomina" IDS_NET_PROPERTIES "Propriet" IDS_FORMAT_BIT "%u Bit/s" diff --git a/reactos/dll/win32/shell32/lang/cs-CZ.rc b/reactos/dll/win32/shell32/lang/cs-CZ.rc index 1f4fc948540..6c80a3e3ce7 100644 --- a/reactos/dll/win32/shell32/lang/cs-CZ.rc +++ b/reactos/dll/win32/shell32/lang/cs-CZ.rc @@ -1,6 +1,6 @@ /* FILE: dll/win32/shell32/lang/cs-CZ.rc * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) - * UPDATED: 2010-04-05 + * UPDATED: 2010-05-06 * THANKS TO: navaraf, who translated major part of this file */ @@ -739,5 +739,5 @@ BEGIN IDS_DEFAULT_CLUSTER_SIZE "Vchoz alokan velikost" IDS_COPY_OF "Kopie " - IDS_SHLEXEC_NOASSOC "There is no Windows program configured to open this type of file." + IDS_SHLEXEC_NOASSOC "Pro oteven tohoto souboru nen nakonfigurovn dn program." END diff --git a/reactos/dll/win32/shell32/lang/it-IT.rc b/reactos/dll/win32/shell32/lang/it-IT.rc index 8372b351e75..18bafe2a6fd 100644 --- a/reactos/dll/win32/shell32/lang/it-IT.rc +++ b/reactos/dll/win32/shell32/lang/it-IT.rc @@ -753,5 +753,5 @@ BEGIN IDS_DEFAULT_CLUSTER_SIZE "Dimensione predefinita di allocazione" IDS_COPY_OF "Copia di" - IDS_SHLEXEC_NOASSOC "There is no Windows program configured to open this type of file." + IDS_SHLEXEC_NOASSOC "Non c' un programma configurato per aprire questo tipo di file." END diff --git a/reactos/media/inf/cpu.inf b/reactos/media/inf/cpu.inf index 087ab209a62bbb576bcdd7d96e6af75c4ca0e27d..90cc393d7b94374d2ac6ec8be2ca0e142b9d719f 100644 GIT binary patch delta 625 zcmY*WOG^S#82yAYh@yu{_Aso}u~9=!Owk1Os)&mn;hmLFxkagX7UbSsm*D&lSBb#=MTOB From 786f5a19d7bb470d3c3eb05343d3ba2c04af2bc6 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sun, 9 May 2010 12:27:57 +0000 Subject: [PATCH 035/151] [win32k] - When message are sent without waiting a reply (non-queued messages) the message queues are referenced and dereferenced in the call. Message removal and cleanup functions for queues expected a reference on the queue. Add checks to determine if the message is a non-queued message and if so release memory for those that had pointers and more importantly skip dereferencing the queues. Possibly fixes random crashes and memory leaks. svn path=/trunk/; revision=47142 --- .../subsystems/win32/win32k/ntuser/msgqueue.c | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c index 4b45bac5c21..5bfe414b5ed 100644 --- a/reactos/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/reactos/subsystems/win32/win32k/ntuser/msgqueue.c @@ -1072,7 +1072,7 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow) { DPRINT("Notify the sender and remove a message from the queue that had not been dispatched\n"); - RemoveEntryList(&SentMessage->ListEntry); + RemoveEntryList(&SentMessage->ListEntry); /* remove the message from the dispatching list */ if(SentMessage->DispatchingListEntry.Flink != NULL) @@ -1086,9 +1086,19 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow) KeSetEvent(SentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE); } - /* dereference our and the sender's message queue */ - IntDereferenceMessageQueue(MessageQueue); - IntDereferenceMessageQueue(SentMessage->SenderQueue); + if (SentMessage->HasPackedLParam == TRUE) + { + if (SentMessage->Msg.lParam) + ExFreePool((PVOID)SentMessage->Msg.lParam); + } + + /* Only if it is not a no wait message */ + if (!(SentMessage->HookMessage & MSQ_SENTNOWAIT)) + { + /* dereference our and the sender's message queue */ + IntDereferenceMessageQueue(MessageQueue); + IntDereferenceMessageQueue(SentMessage->SenderQueue); + } /* free the message */ ExFreePool(SentMessage); @@ -1509,9 +1519,19 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue) KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE); } - /* dereference our and the sender's message queue */ - IntDereferenceMessageQueue(MessageQueue); - IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue); + if (CurrentSentMessage->HasPackedLParam == TRUE) + { + if (CurrentSentMessage->Msg.lParam) + ExFreePool((PVOID)CurrentSentMessage->Msg.lParam); + } + + /* Only if it is not a no wait message */ + if (!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT)) + { + /* dereference our and the sender's message queue */ + IntDereferenceMessageQueue(MessageQueue); + IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue); + } /* free the message */ ExFreePool(CurrentSentMessage); @@ -1547,10 +1567,19 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue) KeSetEvent(CurrentSentMessage->CompletionEvent, IO_NO_INCREMENT, FALSE); } - /* dereference our and the sender's message queue */ - IntDereferenceMessageQueue(MessageQueue); - IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue); + if (CurrentSentMessage->HasPackedLParam == TRUE) + { + if (CurrentSentMessage->Msg.lParam) + ExFreePool((PVOID)CurrentSentMessage->Msg.lParam); + } + /* Only if it is not a no wait message */ + if (!(CurrentSentMessage->HookMessage & MSQ_SENTNOWAIT)) + { + /* dereference our and the sender's message queue */ + IntDereferenceMessageQueue(MessageQueue); + IntDereferenceMessageQueue(CurrentSentMessage->SenderQueue); + } /* free the message */ ExFreePool(CurrentSentMessage); } From 28f11ad5f1c8e4a5748891a1f78ad3291915ce95 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 9 May 2010 13:12:21 +0000 Subject: [PATCH 036/151] [CONSOLE] - Store console changes when screen buffer / window size changes - Mark property sheet as changed when color control changes svn path=/trunk/; revision=47144 --- reactos/dll/cpl/console/colors.c | 1 + reactos/dll/cpl/console/layout.c | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/reactos/dll/cpl/console/colors.c b/reactos/dll/cpl/console/colors.c index f7dde527868..d312fadda0b 100644 --- a/reactos/dll/cpl/console/colors.c +++ b/reactos/dll/cpl/console/colors.c @@ -231,6 +231,7 @@ ColorsProc( InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_SCREEN_COLOR), NULL, TRUE); InvalidateRect(GetDlgItem(hwndDlg, IDC_STATIC_POPUP_COLOR), NULL, TRUE); pConInfo->ActiveStaticControl = index; + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); break; } } diff --git a/reactos/dll/cpl/console/layout.c b/reactos/dll/cpl/console/layout.c index 592ba610168..cca60ca92eb 100644 --- a/reactos/dll/cpl/console/layout.c +++ b/reactos/dll/cpl/console/layout.c @@ -294,6 +294,52 @@ LayoutProc( { switch(LOWORD(wParam)) { + case IDC_EDIT_SCREEN_BUFFER_WIDTH: + case IDC_EDIT_SCREEN_BUFFER_HEIGHT: + case IDC_EDIT_WINDOW_SIZE_WIDTH: + case IDC_UPDOWN_WINDOW_SIZE_HEIGHT: + case IDC_EDIT_WINDOW_POS_LEFT: + case IDC_EDIT_WINDOW_POS_TOP: + { + if (HIWORD(wParam) == EN_KILLFOCUS) + { + DWORD wheight, wwidth; + DWORD sheight, swidth; + DWORD left, top; + + wwidth = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, NULL, FALSE); + wheight = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, NULL, FALSE); + swidth = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_WIDTH, NULL, FALSE); + sheight = GetDlgItemInt(hwndDlg, IDC_EDIT_SCREEN_BUFFER_HEIGHT, NULL, FALSE); + left = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_LEFT, NULL, FALSE); + top = GetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_POS_TOP, NULL, FALSE); + + swidth = max(swidth, 1); + sheight = max(sheight, 1); + + /* automatically adjust window size when screen buffer decreases */ + if (wwidth > swidth) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_WIDTH, swidth, TRUE); + wwidth = swidth; + } + + if (wheight > sheight) + { + SetDlgItemInt(hwndDlg, IDC_EDIT_WINDOW_SIZE_HEIGHT, sheight, TRUE); + wheight = sheight; + } + + + pConInfo->ScreenBuffer = MAKELONG(swidth, sheight); + pConInfo->WindowSize = MAKELONG(wwidth, wheight); + pConInfo->WindowPosition = MAKELONG(left, top); + + PropSheet_Changed(GetParent(hwndDlg), hwndDlg); + } + break; + } + case IDC_CHECK_SYSTEM_POS_WINDOW: { LONG res = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0); From 9cb27f40af5720a054c01c76188d4f953fe34107 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 9 May 2010 13:39:48 +0000 Subject: [PATCH 037/151] [WIN32CSR] - Add primitive resizing support and automatic scrolling support - Patch by Adam Kachwalla (IRC:Crocodile) See issue #2622 for more details. svn path=/trunk/; revision=47146 --- .../win32/csrss/win32csr/guiconsole.c | 206 ++++++++++++++++-- .../win32/csrss/win32csr/guiconsole.h | 5 + 2 files changed, 189 insertions(+), 22 deletions(-) diff --git a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c index 51eca7c21c7..805de33e893 100644 --- a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c +++ b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c @@ -48,6 +48,8 @@ typedef struct GUI_CONSOLE_DATA_TAG COLORREF PopupText; COLORREF Colors[16]; WCHAR szProcessName[MAX_PATH]; + BOOL WindowSizeLock; + POINT OldCursor; } GUI_CONSOLE_DATA, *PGUI_CONSOLE_DATA; #ifndef WM_APP @@ -625,7 +627,7 @@ GuiConsoleUseDefaults(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PCSRSS_ if (Buffer) { Buffer->MaxX = 80; - Buffer->MaxY = 25; + Buffer->MaxY = 300; Buffer->CursorInfo.bVisible = TRUE; Buffer->CursorInfo.dwSize = CSR_DEFAULT_CURSOR_SIZE; } @@ -638,8 +640,8 @@ GuiConsoleInitScrollbar(PCSRSS_CONSOLE Console, HWND hwnd) SCROLLINFO sInfo; PGUI_CONSOLE_DATA GuiData = Console->PrivateData; - DWORD Width = Console->Size.X * GuiData->CharWidth + 2 * GetSystemMetrics(SM_CXFIXEDFRAME); - DWORD Height = Console->Size.Y * GuiData->CharHeight + 2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION); + DWORD Width = Console->Size.X * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); + DWORD Height = Console->Size.Y * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); /* set scrollbar sizes */ sInfo.cbSize = sizeof(SCROLLINFO); @@ -667,6 +669,7 @@ GuiConsoleInitScrollbar(PCSRSS_CONSOLE Console, HWND hwnd) SetScrollInfo(hwnd, SB_HORZ, &sInfo, TRUE); Height += GetSystemMetrics(SM_CYHSCROLL); ShowScrollBar(hwnd, SB_HORZ, TRUE); + } else { @@ -779,9 +782,13 @@ GuiConsoleHandleNcCreate(HWND hWnd, CREATESTRUCTW *Create) Console->PrivateData = GuiData; SetWindowLongPtrW(hWnd, GWL_USERDATA, (DWORD_PTR) Console); - SetTimer(hWnd, 1, CURSOR_BLINK_TIME, NULL); + SetTimer(hWnd, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL); GuiConsoleCreateSysMenu(Console); + + GuiData->WindowSizeLock = TRUE; GuiConsoleInitScrollbar(Console, hWnd); + GuiData->WindowSizeLock = FALSE; + SetEvent(GuiData->hGuiInitEvent); return (BOOL) DefWindowProcW(hWnd, WM_NCCREATE, 0, (LPARAM) Create); @@ -1157,6 +1164,11 @@ GuiWriteStream(PCSRSS_CONSOLE Console, RECT *Region, LONG CursorStartX, LONG Cur { GuiInvalidateCell(Buff, GuiData, Console->hWindow, CursorEndX, CursorEndY); } + + // Set up the update timer (very short interval) - this is a "hack" for getting the OS to + // repaint the window without having it just freeze up and stay on the screen permanently. + GuiData->CursorBlinkOn = TRUE; + SetTimer(Console->hWindow, CONGUI_UPDATE_TIMER, CONGUI_UPDATE_TIME, NULL); } static BOOL WINAPI @@ -1219,16 +1231,93 @@ GuiConsoleHandleTimer(HWND hWnd) { PCSRSS_CONSOLE Console; PGUI_CONSOLE_DATA GuiData; + PCSRSS_SCREEN_BUFFER Buff; RECT CursorRect; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - GuiData->CursorBlinkOn = ! GuiData->CursorBlinkOn; + SetTimer(hWnd, CONGUI_UPDATE_TIMER, CURSOR_BLINK_TIME, NULL); - CursorRect.left = Console->ActiveBuffer->CurrentX; - CursorRect.top = Console->ActiveBuffer->CurrentY; + GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); + + Buff = Console->ActiveBuffer; + CursorRect.left = Buff->CurrentX; + CursorRect.top = Buff->CurrentY; CursorRect.right = CursorRect.left; CursorRect.bottom = CursorRect.top; GuiDrawRegion(Console, &CursorRect); + GuiData->CursorBlinkOn = ! GuiData->CursorBlinkOn; + + if((GuiData->OldCursor.x != Buff->CurrentX) || (GuiData->OldCursor.y != Buff->CurrentY)) + { + SCROLLINFO xScroll; + int OldScrollX = -1, OldScrollY = -1; + int NewScrollX = -1, NewScrollY = -1; + + xScroll.cbSize = sizeof(SCROLLINFO); + xScroll.fMask = SIF_POS; + // Capture the original position of the scroll bars and save them. + if(GetScrollInfo(hWnd, SB_HORZ, &xScroll))OldScrollX = xScroll.nPos; + if(GetScrollInfo(hWnd, SB_VERT, &xScroll))OldScrollY = xScroll.nPos; + + // If we successfully got the info for the horizontal scrollbar + if(OldScrollX >= 0) + { + if((Buff->CurrentX < Buff->ShowX)||(Buff->CurrentX >= (Buff->ShowX + Console->Size.X))) + { + // Handle the horizontal scroll bar + if(Buff->CurrentX >= Console->Size.X) NewScrollX = Buff->CurrentX - Console->Size.X + 1; + else NewScrollX = 0; + } + else + { + NewScrollX = OldScrollX; + } + } + // If we successfully got the info for the vertical scrollbar + if(OldScrollY >= 0) + { + if((Buff->CurrentY < Buff->ShowY) || (Buff->CurrentY >= (Buff->ShowY + Console->Size.Y))) + { + // Handle the vertical scroll bar + if(Buff->CurrentY >= Console->Size.Y) NewScrollY = Buff->CurrentY - Console->Size.Y + 1; + else NewScrollY = 0; + } + else + { + NewScrollY = OldScrollY; + } + } + + // Adjust scroll bars and refresh the window if the cursor has moved outside the visible area + // NOTE: OldScroll# and NewScroll# will both be -1 (initial value) if the info for the respective scrollbar + // was not obtained successfully in the previous steps. This means their difference is 0 (no scrolling) + // and their associated scrollbar is left alone. + if((OldScrollX != NewScrollX) || (OldScrollY != NewScrollY)) + { + Buff->ShowX = NewScrollX; + Buff->ShowY = NewScrollY; + ScrollWindowEx(hWnd, + (OldScrollX - NewScrollX) * GuiData->CharWidth, + (OldScrollY - NewScrollY) * GuiData->CharHeight, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + if(NewScrollX >= 0) + { + xScroll.nPos = NewScrollX; + SetScrollInfo(hWnd, SB_HORZ, &xScroll, TRUE); + } + if(NewScrollY >= 0) + { + xScroll.nPos = NewScrollY; + SetScrollInfo(hWnd, SB_VERT, &xScroll, TRUE); + } + UpdateWindow(hWnd); + GuiData->OldCursor.x = Buff->CurrentX; + GuiData->OldCursor.y = Buff->CurrentY; + } + } } static VOID FASTCALL @@ -1518,16 +1607,83 @@ GuiConsoleHandleSysMenuCommand(HWND hWnd, WPARAM wParam, LPARAM lParam, PGUI_CON return Ret; } +static VOID FASTCALL +GuiConsoleGetMinMaxInfo(HWND hWnd, PMINMAXINFO minMaxInfo) +{ + PCSRSS_CONSOLE Console; + PGUI_CONSOLE_DATA GuiData; + GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); + if((Console == NULL)|| (GuiData == NULL)) return; + + DWORD windx = CONGUI_MIN_WIDTH * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); + DWORD windy = CONGUI_MIN_HEIGHT * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); + + minMaxInfo->ptMinTrackSize.x = windx; + minMaxInfo->ptMinTrackSize.y = windy; + + windx = (Console->ActiveBuffer->MaxX) * GuiData->CharWidth + 2 * (GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXEDGE)); + windy = (Console->ActiveBuffer->MaxY) * GuiData->CharHeight + 2 * (GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYEDGE)) + GetSystemMetrics(SM_CYCAPTION); + + if(Console->Size.X < Console->ActiveBuffer->MaxX) windy += GetSystemMetrics(SM_CYHSCROLL); // window currently has a horizontal scrollbar + if(Console->Size.Y < Console->ActiveBuffer->MaxY) windx += GetSystemMetrics(SM_CXVSCROLL); // window currently has a vertical scrollbar + + minMaxInfo->ptMaxTrackSize.x = windx; + minMaxInfo->ptMaxTrackSize.y = windy; +} static VOID FASTCALL GuiConsoleResize(HWND hWnd, WPARAM wParam, LPARAM lParam) { PCSRSS_CONSOLE Console; PGUI_CONSOLE_DATA GuiData; - GuiConsoleGetDataPointers(hWnd, &Console, &GuiData); - if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED) + if((Console == NULL) || (GuiData == NULL)) return; + + if ((GuiData->WindowSizeLock == FALSE) && (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED)) { - DPRINT1("GuiConsoleResize X %d Y %d\n", LOWORD(lParam), HIWORD(lParam)); + PCSRSS_SCREEN_BUFFER Buff = Console->ActiveBuffer; + + GuiData->WindowSizeLock = TRUE; + + DWORD windx = LOWORD(lParam); + DWORD windy = HIWORD(lParam); + + // Compensate for existing scroll bars (because lParam values do not accommodate scroll bar) + if(Console->Size.X < Buff->MaxX) windy += GetSystemMetrics(SM_CYHSCROLL); // window currently has a horizontal scrollbar + if(Console->Size.Y < Buff->MaxY) windx += GetSystemMetrics(SM_CXVSCROLL); // window currently has a vertical scrollbar + + DWORD charx = windx / GuiData->CharWidth; + DWORD chary = windy / GuiData->CharHeight; + + // Character alignment (round size up or down) + if((windx % GuiData->CharWidth) >= (GuiData->CharWidth / 2)) ++charx; + if((windy % GuiData->CharHeight) >= (GuiData->CharHeight / 2)) ++chary; + + // Compensate for added scroll bars in new window + if(charx < Buff->MaxX)windy -= GetSystemMetrics(SM_CYHSCROLL); // new window will have a horizontal scroll bar + if(chary < Buff->MaxY)windx -= GetSystemMetrics(SM_CXVSCROLL); // new window will have a vertical scroll bar + + charx = windx / GuiData->CharWidth; + chary = windy / GuiData->CharHeight; + + // Character alignment (round size up or down) + if((windx % GuiData->CharWidth) >= (GuiData->CharWidth / 2)) ++charx; + if((windy % GuiData->CharHeight) >= (GuiData->CharHeight / 2)) ++chary; + + // Resize window + if((charx != Console->Size.X) || (chary != Console->Size.Y)) + { + Console->Size.X = (charx <= Buff->MaxX) ? charx : Buff->MaxX; + Console->Size.Y = (chary <= Buff->MaxY) ? chary : Buff->MaxY; + } + + GuiConsoleInitScrollbar(Console, hWnd); + + // Adjust the start of the visible area if we are attempting to show nonexistent areas + if((Buff->MaxX - Buff->ShowX) < Console->Size.X) Buff->ShowX = Buff->MaxX - Console->Size.X; + if((Buff->MaxY - Buff->ShowY) < Console->Size.Y) Buff->ShowY = Buff->MaxY - Console->Size.Y; + InvalidateRect(hWnd, NULL, TRUE); + + GuiData->WindowSizeLock = FALSE; } } VOID @@ -1679,7 +1835,9 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole if (SizeChanged) { + GuiData->WindowSizeLock = TRUE; GuiConsoleInitScrollbar(Console, pConInfo->hConsoleWindow); + GuiData->WindowSizeLock = FALSE; } LeaveCriticalSection(&ActiveBuffer->Header.Lock); @@ -1839,6 +1997,9 @@ GuiConsoleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_VSCROLL: Result = GuiConsoleHandleScroll(hWnd, msg, wParam); break; + case WM_GETMINMAXINFO: + GuiConsoleGetMinMaxInfo(hWnd, (PMINMAXINFO)lParam); + break; case WM_SIZE: GuiConsoleResize(hWnd, wParam, lParam); break; @@ -1886,17 +2047,18 @@ GuiConsoleNotifyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { Title = L""; } - NewWindow = CreateWindowW(L"ConsoleWindowClass", - Title, - WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_HSCROLL | WS_VSCROLL, //WS_OVERLAPPEDWINDOW - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - CW_USEDEFAULT, - NULL, - NULL, - (HINSTANCE) GetModuleHandleW(NULL), - (PVOID) Console); + NewWindow = CreateWindowExW(WS_EX_CLIENTEDGE, + L"ConsoleWindowClass", + Title, + WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + (HINSTANCE) GetModuleHandleW(NULL), + (PVOID) Console); if (NULL != Buffer) { HeapFree(Win32CsrApiHeap, 0, Buffer); diff --git a/reactos/subsystems/win32/csrss/win32csr/guiconsole.h b/reactos/subsystems/win32/csrss/win32csr/guiconsole.h index f933d933b6e..072ef8c8886 100644 --- a/reactos/subsystems/win32/csrss/win32csr/guiconsole.h +++ b/reactos/subsystems/win32/csrss/win32csr/guiconsole.h @@ -8,6 +8,11 @@ #include "api.h" +#define CONGUI_MIN_WIDTH 10 +#define CONGUI_MIN_HEIGHT 10 +#define CONGUI_UPDATE_TIME 0 +#define CONGUI_UPDATE_TIMER 1 + NTSTATUS FASTCALL GuiInitConsole(PCSRSS_CONSOLE Console); /*EOF*/ From b6b00740ca252d6a6279237d14316159491990ee Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sun, 9 May 2010 15:02:58 +0000 Subject: [PATCH 038/151] [INPUT] - Reorder keyboard layouts in the registry after one was deleted - Fixes changing keyboard layouts from regional options See issue #3317 for more details. svn path=/trunk/; revision=47147 --- reactos/dll/cpl/input/settings.c | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/reactos/dll/cpl/input/settings.c b/reactos/dll/cpl/input/settings.c index 58642f54a86..393359dd7a2 100644 --- a/reactos/dll/cpl/input/settings.c +++ b/reactos/dll/cpl/input/settings.c @@ -5,6 +5,7 @@ * PURPOSE: input.dll * PROGRAMMER: Dmitry Chapyshev (dmitry@reactos.org) * Colin Finck + * Gregor Schneider * UPDATE HISTORY: * 06-09-2007 Created */ @@ -376,6 +377,59 @@ UpdateLayoutsList(VOID) (VOID) ListView_SetImageList(GetDlgItem(MainDlgWnd, IDC_KEYLAYOUT_LIST), hImgList, LVSIL_SMALL); } +typedef struct _REG_KB_ENTRY_ +{ + TCHAR szLayoutID[3]; + DWORD dwType; + TCHAR szData[CCH_LAYOUT_ID + 1]; + DWORD dwDataSize; +} REG_KB_ENTRY; + +/* Layouts were deleted so we have to order the existing ones */ +static VOID +UpdateRegValueNames(HKEY hKey) +{ + DWORD dwIndex = 0, dwGot = 0, dwLayoutSize; + DWORD dwSets = 5; + REG_KB_ENTRY* data = HeapAlloc(GetProcessHeap(), 0, dwSets * sizeof(REG_KB_ENTRY)); + + /* Get all existing entries and delete them */ + dwLayoutSize = sizeof(data[0].szLayoutID); + while (RegEnumValue(hKey, + dwIndex, + data[dwGot].szLayoutID, + &dwLayoutSize, + NULL, + &data[dwGot].dwType, + (PBYTE)data[dwGot].szData, + &data[dwGot].dwDataSize) != ERROR_NO_MORE_ITEMS) + { + if (_tcslen(data[dwGot].szLayoutID) <= 2 && _tcslen(data[dwGot].szData) == CCH_LAYOUT_ID) + { + RegDeleteValue(hKey, data[dwGot].szLayoutID); + dwGot++; + if (dwGot == dwSets) + { + dwSets += 5; + data = HeapReAlloc(GetProcessHeap(), 0, data, dwSets * sizeof(REG_KB_ENTRY)); + } + } + dwIndex++; + dwLayoutSize = sizeof(data[0].szLayoutID); + } + + /* Set all entries with an updated value name */ + for (dwIndex = 0; dwIndex < dwGot; dwIndex++) + { + TCHAR szNewLayoutID[3]; + + _stprintf(szNewLayoutID, TEXT("%u"), dwIndex + 1); + RegSetValueEx(hKey, szNewLayoutID, 0, data[dwIndex].dwType, + (PBYTE)data[dwIndex].szData, data[dwIndex].dwDataSize); + } + HeapFree(GetProcessHeap(), 0, data); +} + static VOID DeleteLayout(VOID) { @@ -430,6 +484,7 @@ DeleteLayout(VOID) if (RegDeleteValue(hKey, szLayoutNum) == ERROR_SUCCESS) { UpdateLayoutsList(); + UpdateRegValueNames(hKey); } } RegCloseKey(hKey); From a38d98d504d678d13bb1689a00c60e587c2b8169 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Sun, 9 May 2010 18:06:38 +0000 Subject: [PATCH 039/151] [NTOS]: At times, pages may be removed from the zero or free page list, but without being initialized as part of the PFN database, such that their PageLocation has not changed. However, we can detect these pages because their link pointers will be NULL, meaning they're not _really_ free or zeroed. Use this enhanced check when verifying if a page is in use or not, and additionally triple-check by making sure the reference count is zero. This now matches the Windows checks. We also consider Standby pages (not yet implemented) as usable, since we can always steal them. svn path=/trunk/; revision=47148 --- reactos/ntoskrnl/mm/freelist.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 6f5df91a1cc..7107e1e05a1 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -128,12 +128,23 @@ MmRemoveLRUUserPage(PFN_TYPE Page) RtlClearBit(&MiUserPfnBitMap, Page); } +BOOLEAN +NTAPI +MiIsPfnFree(IN PMMPFN Pfn1) +{ + /* Must be a free or zero page, with no references, linked */ + return ((Pfn1->u3.e1.PageLocation <= StandbyPageList) && + (Pfn1->u1.Flink) && + (Pfn1->u2.Blink) && + !(Pfn1->u3.e2.ReferenceCount)); +} + BOOLEAN NTAPI MiIsPfnInUse(IN PMMPFN Pfn1) { - return ((Pfn1->u3.e1.PageLocation != FreePageList) && - (Pfn1->u3.e1.PageLocation != ZeroedPageList)); + /* Standby list or higher, unlinked, and with references */ + return !MiIsPfnFree(Pfn1); } PFN_NUMBER From af061821718bc57e51154d7ef49738f9f603544d Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Sun, 9 May 2010 18:12:50 +0000 Subject: [PATCH 040/151] [NTOS]: Implement MiRemoveAnyPage and MiRemovePageByColor, but only using the list heads, and not the color list heads. Unused. [NTOS]: Fixup unused MiInsertPageInFreeList variables ot match the other functions (ColorTable vs ColorHead). svn path=/trunk/; revision=47149 --- reactos/ntoskrnl/mm/ARM3/pfnlist.c | 191 +++++++++++++++++++++++++++-- 1 file changed, 182 insertions(+), 9 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pfnlist.c b/reactos/ntoskrnl/mm/ARM3/pfnlist.c index f42abdc82c9..3af1fef57ea 100644 --- a/reactos/ntoskrnl/mm/ARM3/pfnlist.c +++ b/reactos/ntoskrnl/mm/ARM3/pfnlist.c @@ -244,6 +244,175 @@ MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry) } } +PFN_NUMBER +NTAPI +MiRemovePageByColor(IN PFN_NUMBER PageIndex, + IN ULONG Color) +{ + PMMPFN Pfn1; + PMMPFNLIST ListHead; + MMLISTS ListName; + PFN_NUMBER OldFlink, OldBlink; + ULONG OldColor, OldCache; +#if 0 + PMMCOLOR_TABLES ColorTable; +#endif + /* Make sure PFN lock is held */ + ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); + ASSERT(Color < MmSecondaryColors); + + /* Get the PFN entry */ + Pfn1 = MiGetPfnEntry(PageIndex); + ASSERT(Pfn1->u3.e1.RemovalRequested == 0); + ASSERT(Pfn1->u3.e1.Rom == 0); + + /* Capture data for later */ + OldColor = Pfn1->u3.e1.PageColor; + OldCache = Pfn1->u3.e1.CacheAttribute; + + /* Could be either on free or zero list */ + ListHead = MmPageLocationList[Pfn1->u3.e1.PageLocation]; + ListName = ListHead->ListName; + ASSERT(ListName <= FreePageList); + + /* Remove a page */ + ListHead->Total--; + + /* Get the forward and back pointers */ + OldFlink = Pfn1->u1.Flink; + OldBlink = Pfn1->u2.Blink; + + /* Check if the next entry is the list head */ + if (OldFlink != LIST_HEAD) + { + /* It is not, so set the backlink of the actual entry, to our backlink */ + MiGetPfnEntry(OldFlink)->u2.Blink = OldBlink; + } + else + { + /* Set the list head's backlink instead */ + ListHead->Blink = OldFlink; + } + + /* Check if the back entry is the list head */ + if (OldBlink != LIST_HEAD) + { + /* It is not, so set the backlink of the actual entry, to our backlink */ + MiGetPfnEntry(OldBlink)->u1.Flink = OldFlink; + } + else + { + /* Set the list head's backlink instead */ + ListHead->Flink = OldFlink; + } + + /* We are not on a list anymore */ + Pfn1->u1.Flink = Pfn1->u2.Blink = 0; + + /* Zero flags but restore color and cache */ + Pfn1->u3.e2.ShortFlags = 0; + Pfn1->u3.e1.PageColor = OldColor; + Pfn1->u3.e1.CacheAttribute = OldCache; +#if 0 // When switching to ARM3 + /* Get the first page on the color list */ + ColorTable = &MmFreePagesByColor[ListName][Color]; + ASSERT(ColorTable->Count >= 1); + + /* Set the forward link to whoever we were pointing to */ + ColorTable->Flink = Pfn1->OriginalPte.u.Long; + if (ColorTable->Flink == LIST_HEAD) + { + /* This is the beginning of the list, so set the sentinel value */ + ColorTable->Blink = LIST_HEAD; + } + else + { + /* The list is empty, so we are the first page */ + MiGetPfnEntry(ColorTable->Flink)->u4.PteFrame = -1; + } + + /* One more page */ + ColorTable->Total++; +#endif + /* See if we hit any thresholds */ + if (MmAvailablePages == MmHighMemoryThreshold) + { + /* Clear the high memory event */ + KeClearEvent(MiHighMemoryEvent); + } + else if (MmAvailablePages == MmLowMemoryThreshold) + { + /* Signal the low memory event */ + KeSetEvent(MiLowMemoryEvent, 0, FALSE); + } + + /* One less page */ + if (--MmAvailablePages < MmMinimumFreePages) + { + /* FIXME: Should wake up the MPW and working set manager, if we had one */ + } + + /* Return the page */ + return PageIndex; +} + +PFN_NUMBER +NTAPI +MiRemoveAnyPage(IN ULONG Color) +{ + PFN_NUMBER PageIndex; + PMMPFN Pfn1; + + /* Make sure PFN lock is held and we have pages */ + ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); + ASSERT(MmAvailablePages != 0); + ASSERT(Color < MmSecondaryColors); + + /* Check the colored free list */ +#if 0 // Enable when using ARM3 database */ + PageIndex = MmFreePagesByColor[FreePageList][Color].Flink; + if (PageIndex == LIST_HEAD) + { + /* Check the colored zero list */ + PageIndex = MmFreePagesByColor[ZeroedPageList][Color].Flink; + if (PageIndex == LIST_HEAD) + { +#endif + /* Check the free list */ + PageIndex = MmFreePageListHead.Flink; + Color = PageIndex & MmSecondaryColorMask; + if (PageIndex == LIST_HEAD) + { + /* Check the zero list */ + ASSERT(MmFreePageListHead.Total == 0); + PageIndex = MmZeroedPageListHead.Flink; + Color = PageIndex & MmSecondaryColorMask; + ASSERT(PageIndex != LIST_HEAD); + if (PageIndex == LIST_HEAD) + { + /* FIXME: Should check the standby list */ + ASSERT(MmZeroedPageListHead.Total == 0); + } + } +#if 0 // Enable when using ARM3 database */ + } + } +#endif + + /* Remove the page from its list */ + PageIndex = MiRemovePageByColor(PageIndex, Color); + + /* Sanity checks */ + Pfn1 = MiGetPfnEntry(PageIndex); + ASSERT((Pfn1->u3.e1.PageLocation == FreePageList) || + (Pfn1->u3.e1.PageLocation == ZeroedPageList)); + ASSERT(Pfn1->u3.e2.ReferenceCount == 0); + ASSERT(Pfn1->u2.ShareCount == 0); + + /* Return the page */ + return PageIndex; +} + PMMPFN NTAPI MiRemoveHeadList(IN PMMPFNLIST ListHead) @@ -285,10 +454,12 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) { PMMPFNLIST ListHead; PFN_NUMBER LastPage; - PMMPFN Pfn1, Blink; + PMMPFN Pfn1; +#if 0 ULONG Color; - PMMCOLOR_TABLES ColorHead; - + PMMPFN Blink; + PMMCOLOR_TABLES ColorTable; +#endif /* Make sure the page index is valid */ ASSERT((PageFrameIndex != 0) && (PageFrameIndex <= MmHighestPhysicalPage) && @@ -351,21 +522,22 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) KeSetEvent(MiHighMemoryEvent, 0, FALSE); } +#if 0 // When using ARM3 PFN /* Get the page color */ Color = PageFrameIndex & MmSecondaryColorMask; /* Get the first page on the color list */ - ColorHead = &MmFreePagesByColor[FreePageList][Color]; - if (ColorHead->Flink == LIST_HEAD) + ColorTable = &MmFreePagesByColor[FreePageList][Color]; + if (ColorTable->Flink == LIST_HEAD) { /* The list is empty, so we are the first page */ Pfn1->u4.PteFrame = -1; - ColorHead->Flink = PageFrameIndex; + ColorTable->Flink = PageFrameIndex; } else { /* Get the previous page */ - Blink = (PMMPFN)ColorHead->Blink; + Blink = (PMMPFN)ColorTable->Blink; /* Make it link to us */ Pfn1->u4.PteFrame = MI_PFNENTRY_TO_PFN(Blink); @@ -373,11 +545,12 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) } /* Now initialize our own list pointers */ - ColorHead->Blink = Pfn1; + ColorTable->Blink = Pfn1; Pfn1->OriginalPte.u.Long = LIST_HEAD; /* And increase the count in the colored list */ - ColorHead->Count++; + ColorTable->Count++; +#endif /* FIXME: Notify zero page thread if enough pages are on the free list now */ } From eaaf713f3d9e1d7d876fbe3448843cbee1df5da0 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Sun, 9 May 2010 18:17:53 +0000 Subject: [PATCH 041/151] [NTOS]: Acquire PFN lock before setting up hyperspace PTE/page. [NTOS]: Flush TLB after setting up hyperspace. [NTOS]: Use new MiRemoveAnyPage interface instead of MmAllocPage(MC_SYSTEM), as the first test of the new Page API/ABI. [NTOS]: Add support for creating software PTEs. svn path=/trunk/; revision=47150 --- reactos/ntoskrnl/mm/ARM3/i386/init.c | 20 ++++++++++------ reactos/ntoskrnl/mm/ARM3/miarm.h | 36 ++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/i386/init.c b/reactos/ntoskrnl/mm/ARM3/i386/init.c index 250324ca65f..0e6908fcbcd 100644 --- a/reactos/ntoskrnl/mm/ARM3/i386/init.c +++ b/reactos/ntoskrnl/mm/ARM3/i386/init.c @@ -151,6 +151,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) MMPTE TempPde, TempPte; PVOID NonPagedPoolExpansionVa; ULONG OldCount; + KIRQL OldIrql; /* Check for kernel stack size that's too big */ if (MmLargeStackSize > (KERNEL_LARGE_STACK_SIZE / _1KB)) @@ -541,21 +542,26 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) // MiInitializeSystemPtes(PointerPte, MmNumberOfSystemPtes, SystemPteSpace); - // - // Get the PDE For hyperspace - // + /* Get the PDE For hyperspace */ StartPde = MiAddressToPde(HYPER_SPACE); - // - // Allocate a page for it and create it - // - PageFrameIndex = MmAllocPage(MC_SYSTEM); + /* Lock PFN database */ + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + + /* Allocate a page for hyperspace and create it */ + PageFrameIndex = MiRemoveAnyPage(0); TempPde.u.Hard.PageFrameNumber = PageFrameIndex; TempPde.u.Hard.Global = FALSE; // Hyperspace is local! ASSERT(StartPde->u.Hard.Valid == 0); ASSERT(TempPde.u.Hard.Valid == 1); *StartPde = TempPde; + /* Flush the TLB */ + KeFlushCurrentTb(); + + /* Release the lock */ + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + // // Zero out the page table now // diff --git a/reactos/ntoskrnl/mm/ARM3/miarm.h b/reactos/ntoskrnl/mm/ARM3/miarm.h index 11d4189a958..a6e87fe7b8b 100644 --- a/reactos/ntoskrnl/mm/ARM3/miarm.h +++ b/reactos/ntoskrnl/mm/ARM3/miarm.h @@ -89,6 +89,24 @@ #define MM_DECOMMIT 0x10 #define MM_NOACCESS (MM_DECOMMIT | MM_NOCACHE) +// +// Corresponds to MMPTE_SOFTWARE.Protection +// +#ifdef _M_IX86 +#define MM_PTE_SOFTWARE_PROTECTION_BITS 5 +#elif _M_ARM +#define MM_PTE_SOFTWARE_PROTECTION_BITS 5 +#elif _M_AMD64 +#define MM_PTE_SOFTWARE_PROTECTION_BITS 5 +#else +#error Define these please! +#endif + +// +// Creates a software PTE with the given protection +// +#define MI_MAKE_SOFTWARE_PTE(x) ((x) << MM_PTE_SOFTWARE_PROTECTION_BITS) + // // Special values for LoadedImports // @@ -409,6 +427,12 @@ MmArmAccessFault( IN PVOID TrapInformation ); +NTSTATUS +FASTCALL +MiCheckPdeForPagedPool( + IN PVOID Address +); + VOID NTAPI MiInitializeNonPagedPool( @@ -532,6 +556,18 @@ MiRemoveHeadList( IN PMMPFNLIST ListHead ); +PFN_NUMBER +NTAPI +MiAllocatePfn( + IN PMMPTE PointerPte, + IN ULONG Protection +); + +PFN_NUMBER +NTAPI +MiRemoveAnyPage( + IN ULONG Color +); VOID NTAPI From 2699cdc3dea1a650c6c9e350a9e2ebc45bffe130 Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Sun, 9 May 2010 20:23:07 +0000 Subject: [PATCH 042/151] Update WinFile to Wine 1.1.44 svn path=/trunk/; revision=47151 --- rosapps/applications/winfile/winefile.ico | Bin 15086 -> 25214 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/rosapps/applications/winfile/winefile.ico b/rosapps/applications/winfile/winefile.ico index 4030d8e759f29a81defb969b8309a789e4521f24..2b931c895e7c95845106eb4df621bb9539e84210 100644 GIT binary patch literal 25214 zcmeHv30%$D`~Q<7gh~iw2$5yXO!;DDkR_R6jO=3%m9o{_7Z~!0# z{}TZGo}Hb|RW+J+n#fY;ehg`LWV5q6>-W>d|C$}g&p?_*^GKNI>KXBV)%ix`)%r4| zDW}7b9;h6@3zk60x%(0` zU%!0yz*i6a&-FkjwU!L2anwN(NkLHo2@^H7HY!{VrZlhC0!fYi#C&_^8!f}qy7E%( zRobYjsj{N%C(TRMx1xDz{q0+d^Q^d9&3qfImujz~itUvcYAZ*nof@dgE4S_}rjBZO zA*8xPv!6+IKW8;qZR~4FMl(Jaz3}-+@Yz}?)4IkOpSc8|$uf-3YbH-qX{K^q9j6zc z;{>1AjoRVlX-f5QdD@ApgbP?5oa~y*67UcT`=P3;`&S@lV>CN0*gocm4wbEE@?8Hd)P@e#ruA%dEiF3nr}#PA z!1`VsA@tSKWAk#TmePONEQlipdM&;HVXP#kPl|T|O896ZnrW|u+ z(kYcC&q0p719|cR6ggv(l*V@&$a=^$&SXgXeJT~VsI>KkJNHT;si*>GSny!1(Hcld zd;ku+_Cv<4zu-pMTksFu4)*RI7%A=mcfJRNgoh$xLrA{<1P&ZN2%EOp!jNC5!sQ1Q zAoSV>!O=;Ob@>hqn>-1IJ0*e9-s>Rp^MP-BE`#ZY$Km{iD-gXm1}Z;Pfs?BD;7t6}^KGnhI16uf(1363sK zkX8H)+N{`xw)k+T{4H$o3|X|FBHJJ2d|-n zvLno#847F6qCp@CfbhuOV9E=I<-ABRGP8gc@deO+%Kxh~!tWNK;dnS$9IRp&x=ff=i>{uX+_xA6X58Yh1c2$g3sQEbC)i_vVAweXPYn9 zS%J%uJFvxx4?Q~Fhpmnxh`ewgsy@DlwF$RCN$CuXoiQEuT&aMWPEnAUnv8Asf~&v} zJiUeZ{r?~x=wOndXJY&f+qDs%vXrBgkvXt;a9WGvTt*o059pl<7Yj)iUS^&_i4XQuY=aY$pu9QV8S{%yy$vz7RnW1$^4 z=+L16bX|(8*z!s_W0Q^|XqiIBngvuxMl!OG|IhfQ~z&DKwo^-uCjE9=!ee`x2is54tXSJppw z{9FA|V0kq$=G*aX{XSX$%&-qXyKsw~OZ4uxY<(x${u%vexO&&*_Ivi|{>;|5k*!}p zPVmz$-7q_S-88n|P_|yjD>UN7g;lDNx=c0X%#rnvX=k&ZdI{+RP8y5rQ)T_L@svTA z_hv{SVE@5lJ%$XYX}Q8RgV*R%=1gE3ngM@h8q^ zEpS4Q<<%2>I?uOIAF3k9D5{>wveRKszhuJA%)4!Hg_}i*^3@i!aCXa;>)_SXV0F^%2PZBtbfL-GJ5ERVexSORG(mh7e-rxUo3B+K4GYpjg^H2KL%+u zjv22$VZ?|LHcYupe|t|DiVYY)$oSJ@!cc5b+dovEhCdu0ai7OqOu#|JmdohZQnwm9 zf|^DAQvJ2G87CQ6lE8_%W_nbXQmygE7R&mRjyJBHi?^6`grpp}z>C?S;a+;!s5(N^ z(UB6zl||Y`mL$O$H9~JSF;NHnuOjw2i%%?uWYfF7*t{d|`@N&Rs+nRvE$@NL4^2tC zI)`A94y^?4U#c7 zZoSA0`U%cLkDjX`G(Hh@emBG>c3|u2v0TDX9<$2REN%@@|Lz5{Uy@u0XS3i|f3 zhM4HHFlzMJs&jOa>30#0+eSsz!*IrSiHsz)~^poy=&olWfc=M zw}6cRDN;$j#-ArdZK$%pnveqg@-BB*ql z2XU9~gIRJhxbfU!L&^9;GG7+OhrCLB3-6y8-4aB(SQ;%ORJn+taVtV;mJm9b1b zJ#YR6Si6n~3CW3IxzP%`oA`iLQX%S|0=cJg9@c6KY(HKK6MnUXwsYJ-4dd$#HlEOC zYc{CZWMKViCZ^tft`s)8dV|TT5{!k9!o$apV0!3T$UJ!x$HO+r#u$5x$R7+Q9flDj zeW9gQB5d^zhHqB*Lp!s*5S5k-iB}(E44A;g)vaf{z;}~>g+3m6ATKu$&Ya7K9eIzy z3w0>Z=Yw}ZAPf+mhp4DzkcT3;a{Ve^(*0m;y9s*tvt(lF*}JcSy2mMu*(1Tlc@MN| z8O+4g@rijD(~6k5+SO?v%;iM^pTC`ntCeh0f$!@F+x&__b(Rw(rCfq%ZwRC$Ux)r) zrvR4kf}dPcB=L2tWkI0on2Y`r!f0L^Z%8sSlWEOCv;Li%f!$$eh$ydN4a!p ztK@gF_%@Uo5!u&H^v92z*2-umoK^@1A^v@00G!=6BA(;awy!@QE%GXt4%gFU2^M>(-Qft zRXRFHj~<;k@fp&_loZ_gyot1P=kw=V9Q+hs@aLR4GY6f^QP!j$y7ke{QIjhS^-maT zbHbQr{RicTZL3WOb#-@o0$kL;C?(Cx-;g(_RN0fEN+u(J_@M4hlux~;Swmi^+tbaN zlKF)|q-B*%#;vDNw*md~3T7dhNFG30X|3y%Prht; zaq{W%(~~b&NYn!(FNQ2*AY<2{RP7kGk_CLV)0z_ajC=>*4zH>8FJY`|hXzkorbOM!uzV`_DSH(?ZYSI;bw}^=kN9 z@fjXyD89<>#l~NbTs&7Z9m~d#T`^9hab#0d6$f$LiTauNlhdmx&T}ajZ#FgM+BKGP z_PA7xqnEfJb*2AKoT|ZI!RjZ|XI#;*P5vbhv_d;{S4ai96LRN&fmP84-DsjaF)fh6 z+uK`uRf85aMhYlEF?UDqjoc5JE|(1ar@2Ru9^bFuVCmrK?vlAJDDdyyQG4FU#>bJU zy|M3ucJ2Jzjn7MS>uNP1Nxb|@_Elv4x~P~ zeC6`(bLY=r&dtp|d-CMTv-$b?h4=5@e_B~t`62)E zulFY=Ja-fD)>Olme4}HpC-V2mV+Kq#sB}szB=+gI$=0;nWb@%-Vtc5V*c>b-8xIr_ ztJET5ky1#^lM2bY#9IXS$I0sb1!QG>0WpcYNmlH;NtW%sL6*keAd6$JlSR?j$%3eB zLp~i&PrH_j^Sa2G=-Y^sAl`?i_e&p^ zmXMKj^5sMoYW-he|lZ$*cnOj+oawkJzY;W`+Q=3Xa5>1pNai2n7{DD zdg~1ba4g*rh`e68@;!*BNcc)9^3HeVy9K)Q`7<0H9hrN(CV0%#dzYTR)j%FX@ozp* zKzh05O7Lq6&XR#%=f4aK&ymiKCnUP*^%ywOpsKa1>S(mz-`>S3)|KZ$+yowyP!G!+ zBl_H=*QN*Je`kOAmIVLct%*c+t}9WV?Np1~&2%J6GwhHZYOpJk`gxCl8R&w(PjwgYiL1aPp)t@k>gnon8;ajKy^!FVE~CH0 zY{X%aKvb+!YO&I6SJKiXg2=Cpmtlofdx?^vT`hS=$NK%G1NN;q?=+*I-Xng@=BYB=VqGG0J?d?T zIywACc&}6ZeI`!CnHK<0C@2dE3?S|T-k&tzT%!1SM~X>rch>(6<98(rOLveK%fn=O zSqS2{ud~mzPgEy|-x!}+9De$ILI1yvii#rcp8R)?A`yM3Hj5~JVb<*?;cvItml-D% zt2DR8vD0q8ph@`YvzNo~!gDjX-n8kBhldAQYrgKS3(tL3v%sS;#V^XfL;5tq|MiWJ z#>%DrPv0RFzoU!GG!LFnmACgcA`}J^n$kQT+R$rGA1Hpm<0bzZe#?|wWa--V9|Quw z_vYsDpNx#ok!jPe6DOxT#K$L#czJFAz~}pj@cB=l^NkY4A8_(6>FbflJRcew|Bd;% zzIx98UF?q$_wBpMIx`{B(~BhCy6wSeX)kg*@@b-@Q$m7*o)A7i_M@k#-^rk$AojFS z1HGX5gY!!N75v8haI$!r6XLca?b>Z7y?bv%+ieE`7G&f<{3%`{;(YJ{X#Zw3?a_W(PY4Ym6)H0Y>d1fc?+^DvXG1#wGZ#>jE^FbZ+c_+ zBhNh`{dny7r*kirP3c6%=J1zc)J1iAc=-_}rQgXn-z+4FiFt@Wo^5AX#rb5+ z7=MzKRDfgrBKhT)9DMfVlQnDZ;CO#b{QRDf)vF81h!NSOO`8}J9DIt1L_W;&OdZgf zB8q?SrAMT{*#CnZ50Y<|`H*f#-nF>nd=Juoj!T`a`iFZhd8(tw3O_R5Cxz*xLT|<%Z0Qu3MLAsQ8L`pWH-(cw$_qobgYdg%5$8EwRZ>^ynGk= zag-ZLPRS?k?%8jL4ck+RzYND^r7*<4`vY>7y!?(=3JTkv_v{(;aL111n|S{oZw!C( z)yJei|5T&Te>#6tSiO(5Sbso<<;{{BoxhoQMUnAtiNyc-J(7O>#K+v+OL3bv1#a)q zVX}*g$~2$OoqzZ5-hKKuO-%zgZSCQf7)LtcVs0AZZ!j*P{y%uVtcmzti9F8L7+`>XnM@hiPu3#-0-O)&G=@L(R(X@~ zGx+L=YnV8tfp;Fo-xuQ-p2(ksoxVqG1;Y2Q-n`+Lm6a{TJzFhhW#ztj#_K!07CL%* zdO!E>-FtXwXsD@=kI%Dx`}WcGo_dLnpRB^anvTDo*rq<;({gV9v&J)wgdMp^mfP4? zQT(`WKI_t@OB#6Qup9nxwriUyn-KrOdVz~8DE{NO|0V+jjo-fw zVQi?5!~dH{9Em-6lw_Sc{qgzp=jWe3eVSihUViQI00)iH@K1rOze!J1yHrR2K?}+7jNe1c~N|55HQI76~;^>l=V{j;lPhKKh*jnjVwPU^kFa@08A&aCMN+Om!SzplqM@hPx-o1`sUI|M(unU2 zro7B7DF4U$K(QYxenpb5Jt5jt4c`nLr~hkHur*bN>BHoyFOT3n;_8!kWNUUgu{rvr z*=&t%YBJT6cKa1cypk>_tekf+FhzxhD^LN0&(ft0;^PaY%x z`SLw^g#57LJ$X=3MM_^(k$cap$X(=;XO-j*^6jUUq!^i&r{lH#C$UTS;UC*e`od#| z!~8Y<>VdBw`09bL9%$SH4V}}vJ686bR%`BD6PIFrbIxaR=eWN3Ijz1d4&}EEry$1N zLY(%xBt93`i%sh~pGEse%m2x9S{i6W4_S`ce#bA(-togW|1Qyeq;|;k+z{P!|7^x} zrq0G|jQitxS8W%8pdXLN!>iLEQCoP$fyS{vAk#DO&F1MdW>{@@u)Dr1EVME{A>qxT zw8Ir?nHjGVQj@BDxBHiySy_aS88hZv)GbZ)T$bj4J0BYM+cdhjPIm9xN6Z}@$WjYS zvcY=eNn2an*qu9frW6$yJ$jp-|5I0NbNgj+#z=2voV{*=VC0yXJXdk zekR?MHH~M_!qEM3y2rmTnmq$EFCw4Vd-;=~_yZ*3SU&OF8O-20bokH}w0*ItxcDCa z?Tr_%eD@_a?BfYY=t=FnA1#r@zn>F_cEb31gi``p?;lI79qbtUt^(d2+%JxE<9k@q zu~5S{msO9`|2oJ4Fy4 z&yOrvkVt;}?JVw@WfMnS91ZgXS{A*Aokx7 z?HVD|{bGuRM^>%ckNcOx%k|mME`G}P|1+LHo?arNqC)q4uaM=-lW|{BMAX!Fl1`n% z(HG%}XFKjy`_p~W_x0J&EqTt^|D5L!U+6E# zl(%l}Rk~n7c%he9-TSQc`d`LB7DcanUC%$+v0nS!nVDcG`N7DEh>jJLtScqtKa&hd zj~+u7;91orLxv17!Cx+#;yff0_XCdA=l`2!uRq)V9JdHE+02bt<5||cqQ_*6;S4+j z@Xbg~P0dMt`t+Gf8UNH#9NNbpgV!e7|Kh*ie760O4*Q6yohNb0yhH9ieNCbh6G>4~ z(VmMJFNT~sb4Gx__%TA;Ik*OISlc@L{-f)=tpA(;{OM_%M11|XlT#NilM}glWN&;t zNl8g5N=r+-cjU;CS68oIeTn-Qukrq`Isand(EgXbtYqwe&hv+!rxD>^h?^*Ygzv{^ zq3KFIr{HHw_eqdzWERH{C!kWNs@29{IAxfBd@+7dG{)qv*NWn*+9X7Nt10yFEV*k z^7I`^Df~PP(bv#+=_@jF!HU;f`UXv!cS%Fi(*M>@e;`LT$trgc>=~^pYXDujyOGYg+eXBKTGX7D7&m)Qff4fhH zO!>XpJb2P%GC&{y*uYo%>VYPBfL*7dpYIg!vVUKTroE6IkjF|fEmKBT6tg_0()<$h Rl-0%cr!b}R4gP(t{|8nGq51#- literal 15086 zcmeI3cU%-l8^>q&j@|?XK~%5-_J$}iiY-d)i6t?1#fm{JF^C#F_AY9$#l*xIvBgB+ zC?Z9QN;G1L8dMNOKn)!Z1b*)`ckX!{)x^B7e`G(OFH?4Qp5M&P?d{I&(n=sbfk})SL@=NRqLHU<5)b6c3J{tF#xa)MTxb0|? zuwrk7IQ6q#%+_`aX{C`cu}aMgHu}g8UV%I!9rCcJ5NECeGpPY_;f`W)+wn|s)Aw=0 z7u){BhK}@OCMK?B`dqnZmbf(-vTvgyG;RSp4{^{q$c|i7^~w8{IGL57Z z$X3#UQimOZaNKna&XGyzL}k~TD&C>A^PTi!M=!78>g!j0>1DJg2p>Pl#fXP_N*0;h?TC7&%eQ;7U!H-TPKM#Z%V>5u6w`yFVPe*u z=5hw{1*~e%!26SDU}t;^zRSof-W(QonXVUgyTXg8B`HW74`! zIG>za9Gjm0xK*D%?UdI~o@~Z;9X`f>&w-k|*)VtP0|SFmu(tMqAZ((s>_^S^U17M| zKWC)BzfX@@vuxF4@bq+GC(fN@XCrU2OLwxF?~=`??K^%qe!{fkhY#a1fBtHG@x^+K z@?8M7d3U;6ySjr?8AB>5zil55{qSs2Q4yqL>-KHAtZmy3bl#-Y6%`b0ZEfq$`+VM= zyu3Wj_njZ#vUSVV)U-aKn!5_F)2z0)w|8>sONyn9d;ws_nDXXDysVT_;&`%&Op2N`-KT}o(Tg--V@rnoM)z{{QJ;@ zD77}rUifBegaIGjk_RQdx~GSwLJat&NSL)MPZ%{LRd62?%NjeLWHQ-tve<<%CiLHo zb?W7lX_sXFr(fBZep_CqvV9>Cnzo~FB>fI~_`DE47?&#y9F-(=?R|;a*c_nxQABOx zuN~fgA>!<O%5zMPT*#N#sL{1D`)u|vsJSl~HkUI{M*~~Rb4;iB!g$C;*qpfs>!Vju?@FeU z`jkr8QC`BH@)8YyeUxw1qQz$w+Ml&9jID};)q>?UR=;JTwFYe{FVU9r676p$E9wjwu)ae3-fKeHmIPRRwhdiwXRGN-c?q}M zIcTvn5T>nN@b2YgI3JHfH#*;)o-rhPP+p=Z%y|esm6QN1$I0Y zEHDXMLI(jDb>^iEHea2SMTr8uxFoV0-94rdG1pnl8?4|acubyQVh6C3I`}q7) zuKk(I&a?B+Q4!+tyJ)v^3x@672T^87w#SyS&)9mHo3ADf2Jqaq7i%wG#t-RvIF?(4 zlNmXM*MK`SHf@R}`(@ucKV5u|(S5T@EbLyj=T?`J-XO&tOu+9NR-LVqeT} z2vHOxJUj1291#CQR8*pwjg51eIq>v7#$qy29rSG*K@{Js&^}}PVQ$eJ_AZ?;X4y*Y zJs*PWSvf^dfYf+}BCSKeeoM>PcXxMX^OuFNGuQJOz1vlWY|sek>b9xWzJl8H*wk4CRzv5!hvk^+qGA*DDF z_=I)nu#Alyxl_l`q=@=KaBwiv($cVg{RT8@)RaE^c5rZTC7NN~x^<}4r5o4@vOjlW zVx@LpofKKCRzq07e(RX0*CDpV?;_jsWjs3{mCq(m4V0RRa&fkE2j^Vr9ZpJ9Q&W+Y zlq3~Vrn-%&llE2mG5oZpIJOr#LEa~ zN3g|&nHG9f)<#Bkng|(GR?xMa5~`A#OiW zBut!_FTB$;i#2jcVdmzsOh@MsY30wV{I0C|J4U)1KJR zcS^+NyI%-HCgicUuIa39{X}MH$lrgG3I2KU=P|x#_okoAsLLvjf#cI;YYtVcUwaRW z_D01|J_Vy^dg>WMpP?@V*PeOIzHtVtSu^3~8eB~0`1}1ozXm5RN)*S;tCoJ*s)Jxw zwo2VxJBR#$s=YkEk9m^z6T*^9ufc{6sV~>yVQN2(ATMgEHAuz3am-kqAoTO7RKG0n zI)u*drF4@;2zCyTeR)=;f49aytoCQd_hnDtEfH7jc_9q-pf%VjgVnW5B!6cV6GeaO zYcOH;mqx+$zc;>o{h?_Pr!5B4r}xj7^Q}%r5#qef>baK%{#Je;+GEiyNBs%ecM&Dx z+%*M4?;$zNvE_4SWj*h;#_{RKL}9=j$bY(5%0A!Q78=kyo3?IV=GrIDf2Ey#!}9QF zrLKRSJz>qZf=kbw*V6B`DT$5W3)zN1wSDC}r#Swuc3 z{)DbuKZuq#u()J z?h{e>a;6e#KVM3vJ$)&y^WzN&^qn>vHw$*r&tda*2yBmCQ}6Nfz5WKYho((Ks?($q zm9=RS5|d-lxbczK(!ZMKzrQz{ggk=dubFVtqUqI4Xk$5T0R$agG&*(#4(I+r!vp8h zH2g7|UnPG7(V`q$k`F?YR#eucHI>_jU(GRhaVdXqwY)*m{fBLchu{%_CVPHH`&d<+ zhZOI@Qy%l7i3^pTW1d3at`W@M=?Rxu(se8vEssW_Bjr2Nc^(&{i4-HEneuoMO*&J# zOVn?+6V7wa^r}UNdx|0J<-lMW6y{W8CAFAtn`9^N{9Xrm+<#N8~QuX1rIg#yr1diqK zDdLJ{u|hko-5A452b- z_^&r|J@4H+WoB=`rfTuj!fR6^+mi&2`H(62m|}S}kz#(Nl*j&PGBE5m?GNjtrPq9n zh|7fg$#4t`xrtE}3nal~gS6qXLYj=FGH2rT+qr9j6P7Jn{8%mhpRP}22OfiC{INI2 z{QeXZX}?#(gM3DsOro+Tld0@HXA$IvMzHDlE^0Jr4D%*VXg+o_hMkMS*x1MLxcdxK zshuX%lJcR+bSiVaZr#oE2TnJ1a|^GQ{uyf@vG0<>kHxa z?%(SA1;wN>@@b3aw4dJ!Iy#Qz46G(2x7D}7&|(KXu4OHqL1 zd*_e*1HidXqesV(e$y();JGS+9Z7+bt&wA+0#Nbe)k?I0)fz} z0Rg|!ces1i`u!4={yOfnJC=f)-Q3ZI=5uJkH<)%h6uvj&u_{f0)#SHZL;g2y+K(7R z8o3{7oR)qcDt|%a@}%t|hNzTRw>W{NggRKt|6sLjcfID}t z**H1*RjGga@_6<$`T8Wt?wLQQle*MO6#X}rTQ6LN9Q+_ZB}Cn3*_&74a|Kvpy?z} zxPCfY>Ejdx9*uBH@4a22SL>z)9{KC4Np#E4&We z<@6mt{vPSCI97xYZW_&hIQdKe3L*4MefVG-CD9*OYGTwE$B#;+NfFA{*qoS<8`Qtg^IUtX#HPdtBT^t}0(aUV+a z&)<)$H~(C}C>|sqzXf!RjnV3Zp>Urv4fD5b$Jw|CxRaG#lma~EBo`MyZRYBFu2TJ- zyR2lh7d&CdFBUU;_Iz!&9wzOyk0SCosq*hX()#D?hwEqTAo+-gVD6<2sCNZnZ_!jZ{NPKu3r~y z+*Fls|3nyA@AnhR3ae&~v-1cxXmBi>J~NT+`#zUN#ezMdIi}~iQfv#zq`l6bn!O65 zNNz@kloa~rX&u+DUBiL}3(%*JJGyu8ftfRBB04%+*=otsCD3o)0_+rN=XB|oNd54A z?Z0yv)5RTGlP2?6>(+s+N3V-)$VYc6Zasw^JN<(7>wmjU=OUXU(~%V?CaQd*T0^L? z$j2ebMX*CBDISFMzuP6A`mXx9vy6ahRoKwJ`TNYmqFFhu1wBK(TcgK}eicw(q3TyB zii?Y3Xkt{t9Gp_v;Grq3dGqtscfE4@|6f#f7Gy$k(D|TO0;`d0)ut7Xt=LNfyAkgY zO^N@@L2GDN-THM4GBPr%RLeZ`g-L`e1Tvwh?`qz^@KJPrXr6o~yoHI502M-6*l{07VoH7H*&d$b6@0leO zw^X8|rxQXN_+BU1?Lu%L)Z22n(HIIAE?TG_!;hzaMD04Y3v~^2pV6GpA)(TGaiIJ^ z5!3Vc=0eW;(Dy;nqi2ueKJI;rXwHj8naJa>_1)w*N;=d;a~@)z`g6TDeb; z>*n)rM`-$Dsrc3&e2yipx|IJ*-%r)efPUnaN7bofF>lD2LU@@nJyn@8H)TBuky8F& z6$(Cmi(jU06{L1A>#IsB(oET3RjJ;~c2%Xam+dst60VnYLOWejUsbOlk^DR#q$*v) f8&g?IL->;_mE-kPX@;FDRk*2A`Yl(US9bAVCP@~T From 76a4723fa9ed94ff9db25f16b5b0616f98ac42a1 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 9 May 2010 21:58:04 +0000 Subject: [PATCH 043/151] [INF] - Add 'PortSubClass' values for serial and parallel ports. svn path=/trunk/; revision=47152 --- reactos/media/inf/ports.inf | Bin 9228 -> 9694 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/reactos/media/inf/ports.inf b/reactos/media/inf/ports.inf index 8423d3216acc3c3e4e6800cc8b192354cf37a47e..198bf980a56caa5c2f4aa64fc53f500f57470fa3 100644 GIT binary patch delta 431 zcmeD2xaYlrhkf!sCZWj^Yyy+BIE5w$aB@w40cJ}WTQhhtcryes=rAaNu@ZwTLmopZ zLoP!ALlHwhLjjOZWJqU7WhiDaW-wwjmkLX7HK(l1+BA z0ecwZWEoDs$#Xc;CfjieS;m5ukmn`k`e3jVGr``1ISD-wsOcd?)WF!>&Dkgg037N~ A;s5{u delta 47 zcmccT-Q%%=hkddOyV&LkjughpUpQ+fM{o$RdN71D#7^GM89cdwOJXt`hrs3(?kXt& DbtevQ From 7335bf8947cdbed07c44a6e4cc258bed717c98f4 Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Mon, 10 May 2010 18:27:07 +0000 Subject: [PATCH 044/151] Update the rapps Database to a valid FireFox Link once more... + update all apps to the recent versions svn path=/trunk/; revision=47154 --- reactos/base/applications/rapps/rapps/firefox3.txt | 12 ++++++------ reactos/base/applications/rapps/rapps/mirandaim.txt | 4 ++-- reactos/base/applications/rapps/rapps/openttd.txt | 4 ++-- reactos/base/applications/rapps/rapps/opera.txt | 6 +++--- reactos/base/applications/rapps/rapps/scummvm.txt | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/reactos/base/applications/rapps/rapps/firefox3.txt b/reactos/base/applications/rapps/rapps/firefox3.txt index e9313b7677a..284c872da4d 100644 --- a/reactos/base/applications/rapps/rapps/firefox3.txt +++ b/reactos/base/applications/rapps/rapps/firefox3.txt @@ -8,35 +8,35 @@ Description = The most popular and one of the best free Web Browsers out there. Size = 7.2M Category = 5 URLSite = http://www.mozilla.com/en-US/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real/win32/en-US/Firefox%20Setup%203.0.19.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real-real/win32/en-US/Firefox%20Setup%203.0.19.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. Size = 7.0M URLSite = http://www.mozilla-europe.org/de/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real/win32/de/Firefox%20Setup%203.0.19.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real-real/win32/de/Firefox%20Setup%203.0.19.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. Size = 7.0M URLSite = http://www.mozilla-europe.org/es/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real/win32/es-ES/Firefox%20Setup%203.0.19.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real-real/win32/es-ES/Firefox%20Setup%203.0.19.exe [Section.0414] Description = Mest populære og best også gratis nettleserene der ute. Size = 7.0M URLSite = http://www.mozilla-europe.org/no/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real/win32/nb-NO/Firefox%20Setup%203.0.19.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real-real/win32/nb-NO/Firefox%20Setup%203.0.19.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych. Size = 7.8M URLSite = http://www.mozilla-europe.org/pl/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real/win32/pl/Firefox%20Setup%203.0.19.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real-real/win32/pl/Firefox%20Setup%203.0.19.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных браузеров. Size = 7.4M URLSite = http://www.mozilla-europe.org/ru/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real/win32/ru/Firefox%20Setup%203.0.19.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.19-real-real/win32/ru/Firefox%20Setup%203.0.19.exe diff --git a/reactos/base/applications/rapps/rapps/mirandaim.txt b/reactos/base/applications/rapps/rapps/mirandaim.txt index e1f66280ecc..aadc724e326 100644 --- a/reactos/base/applications/rapps/rapps/mirandaim.txt +++ b/reactos/base/applications/rapps/rapps/mirandaim.txt @@ -2,13 +2,13 @@ [Section] Name = Miranda IM -Version = 0.8.21 +Version = 0.8.22 Licence = GPL Description = Open source multiprotocol instant messaging application - May not work completely. Size = 1.6MB Category = 5 URLSite = http://www.miranda-im.org/ -URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.8.21-unicode.exe +URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.8.22-unicode.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/openttd.txt b/reactos/base/applications/rapps/rapps/openttd.txt index 2e70160c846..b1f35d6c9f5 100644 --- a/reactos/base/applications/rapps/rapps/openttd.txt +++ b/reactos/base/applications/rapps/rapps/openttd.txt @@ -2,13 +2,13 @@ [Section] Name = OpenTTD -Version = 1.0.0 +Version = 1.0.1 Licence = GPL v2 Description = Open Source clone of the "Transport Tycoon Deluxe" game engine. You need a copy of Transport Tycoon. Size = 3.5MB Category = 4 URLSite = http://www.openttd.org/ -URLDownload = http://binaries.openttd.org/releases/1.0.0/openttd-1.0.0-windows-win32.exe +URLDownload = http://binaries.openttd.org/releases/1.0.1/openttd-1.0.1-windows-win32.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/opera.txt b/reactos/base/applications/rapps/rapps/opera.txt index aee4c21a933..045e7e0f322 100644 --- a/reactos/base/applications/rapps/rapps/opera.txt +++ b/reactos/base/applications/rapps/rapps/opera.txt @@ -2,13 +2,13 @@ [Section] Name = Opera -Version = 10.52 +Version = 10.53 Licence = Freeware Description = The popular Opera Browser with many advanced features and including a Mail and BitTorrent client. -Size = 12.0M +Size = 12.4M Category = 5 URLSite = http://www.opera.com/ -URLDownload = http://get4.opera.com/pub/opera/win/1052/int/Opera_1052_int_Setup.exe +URLDownload = http://get4.opera.com/pub/opera/win/1053/int/Opera_1053_int_Setup.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/scummvm.txt b/reactos/base/applications/rapps/rapps/scummvm.txt index ebe7b348a50..d64e53c3653 100644 --- a/reactos/base/applications/rapps/rapps/scummvm.txt +++ b/reactos/base/applications/rapps/rapps/scummvm.txt @@ -2,13 +2,13 @@ [Section] Name = ScummVM -Version = 1.1.0 +Version = 1.1.1 Licence = GPL Description = Sam and Max, Day of the Tentacle, etc on ReactOS. -Size = 3.4MB +Size = 3.3MB Category = 4 URLSite = http://scummvm.org/ -URLDownload = http://dfn.dl.sourceforge.net/project/scummvm/scummvm/1.1.0/scummvm-1.1.0-win32.exe +URLDownload = http://dfn.dl.sourceforge.net/project/scummvm/scummvm/1.1.1/scummvm-1.1.1-win32.exe CDPath = none [Section.0407] From 609171f4ac52108e714275b80c1acedf75de621e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 10 May 2010 21:14:26 +0000 Subject: [PATCH 045/151] [AFD] - Fix signaling socket termination events on disconnect - Fixes bug 4951 svn path=/trunk/; revision=47156 --- reactos/drivers/network/afd/afd/read.c | 70 ++++++++++++++++++-------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/reactos/drivers/network/afd/afd/read.c b/reactos/drivers/network/afd/afd/read.c index e7e9a6e67db..3c6ddaa861f 100644 --- a/reactos/drivers/network/afd/afd/read.c +++ b/reactos/drivers/network/afd/afd/read.c @@ -26,10 +26,38 @@ #include "tdiconn.h" #include "debug.h" -static BOOLEAN CantReadMore( PAFD_FCB FCB ) { - UINT BytesAvailable = FCB->Recv.Content - FCB->Recv.BytesUsed; +static NTSTATUS RefillSocketBuffer( PAFD_FCB FCB ) { + NTSTATUS Status = STATUS_PENDING; - return !BytesAvailable; + if( !FCB->ReceiveIrp.InFlightRequest ) { + AFD_DbgPrint(MID_TRACE,("Replenishing buffer\n")); + + Status = TdiReceive( &FCB->ReceiveIrp.InFlightRequest, + FCB->Connection.Object, + TDI_RECEIVE_NORMAL, + FCB->Recv.Window, + FCB->Recv.Size, + &FCB->ReceiveIrp.Iosb, + ReceiveComplete, + FCB ); + + if( ( Status == STATUS_SUCCESS && !FCB->ReceiveIrp.Iosb.Information ) || + ( !NT_SUCCESS( Status ) ) ) + { + /* The socket has been closed */ + FCB->PollState |= AFD_EVENT_DISCONNECT; + FCB->Overread = TRUE; + Status = STATUS_FILE_CLOSED; + } + else if( Status == STATUS_SUCCESS ) + { + FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information; + FCB->PollState |= AFD_EVENT_RECEIVE; + } + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } + + return Status; } static NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB, @@ -46,7 +74,22 @@ static NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB, AFD_DbgPrint(MID_TRACE,("Called, BytesAvailable = %d\n", BytesAvailable)); - if( CantReadMore(FCB) ) return STATUS_PENDING; + if( FCB->Overread ) return STATUS_FILE_CLOSED; + if( !BytesAvailable ) { + FCB->Recv.Content = FCB->Recv.BytesUsed = 0; + Status = RefillSocketBuffer( FCB ); + if ( Status != STATUS_SUCCESS ) + return Status; + + /* If RefillSocketBuffer returns STATUS_SUCCESS, we're good to go + * If RefillSocketBuffer returns STATUS_PENDING, then it's waiting on the transport for data + * If RefillSocketBuffer returns STATUS_FILE_CLOSED, then the connection was terminated + */ + + /* Recalculate BytesAvailable based on new data */ + BytesAvailable = FCB->Recv.Content - FCB->Recv.BytesUsed; + ASSERT(BytesAvailable); + } Map = (PAFD_MAPBUF)(RecvReq->BufferArray + RecvReq->BufferCount); @@ -88,23 +131,8 @@ static NTSTATUS TryToSatisfyRecvRequestFromBuffer( PAFD_FCB FCB, if( FCB->Recv.BytesUsed == FCB->Recv.Content ) { FCB->Recv.BytesUsed = FCB->Recv.Content = 0; FCB->PollState &= ~AFD_EVENT_RECEIVE; - PollReeval( FCB->DeviceExt, FCB->FileObject ); - if( !FCB->ReceiveIrp.InFlightRequest ) { - AFD_DbgPrint(MID_TRACE,("Replenishing buffer\n")); - - Status = TdiReceive( &FCB->ReceiveIrp.InFlightRequest, - FCB->Connection.Object, - TDI_RECEIVE_NORMAL, - FCB->Recv.Window, - FCB->Recv.Size, - &FCB->ReceiveIrp.Iosb, - ReceiveComplete, - FCB ); - - if( Status == STATUS_SUCCESS ) - FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information; - } + RefillSocketBuffer( FCB ); } return STATUS_SUCCESS; @@ -159,7 +187,7 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) { } } - if( !CantReadMore(FCB) ) { + if( !FCB->Recv.Content ) { FCB->PollState |= AFD_EVENT_RECEIVE; } else FCB->PollState &= ~AFD_EVENT_RECEIVE; From 449b78ccc5bee41534ba5aaca7b36e398a4515af Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 11 May 2010 00:36:56 +0000 Subject: [PATCH 046/151] [NTOSKRNL] - Fix a typo - Safe mode with networking has an OptionValue of 2 not 1 - Currently unused (for now ;)) svn path=/trunk/; revision=47157 --- reactos/ntoskrnl/ex/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ex/init.c b/reactos/ntoskrnl/ex/init.c index fed59bce758..cc040e4b60d 100644 --- a/reactos/ntoskrnl/ex/init.c +++ b/reactos/ntoskrnl/ex/init.c @@ -1612,7 +1612,7 @@ Phase1InitializationDiscard(IN PVOID Context) else if (!strncmp(SafeBoot, "NETWORK", 7)) { /* With Networking */ - InitSafeBootMode = 1; + InitSafeBootMode = 2; SafeBoot += 7; MessageCode = BOOTING_IN_SAFEMODE_NETWORK; } From b5a09b26c2e38c67442c31cd449cee95f269ba44 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 00:36:52 +0000 Subject: [PATCH 047/151] [NTOS]: Restore previous correct ASM behavior of checking for success codes, not only STATUS_SUCCESS, after a page fault. For example, a demand zero fault returns STATUS_PAGE_FAULT_DEMAND_ZERO upon success, and the new C code would treat it as a failure. Fixes a bug. svn path=/trunk/; revision=47159 --- reactos/ntoskrnl/ke/i386/traphdlr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/ke/i386/traphdlr.c b/reactos/ntoskrnl/ke/i386/traphdlr.c index b9033c2069e..8c535103123 100644 --- a/reactos/ntoskrnl/ke/i386/traphdlr.c +++ b/reactos/ntoskrnl/ke/i386/traphdlr.c @@ -1206,7 +1206,7 @@ KiTrap0EHandler(IN PKTRAP_FRAME TrapFrame) (PVOID)Cr2, TrapFrame->SegCs & MODE_MASK, TrapFrame); - if (Status == STATUS_SUCCESS) KiEoiHelper(TrapFrame); + if (NT_SUCCESS(Status)) KiEoiHelper(TrapFrame); /* Check for S-LIST fault */ if (TrapFrame->Eip == (ULONG_PTR)ExpInterlockedPopEntrySListFault) From f61cf60f1b88c3a6287a6590249e1e8a2c8d9527 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 00:38:46 +0000 Subject: [PATCH 048/151] [NTOS]: HEADERS: Add PDE_TOP. It is defined for IA64/AMD64 but not for i386 (in the public headers). Add a note that these addresses are bogus on PAE systems. svn path=/trunk/; revision=47160 --- reactos/ntoskrnl/include/internal/i386/mm.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reactos/ntoskrnl/include/internal/i386/mm.h b/reactos/ntoskrnl/include/internal/i386/mm.h index 7e768bbde1c..68f312a6f24 100644 --- a/reactos/ntoskrnl/include/internal/i386/mm.h +++ b/reactos/ntoskrnl/include/internal/i386/mm.h @@ -14,8 +14,10 @@ PULONG MmGetPageDirectory(VOID); #define PAGETABLE_MAP (0xc0000000) #define PAGEDIRECTORY_MAP (0xc0000000 + (PAGETABLE_MAP / (1024))) +/* FIXME: These are different for PAE */ #define PTE_BASE 0xC0000000 #define PDE_BASE 0xC0300000 +#define PDE_TOP 0xC0300FFF #define PTE_TOP 0xC03FFFFF #define HYPER_SPACE 0xC0400000 From c5e12bcf4081c476c73570f1d7c784273f4e2a1f Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 00:40:23 +0000 Subject: [PATCH 049/151] [NTOS]: We might get page faults before memory areas are setup, since so much ARM3 work now gets done before the memory areas are ready to go. Since obviously these faults cannot be caused by non-ARM3 Mm, we assume them to be ARM3 faults (as long as they happened in KSEG0_BASE). Fixes a bug where early page faults in ARM3 PTEs would get treated as non-ARM3 faults and fail. svn path=/trunk/; revision=47161 --- reactos/ntoskrnl/mm/mmfault.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/mm/mmfault.c b/reactos/ntoskrnl/mm/mmfault.c index e00739bb3b5..f908e608bed 100644 --- a/reactos/ntoskrnl/mm/mmfault.c +++ b/reactos/ntoskrnl/mm/mmfault.c @@ -274,15 +274,23 @@ MmAccessFault(IN BOOLEAN StoreInstruction, #endif } - // - // Check if this is an ARM3 memory area - // + /* + * Check if this is an ARM3 memory area or if there's no memory area at all. + * The latter can happen early in the boot cycle when ARM3 paged pool is in + * use before having defined the memory areas proper. + * A proper fix would be to define memory areas in the ARM3 code, but we want + * to avoid adding this ReactOS-specific construct to ARM3 code. + * Either way, in the future, as ReactOS-paged pool is eliminated, this hack + * can go away. + */ MemoryArea = MmLocateMemoryAreaByAddress(MmGetKernelAddressSpace(), Address); - if ((MemoryArea) && (MemoryArea->Type == MEMORY_AREA_OWNED_BY_ARM3)) + if ((!(MemoryArea) && ((ULONG_PTR)Address >= (ULONG_PTR)MmSystemRangeStart)) || + ((MemoryArea) && (MemoryArea->Type == MEMORY_AREA_OWNED_BY_ARM3))) { // // Hand it off to more competent hands... // + DPRINT1("ARM3 fault\n"); return MmArmAccessFault(StoreInstruction, Address, Mode, TrapInformation); } From 0a6ca405985ba9b49bd9661251268ead8e2ca2d7 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 12 May 2010 02:34:04 +0000 Subject: [PATCH 050/151] [HAL] - Return the correct value if the PCI slot number is invalid - Use the bus number from the PCI BIOS instead of doing a manual probe if we can because it is much more accurate (our probing code doesn't detect buses without devices present) - Don't probe for devices at invalid locations on PCI type 2 buses - Check for a valid bus number so we don't return the wrong value svn path=/trunk/; revision=47162 --- reactos/hal/halx86/generic/bus/pcibus.c | 98 +++++++++++++++---------- 1 file changed, 59 insertions(+), 39 deletions(-) diff --git a/reactos/hal/halx86/generic/bus/pcibus.c b/reactos/hal/halx86/generic/bus/pcibus.c index 2440cd4182b..e146fcb386a 100644 --- a/reactos/hal/halx86/generic/bus/pcibus.c +++ b/reactos/hal/halx86/generic/bus/pcibus.c @@ -360,15 +360,19 @@ HalpGetPCIData(IN PBUS_HANDLER BusHandler, (1 == BusHandler->BusNumber && 0 != Slot.u.bits.DeviceNumber)) { DPRINT("Blacklisted PCI slot\n"); - if (0 == Offset && 2 <= Length) + if (0 == Offset && sizeof(USHORT) <= Length) { *(PUSHORT)Buffer = PCI_INVALID_VENDORID; - return 2; + return sizeof(USHORT); } return 0; } #endif + /* Make sure the bus number is in our range of good bus numbers */ + if (BusHandler->BusNumber > HalpMaxPciBus || BusHandler->BusNumber < HalpMinPciBus) + return 0; + /* Normalize the length */ if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG); @@ -390,9 +394,15 @@ HalpGetPCIData(IN PBUS_HANDLER BusHandler, /* Validate the vendor ID */ if (PciConfig->VendorID == PCI_INVALID_VENDORID) { - /* It's invalid, but we want to return this much */ - PciConfig->VendorID = PCI_INVALID_VENDORID; - Len = sizeof(USHORT); + /* It's invalid, but we can copy PCI_INVALID_VENDORID */ + if (Offset == 0 && Length >= sizeof(USHORT)) + { + *(PUSHORT)Buffer = PCI_INVALID_VENDORID; + return sizeof(USHORT); + } + + /* We can't copy PCI_INVALID_VENDORID so just return 0 */ + return 0; } /* Now check if there's space left */ @@ -455,6 +465,10 @@ HalpSetPCIData(IN PBUS_HANDLER BusHandler, } #endif + /* Make sure this bus number is in our range of good bus numbers */ + if (BusHandler->BusNumber > HalpMaxPciBus || BusHandler->BusNumber < HalpMinPciBus) + return 0; + /* Normalize the length */ if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG); @@ -700,7 +714,6 @@ HaliPciInterfaceReadConfig(IN PBUS_HANDLER RootBusHandler, IN ULONG Length) { BUS_HANDLER BusHandler; - PPCI_COMMON_CONFIG PciData = (PPCI_COMMON_CONFIG)Buffer; /* Setup fake PCI Bus handler */ RtlCopyMemory(&BusHandler, &HalpFakePciBusHandler, sizeof(BUS_HANDLER)); @@ -709,21 +722,6 @@ HaliPciInterfaceReadConfig(IN PBUS_HANDLER RootBusHandler, /* Read configuration data */ HalpReadPCIConfig(&BusHandler, SlotNumber, Buffer, Offset, Length); - /* Check if caller only wanted at least Vendor ID */ - if (Length >= 2) - { - /* Validate it */ - if (PciData->VendorID != PCI_INVALID_VENDORID) - { - /* Check if this is the new maximum bus number */ - if (HalpMaxPciBus < BusHandler.BusNumber) - { - /* Set it */ - HalpMaxPciBus = BusHandler.BusNumber; - } - } - } - /* Return length */ return Length; } @@ -970,6 +968,7 @@ HalpInitializePciStubs(VOID) ULONG i; PCI_SLOT_NUMBER j; ULONG VendorId = 0; + ULONG MaxPciBusNumber; /* Query registry information */ PciRegistryInfo = HalpQueryPciRegistryInfo(); @@ -977,11 +976,19 @@ HalpInitializePciStubs(VOID) { /* Assume type 1 */ PciType = 1; + + /* Force a manual bus scan later */ + MaxPciBusNumber = MAXULONG; } else { - /* Get the type and free the info structure */ + /* Get the PCI type */ PciType = PciRegistryInfo->HardwareMechanism & 0xF; + + /* Get MaxPciBusNumber and make it 0-based */ + MaxPciBusNumber = PciRegistryInfo->NoBuses - 1; + + /* Free the info structure */ ExFreePool(PciRegistryInfo); } @@ -1007,7 +1014,7 @@ HalpInitializePciStubs(VOID) /* Type 2 PCI Bus */ case 2: - /* Copy the Type 1 handler data */ + /* Copy the Type 2 handler data */ RtlCopyMemory(&PCIConfigHandler, &PCIConfigHandlerType2, sizeof (PCIConfigHandler)); @@ -1027,31 +1034,44 @@ HalpInitializePciStubs(VOID) DbgPrint("HAL: Unknown PCI type\n"); } - /* Loop all possible buses */ - for (i = 0; i < 256; i++) + /* Run a forced bus scan if needed */ + if (MaxPciBusNumber == MAXULONG) { - /* Loop all devices */ - for (j.u.AsULONG = 0; j.u.AsULONG < 32; j.u.AsULONG++) + /* Initialize the max bus number to 0xFF */ + HalpMaxPciBus = 0xFF; + + /* Initialize the counter */ + MaxPciBusNumber = 0; + + /* Loop all possible buses */ + for (i = 0; i < HalpMaxPciBus; i++) { - /* Query the interface */ - if (HaliPciInterfaceReadConfig(NULL, - i, - j, - &VendorId, - 0, - sizeof(ULONG))) + /* Loop all devices */ + for (j.u.AsULONG = 0; j.u.AsULONG < BusData->MaxDevice; j.u.AsULONG++) { - /* Validate the vendor ID */ - if ((USHORT)VendorId != PCI_INVALID_VENDORID) + /* Query the interface */ + if (HaliPciInterfaceReadConfig(NULL, + i, + j, + &VendorId, + 0, + sizeof(ULONG))) { - /* Set this as the maximum ID */ - HalpMaxPciBus = i; - break; + /* Validate the vendor ID */ + if ((USHORT)VendorId != PCI_INVALID_VENDORID) + { + /* Set this as the maximum ID */ + MaxPciBusNumber = i; + break; + } } } } } + /* Set the real max bus number */ + HalpMaxPciBus = MaxPciBusNumber; + /* We're done */ HalpPCIConfigInitialized = TRUE; } From 3ffc64878c7179e6a86c05327a659f8568af0033 Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Wed, 12 May 2010 03:03:12 +0000 Subject: [PATCH 051/151] [WIN32CSR] Get rid of dynamic "LineBuffer": it wasn't being resized properly in all cases, causing corruption of Win32CsrApiHeap. Replaced with fixed buffer (painting a line with multiple TextOutW calls if necessary). svn path=/trunk/; revision=47163 --- .../win32/csrss/win32csr/guiconsole.c | 31 ++++--------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c index 805de33e893..ec400e6fbd9 100644 --- a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c +++ b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c @@ -22,7 +22,6 @@ typedef struct GUI_CONSOLE_DATA_TAG HFONT Font; unsigned CharWidth; unsigned CharHeight; - PWCHAR LineBuffer; BOOL CursorBlinkOn; BOOL ForceCursorOff; CRITICAL_SECTION Lock; @@ -713,9 +712,6 @@ GuiConsoleHandleNcCreate(HWND hWnd, CREATESTRUCTW *Create) InitializeCriticalSection(&GuiData->Lock); - GuiData->LineBuffer = (PWCHAR)HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, - Console->Size.X * sizeof(WCHAR)); - GuiData->Font = CreateFontW(LOWORD(GuiData->FontSize), 0, //HIWORD(GuiData->FontSize), 0, @@ -895,21 +891,22 @@ GuiConsolePaint(PCSRSS_CONSOLE Console, for (Line = TopLine; Line <= BottomLine; Line++) { + WCHAR LineBuffer[80]; From = ConioCoordToPointer(Buff, LeftChar, Line); Start = LeftChar; - To = GuiData->LineBuffer; + To = LineBuffer; for (Char = LeftChar; Char <= RightChar; Char++) { - if (*(From + 1) != LastAttribute) + if (*(From + 1) != LastAttribute || (Char - Start == sizeof(LineBuffer) / sizeof(WCHAR))) { TextOutW(hDC, (Start - Buff->ShowX) * GuiData->CharWidth, (Line - Buff->ShowY) * GuiData->CharHeight, - GuiData->LineBuffer, + LineBuffer, Char - Start); Start = Char; - To = GuiData->LineBuffer; + To = LineBuffer; Attribute = *(From + 1); if (Attribute != LastAttribute) { @@ -932,7 +929,7 @@ GuiConsolePaint(PCSRSS_CONSOLE Console, TextOutW(hDC, (Start - Buff->ShowX) * GuiData->CharWidth, (Line - Buff->ShowY) * GuiData->CharHeight, - GuiData->LineBuffer, + LineBuffer, RightChar - Start + 1); } @@ -1809,22 +1806,6 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole windx = LOWORD(pConInfo->WindowSize); windy = HIWORD(pConInfo->WindowSize); - if (windx > Console->Size.X) - { - PWCHAR LineBuffer = HeapAlloc(Win32CsrApiHeap, HEAP_ZERO_MEMORY, windx * sizeof(WCHAR)); - if (LineBuffer) - { - HeapFree(Win32CsrApiHeap, 0, GuiData->LineBuffer); - GuiData->LineBuffer = LineBuffer; - } - else - { - LeaveCriticalSection(&ActiveBuffer->Header.Lock); - return; - } - } - - if (windx != Console->Size.X || windy != Console->Size.Y) { /* resize window */ From acb61e7d31ee4961ab5c17561507aa320f1fba72 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 12 May 2010 03:29:08 +0000 Subject: [PATCH 052/151] [FREELDR] Fix uninitialized variable warning. (Does anyone know why the warning isn't treated as an error?) [SETUPLDR] Use mini_hal only on i386 builds svn path=/trunk/; revision=47164 --- reactos/boot/freeldr/freeldr/fs/iso.c | 1 + reactos/boot/freeldr/freeldr/setupldr.rbuild | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/reactos/boot/freeldr/freeldr/fs/iso.c b/reactos/boot/freeldr/freeldr/fs/iso.c index dd1231558d7..f0a9832935e 100644 --- a/reactos/boot/freeldr/freeldr/fs/iso.c +++ b/reactos/boot/freeldr/freeldr/fs/iso.c @@ -161,6 +161,7 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile DPRINTM(DPRINT_FILESYSTEM, "IsoLookupFile() FileName = %s\n", FileName); RtlZeroMemory(IsoFileInfoPointer, sizeof(ISO_FILE_INFO)); + RtlZeroMemory(&IsoFileInfo, sizeof(ISO_FILE_INFO)); // // Read The Primary Volume Descriptor diff --git a/reactos/boot/freeldr/freeldr/setupldr.rbuild b/reactos/boot/freeldr/freeldr/setupldr.rbuild index f951fcc3dc0..bf41b103c48 100644 --- a/reactos/boot/freeldr/freeldr/setupldr.rbuild +++ b/reactos/boot/freeldr/freeldr/setupldr.rbuild @@ -5,7 +5,9 @@ freeldr_startup freeldr_base64k freeldr_base - mini_hal + + mini_hal + freeldr_arch setupldr_main rossym From 630ecdce7c7baf29cabb4ffa0123b5b67bea7062 Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Wed, 12 May 2010 03:34:02 +0000 Subject: [PATCH 053/151] [KERNEL32] [WIN32CSR] Implement SetConsoleScreenBufferSize. FAR Manager now works again. svn path=/trunk/; revision=47165 --- reactos/dll/win32/kernel32/misc/console.c | 21 +- reactos/include/reactos/subsys/csrss/csrss.h | 7 + .../subsystems/win32/csrss/win32csr/conio.c | 29 +++ .../subsystems/win32/csrss/win32csr/dllmain.c | 1 + .../win32/csrss/win32csr/guiconsole.c | 184 ++++++++++-------- .../win32/csrss/win32csr/tuiconsole.c | 16 +- 6 files changed, 173 insertions(+), 85 deletions(-) diff --git a/reactos/dll/win32/kernel32/misc/console.c b/reactos/dll/win32/kernel32/misc/console.c index 5a5871d8939..7ead208edf2 100644 --- a/reactos/dll/win32/kernel32/misc/console.c +++ b/reactos/dll/win32/kernel32/misc/console.c @@ -3086,16 +3086,29 @@ FlushConsoleInputBuffer(HANDLE hConsoleInput) /*-------------------------------------------------------------- * SetConsoleScreenBufferSize * - * @unimplemented + * @implemented */ BOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize) { - DPRINT1("SetConsoleScreenBufferSize(0x%x, 0x%x) UNIMPLEMENTED!\n", hConsoleOutput, dwSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + CSR_API_MESSAGE Request; + ULONG CsrRequest; + NTSTATUS Status; + + CsrRequest = MAKE_CSR_API(SET_SCREEN_BUFFER_SIZE, CSR_CONSOLE); + Request.Data.SetScreenBufferSize.OutputHandle = hConsoleOutput; + Request.Data.SetScreenBufferSize.Size = dwSize; + + Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; } /*-------------------------------------------------------------- diff --git a/reactos/include/reactos/subsys/csrss/csrss.h b/reactos/include/reactos/subsys/csrss/csrss.h index 1f276fa16d9..0119bad99a3 100644 --- a/reactos/include/reactos/subsys/csrss/csrss.h +++ b/reactos/include/reactos/subsys/csrss/csrss.h @@ -472,6 +472,11 @@ typedef struct DWORD ProcessGroup; } CSRSS_GENERATE_CTRL_EVENT, *PCSRSS_GENERATE_CTRL_EVENT; +typedef struct +{ + HANDLE OutputHandle; + COORD Size; +} CSRSS_SET_SCREEN_BUFFER_SIZE, *PCSRSS_SET_SCREEN_BUFFER_SIZE; #define CSR_API_MESSAGE_HEADER_SIZE(Type) (FIELD_OFFSET(CSR_API_MESSAGE, Data) + sizeof(Type)) @@ -551,6 +556,7 @@ typedef struct #define GET_CONSOLE_ALIASES_EXES_LENGTH (0x3D) #define GENERATE_CTRL_EVENT (0x3E) #define CREATE_THREAD (0x3F) +#define SET_SCREEN_BUFFER_SIZE (0x40) /* Keep in sync with definition below. */ #define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS)) @@ -624,6 +630,7 @@ typedef struct _CSR_API_MESSAGE CSRSS_GET_CONSOLE_ALIASES_EXES GetConsoleAliasesExes; CSRSS_GET_CONSOLE_ALIASES_EXES_LENGTH GetConsoleAliasesExesLength; CSRSS_GENERATE_CTRL_EVENT GenerateCtrlEvent; + CSRSS_SET_SCREEN_BUFFER_SIZE SetScreenBufferSize; } Data; } CSR_API_MESSAGE, *PCSR_API_MESSAGE; diff --git a/reactos/subsystems/win32/csrss/win32csr/conio.c b/reactos/subsystems/win32/csrss/win32csr/conio.c index fa3244e0d7e..6206a538786 100644 --- a/reactos/subsystems/win32/csrss/win32csr/conio.c +++ b/reactos/subsystems/win32/csrss/win32csr/conio.c @@ -3118,4 +3118,33 @@ CSR_API(CsrGenerateCtrlEvent) return Status; } +CSR_API(CsrSetScreenBufferSize) +{ + NTSTATUS Status; + PCSRSS_CONSOLE Console; + PCSRSS_SCREEN_BUFFER Buff; + + Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); + + Status = ConioConsoleFromProcessData(ProcessData, &Console); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + Status = ConioLockScreenBuffer(ProcessData, Request->Data.SetScreenBufferSize.OutputHandle, &Buff, GENERIC_WRITE); + if (!NT_SUCCESS(Status)) + { + ConioUnlockConsole(Console); + return Status; + } + + Status = ConioResizeBuffer(Console, Buff, Request->Data.SetScreenBufferSize.Size); + ConioUnlockScreenBuffer(Buff); + ConioUnlockConsole(Console); + + return Status; +} + /* EOF */ diff --git a/reactos/subsystems/win32/csrss/win32csr/dllmain.c b/reactos/subsystems/win32/csrss/win32csr/dllmain.c index e1fc421ff7c..f8332a7ea76 100644 --- a/reactos/subsystems/win32/csrss/win32csr/dllmain.c +++ b/reactos/subsystems/win32/csrss/win32csr/dllmain.c @@ -74,6 +74,7 @@ static CSRSS_API_DEFINITION Win32CsrApiDefinitions[] = CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES, CsrGetConsoleAliasesExes), CSRSS_DEFINE_API(GET_CONSOLE_ALIASES_EXES_LENGTH, CsrGetConsoleAliasesExesLength), CSRSS_DEFINE_API(GENERATE_CTRL_EVENT, CsrGenerateCtrlEvent), + CSRSS_DEFINE_API(SET_SCREEN_BUFFER_SIZE, CsrSetScreenBufferSize), { 0, 0, NULL } }; diff --git a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c index ec400e6fbd9..e1ad5f50bb5 100644 --- a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c +++ b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c @@ -1708,11 +1708,105 @@ GuiConsoleHandleScrollbarMenu() } +static NTSTATUS WINAPI +GuiResizeBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer, COORD Size) +{ + BYTE * Buffer; + DWORD Offset = 0; + BYTE * OldPtr; + USHORT CurrentY; + BYTE * OldBuffer; +#if HAVE_WMEMSET + USHORT value = MAKEWORD(' ', ScreenBuffer->DefaultAttrib); +#endif + DWORD diff; + DWORD i; + + /* Buffer size is not allowed to be smaller than window size */ + if (Size.X < Console->Size.X || Size.Y < Console->Size.Y) + return STATUS_INVALID_PARAMETER; + + if (Size.X == ScreenBuffer->MaxX && Size.Y == ScreenBuffer->MaxY) + return STATUS_SUCCESS; + + Buffer = HeapAlloc(Win32CsrApiHeap, 0, Size.X * Size.Y * 2); + if (!Buffer) + return STATUS_NO_MEMORY; + + DPRINT1("Resizing (%d,%d) to (%d,%d)\n", ScreenBuffer->MaxX, ScreenBuffer->MaxY, Size.X, Size.Y); + OldBuffer = ScreenBuffer->Buffer; + + for (CurrentY = 0; CurrentY < ScreenBuffer->MaxY && CurrentY < Size.Y; CurrentY++) + { + OldPtr = ConioCoordToPointer(ScreenBuffer, 0, CurrentY); + if (Size.X <= ScreenBuffer->MaxX) + { + /* reduce size */ + RtlCopyMemory(&Buffer[Offset], OldPtr, Size.X * 2); + Offset += (Size.X * 2); + } + else + { + /* enlarge size */ + RtlCopyMemory(&Buffer[Offset], OldPtr, ScreenBuffer->MaxX * 2); + Offset += (ScreenBuffer->MaxX * 2); + + diff = Size.X - ScreenBuffer->MaxX; + /* zero new part of it */ +#if HAVE_WMEMSET + wmemset((WCHAR*)&Buffer[Offset], value, diff); +#else + for (i = 0; i < diff; i++) + { + Buffer[Offset++] = ' '; + Buffer[Offset++] = ScreenBuffer->DefaultAttrib; + } +#endif + } + } + + if (Size.Y > ScreenBuffer->MaxY) + { + diff = Size.X * (Size.Y - ScreenBuffer->MaxY); +#if HAVE_WMEMSET + wmemset((WCHAR*)&Buffer[Offset], value, diff); +#else + for (i = 0; i < diff; i++) + { + Buffer[Offset++] = ' '; + Buffer[Offset++] = ScreenBuffer->DefaultAttrib; + } +#endif + } + + (void)InterlockedExchangePointer((PVOID volatile *)&ScreenBuffer->Buffer, Buffer); + HeapFree(Win32CsrApiHeap, 0, OldBuffer); + ScreenBuffer->MaxX = Size.X; + ScreenBuffer->MaxY = Size.Y; + ScreenBuffer->VirtualY = 0; + + /* Ensure cursor and window are within buffer */ + if (ScreenBuffer->CurrentX >= Size.X) + ScreenBuffer->CurrentX = Size.X - 1; + if (ScreenBuffer->CurrentY >= Size.Y) + ScreenBuffer->CurrentY = Size.Y - 1; + if (ScreenBuffer->ShowX > Size.X - Console->Size.X) + ScreenBuffer->ShowX = Size.X - Console->Size.X; + if (ScreenBuffer->ShowY > Size.Y - Console->Size.Y) + ScreenBuffer->ShowY = Size.Y - Console->Size.Y; + + /* TODO: Should update scrollbar, but can't use anything that + * calls SendMessage or it could cause deadlock */ + + return STATUS_SUCCESS; +} + static VOID FASTCALL GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsoleInfo pConInfo) { DWORD windx, windy; PCSRSS_SCREEN_BUFFER ActiveBuffer = Console->ActiveBuffer; + COORD BufSize; BOOL SizeChanged = FALSE; EnterCriticalSection(&ActiveBuffer->Header.Lock); @@ -1724,85 +1818,6 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole /* apply cursor size */ ActiveBuffer->CursorInfo.dwSize = min(max(pConInfo->CursorSize, 1), 100); - windx = LOWORD(pConInfo->ScreenBuffer); - windy = HIWORD(pConInfo->ScreenBuffer); - - if (windx != ActiveBuffer->MaxX || windy != ActiveBuffer->MaxY) - { - BYTE * Buffer = HeapAlloc(Win32CsrApiHeap, 0, windx * windy * 2); - - if (Buffer) - { - DWORD Offset = 0; - BYTE * OldPtr; - USHORT CurrentY; - BYTE * OldBuffer; - USHORT value; - DWORD diff; - DWORD i; - - value = MAKEWORD(' ', ActiveBuffer->DefaultAttrib); - - DPRINT("MaxX %d MaxY %d windx %d windy %d value %04x DefaultAttrib %d\n",ActiveBuffer->MaxX, ActiveBuffer->MaxY, windx, windy, value, ActiveBuffer->DefaultAttrib); - OldBuffer = ActiveBuffer->Buffer; - - for (CurrentY = 0; CurrentY < min(ActiveBuffer->MaxY, windy); CurrentY++) - { - OldPtr = ConioCoordToPointer(ActiveBuffer, 0, CurrentY); - if (windx <= ActiveBuffer->MaxX) - { - /* reduce size */ - RtlCopyMemory(&Buffer[Offset], OldPtr, windx * 2); - Offset += (windx * 2); - } - else - { - /* enlarge size */ - RtlCopyMemory(&Buffer[Offset], OldPtr, ActiveBuffer->MaxX * 2); - Offset += (ActiveBuffer->MaxX * 2); - - diff = windx - ActiveBuffer->MaxX; - /* zero new part of it */ -#if HAVE_WMEMSET - wmemset((WCHAR*)&Buffer[Offset], value, diff); -#else - for (i = 0; i < diff; i++) - { - Buffer[Offset++] = ' '; - Buffer[Offset++] = ActiveBuffer->DefaultAttrib; - } -#endif - } - } - - if (windy > ActiveBuffer->MaxY) - { - diff = windy - ActiveBuffer->MaxY; -#if HAVE_WMEMSET - wmemset((WCHAR*)&Buffer[Offset], value, diff * windx); -#else - for (i = 0; i < diff * windx; i++) - { - Buffer[Offset++] = ' '; - Buffer[Offset++] = ActiveBuffer->DefaultAttrib; - } -#endif - } - - (void)InterlockedExchangePointer((PVOID volatile *)&ActiveBuffer->Buffer, Buffer); - HeapFree(Win32CsrApiHeap, 0, OldBuffer); - ActiveBuffer->MaxX = windx; - ActiveBuffer->MaxY = windy; - ActiveBuffer->VirtualY = 0; - SizeChanged = TRUE; - } - else - { - LeaveCriticalSection(&ActiveBuffer->Header.Lock); - return; - } - } - windx = LOWORD(pConInfo->WindowSize); windy = HIWORD(pConInfo->WindowSize); @@ -1814,6 +1829,14 @@ GuiApplyUserSettings(PCSRSS_CONSOLE Console, PGUI_CONSOLE_DATA GuiData, PConsole SizeChanged = TRUE; } + BufSize.X = LOWORD(pConInfo->ScreenBuffer); + BufSize.Y = HIWORD(pConInfo->ScreenBuffer); + if (BufSize.X != ActiveBuffer->MaxX || BufSize.Y != ActiveBuffer->MaxY) + { + if (NT_SUCCESS(GuiResizeBuffer(Console, ActiveBuffer, BufSize))) + SizeChanged = TRUE; + } + if (SizeChanged) { GuiData->WindowSizeLock = TRUE; @@ -2222,7 +2245,8 @@ static CSRSS_CONSOLE_VTBL GuiVtbl = GuiUpdateScreenInfo, GuiChangeTitle, GuiCleanupConsole, - GuiChangeIcon + GuiChangeIcon, + GuiResizeBuffer, }; NTSTATUS FASTCALL diff --git a/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c b/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c index 02f5abfc2bf..5c03f93d590 100644 --- a/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c +++ b/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c @@ -290,6 +290,19 @@ TuiCleanupConsole(PCSRSS_CONSOLE Console) } } +static BOOL WINAPI +TuiChangeIcon(PCSRSS_CONSOLE Console, HICON hWindowIcon) +{ + return TRUE; +} + +static NTSTATUS WINAPI +TuiResizeBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer, COORD Size) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; +} + DWORD WINAPI TuiConsoleThread (PVOID Data) { @@ -340,7 +353,8 @@ static CSRSS_CONSOLE_VTBL TuiVtbl = TuiUpdateScreenInfo, TuiChangeTitle, TuiCleanupConsole, - NULL // ChangeIcon + TuiChangeIcon, + TuiResizeBuffer, }; NTSTATUS FASTCALL From cdc3b26818e39736fd8c9126eccede4398810e56 Mon Sep 17 00:00:00 2001 From: Jeffrey Morlan Date: Wed, 12 May 2010 04:01:16 +0000 Subject: [PATCH 054/151] commit file missing from r47165 svn path=/trunk/; revision=47166 --- reactos/subsystems/win32/csrss/include/conio.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reactos/subsystems/win32/csrss/include/conio.h b/reactos/subsystems/win32/csrss/include/conio.h index 35d71863a15..cf62ac71c52 100644 --- a/reactos/subsystems/win32/csrss/include/conio.h +++ b/reactos/subsystems/win32/csrss/include/conio.h @@ -61,6 +61,7 @@ typedef struct tagCSRSS_CONSOLE_VTBL BOOL (WINAPI *ChangeTitle)(PCSRSS_CONSOLE Console); VOID (WINAPI *CleanupConsole)(PCSRSS_CONSOLE Console); BOOL (WINAPI *ChangeIcon)(PCSRSS_CONSOLE Console, HICON hWindowIcon); + NTSTATUS (WINAPI *ResizeBuffer)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer, COORD Size); } CSRSS_CONSOLE_VTBL, *PCSRSS_CONSOLE_VTBL; typedef struct tagCSRSS_CONSOLE @@ -137,6 +138,7 @@ CSR_API(CsrGetConsoleOutputCodePage); CSR_API(CsrSetConsoleOutputCodePage); CSR_API(CsrGetProcessList); CSR_API(CsrGenerateCtrlEvent); +CSR_API(CsrSetScreenBufferSize); #define ConioInitScreenBuffer(Console, Buff) (Console)->Vtbl->InitScreenBuffer((Console), (Buff)) #define ConioDrawRegion(Console, Region) (Console)->Vtbl->DrawRegion((Console), (Region)) @@ -150,6 +152,8 @@ CSR_API(CsrGenerateCtrlEvent); (Console)->Vtbl->UpdateScreenInfo(Console, Buff) #define ConioChangeTitle(Console) (Console)->Vtbl->ChangeTitle(Console) #define ConioCleanupConsole(Console) (Console)->Vtbl->CleanupConsole(Console) +#define ConioChangeIcon(Console, hWindowIcon) (Console)->Vtbl->ChangeIcon(Console, hWindowIcon) +#define ConioResizeBuffer(Console, Buff, Size) (Console)->Vtbl->ResizeBuffer(Console, Buff, Size) #define ConioRectHeight(Rect) \ (((Rect)->top) > ((Rect)->bottom) ? 0 : ((Rect)->bottom) - ((Rect)->top) + 1) @@ -164,7 +168,6 @@ CSR_API(CsrGenerateCtrlEvent); Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), Access, CONIO_SCREEN_BUFFER_MAGIC) #define ConioUnlockScreenBuffer(Buff) \ Win32CsrUnlockObject((Object_t *) Buff) -#define ConioChangeIcon(Console, hWindowIcon) (Console)->Vtbl->ChangeIcon(Console, hWindowIcon) /* alias.c */ VOID IntDeleteAllAliases(struct tagALIAS_HEADER *RootHeader); From e4dec4c4cba25e75a481b79d15b1de47a5d3b64a Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 12 May 2010 09:34:36 +0000 Subject: [PATCH 055/151] - Revert 47139 by cgutman: Don't try to be smarter than usbdriver's author. He especially put registering HCD interface before so that any error handling function would work correctly and free up allocated resources. Fixes one crash in VMWare. A proper solution for the problem which 47139 tried to "fix" will be committed next. svn path=/trunk/; revision=47167 --- reactos/drivers/usb/nt4compat/usbdriver/ehci.c | 16 ++++++++-------- reactos/drivers/usb/nt4compat/usbdriver/uhci.c | 16 +++++++--------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c index 2d4b44e933e..56d7d548cdb 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c @@ -3530,7 +3530,6 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; PCI_SLOT_NUMBER slot_num; NTSTATUS status; - UCHAR hcd_id; pdev = ehci_create_device(drvr_obj, dev_mgr); @@ -3697,13 +3696,6 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU return NULL; } - //register with dev_mgr - ehci_init_hcd_interface(pdev_ext->ehci); - hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf); - - pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id); - pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr); - return pdev; } @@ -3719,6 +3711,7 @@ ehci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) STRING string, another_string; CHAR str_dev_name[64], str_symb_name[64]; + UCHAR hcd_id; if (drvr_obj == NULL) return NULL; @@ -3768,6 +3761,13 @@ ehci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) RtlFreeUnicodeString(&dev_name); RtlFreeUnicodeString(&symb_name); + //register with dev_mgr though it is not initilized + ehci_init_hcd_interface(pdev_ext->ehci); + hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf); + + pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id); + pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr); + return pdev; } diff --git a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c index 8c903d35459..0ff08970420 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c @@ -67,7 +67,6 @@ extern PDEVICE_OBJECT ehci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_pa #define release_adapter( padapTER ) HalPutDmaAdapter(padapTER) - #define get_int_idx( _urb, _idx ) \ {\ UCHAR interVAL;\ @@ -406,6 +405,7 @@ uhci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) STRING string, another_string; CHAR str_dev_name[64], str_symb_name[64]; + UCHAR hcd_id; if (drvr_obj == NULL) return NULL; @@ -455,6 +455,12 @@ uhci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) RtlFreeUnicodeString(&dev_name); RtlFreeUnicodeString(&symb_name); + //register with dev_mgr though it is not initilized + uhci_init_hcd_interface(pdev_ext->uhci); + hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf); + + pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id); + pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr); return pdev; } @@ -681,7 +687,6 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; PCI_SLOT_NUMBER slot_num; NTSTATUS status; - UCHAR hcd_id; pdev = uhci_create_device(drvr_obj, dev_mgr); @@ -847,13 +852,6 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU return NULL; } - //register with dev_mgr - uhci_init_hcd_interface(pdev_ext->uhci); - hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf); - - pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id); - pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr); - return pdev; } From cdf047825581df7459aa5a8ca02eccd5bc6c0ae7 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 12 May 2010 09:42:07 +0000 Subject: [PATCH 056/151] [USBDRIVER] - Implement deregistering HCD in a device manager. Now, the HCI which failed to initialize will be properly freed without calling NULL pointer or crashing with freed memory access. See issue #4813 for more details. svn path=/trunk/; revision=47168 --- .../drivers/usb/nt4compat/usbdriver/devmgr.c | 14 ++++++++++ .../drivers/usb/nt4compat/usbdriver/devmgr.h | 6 +++++ .../drivers/usb/nt4compat/usbdriver/ehci.c | 26 ++++++++++--------- .../drivers/usb/nt4compat/usbdriver/uhci.c | 24 +++++++++-------- 4 files changed, 47 insertions(+), 23 deletions(-) diff --git a/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c b/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c index 46c12a07fc1..a1357f26f6d 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/devmgr.c @@ -1457,6 +1457,20 @@ dev_mgr_register_hcd(PUSB_DEV_MANAGER dev_mgr, PHCD hcd) return dev_mgr->hcd_count - 1; } +VOID +dev_mgr_deregister_hcd(PUSB_DEV_MANAGER dev_mgr, UCHAR hcd_id) +{ + UCHAR i; + + if (dev_mgr == NULL || hcd_id >= MAX_HCDS - 1) + return; + + for (i = hcd_id; i < dev_mgr->hcd_count - 1; i++) + dev_mgr->hcd_array[i] = dev_mgr->hcd_array[i + 1]; + + dev_mgr->hcd_count--; +} + BOOLEAN dev_mgr_register_irp(PUSB_DEV_MANAGER dev_mgr, PIRP pirp, PURB purb) { diff --git a/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h b/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h index c6d22522935..50d3b6fe6d6 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h +++ b/reactos/drivers/usb/nt4compat/usbdriver/devmgr.h @@ -208,6 +208,12 @@ PUSB_DEV_MANAGER dev_mgr, PHCD hcd ); +VOID +dev_mgr_deregister_hcd( +PUSB_DEV_MANAGER dev_mgr, +UCHAR hcd_id +); + NTSTATUS dev_mgr_dispatch( IN PUSB_DEV_MANAGER dev_mgr, diff --git a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c index 56d7d548cdb..0453fb9727a 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/ehci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/ehci.c @@ -271,7 +271,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU BOOLEAN ehci_init_schedule(PEHCI_DEV ehci, PADAPTER_OBJECT padapter); -BOOLEAN ehci_release(PDEVICE_OBJECT pdev); +BOOLEAN ehci_release(PDEVICE_OBJECT pdev, PUSB_DEV_MANAGER dev_mgr); static VOID ehci_stop(PEHCI_DEV ehci); @@ -313,7 +313,7 @@ PDEVICE_OBJECT ehci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUS PDEVICE_OBJECT ehci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr); -BOOLEAN ehci_delete_device(PDEVICE_OBJECT pdev); +BOOLEAN ehci_delete_device(PDEVICE_OBJECT pdev, PUSB_DEV_MANAGER dev_mgr); VOID ehci_get_capabilities(PEHCI_DEV ehci, PBYTE base); @@ -3366,7 +3366,7 @@ ehci_hcd_release(PHCD hcd) ehci = ehci_from_hcd(hcd); pdev_ext = ehci->pdev_ext; - return ehci_release(pdev_ext->pdev_obj); + return ehci_release(pdev_ext->pdev_obj, hcd->dev_mgr); } NTSTATUS @@ -3565,7 +3565,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU if (pdev_ext->padapter == NULL) { //fatal error - ehci_delete_device(pdev); + ehci_delete_device(pdev, dev_mgr); return NULL; } @@ -3584,7 +3584,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU DbgPrint("ehci_alloc(): error assign slot res, 0x%x\n", status); release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - ehci_delete_device(pdev); + ehci_delete_device(pdev, dev_mgr); return NULL; } @@ -3619,7 +3619,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU DbgPrint("ehci_alloc(): error, can not translate bus address\n"); release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - ehci_delete_device(pdev); + ehci_delete_device(pdev, dev_mgr); return NULL; } @@ -3638,7 +3638,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU { release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - ehci_delete_device(pdev); + ehci_delete_device(pdev, dev_mgr); return NULL; } } @@ -3663,7 +3663,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU { release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - ehci_delete_device(pdev); + ehci_delete_device(pdev, dev_mgr); return NULL; } @@ -3692,7 +3692,7 @@ ehci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU affinity, FALSE) //No float save != STATUS_SUCCESS) { - ehci_release(pdev); + ehci_release(pdev, dev_mgr); return NULL; } @@ -4017,7 +4017,7 @@ ehci_get_capabilities(PEHCI_DEV ehci, PBYTE base) } BOOLEAN -ehci_delete_device(PDEVICE_OBJECT pdev) +ehci_delete_device(PDEVICE_OBJECT pdev, PUSB_DEV_MANAGER dev_mgr) { STRING string; UNICODE_STRING symb_name; @@ -4037,6 +4037,8 @@ ehci_delete_device(PDEVICE_OBJECT pdev) IoDeleteSymbolicLink(&symb_name); RtlFreeUnicodeString(&symb_name); + dev_mgr_deregister_hcd(dev_mgr, pdev_ext->ehci->hcd_interf.hcd_get_id(&pdev_ext->ehci->hcd_interf)); + if (pdev_ext->res_list) ExFreePool(pdev_ext->res_list); // not allocated by usb_alloc_mem @@ -4062,7 +4064,7 @@ ehci_stop(PEHCI_DEV ehci) } BOOLEAN -ehci_release(PDEVICE_OBJECT pdev) +ehci_release(PDEVICE_OBJECT pdev, PUSB_DEV_MANAGER dev_mgr) { PEHCI_DEVICE_EXTENSION pdev_ext; PEHCI_DEV ehci; @@ -4095,7 +4097,7 @@ ehci_release(PDEVICE_OBJECT pdev) release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - ehci_delete_device(pdev); + ehci_delete_device(pdev, dev_mgr); return FALSE; diff --git a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c index 0ff08970420..857498c4e00 100644 --- a/reactos/drivers/usb/nt4compat/usbdriver/uhci.c +++ b/reactos/drivers/usb/nt4compat/usbdriver/uhci.c @@ -102,7 +102,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU BOOLEAN uhci_init_schedule(PUHCI_DEV uhci, PADAPTER_OBJECT padapter); -BOOLEAN uhci_release(PDEVICE_OBJECT pdev); +BOOLEAN uhci_release(PDEVICE_OBJECT pdev, PUSB_DEV_MANAGER dev_mgr); static VOID uhci_stop(PUHCI_DEV uhci); @@ -465,7 +465,7 @@ uhci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) } BOOLEAN -uhci_delete_device(PDEVICE_OBJECT pdev) +uhci_delete_device(PDEVICE_OBJECT pdev, PUSB_DEV_MANAGER dev_mgr) { STRING string; UNICODE_STRING symb_name; @@ -485,6 +485,8 @@ uhci_delete_device(PDEVICE_OBJECT pdev) IoDeleteSymbolicLink(&symb_name); RtlFreeUnicodeString(&symb_name); + dev_mgr_deregister_hcd(dev_mgr, pdev_ext->uhci->hcd_interf.hcd_get_id(&pdev_ext->uhci->hcd_interf)); + if (pdev_ext->res_list) ExFreePool(pdev_ext->res_list); // not allocated by usb_alloc_mem @@ -723,7 +725,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU if (pdev_ext->padapter == NULL) { //fatal error - uhci_delete_device(pdev); + uhci_delete_device(pdev, dev_mgr); return NULL; } @@ -742,7 +744,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU DbgPrint("uhci_alloc(): error assign slot res, 0x%x\n", status); release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - uhci_delete_device(pdev); + uhci_delete_device(pdev, dev_mgr); return NULL; } @@ -772,7 +774,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU DbgPrint("uhci_alloc(): error, can not translate bus address\n"); release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - uhci_delete_device(pdev); + uhci_delete_device(pdev, dev_mgr); return NULL; } @@ -791,7 +793,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU { release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - uhci_delete_device(pdev); + uhci_delete_device(pdev, dev_mgr); return NULL; } } @@ -810,7 +812,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU { release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - uhci_delete_device(pdev); + uhci_delete_device(pdev, dev_mgr); return NULL; } @@ -848,7 +850,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU FALSE) //No float save != STATUS_SUCCESS) { - uhci_release(pdev); + uhci_release(pdev, dev_mgr); return NULL; } @@ -856,7 +858,7 @@ uhci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PU } BOOLEAN -uhci_release(PDEVICE_OBJECT pdev) +uhci_release(PDEVICE_OBJECT pdev, PUSB_DEV_MANAGER dev_mgr) { PDEVICE_EXTENSION pdev_ext; PUHCI_DEV uhci; @@ -892,7 +894,7 @@ uhci_release(PDEVICE_OBJECT pdev) release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; - uhci_delete_device(pdev); + uhci_delete_device(pdev, dev_mgr); return FALSE; @@ -3671,7 +3673,7 @@ uhci_hcd_release(struct _HCD * hcd) uhci = uhci_from_hcd(hcd); pdev_ext = uhci->pdev_ext; - return uhci_release(pdev_ext->pdev_obj); + return uhci_release(pdev_ext->pdev_obj, hcd->dev_mgr); } NTSTATUS From c6ddd201c7377d85ca1ca834a78df1f9fa1b4fe4 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 12 May 2010 09:45:43 +0000 Subject: [PATCH 057/151] [HALX86] - Revert changes to HalpGetPCIData made in r47162. There is no need to introduce ReactOS-specific behavior of this function. It's much better to aim real NT compatibility, and develop your drivers against NT first and only then hack ReactOS. - Changes to buses scanning are left as they are. svn path=/trunk/; revision=47169 --- reactos/hal/halx86/generic/bus/pcibus.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/reactos/hal/halx86/generic/bus/pcibus.c b/reactos/hal/halx86/generic/bus/pcibus.c index e146fcb386a..3c46e805122 100644 --- a/reactos/hal/halx86/generic/bus/pcibus.c +++ b/reactos/hal/halx86/generic/bus/pcibus.c @@ -369,10 +369,6 @@ HalpGetPCIData(IN PBUS_HANDLER BusHandler, } #endif - /* Make sure the bus number is in our range of good bus numbers */ - if (BusHandler->BusNumber > HalpMaxPciBus || BusHandler->BusNumber < HalpMinPciBus) - return 0; - /* Normalize the length */ if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG); @@ -394,15 +390,9 @@ HalpGetPCIData(IN PBUS_HANDLER BusHandler, /* Validate the vendor ID */ if (PciConfig->VendorID == PCI_INVALID_VENDORID) { - /* It's invalid, but we can copy PCI_INVALID_VENDORID */ - if (Offset == 0 && Length >= sizeof(USHORT)) - { - *(PUSHORT)Buffer = PCI_INVALID_VENDORID; - return sizeof(USHORT); - } - - /* We can't copy PCI_INVALID_VENDORID so just return 0 */ - return 0; + /* It's invalid, but we want to return this much */ + PciConfig->VendorID = PCI_INVALID_VENDORID; + Len = sizeof(USHORT); } /* Now check if there's space left */ @@ -465,10 +455,6 @@ HalpSetPCIData(IN PBUS_HANDLER BusHandler, } #endif - /* Make sure this bus number is in our range of good bus numbers */ - if (BusHandler->BusNumber > HalpMaxPciBus || BusHandler->BusNumber < HalpMinPciBus) - return 0; - /* Normalize the length */ if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG); From 133872d3e7dbcda07bfcb58f36a8052f6a227384 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 18:33:18 +0000 Subject: [PATCH 058/151] [NTOS]: MmSystemPageDirectory is an array of page directories, not just a value. On x86 there's just one page directory, but that's not the case on other architectures/PAE, so fix this bug. svn path=/trunk/; revision=47172 --- reactos/ntoskrnl/mm/ARM3/arm/init.c | 2 +- reactos/ntoskrnl/mm/ARM3/mminit.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/arm/init.c b/reactos/ntoskrnl/mm/ARM3/arm/init.c index e16b7b83441..091d0cb7b5e 100644 --- a/reactos/ntoskrnl/mm/ARM3/arm/init.c +++ b/reactos/ntoskrnl/mm/ARM3/arm/init.c @@ -41,7 +41,7 @@ ULONG MmSessionPoolSize; ULONG MmSessionImageSize; PVOID MiSystemViewStart; ULONG MmSystemViewSize; -PFN_NUMBER MmSystemPageDirectory; +PFN_NUMBER MmSystemPageDirectory[PD_COUNT]; PMMPTE MmSystemPagePtes; ULONG MmNumberOfSystemPtes; ULONG MxPfnAllocation; diff --git a/reactos/ntoskrnl/mm/ARM3/mminit.c b/reactos/ntoskrnl/mm/ARM3/mminit.c index d21adc08758..82efa5c5075 100644 --- a/reactos/ntoskrnl/mm/ARM3/mminit.c +++ b/reactos/ntoskrnl/mm/ARM3/mminit.c @@ -151,7 +151,7 @@ ULONG MmSystemViewSize; // map paged pool PDEs into external processes when they fault on a paged pool // address. // -PFN_NUMBER MmSystemPageDirectory; +PFN_NUMBER MmSystemPageDirectory[PD_COUNT]; PMMPTE MmSystemPagePtes; // @@ -1483,7 +1483,8 @@ MiBuildPagedPool(VOID) // Get the page frame number for the system page directory // PointerPte = MiAddressToPte(PDE_BASE); - MmSystemPageDirectory = PFN_FROM_PTE(PointerPte); + ASSERT(PD_COUNT == 1); + MmSystemPageDirectory[0] = PFN_FROM_PTE(PointerPte); // // Allocate a system PTE which will hold a copy of the page directory @@ -1500,7 +1501,8 @@ MiBuildPagedPool(VOID) // way). // TempPte = ValidKernelPte; - TempPte.u.Hard.PageFrameNumber = MmSystemPageDirectory; + ASSERT(PD_COUNT == 1); + TempPte.u.Hard.PageFrameNumber = MmSystemPageDirectory[0]; ASSERT(PointerPte->u.Hard.Valid == 0); ASSERT(TempPte.u.Hard.Valid == 1); *PointerPte = TempPte; From 926bd0522f6c058fdba6b9026ff8c48a03cbfa67 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 18:36:15 +0000 Subject: [PATCH 059/151] [NTOS]: Compute MiHighestUserPte, MiHighestUserPde, MiSessionImagePteStart, MiSessionImagePteEnd, MiSessionBasePte, MiSessionLastPte since these internal variables did not exit yet. Useful for debugging and also future PFN support. Just computes some values, no behavior changes. svn path=/trunk/; revision=47173 --- reactos/ntoskrnl/mm/ARM3/mminit.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/mm/ARM3/mminit.c b/reactos/ntoskrnl/mm/ARM3/mminit.c index 82efa5c5075..5ed08499d98 100644 --- a/reactos/ntoskrnl/mm/ARM3/mminit.c +++ b/reactos/ntoskrnl/mm/ARM3/mminit.c @@ -136,6 +136,14 @@ ULONG MmSessionViewSize; ULONG MmSessionPoolSize; ULONG MmSessionImageSize; +/* + * These are the PTE addresses of the boundaries carved out above + */ +PMMPTE MiSessionImagePteStart; +PMMPTE MiSessionImagePteEnd; +PMMPTE MiSessionBasePte; +PMMPTE MiSessionLastPte; + // // The system view space, on the other hand, is where sections that are memory // mapped into "system space" end up. @@ -217,6 +225,11 @@ ULONG MmUserProbeAddress; PVOID MmHighestUserAddress; PVOID MmSystemRangeStart; +/* And these store the respective highest PTE/PDE address */ +PMMPTE MiHighestUserPte; +PMMPDE MiHighestUserPde; + +/* These variables define the system cache address space */ PVOID MmSystemCacheStart; PVOID MmSystemCacheEnd; MMSUPPORT MmSystemCacheWs; @@ -1700,6 +1713,10 @@ MmArmInitSystem(IN ULONG Phase, MmUserProbeAddress = (ULONG_PTR)MmSystemRangeStart - 0x10000; MmHighestUserAddress = (PVOID)(MmUserProbeAddress - 1); + /* Highest PTE and PDE based on the addresses above */ + MiHighestUserPte = MiAddressToPte(MmHighestUserAddress); + MiHighestUserPde = MiAddressToPde(MmHighestUserAddress); + // // Get the size of the boot loader's image allocations and then round // that region up to a PDE size, so that any PDEs we might create for @@ -1772,7 +1789,12 @@ MmArmInitSystem(IN ULONG Phase, // MiSystemViewStart = (PVOID)((ULONG_PTR)MmSessionBase - MmSystemViewSize); - + + /* Compute the PTE addresses for all the addresses we carved out */ + MiSessionImagePteStart = MiAddressToPte(MiSessionImageStart); + MiSessionImagePteEnd = MiAddressToPte(MiSessionImageEnd); + MiSessionBasePte = MiAddressToPte(MmSessionBase); + MiSessionLastPte = MiAddressToPte(MiSessionSpaceEnd); /* Initialize the user mode image list */ InitializeListHead(&MmLoadedUserImageList); From 944fe46d7063c4beca7a127e71a04ff1114ec5fb Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 18:39:09 +0000 Subject: [PATCH 060/151] [NTOS]: User pages are not used until Phase 1, they should not be setup in Phase 0. Fixes premature initalization. svn path=/trunk/; revision=47174 --- reactos/ntoskrnl/mm/mminit.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/mm/mminit.c b/reactos/ntoskrnl/mm/mminit.c index a03ce8ed3de..cb10634fdc2 100644 --- a/reactos/ntoskrnl/mm/mminit.c +++ b/reactos/ntoskrnl/mm/mminit.c @@ -400,13 +400,11 @@ MmInitSystem(IN ULONG Phase, /* Initialize the loaded module list */ MiInitializeLoadedModuleList(LoaderBlock); - - /* Initialize working sets */ - MiInitializeUserPfnBitmap(); - MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory); } else if (Phase == 1) { + MiInitializeUserPfnBitmap(); + MmInitializeMemoryConsumer(MC_USER, MmTrimUserMemory); MmInitializeRmapList(); MmInitializePageOp(); MmInitSectionImplementation(); From 291fb765f30fd2d45c6a5d94b741ff7fd4d00a55 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 18:42:05 +0000 Subject: [PATCH 061/151] [NTOS]: Fix 4MB assumptions and use PDE_MAPPED_VA instead, which accurately describes the address space mapped by a PDE (which is different on PAE, x64, ARM, etc). svn path=/trunk/; revision=47175 --- reactos/ntoskrnl/mm/ARM3/i386/init.c | 4 ++-- reactos/ntoskrnl/mm/ARM3/mminit.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/i386/init.c b/reactos/ntoskrnl/mm/ARM3/i386/init.c index 0e6908fcbcd..c0226ebc8ac 100644 --- a/reactos/ntoskrnl/mm/ARM3/i386/init.c +++ b/reactos/ntoskrnl/mm/ARM3/i386/init.c @@ -339,7 +339,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) MmNonPagedSystemStart = (PVOID)((ULONG_PTR)MmNonPagedPoolStart - (MmNumberOfSystemPtes + 1) * PAGE_SIZE); MmNonPagedSystemStart = (PVOID)((ULONG_PTR)MmNonPagedSystemStart & - ~((4 * 1024 * 1024) - 1)); + ~(PDE_MAPPED_VA - 1)); // // Don't let it go below the minimum @@ -387,7 +387,7 @@ MiInitMachineDependent(IN PLOADER_PARAMETER_BLOCK LoaderBlock) // MmPfnDatabase[0] = (PVOID)0xB0000000; MmPfnDatabase[1] = &MmPfnDatabase[0][MmHighestPhysicalPage]; - ASSERT(((ULONG_PTR)MmPfnDatabase[0] & ((4 * 1024 * 1024) - 1)) == 0); + ASSERT(((ULONG_PTR)MmPfnDatabase[0] & (PDE_MAPPED_VA - 1)) == 0); // // Non paged pool comes after the PFN database diff --git a/reactos/ntoskrnl/mm/ARM3/mminit.c b/reactos/ntoskrnl/mm/ARM3/mminit.c index 5ed08499d98..eba66b18311 100644 --- a/reactos/ntoskrnl/mm/ARM3/mminit.c +++ b/reactos/ntoskrnl/mm/ARM3/mminit.c @@ -1725,8 +1725,8 @@ MmArmInitSystem(IN ULONG Phase, // MmBootImageSize = KeLoaderBlock->Extension->LoaderPagesSpanned; MmBootImageSize *= PAGE_SIZE; - MmBootImageSize = (MmBootImageSize + (4 * 1024 * 1024) - 1) & ~((4 * 1024 * 1024) - 1); - ASSERT((MmBootImageSize % (4 * 1024 * 1024)) == 0); + MmBootImageSize = (MmBootImageSize + PDE_MAPPED_VA - 1) & ~(PDE_MAPPED_VA - 1); + ASSERT((MmBootImageSize % PDE_MAPPED_VA) == 0); // // Set the size of session view, pool, and image From 6899eeb7b62a8f56fb5d5ee6ade88ca6fa8dfd0f Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 12 May 2010 19:10:04 +0000 Subject: [PATCH 062/151] [WINLOGON] Fixed bug of the month. I'm surprised that winlogon worked at all. svn path=/trunk/; revision=47177 --- reactos/base/system/winlogon/environment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/base/system/winlogon/environment.c b/reactos/base/system/winlogon/environment.c index f0beeba90bd..4d349fee237 100644 --- a/reactos/base/system/winlogon/environment.c +++ b/reactos/base/system/winlogon/environment.c @@ -66,7 +66,7 @@ CreateUserEnvironment(IN PWLSESSION Session, } /* Allocate enough memory */ - lpFullEnviron = HeapAlloc(GetProcessHeap, 0, (EnvBlockSize + ProfileSize + 1) * sizeof(WCHAR)); + lpFullEnviron = HeapAlloc(GetProcessHeap(), 0, (EnvBlockSize + ProfileSize + 1) * sizeof(WCHAR)); if (!lpFullEnviron) { TRACE("HeapAlloc() failed\n"); From 47b27e38f3183629d9bfc9ca3a4daf0efbc68d1c Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 19:11:49 +0000 Subject: [PATCH 063/151] [NTOS]: Fix MiInsertPageInFreeList, it was using the ARM3 PFN Database macro, even though we are still using the Mm PFN Database. Also, it was lacking the code to notify the zero-page thread, and to increase available pages. svn path=/trunk/; revision=47178 --- reactos/ntoskrnl/mm/ARM3/pfnlist.c | 16 +++++++++++----- reactos/ntoskrnl/mm/freelist.c | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pfnlist.c b/reactos/ntoskrnl/mm/ARM3/pfnlist.c index 3af1fef57ea..ff17eb0b3c8 100644 --- a/reactos/ntoskrnl/mm/ARM3/pfnlist.c +++ b/reactos/ntoskrnl/mm/ARM3/pfnlist.c @@ -466,7 +466,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) (PageFrameIndex >= MmLowestPhysicalPage)); /* Get the PFN entry */ - Pfn1 = MI_PFN_TO_PFNENTRY(PageFrameIndex); + Pfn1 = MiGetPfnEntry(PageFrameIndex); /* Sanity checks that a right kind of page is being inserted here */ ASSERT(Pfn1->u4.MustBeCached == 0); @@ -484,7 +484,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) if (LastPage != LIST_HEAD) { /* Link us with the previous page, so we're at the end now */ - MI_PFN_TO_PFNENTRY(LastPage)->u1.Flink = PageFrameIndex; + MiGetPfnEntry(LastPage)->u1.Flink = PageFrameIndex; } else { @@ -507,8 +507,8 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) Pfn1->u4.InPageError = 0; Pfn1->u4.AweAllocation = 0; - /* Not yet until we switch to this */ - //MmAvailablePages++; + /* Increase available pages */ + MmAvailablePages++; /* Check if we've reached the configured low memory threshold */ if (MmAvailablePages == MmLowMemoryThreshold) @@ -552,7 +552,13 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) ColorTable->Count++; #endif - /* FIXME: Notify zero page thread if enough pages are on the free list now */ + /* Notify zero page thread if enough pages are on the free list now */ + extern KEVENT ZeroPageThreadEvent; + if ((MmFreePageListHead.Total > 8) && !(KeReadStateEvent(&ZeroPageThreadEvent))) + { + /* This is ReactOS-specific */ + KeSetEvent(&ZeroPageThreadEvent, IO_NO_INCREMENT, FALSE); + } } /* EOF */ diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 7107e1e05a1..80694e368df 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -49,7 +49,7 @@ SIZE_T MmPagedPoolCommit; SIZE_T MmPeakCommitment; SIZE_T MmtotalCommitLimitMaximum; -static KEVENT ZeroPageThreadEvent; +KEVENT ZeroPageThreadEvent; static BOOLEAN ZeroPageThreadShouldTerminate = FALSE; static RTL_BITMAP MiUserPfnBitMap; From 0b2f076246fadeb13ff3a561721d82a87b1bce42 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Wed, 12 May 2010 19:19:44 +0000 Subject: [PATCH 064/151] [USRMGR] - Fix the friends of the bug of the month svn path=/trunk/; revision=47179 --- reactos/dll/cpl/usrmgr/groups.c | 4 ++-- reactos/dll/cpl/usrmgr/users.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/reactos/dll/cpl/usrmgr/groups.c b/reactos/dll/cpl/usrmgr/groups.c index 255d6bf4f79..4eebfa40f26 100644 --- a/reactos/dll/cpl/usrmgr/groups.c +++ b/reactos/dll/cpl/usrmgr/groups.c @@ -234,10 +234,10 @@ GroupNew(HWND hwndDlg) } if (group.lgrpi1_name) - HeapFree(GetProcessHeap, 0, group.lgrpi1_name); + HeapFree(GetProcessHeap(), 0, group.lgrpi1_name); if (group.lgrpi1_comment) - HeapFree(GetProcessHeap, 0, group.lgrpi1_comment); + HeapFree(GetProcessHeap(), 0, group.lgrpi1_comment); } diff --git a/reactos/dll/cpl/usrmgr/users.c b/reactos/dll/cpl/usrmgr/users.c index 8335e1d9aa9..04ff45eaca3 100644 --- a/reactos/dll/cpl/usrmgr/users.c +++ b/reactos/dll/cpl/usrmgr/users.c @@ -294,16 +294,16 @@ UserNew(HWND hwndDlg) } if (user.usri3_name) - HeapFree(GetProcessHeap, 0, user.usri3_name); + HeapFree(GetProcessHeap(), 0, user.usri3_name); if (user.usri3_full_name) - HeapFree(GetProcessHeap, 0, user.usri3_full_name); + HeapFree(GetProcessHeap(), 0, user.usri3_full_name); if (user.usri3_comment) - HeapFree(GetProcessHeap, 0, user.usri3_comment); + HeapFree(GetProcessHeap(), 0, user.usri3_comment); if (user.usri3_password) - HeapFree(GetProcessHeap, 0, user.usri3_password); + HeapFree(GetProcessHeap(), 0, user.usri3_password); } From 7b762e3b4ea4e84590b78e539b7d4f83ab47bf7a Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Wed, 12 May 2010 19:54:02 +0000 Subject: [PATCH 065/151] [SHELL32] Improve debug print by printing text svn path=/trunk/; revision=47180 --- reactos/dll/win32/shell32/shfldr_cpanel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/shell32/shfldr_cpanel.c b/reactos/dll/win32/shell32/shfldr_cpanel.c index a7b92512462..7fd7a7a102b 100644 --- a/reactos/dll/win32/shell32/shfldr_cpanel.c +++ b/reactos/dll/win32/shell32/shfldr_cpanel.c @@ -1346,7 +1346,7 @@ static HRESULT WINAPI ICPanel_IContextMenu2_InvokeCommand( } else { - FIXME("\n"); + FIXME("Couldn't retrieve pointer to cpl structure\n"); return E_FAIL; } if (SUCCEEDED(IShellLink_Constructor(NULL, &IID_IShellLinkA, (LPVOID*)&isl))) From 0c0d737b5d02d56331497bef8e9b5b89d71bd375 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Wed, 12 May 2010 20:37:48 +0000 Subject: [PATCH 066/151] [SHELL32] Remove misplaced function header svn path=/trunk/; revision=47181 --- reactos/dll/win32/shell32/shfldr_cpanel.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/reactos/dll/win32/shell32/shfldr_cpanel.c b/reactos/dll/win32/shell32/shfldr_cpanel.c index 7fd7a7a102b..c9f5b932de6 100644 --- a/reactos/dll/win32/shell32/shfldr_cpanel.c +++ b/reactos/dll/win32/shell32/shfldr_cpanel.c @@ -315,9 +315,6 @@ static PIDLCPanelStruct* _ILGetCPanelPointer(LPCITEMIDLIST pidl) return NULL; } - /************************************************************************** - * ISF_ControlPanel_fnEnumObjects - */ static BOOL SHELL_RegisterCPanelApp(IEnumIDList* list, LPCSTR path) { LPITEMIDLIST pidl; From 77bbb3cacb84b2987805c174799f2aa874106d9c Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Wed, 12 May 2010 20:41:55 +0000 Subject: [PATCH 067/151] [SHELL32] Add initial ctrl+c/v handling (WIP for bug #4850) svn path=/trunk/; revision=47182 --- reactos/dll/win32/shell32/shlview.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reactos/dll/win32/shell32/shlview.c b/reactos/dll/win32/shell32/shlview.c index ef7f587f7c1..cc1752a20d2 100644 --- a/reactos/dll/win32/shell32/shlview.c +++ b/reactos/dll/win32/shell32/shlview.c @@ -1511,6 +1511,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn msg.pt = 0;*/ LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh; + SHORT ctrl = GetAsyncKeyState(VK_CONTROL); /* initiate a rename of the selected file or directory */ if(plvKeyDown->wVKey == VK_F2) @@ -1591,6 +1592,14 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn IShellBrowser_BrowseObject(lpSb, NULL, SBSP_PARENT); } } + else if(plvKeyDown->wVKey == 'C' && (ctrl & 0x8000)) + { + FIXME("Need to copy\n"); + } + else if(plvKeyDown->wVKey == 'V' && (ctrl & 0x8000)) + { + FIXME("Need to paste\n"); + } else FIXME("LVN_KEYDOWN key=0x%08x\n",plvKeyDown->wVKey); } From 11453cf565af07ba3d11f8d7994f117dcf1f880a Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 20:48:15 +0000 Subject: [PATCH 068/151] [NTOS]: Add assertions to the paged pool and demand zero page faults, to catch possible errors and corruptions. These paths are not yet taken in today's builds, so they do not affect any runtime code. [NTOS]: Add assertions regarding the portability of certain code, which will need changes on ARM/x64. These should probably be C_ASSERT's but I don't want to break Timo's build. [NTOS]: Define MM_NOIRQL (found in assertions) instead of magical -1. [NTOS]: Add MI_IS_SESSION_PTE macro. [NTOS]: Export the MiXxxPte variables. [NTOS]: Fix some typos in comments. svn path=/trunk/; revision=47183 --- reactos/ntoskrnl/mm/ARM3/miarm.h | 36 +++++++++++++++++++++++------ reactos/ntoskrnl/mm/ARM3/pagfault.c | 22 +++++++++++++++++- reactos/ntoskrnl/mm/ARM3/pool.c | 8 ++++--- 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/miarm.h b/reactos/ntoskrnl/mm/ARM3/miarm.h index a6e87fe7b8b..6a84e4af354 100644 --- a/reactos/ntoskrnl/mm/ARM3/miarm.h +++ b/reactos/ntoskrnl/mm/ARM3/miarm.h @@ -42,7 +42,7 @@ #define _1KB (1024) #define _1MB (1024 * _1KB) -/* Are mapped by a PDE */ +/* Area mapped by a PDE */ #define PDE_MAPPED_VA (PTE_COUNT * PAGE_SIZE) /* Size of a PDE directory, and size of a page table */ @@ -89,6 +89,18 @@ #define MM_DECOMMIT 0x10 #define MM_NOACCESS (MM_DECOMMIT | MM_NOCACHE) +// +// Assertions for session images, addresses, and PTEs +// +#define MI_IS_SESSION_IMAGE_ADDRESS(Address) \ + (((Address) >= MiSessionImageStart) && ((Address) < MiSessionImageEnd)) + +#define MI_IS_SESSION_ADDRESS(Address) \ + (((Address) >= MmSessionBase) && ((Address) < MiSessionSpaceEnd)) + +#define MI_IS_SESSION_PTE(Pte) \ + ((((PMMPTE)Pte) >= MiSessionBasePte) && (((PMMPTE)Pte) < MiSessionLastPte)) + // // Corresponds to MMPTE_SOFTWARE.Protection // @@ -119,6 +131,11 @@ // #define LIST_HEAD 0xFFFFFFFF +// +// Special IRQL value (found in assertions) +// +#define MM_NOIRQL (KIRQL)0xFFFFFFFF + // // FIXFIX: These should go in ex.h after the pool merge // @@ -284,6 +301,10 @@ extern PVOID MiSystemViewStart; extern ULONG MmSystemViewSize; extern PVOID MmSessionBase; extern PVOID MiSessionSpaceEnd; +extern PMMPTE MiSessionImagePteStart; +extern PMMPTE MiSessionImagePteEnd; +extern PMMPTE MiSessionBasePte; +extern PMMPTE MiSessionLastPte; extern ULONG MmSizeOfPagedPoolInBytes; extern PMMPTE MmSystemPagePtes; extern PVOID MmSystemCacheStart; @@ -327,16 +348,17 @@ extern ULONG MmTotalFreeSystemPtes[MaximumPtePoolTypes]; extern PFN_NUMBER MmTotalSystemDriverPages; extern PVOID MiSessionImageStart; extern PVOID MiSessionImageEnd; +extern PMMPTE MiHighestUserPte; +extern PMMPDE MiHighestUserPde; +extern PFN_NUMBER MmSystemPageDirectory[PD_COUNT]; #define MI_PFN_TO_PFNENTRY(x) (&MmPfnDatabase[1][x]) #define MI_PFNENTRY_TO_PFN(x) (x - MmPfnDatabase[1]) -#define MI_IS_SESSION_IMAGE_ADDRESS(Address) \ - (((Address) >= MiSessionImageStart) && ((Address) < MiSessionImageEnd)) - -#define MI_IS_SESSION_ADDRESS(Address) \ - (((Address) >= MmSessionBase) && ((Address) < MiSessionSpaceEnd)) - +// +// Returns if the page is physically resident (ie: a large page) +// FIXFIX: CISC/x86 only? +// FORCEINLINE BOOLEAN MI_IS_PHYSICAL_ADDRESS(IN PVOID Address) diff --git a/reactos/ntoskrnl/mm/ARM3/pagfault.c b/reactos/ntoskrnl/mm/ARM3/pagfault.c index dbed3005446..94363c0f670 100644 --- a/reactos/ntoskrnl/mm/ARM3/pagfault.c +++ b/reactos/ntoskrnl/mm/ARM3/pagfault.c @@ -27,6 +27,10 @@ MiCheckPdeForPagedPool(IN PVOID Address) PMMPDE PointerPde; NTSTATUS Status = STATUS_SUCCESS; + /* No session support in ReactOS yet */ + ASSERT(MI_IS_SESSION_ADDRESS(Address) == FALSE); + ASSERT(MI_IS_SESSION_PTE(Address) == FALSE); + // // Check if this is a fault while trying to access the page table itself // @@ -60,6 +64,9 @@ MiCheckPdeForPagedPool(IN PVOID Address) // if (PointerPde->u.Hard.Valid == 0) { + /* This seems to be making the assumption that one PDE is one page long */ + ASSERT(PAGE_SIZE == (PD_COUNT * (sizeof(MMPTE) * PDE_COUNT))); + // // Copy it from our double-mapped system page directory // @@ -88,6 +95,10 @@ MiResolveDemandZeroFault(IN PVOID Address, Address, Process); + /* Must currently only be called by paging path, for system addresses only */ + ASSERT(OldIrql == MM_NOIRQL); + ASSERT(Process == NULL); + // // Lock the PFN database // @@ -110,11 +121,16 @@ MiResolveDemandZeroFault(IN PVOID Address, // InterlockedIncrement(&KeGetCurrentPrcb()->MmDemandZeroCount); + /* Shouldn't see faults for user PTEs yet */ + ASSERT(PointerPte > MiHighestUserPte); + // // Build the PTE // TempPte = ValidKernelPte; TempPte.u.Hard.PageFrameNumber = PageFrameNumber; + ASSERT(TempPte.u.Hard.Valid == 1); + ASSERT(PointerPte->u.Hard.Valid == 0); *PointerPte = TempPte; ASSERT(PointerPte->u.Hard.Valid == 1); @@ -155,6 +171,9 @@ MiDispatchFault(IN BOOLEAN StoreInstruction, // TempPte = *PointerPte; + /* No prototype */ + ASSERT(PrototypePte == NULL); + // // The PTE must be invalid, but not totally blank // @@ -175,7 +194,8 @@ MiDispatchFault(IN BOOLEAN StoreInstruction, Status = MiResolveDemandZeroFault(Address, PointerPte, Process, - -1); + MM_NOIRQL); + ASSERT(KeAreAllApcsDisabled () == TRUE); if (NT_SUCCESS(Status)) { // diff --git a/reactos/ntoskrnl/mm/ARM3/pool.c b/reactos/ntoskrnl/mm/ARM3/pool.c index 10a585e8912..2ae4006a4a3 100644 --- a/reactos/ntoskrnl/mm/ARM3/pool.c +++ b/reactos/ntoskrnl/mm/ARM3/pool.c @@ -334,12 +334,13 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType, // // Save it into our double-buffered system page directory // + /* This seems to be making the assumption that one PDE is one page long */ + ASSERT(PAGE_SIZE == (PD_COUNT * (sizeof(MMPTE) * PDE_COUNT))); MmSystemPagePtes[(ULONG_PTR)PointerPte & (PAGE_SIZE - 1) / sizeof(MMPTE)] = TempPte; - // - // Write the actual PTE now - // + /* Write the actual PTE now */ + ASSERT(TempPte.u.Hard.Valid == 1); *PointerPte++ = TempPte; // @@ -432,6 +433,7 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType, // // Write the demand zero PTE and keep going // + ASSERT(PointerPte->u.Hard.Valid == 0); *PointerPte++ = TempPte; } while (PointerPte < StartPte); From 547dbfc5cf307bbc6caa09dcf1766f75bb4fae33 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 20:57:21 +0000 Subject: [PATCH 069/151] [NTOS]: Move MiFindContiguousPages to ARM3/contmem.c since I don't know what it was doing in freelist.c. No code change. svn path=/trunk/; revision=47184 --- reactos/ntoskrnl/mm/ARM3/contmem.c | 188 +++++++++++++++++++++++++++++ reactos/ntoskrnl/mm/ARM3/miarm.h | 6 + reactos/ntoskrnl/mm/freelist.c | 188 ----------------------------- 3 files changed, 194 insertions(+), 188 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/contmem.c b/reactos/ntoskrnl/mm/ARM3/contmem.c index 890bd74c0ea..5a26977cbe3 100644 --- a/reactos/ntoskrnl/mm/ARM3/contmem.c +++ b/reactos/ntoskrnl/mm/ARM3/contmem.c @@ -18,6 +18,194 @@ /* PRIVATE FUNCTIONS **********************************************************/ +PFN_NUMBER +NTAPI +MiFindContiguousPages(IN PFN_NUMBER LowestPfn, + IN PFN_NUMBER HighestPfn, + IN PFN_NUMBER BoundaryPfn, + IN PFN_NUMBER SizeInPages, + IN MEMORY_CACHING_TYPE CacheType) +{ + PFN_NUMBER Page, PageCount, LastPage, Length, BoundaryMask; + ULONG i = 0; + PMMPFN Pfn1, EndPfn; + KIRQL OldIrql; + PAGED_CODE (); + ASSERT(SizeInPages != 0); + + // + // Convert the boundary PFN into an alignment mask + // + BoundaryMask = ~(BoundaryPfn - 1); + + // + // Loop all the physical memory blocks + // + do + { + // + // Capture the base page and length of this memory block + // + Page = MmPhysicalMemoryBlock->Run[i].BasePage; + PageCount = MmPhysicalMemoryBlock->Run[i].PageCount; + + // + // Check how far this memory block will go + // + LastPage = Page + PageCount; + + // + // Trim it down to only the PFNs we're actually interested in + // + if ((LastPage - 1) > HighestPfn) LastPage = HighestPfn + 1; + if (Page < LowestPfn) Page = LowestPfn; + + // + // Skip this run if it's empty or fails to contain all the pages we need + // + if (!(PageCount) || ((Page + SizeInPages) > LastPage)) continue; + + // + // Now scan all the relevant PFNs in this run + // + Length = 0; + for (Pfn1 = MiGetPfnEntry(Page); Page < LastPage; Page++, Pfn1++) + { + // + // If this PFN is in use, ignore it + // + if (MiIsPfnInUse(Pfn1)) continue; + + // + // If we haven't chosen a start PFN yet and the caller specified an + // alignment, make sure the page matches the alignment restriction + // + if ((!(Length) && (BoundaryPfn)) && + (((Page ^ (Page + SizeInPages - 1)) & BoundaryMask))) + { + // + // It does not, so bail out + // + continue; + } + + // + // Increase the number of valid pages, and check if we have enough + // + if (++Length == SizeInPages) + { + // + // It appears we've amassed enough legitimate pages, rollback + // + Pfn1 -= (Length - 1); + Page -= (Length - 1); + + // + // Acquire the PFN lock + // + OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); + do + { + // + // Things might've changed for us. Is the page still free? + // + if (MiIsPfnInUse(Pfn1)) break; + + // + // So far so good. Is this the last confirmed valid page? + // + if (!--Length) + { + // + // Sanity check that we didn't go out of bounds + // + ASSERT(i != MmPhysicalMemoryBlock->NumberOfRuns); + + // + // Loop until all PFN entries have been processed + // + EndPfn = Pfn1 - SizeInPages + 1; + do + { + // + // This PFN is now a used page, set it up + // + MiUnlinkFreeOrZeroedPage(Pfn1); + Pfn1->u3.e2.ReferenceCount = 1; + + // + // Check if it was already zeroed + // + if (Pfn1->u3.e1.PageLocation != ZeroedPageList) + { + // + // It wasn't, so zero it + // + MiZeroPage(MiGetPfnEntryIndex(Pfn1)); + } + + // + // Mark it in use + // + Pfn1->u3.e1.PageLocation = ActiveAndValid; + + // + // Check if this is the last PFN, otherwise go on + // + if (Pfn1 == EndPfn) break; + Pfn1--; + } while (TRUE); + + // + // Mark the first and last PFN so we can find them later + // + Pfn1->u3.e1.StartOfAllocation = 1; + (Pfn1 + SizeInPages - 1)->u3.e1.EndOfAllocation = 1; + + // + // Now it's safe to let go of the PFN lock + // + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + + // + // Quick sanity check that the last PFN is consistent + // + EndPfn = Pfn1 + SizeInPages; + ASSERT(EndPfn == MiGetPfnEntry(Page + 1)); + + // + // Compute the first page, and make sure it's consistent + // + Page -= SizeInPages - 1; + ASSERT(Pfn1 == MiGetPfnEntry(Page)); + ASSERT(Page != 0); + return Page; + } + + // + // Keep going. The purpose of this loop is to reconfirm that + // after acquiring the PFN lock these pages are still usable + // + Pfn1++; + Page++; + } while (TRUE); + + // + // If we got here, something changed while we hadn't acquired + // the PFN lock yet, so we'll have to restart + // + KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); + Length = 0; + } + } + } while (++i != MmPhysicalMemoryBlock->NumberOfRuns); + + // + // And if we get here, it means no suitable physical memory runs were found + // + return 0; +} + PVOID NTAPI MiCheckForContiguousMemory(IN PVOID BaseAddress, diff --git a/reactos/ntoskrnl/mm/ARM3/miarm.h b/reactos/ntoskrnl/mm/ARM3/miarm.h index 6a84e4af354..cb6c0dc2f2f 100644 --- a/reactos/ntoskrnl/mm/ARM3/miarm.h +++ b/reactos/ntoskrnl/mm/ARM3/miarm.h @@ -621,4 +621,10 @@ MiSyncCachedRanges( VOID ); +BOOLEAN +NTAPI +MiIsPfnInUse( + IN PMMPFN Pfn1 +); + /* EOF */ diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 80694e368df..b6b9806e4b0 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -147,194 +147,6 @@ MiIsPfnInUse(IN PMMPFN Pfn1) return !MiIsPfnFree(Pfn1); } -PFN_NUMBER -NTAPI -MiFindContiguousPages(IN PFN_NUMBER LowestPfn, - IN PFN_NUMBER HighestPfn, - IN PFN_NUMBER BoundaryPfn, - IN PFN_NUMBER SizeInPages, - IN MEMORY_CACHING_TYPE CacheType) -{ - PFN_NUMBER Page, PageCount, LastPage, Length, BoundaryMask; - ULONG i = 0; - PMMPFN Pfn1, EndPfn; - KIRQL OldIrql; - PAGED_CODE (); - ASSERT(SizeInPages != 0); - - // - // Convert the boundary PFN into an alignment mask - // - BoundaryMask = ~(BoundaryPfn - 1); - - // - // Loop all the physical memory blocks - // - do - { - // - // Capture the base page and length of this memory block - // - Page = MmPhysicalMemoryBlock->Run[i].BasePage; - PageCount = MmPhysicalMemoryBlock->Run[i].PageCount; - - // - // Check how far this memory block will go - // - LastPage = Page + PageCount; - - // - // Trim it down to only the PFNs we're actually interested in - // - if ((LastPage - 1) > HighestPfn) LastPage = HighestPfn + 1; - if (Page < LowestPfn) Page = LowestPfn; - - // - // Skip this run if it's empty or fails to contain all the pages we need - // - if (!(PageCount) || ((Page + SizeInPages) > LastPage)) continue; - - // - // Now scan all the relevant PFNs in this run - // - Length = 0; - for (Pfn1 = MiGetPfnEntry(Page); Page < LastPage; Page++, Pfn1++) - { - // - // If this PFN is in use, ignore it - // - if (MiIsPfnInUse(Pfn1)) continue; - - // - // If we haven't chosen a start PFN yet and the caller specified an - // alignment, make sure the page matches the alignment restriction - // - if ((!(Length) && (BoundaryPfn)) && - (((Page ^ (Page + SizeInPages - 1)) & BoundaryMask))) - { - // - // It does not, so bail out - // - continue; - } - - // - // Increase the number of valid pages, and check if we have enough - // - if (++Length == SizeInPages) - { - // - // It appears we've amassed enough legitimate pages, rollback - // - Pfn1 -= (Length - 1); - Page -= (Length - 1); - - // - // Acquire the PFN lock - // - OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); - do - { - // - // Things might've changed for us. Is the page still free? - // - if (MiIsPfnInUse(Pfn1)) break; - - // - // So far so good. Is this the last confirmed valid page? - // - if (!--Length) - { - // - // Sanity check that we didn't go out of bounds - // - ASSERT(i != MmPhysicalMemoryBlock->NumberOfRuns); - - // - // Loop until all PFN entries have been processed - // - EndPfn = Pfn1 - SizeInPages + 1; - do - { - // - // This PFN is now a used page, set it up - // - MiUnlinkFreeOrZeroedPage(Pfn1); - Pfn1->u3.e2.ReferenceCount = 1; - - // - // Check if it was already zeroed - // - if (Pfn1->u3.e1.PageLocation != ZeroedPageList) - { - // - // It wasn't, so zero it - // - MiZeroPage(MiGetPfnEntryIndex(Pfn1)); - } - - // - // Mark it in use - // - Pfn1->u3.e1.PageLocation = ActiveAndValid; - - // - // Check if this is the last PFN, otherwise go on - // - if (Pfn1 == EndPfn) break; - Pfn1--; - } while (TRUE); - - // - // Mark the first and last PFN so we can find them later - // - Pfn1->u3.e1.StartOfAllocation = 1; - (Pfn1 + SizeInPages - 1)->u3.e1.EndOfAllocation = 1; - - // - // Now it's safe to let go of the PFN lock - // - KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); - - // - // Quick sanity check that the last PFN is consistent - // - EndPfn = Pfn1 + SizeInPages; - ASSERT(EndPfn == MiGetPfnEntry(Page + 1)); - - // - // Compute the first page, and make sure it's consistent - // - Page -= SizeInPages - 1; - ASSERT(Pfn1 == MiGetPfnEntry(Page)); - ASSERT(Page != 0); - return Page; - } - - // - // Keep going. The purpose of this loop is to reconfirm that - // after acquiring the PFN lock these pages are still usable - // - Pfn1++; - Page++; - } while (TRUE); - - // - // If we got here, something changed while we hadn't acquired - // the PFN lock yet, so we'll have to restart - // - KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); - Length = 0; - } - } - } while (++i != MmPhysicalMemoryBlock->NumberOfRuns); - - // - // And if we get here, it means no suitable physical memory runs were found - // - return 0; -} - PMDL NTAPI MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, From b320b4bcb1e0d5e139cb959227b9057ec68cf369 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Wed, 12 May 2010 21:11:24 +0000 Subject: [PATCH 070/151] [SHELL32] Amendment to r47182: GetAsyncKeyState -> GetKeyState (thanks to Giannis), simplify svn path=/trunk/; revision=47185 --- reactos/dll/win32/shell32/shlview.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/shell32/shlview.c b/reactos/dll/win32/shell32/shlview.c index cc1752a20d2..c1030254bea 100644 --- a/reactos/dll/win32/shell32/shlview.c +++ b/reactos/dll/win32/shell32/shlview.c @@ -1511,7 +1511,7 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn msg.pt = 0;*/ LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh; - SHORT ctrl = GetAsyncKeyState(VK_CONTROL); + SHORT ctrl = GetKeyState(VK_CONTROL) & 0x8000; /* initiate a rename of the selected file or directory */ if(plvKeyDown->wVKey == VK_F2) @@ -1592,11 +1592,11 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn IShellBrowser_BrowseObject(lpSb, NULL, SBSP_PARENT); } } - else if(plvKeyDown->wVKey == 'C' && (ctrl & 0x8000)) + else if(plvKeyDown->wVKey == 'C' && ctrl) { FIXME("Need to copy\n"); } - else if(plvKeyDown->wVKey == 'V' && (ctrl & 0x8000)) + else if(plvKeyDown->wVKey == 'V' && ctrl) { FIXME("Need to paste\n"); } From 3a80da9a3e315da5e68f222e45856df348526510 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 21:37:19 +0000 Subject: [PATCH 071/151] [NTOS]: When grabbing physically contigous pages from the zero or free list, make sure to re-initialize their PFN entries correctly, since their data might be stale. Fixes potential weird memory corruption bugs. [NTOS]: Physically contiguous memory allocations are not guaranteed to be zeroed, so do not zero the pages. [NTOS]: When allocating contigous memory, mark the PFN entries appropriately after mapping the I/O ranges. [NTOS]: When freeing contiguous memory, assert that all the freed pages correspond to PFN entries that we expect to have allocated for this purpose. Detects (not neccessarily fixes) memory corruption issues in contiguous memory allocations. [NTOS]: These changes mostly affect certain network card and sound card systems/real hardware, they fix possible bugs and detect corruption that was otherwise going by unnoticed. svn path=/trunk/; revision=47186 --- reactos/ntoskrnl/mm/ARM3/contmem.c | 82 +++++++++++++++++------------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/contmem.c b/reactos/ntoskrnl/mm/ARM3/contmem.c index 5a26977cbe3..1ce57d01d9a 100644 --- a/reactos/ntoskrnl/mm/ARM3/contmem.c +++ b/reactos/ntoskrnl/mm/ARM3/contmem.c @@ -132,23 +132,14 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn, // MiUnlinkFreeOrZeroedPage(Pfn1); Pfn1->u3.e2.ReferenceCount = 1; - - // - // Check if it was already zeroed - // - if (Pfn1->u3.e1.PageLocation != ZeroedPageList) - { - // - // It wasn't, so zero it - // - MiZeroPage(MiGetPfnEntryIndex(Pfn1)); - } - - // - // Mark it in use - // + Pfn1->u2.ShareCount = 1; Pfn1->u3.e1.PageLocation = ActiveAndValid; - + Pfn1->u3.e1.StartOfAllocation = 0; + Pfn1->u3.e1.EndOfAllocation = 0; + Pfn1->u3.e1.PrototypePte = 0; + Pfn1->u4.VerifierAllocation = 0; + Pfn1->PteAddress = (PVOID)0xBAADF00D; + // // Check if this is the last PFN, otherwise go on // @@ -331,7 +322,10 @@ MiFindContiguousMemory(IN PFN_NUMBER LowestPfn, { PFN_NUMBER Page; PHYSICAL_ADDRESS PhysicalAddress; - PAGED_CODE (); + PMMPFN Pfn1, EndPfn; + PMMPTE PointerPte; + PVOID BaseAddress; + PAGED_CODE(); ASSERT(SizeInPages != 0); // @@ -348,7 +342,22 @@ MiFindContiguousMemory(IN PFN_NUMBER LowestPfn, // We'll just piggyback on the I/O memory mapper // PhysicalAddress.QuadPart = Page << PAGE_SHIFT; - return MmMapIoSpace(PhysicalAddress, SizeInPages << PAGE_SHIFT, CacheType); + BaseAddress = MmMapIoSpace(PhysicalAddress, SizeInPages << PAGE_SHIFT, CacheType); + ASSERT(BaseAddress); + + /* Loop the PFN entries */ + Pfn1 = MiGetPfnEntry(Page); + EndPfn = Pfn1 + SizeInPages; + PointerPte = MiAddressToPte(BaseAddress); + do + { + /* Write the PTE address */ + Pfn1->PteAddress = PointerPte++; + Pfn1->u4.PteFrame = PFN_FROM_PTE(MiAddressToPte(PointerPte)); + } while (Pfn1++ < EndPfn); + + /* Return the address */ + return BaseAddress; } PVOID @@ -437,6 +446,7 @@ MiFreeContiguousMemory(IN PVOID BaseAddress) KIRQL OldIrql; PFN_NUMBER PageFrameIndex, LastPage, PageCount; PMMPFN Pfn1, StartPfn; + PMMPTE PointerPte; PAGED_CODE(); // @@ -455,10 +465,9 @@ MiFreeContiguousMemory(IN PVOID BaseAddress) return; } - // - // Otherwise, get the PTE and page number for the allocation - // - PageFrameIndex = PFN_FROM_PTE(MiAddressToPte(BaseAddress)); + /* Get the PTE and frame number for the allocation*/ + PointerPte = MiAddressToPte(BaseAddress); + PageFrameIndex = PFN_FROM_PTE(PointerPte); // // Now get the PFN entry for this, and make sure it's the correct one @@ -469,11 +478,11 @@ MiFreeContiguousMemory(IN PVOID BaseAddress) // // This probably means you did a free on an address that was in between // - KeBugCheckEx (BAD_POOL_CALLER, - 0x60, - (ULONG_PTR)BaseAddress, - 0, - 0); + KeBugCheckEx(BAD_POOL_CALLER, + 0x60, + (ULONG_PTR)BaseAddress, + 0, + 0); } // @@ -482,16 +491,21 @@ MiFreeContiguousMemory(IN PVOID BaseAddress) StartPfn = Pfn1; Pfn1->u3.e1.StartOfAllocation = 0; - // - // Look the PFNs - // + /* Look the PFNs until we find the one that marks the end of the allocation */ do { - // - // Until we find the one that marks the end of the allocation - // + /* Make sure these are the pages we setup in the allocation routine */ + ASSERT(Pfn1->u3.e2.ReferenceCount == 1); + ASSERT(Pfn1->u2.ShareCount == 1); + ASSERT(Pfn1->PteAddress == PointerPte); + ASSERT(Pfn1->u3.e1.PageLocation == ActiveAndValid); + ASSERT(Pfn1->u4.VerifierAllocation == 0); + ASSERT(Pfn1->u3.e1.PrototypePte == 0); + + /* Keep going for assertions */ + PointerPte++; } while (Pfn1++->u3.e1.EndOfAllocation == 0); - + // // Found it, unmark it // From 931fc122a08a6f73e28e3cc1fc29788347f59eb3 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Wed, 12 May 2010 22:10:07 +0000 Subject: [PATCH 072/151] [MSGINA] Use WLX_PROFILE_V2_0 instead of WLX_PROFILE_V1_0 and create an environment string that is filled with a single environment variable. WIP for bug #4102. svn path=/trunk/; revision=47187 --- reactos/dll/win32/msgina/msgina.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/msgina/msgina.c b/reactos/dll/win32/msgina/msgina.c index 4ac03fed363..02c619d3e32 100644 --- a/reactos/dll/win32/msgina/msgina.c +++ b/reactos/dll/win32/msgina/msgina.c @@ -415,8 +415,9 @@ DoLoginTasks( IN PWSTR Password) { LPWSTR ProfilePath = NULL; + LPWSTR lpEnvironment = NULL; TOKEN_STATISTICS Stats; - PWLX_PROFILE_V1_0 pProfile = NULL; + PWLX_PROFILE_V2_0 pProfile = NULL; DWORD cbStats, cbSize; BOOL bResult; @@ -449,15 +450,25 @@ DoLoginTasks( } /* Allocate memory for profile */ - pProfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WLX_PROFILE_V1_0)); + pProfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WLX_PROFILE_V2_0)); if (!pProfile) { WARN("HeapAlloc() failed\n"); goto cleanup; } - pProfile->dwType = WLX_PROFILE_TYPE_V1_0; + pProfile->dwType = WLX_PROFILE_TYPE_V2_0; pProfile->pszProfile = ProfilePath; + lpEnvironment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32 * sizeof(WCHAR)); + if (!lpEnvironment) + { + WARN("HeapAlloc() failed\n"); + goto cleanup; + } + wcscpy(lpEnvironment, L"LOGONSERVER=\\\\Test"); + + pProfile->pszEnvironment = lpEnvironment; + if (!GetTokenInformation(pgContext->UserToken, TokenStatistics, (PVOID)&Stats, @@ -467,6 +478,7 @@ DoLoginTasks( WARN("Couldn't get Authentication id from user token!\n"); goto cleanup; } + *pgContext->pAuthenticationId = Stats.AuthenticationId; pgContext->pMprNotifyInfo->pszUserName = DuplicationString(UserName); pgContext->pMprNotifyInfo->pszDomain = DuplicationString(Domain); @@ -477,6 +489,10 @@ DoLoginTasks( return TRUE; cleanup: + if (pProfile) + { + HeapFree(GetProcessHeap(), 0, pProfile->pszEnvironment); + } HeapFree(GetProcessHeap(), 0, pProfile); HeapFree(GetProcessHeap(), 0, ProfilePath); return FALSE; From df33b38ed0e6ddda538c1e1ffc8718c918a20e59 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 22:47:46 +0000 Subject: [PATCH 073/151] [NTOS]: Fix definition of unused MI_MAKE_SOFTWARE_PTE macro. [NTOS]: Correctly setup the PFN entries for freshly allocated paged pool pages. Fixes a problem where the page could've still had stale/garbage data. [NTOS]: Add some extra assertions in the code to catch memory corruption and detect invalid logic. [NTOS]: Fix some typos in the code (comments/whitespace). [NTOS]: Make the dreaded page fault message that breaks paged pool on some systems more verbose for future debugging. svn path=/trunk/; revision=47189 --- reactos/ntoskrnl/mm/ARM3/contmem.c | 8 ++++---- reactos/ntoskrnl/mm/ARM3/miarm.h | 2 +- reactos/ntoskrnl/mm/ARM3/pagfault.c | 2 +- reactos/ntoskrnl/mm/ARM3/pool.c | 13 +++++++------ reactos/ntoskrnl/mm/ARM3/procsup.c | 16 ++++++---------- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/contmem.c b/reactos/ntoskrnl/mm/ARM3/contmem.c index 1ce57d01d9a..0d7628bf88f 100644 --- a/reactos/ntoskrnl/mm/ARM3/contmem.c +++ b/reactos/ntoskrnl/mm/ARM3/contmem.c @@ -491,7 +491,7 @@ MiFreeContiguousMemory(IN PVOID BaseAddress) StartPfn = Pfn1; Pfn1->u3.e1.StartOfAllocation = 0; - /* Look the PFNs until we find the one that marks the end of the allocation */ + /* Loop the PFNs until we find the one that marks the end of the allocation */ do { /* Make sure these are the pages we setup in the allocation routine */ @@ -530,14 +530,14 @@ MiFreeContiguousMemory(IN PVOID BaseAddress) // // Loop all the pages // - LastPage = PageFrameIndex + PageCount; + LastPage = PageFrameIndex + PageCount; do { // // Free each one, and move on // - MmReleasePageMemoryConsumer(MC_NPPOOL, PageFrameIndex); - } while (++PageFrameIndex < LastPage); + MmReleasePageMemoryConsumer(MC_NPPOOL, PageFrameIndex++); + } while (PageFrameIndex < LastPage); // // Release the PFN lock diff --git a/reactos/ntoskrnl/mm/ARM3/miarm.h b/reactos/ntoskrnl/mm/ARM3/miarm.h index cb6c0dc2f2f..193eb04e698 100644 --- a/reactos/ntoskrnl/mm/ARM3/miarm.h +++ b/reactos/ntoskrnl/mm/ARM3/miarm.h @@ -117,7 +117,7 @@ // // Creates a software PTE with the given protection // -#define MI_MAKE_SOFTWARE_PTE(x) ((x) << MM_PTE_SOFTWARE_PROTECTION_BITS) +#define MI_MAKE_SOFTWARE_PTE(p, x) ((p)->u.Long = (x << MM_PTE_SOFTWARE_PROTECTION_BITS)) // // Special values for LoadedImports diff --git a/reactos/ntoskrnl/mm/ARM3/pagfault.c b/reactos/ntoskrnl/mm/ARM3/pagfault.c index 94363c0f670..7455a100af1 100644 --- a/reactos/ntoskrnl/mm/ARM3/pagfault.c +++ b/reactos/ntoskrnl/mm/ARM3/pagfault.c @@ -324,7 +324,7 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction, // // This might happen...not sure yet // - DPRINT1("FAULT ON PAGE TABLES!\n"); + DPRINT1("FAULT ON PAGE TABLES: %p %lx %lx!\n", Address, *PointerPte, *PointerPde); // // Map in the page table diff --git a/reactos/ntoskrnl/mm/ARM3/pool.c b/reactos/ntoskrnl/mm/ARM3/pool.c index 2ae4006a4a3..17c99223e00 100644 --- a/reactos/ntoskrnl/mm/ARM3/pool.c +++ b/reactos/ntoskrnl/mm/ARM3/pool.c @@ -595,14 +595,15 @@ MiAllocatePoolPages(IN POOL_TYPE PoolType, // PageFrameNumber = MmAllocPage(MC_NPPOOL); - // - // Get the PFN entry for it - // + /* Get the PFN entry for it and fill it out */ Pfn1 = MiGetPfnEntry(PageFrameNumber); + Pfn1->u3.e2.ReferenceCount = 1; + Pfn1->u2.ShareCount = 1; + Pfn1->PteAddress = PointerPte; + Pfn1->u3.e1.PageLocation = ActiveAndValid; + Pfn1->u4.VerifierAllocation = 0; - // - // Write the PTE for it - // + /* Write the PTE for it */ TempPte.u.Hard.PageFrameNumber = PageFrameNumber; ASSERT(PointerPte->u.Hard.Valid == 0); ASSERT(TempPte.u.Hard.Valid == 1); diff --git a/reactos/ntoskrnl/mm/ARM3/procsup.c b/reactos/ntoskrnl/mm/ARM3/procsup.c index 24bd11a2586..8f1e6b732c1 100644 --- a/reactos/ntoskrnl/mm/ARM3/procsup.c +++ b/reactos/ntoskrnl/mm/ARM3/procsup.c @@ -153,7 +153,6 @@ MmCreateKernelStack(IN BOOLEAN GuiStack, // Next PTE // PointerPte++; - ASSERT(PointerPte->u.Hard.Valid == 0); // // Get a page @@ -164,6 +163,8 @@ MmCreateKernelStack(IN BOOLEAN GuiStack, // // Write it // + ASSERT(PointerPte->u.Hard.Valid == 0); + ASSERT(TempPte.u.Hard.Valid == 1); *PointerPte = TempPte; } @@ -243,26 +244,21 @@ MmGrowKernelStackEx(IN PVOID StackPointer, // Acquire the PFN DB lock // OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); - + // // Loop each stack page // while (LimitPte >= NewLimitPte) { - // - // Sanity check - // - ASSERT(LimitPte->u.Hard.Valid == 0); - // // Get a page // PageFrameIndex = MmAllocPage(MC_NPPOOL); TempPte.u.Hard.PageFrameNumber = PageFrameIndex; - // - // Write it - // + /* Write the valid PTE */ + ASSERT(LimitPte->u.Hard.Valid == 0); + ASSERT(TempPte.u.Hard.Valid == 1); *LimitPte-- = TempPte; } From 0ca885a5862acd2417aeada7bd5c54d5f7189573 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 13 May 2010 20:38:16 +0000 Subject: [PATCH 074/151] [USERENV] CreateEnvironmentBlock: Also add the volatile environment values to the users environment block. svn path=/trunk/; revision=47194 --- reactos/dll/win32/userenv/environment.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/userenv/environment.c b/reactos/dll/win32/userenv/environment.c index 5bb38a6dc73..0a148abb20b 100644 --- a/reactos/dll/win32/userenv/environment.c +++ b/reactos/dll/win32/userenv/environment.c @@ -439,13 +439,16 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment, FALSE); } - - /* Set user environment variables */ SetUserEnvironment(lpEnvironment, hKeyUser, L"Environment"); + /* Set user volatile environment variables */ + SetUserEnvironment(lpEnvironment, + hKeyUser, + L"Volatile Environment"); + RegCloseKey(hKeyUser); return TRUE; From ebb491824acfaf851e921734163eb11afc1ef787 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 14 May 2010 01:30:37 +0000 Subject: [PATCH 075/151] [IPHLPAPI] - Implement GetAdaptersAddresses - Fixes the last iphlpapi winetest svn path=/trunk/; revision=47195 --- reactos/dll/win32/iphlpapi/iphlpapi_main.c | 189 +++++++++++++++++- reactos/dll/win32/iphlpapi/iphlpapi_private.h | 13 ++ 2 files changed, 197 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/iphlpapi/iphlpapi_main.c b/reactos/dll/win32/iphlpapi/iphlpapi_main.c index 0bc146b6616..d945dadf836 100644 --- a/reactos/dll/win32/iphlpapi/iphlpapi_main.c +++ b/reactos/dll/win32/iphlpapi/iphlpapi_main.c @@ -2301,17 +2301,196 @@ PIP_ADAPTER_ORDER_MAP WINAPI GetAdapterOrderMap(VOID) } /* - * @unimplemented + * @implemented */ DWORD WINAPI GetAdaptersAddresses(ULONG Family,ULONG Flags,PVOID Reserved,PIP_ADAPTER_ADDRESSES pAdapterAddresses,PULONG pOutBufLen) { + InterfaceIndexTable *indexTable; + IFInfo ifInfo; + int i; + ULONG ret, requiredSize = 0; + PIP_ADAPTER_ADDRESSES currentAddress; + PUCHAR currentLocation; + HANDLE tcpFile; + if (!pOutBufLen) return ERROR_INVALID_PARAMETER; - if (!pAdapterAddresses || *pOutBufLen == 0) - return ERROR_BUFFER_OVERFLOW; if (Reserved) return ERROR_INVALID_PARAMETER; - FIXME(":stub\n"); - return ERROR_NO_DATA; + indexTable = getNonLoopbackInterfaceIndexTable(); //I think we want non-loopback here + if (!indexTable) + return ERROR_NOT_ENOUGH_MEMORY; + + ret = openTcpFile(&tcpFile); + if (!NT_SUCCESS(ret)) + return ERROR_NO_DATA; + + for (i = indexTable->numIndexes; i >= 0; i--) + { + if (NT_SUCCESS(getIPAddrEntryForIf(tcpFile, + NULL, + indexTable->indexes[i], + &ifInfo))) + { + /* The whole struct */ + requiredSize += sizeof(IP_ADAPTER_ADDRESSES); + + /* Friendly name */ + if (!(Flags & GAA_FLAG_SKIP_FRIENDLY_NAME)) + requiredSize += strlen((char *)ifInfo.if_info.ent.if_descr) + 1; //FIXME + + /* Adapter name */ + requiredSize += strlen((char *)ifInfo.if_info.ent.if_descr) + 1; + + /* Unicast address */ + if (!(Flags & GAA_FLAG_SKIP_UNICAST)) + requiredSize += sizeof(IP_ADAPTER_UNICAST_ADDRESS); + + /* FIXME: Implement multicast, anycast, and dns server stuff */ + + /* FIXME: Implement dns suffix and description */ + requiredSize += 2 * sizeof(WCHAR); + + /* We're only going to implement what's required for XP SP0 */ + } + } + + if (*pOutBufLen < requiredSize) + { + *pOutBufLen = requiredSize; + closeTcpFile(tcpFile); + free(indexTable); + return ERROR_BUFFER_OVERFLOW; + } + + RtlZeroMemory(pAdapterAddresses, requiredSize); + + /* Let's set up the pointers */ + currentAddress = pAdapterAddresses; + for (i = indexTable->numIndexes; i >= 0; i--) + { + if (NT_SUCCESS(getIPAddrEntryForIf(tcpFile, + NULL, + indexTable->indexes[i], + &ifInfo))) + { + currentLocation = (PUCHAR)currentAddress + (ULONG_PTR)sizeof(IP_ADAPTER_ADDRESSES); + + /* FIXME: Friendly name */ + if (!(Flags & GAA_FLAG_SKIP_FRIENDLY_NAME)) + { + currentAddress->FriendlyName = (PVOID)currentLocation; + currentLocation += sizeof(WCHAR); + } + + /* Adapter name */ + currentAddress->AdapterName = (PVOID)currentLocation; + currentLocation += strlen((char *)ifInfo.if_info.ent.if_descr) + 1; + + /* Unicast address */ + if (!(Flags & GAA_FLAG_SKIP_UNICAST)) + { + currentAddress->FirstUnicastAddress = (PVOID)currentLocation; + currentLocation += sizeof(IP_ADAPTER_UNICAST_ADDRESS); + currentAddress->FirstUnicastAddress->Address.lpSockaddr = (PVOID)currentLocation; + currentLocation += sizeof(struct sockaddr); + } + + /* FIXME: Implement multicast, anycast, and dns server stuff */ + + /* FIXME: Implement dns suffix and description */ + currentAddress->DnsSuffix = (PVOID)currentLocation; + currentLocation += sizeof(WCHAR); + + currentAddress->Description = (PVOID)currentLocation; + currentLocation += sizeof(WCHAR); + + currentAddress->Next = (PVOID)currentLocation; + + /* We're only going to implement what's required for XP SP0 */ + + currentAddress = currentAddress->Next; + } + } + + /* Terminate the last address correctly */ + if (currentAddress) + currentAddress->Next = NULL; + + /* Now again, for real this time */ + + currentAddress = pAdapterAddresses; + for (i = indexTable->numIndexes; i >= 0; i--) + { + if (NT_SUCCESS(getIPAddrEntryForIf(tcpFile, + NULL, + indexTable->indexes[i], + &ifInfo))) + { + /* Make sure we're not looping more than we hoped for */ + ASSERT(currentAddress); + + /* Alignment information */ + currentAddress->Length = sizeof(IP_ADAPTER_ADDRESSES); + currentAddress->IfIndex = indexTable->indexes[i]; + + /* Adapter name */ + strcpy(currentAddress->AdapterName, (char *)ifInfo.if_info.ent.if_descr); + + if (!(Flags & GAA_FLAG_SKIP_UNICAST)) + { + currentAddress->FirstUnicastAddress->Length = sizeof(IP_ADAPTER_UNICAST_ADDRESS); + currentAddress->FirstUnicastAddress->Flags = 0; //FIXME + currentAddress->FirstUnicastAddress->Next = NULL; //FIXME: Support more than one address per adapter + currentAddress->FirstUnicastAddress->Address.lpSockaddr->sa_family = AF_INET; + memcpy(currentAddress->FirstUnicastAddress->Address.lpSockaddr->sa_data, + &ifInfo.ip_addr.iae_addr, + sizeof(ifInfo.ip_addr.iae_addr)); + currentAddress->FirstUnicastAddress->Address.iSockaddrLength = sizeof(ifInfo.ip_addr.iae_addr) + sizeof(USHORT); + currentAddress->FirstUnicastAddress->PrefixOrigin = IpPrefixOriginOther; //FIXME + currentAddress->FirstUnicastAddress->SuffixOrigin = IpPrefixOriginOther; //FIXME + currentAddress->FirstUnicastAddress->DadState = IpDadStatePreferred; //FIXME + currentAddress->FirstUnicastAddress->ValidLifetime = 0xFFFFFFFF; //FIXME + currentAddress->FirstUnicastAddress->PreferredLifetime = 0xFFFFFFFF; //FIXME + currentAddress->FirstUnicastAddress->LeaseLifetime = 0xFFFFFFFF; //FIXME + } + + /* FIXME: Implement multicast, anycast, and dns server stuff */ + currentAddress->FirstAnycastAddress = NULL; + currentAddress->FirstMulticastAddress = NULL; + currentAddress->FirstDnsServerAddress = NULL; + + /* FIXME: Implement dns suffix, description, and friendly name */ + currentAddress->DnsSuffix[0] = UNICODE_NULL; + currentAddress->Description[0] = UNICODE_NULL; + currentAddress->FriendlyName[0] = UNICODE_NULL; + + /* Physical Address */ + memcpy(currentAddress->PhysicalAddress, ifInfo.if_info.ent.if_physaddr, ifInfo.if_info.ent.if_physaddrlen); + currentAddress->PhysicalAddressLength = ifInfo.if_info.ent.if_physaddrlen; + + /* Flags */ + currentAddress->Flags = 0; //FIXME + + /* MTU */ + currentAddress->Mtu = ifInfo.if_info.ent.if_mtu; + + /* Interface type */ + currentAddress->IfType = ifInfo.if_info.ent.if_type; + + /* Operational status */ + currentAddress->OperStatus = ifInfo.if_info.ent.if_operstatus; + + /* We're only going to implement what's required for XP SP0 */ + + /* Move to the next address */ + currentAddress = currentAddress->Next; + } + } + + closeTcpFile(tcpFile); + free(indexTable); + + return NO_ERROR; } /* diff --git a/reactos/dll/win32/iphlpapi/iphlpapi_private.h b/reactos/dll/win32/iphlpapi/iphlpapi_private.h index 766f7f4e6ee..fa6c1c151cd 100644 --- a/reactos/dll/win32/iphlpapi/iphlpapi_private.h +++ b/reactos/dll/win32/iphlpapi/iphlpapi_private.h @@ -60,6 +60,15 @@ #define TCP_REQUEST_QUERY_INFORMATION_INIT { { { 0 } } } #define TCP_REQUEST_SET_INFORMATION_INIT { { 0 } } +/* FIXME: ROS headers suck */ +#ifndef GAA_FLAG_SKIP_UNICAST +#define GAA_FLAG_SKIP_UNICAST 0x0001 +#endif + +#ifndef GAA_FLAG_SKIP_FRIENDLY_NAME +#define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020 +#endif + // As in the mib from RFC 1213 typedef struct _IPRouteEntry { @@ -138,6 +147,10 @@ typedef VOID (*EnumNameServersFunc)( PWCHAR Interface, PWCHAR NameServer, PVOID Data ); void EnumNameServers( HANDLE RegHandle, PWCHAR Interface, PVOID Data, EnumNameServersFunc cb ); +NTSTATUS getIPAddrEntryForIf(HANDLE tcpFile, + char *name, + DWORD index, + IFInfo *ifInfo); #include /* This is here until we switch to version 2.5 of the mingw headers */ From 0801068a35de140186919523bf13a346af4c422b Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Fri, 14 May 2010 15:47:00 +0000 Subject: [PATCH 076/151] [PORTCLS] - Don't request initializing delayed service request as this is the task of the miniport driver - Reimplement the service group object: - Use the initialized timer object when RequestService is called - Fix possible race conditions when adding / removing a service sink by protecting it with a lock - Acquire the service group list lock when executing the shared dpc routine svn path=/trunk/; revision=47197 --- .../wdm/audio/backpln/portcls/pin_dmus.cpp | 1 - .../audio/backpln/portcls/pin_wavecyclic.cpp | 3 +- .../wdm/audio/backpln/portcls/pin_wavepci.cpp | 1 - .../audio/backpln/portcls/service_group.cpp | 192 +++++++++++------- 4 files changed, 116 insertions(+), 81 deletions(-) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp b/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp index da6e98d9d51..991e0e11426 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/pin_dmus.cpp @@ -602,7 +602,6 @@ CPortPinDMus::Init( DPRINT("Failed to add pin to service group\n"); return Status; } - m_ServiceGroup->SupportDelayedService(); } Status = m_IrpQueue->Init(ConnectDetails, 0, 0, NULL); diff --git a/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp b/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp index ff02905e386..0520480ae92 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp @@ -1213,7 +1213,6 @@ CPortPinWaveCyclic::Init( return Status; } - m_ServiceGroup->SupportDelayedService(); m_Stream->SetState(KSSTATE_STOP); m_State = KSSTATE_STOP; m_CommonBufferOffset = 0; @@ -1224,6 +1223,8 @@ CPortPinWaveCyclic::Init( m_Delay = Int32x32To64(10, -10000); Status = m_Stream->SetNotificationFreq(10, &m_FrameSize); + PC_ASSERT(NT_SUCCESS(Status)); + PC_ASSERT(m_FrameSize); SilenceBuffer = AllocateItem(NonPagedPool, m_FrameSize, TAG_PORTCLASS); if (!SilenceBuffer) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp b/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp index 935ece83ec7..1b44fe1794f 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp @@ -815,7 +815,6 @@ CPortPinWavePci::Init( DPRINT("Failed to add pin to service group\n"); return Status; } - m_ServiceGroup->SupportDelayedService(); } // delay of 10 milisec diff --git a/reactos/drivers/wdm/audio/backpln/portcls/service_group.cpp b/reactos/drivers/wdm/audio/backpln/portcls/service_group.cpp index 8e2bb943cf8..3a17faeec85 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/service_group.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/service_group.cpp @@ -54,12 +54,10 @@ protected: LIST_ENTRY m_ServiceSinkHead; - BOOL m_Initialized; - BOOL m_TimerActive; + BOOL m_TimerInitialized; KTIMER m_Timer; KDPC m_Dpc; - KEVENT m_Event; - LONG m_ThreadActive; + KSPIN_LOCK m_Lock; friend VOID NTAPI IServiceGroupDpc(IN struct _KDPC *Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2); @@ -105,9 +103,16 @@ CServiceGroup::QueryInterface( CServiceGroup::CServiceGroup(IUnknown * OuterUnknown) { + // initialize dpc KeInitializeDpc(&m_Dpc, IServiceGroupDpc, (PVOID)this); + + // set highest importance KeSetImportanceDpc(&m_Dpc, HighImportance); - KeInitializeEvent(&m_Event, NotificationEvent, FALSE); + + // initialize service group list lock + KeInitializeSpinLock(&m_Lock); + + // initialize service group list InitializeListHead(&m_ServiceSinkHead); } @@ -119,15 +124,34 @@ CServiceGroup::RequestService() DPRINT("CServiceGroup::RequestService() Dpc at Level %u\n", KeGetCurrentIrql()); - if (KeGetCurrentIrql() > DISPATCH_LEVEL) + if (m_TimerInitialized) { - KeInsertQueueDpc(&m_Dpc, NULL, NULL); - return; - } + LARGE_INTEGER DueTime; - KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); - KeInsertQueueDpc(&m_Dpc, NULL, NULL); - KeLowerIrql(OldIrql); + // no due time + DueTime.QuadPart = 0LL; + + // delayed service requested + KeSetTimer(&m_Timer, DueTime, &m_Dpc); + } + else + { + // check curent irql + if (KeGetCurrentIrql() > DISPATCH_LEVEL) + { + //insert dpc to queue + KeInsertQueueDpc(&m_Dpc, NULL, NULL); + } + else + { + // raise irql to dispatch level to make dpc fire immediately + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + // insert dpc to queue + KeInsertQueueDpc(&m_Dpc, NULL, NULL); + // lower irql to old level + KeLowerIrql(OldIrql); + } + } } //--------------------------------------------------------------- @@ -140,18 +164,33 @@ CServiceGroup::AddMember( IN PSERVICESINK pServiceSink) { PGROUP_ENTRY Entry; + KIRQL OldLevel; + // sanity check PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL); + // allocate service sink entry Entry = (PGROUP_ENTRY)AllocateItem(NonPagedPool, sizeof(GROUP_ENTRY), TAG_PORTCLASS); if (!Entry) + { + // out of memory return STATUS_INSUFFICIENT_RESOURCES; + } + // initialize service sink entry Entry->pServiceSink = pServiceSink; + // increment reference count pServiceSink->AddRef(); + // acquire service group list lock + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // insert into service sink list InsertTailList(&m_ServiceSinkHead, &Entry->Entry); + // release service group list lock + KeReleaseSpinLock(&m_Lock, OldLevel); + return STATUS_SUCCESS; } @@ -162,23 +201,45 @@ CServiceGroup::RemoveMember( { PLIST_ENTRY CurEntry; PGROUP_ENTRY Entry; + KIRQL OldLevel; + // sanity check PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL); + // acquire service group list lock + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // grab first entry CurEntry = m_ServiceSinkHead.Flink; + + // loop list until the passed entry is found while (CurEntry != &m_ServiceSinkHead) { + // grab entry Entry = CONTAINING_RECORD(CurEntry, GROUP_ENTRY, Entry); + + // check if it matches the passed entry if (Entry->pServiceSink == pServiceSink) { + // remove entry from list RemoveEntryList(&Entry->Entry); + + // release service sink reference pServiceSink->Release(); + + // free service sink entry FreeItem(Entry, TAG_PORTCLASS); - return; + + // leave loop + break; } + // move to next entry CurEntry = CurEntry->Flink; } + // release service group list lock + KeReleaseSpinLock(&m_Lock, OldLevel); + } VOID @@ -194,73 +255,40 @@ IServiceGroupDpc( PGROUP_ENTRY Entry; CServiceGroup * This = (CServiceGroup*)DeferredContext; + // acquire service group list lock + KeAcquireSpinLockAtDpcLevel(&This->m_Lock); + + // grab first entry CurEntry = This->m_ServiceSinkHead.Flink; + + // loop the list and call the attached service sink/group while (CurEntry != &This->m_ServiceSinkHead) { + //grab current entry Entry = (PGROUP_ENTRY)CONTAINING_RECORD(CurEntry, GROUP_ENTRY, Entry); + + // call service sink/group Entry->pServiceSink->RequestService(); + + // move to next entry CurEntry = CurEntry->Flink; } + + // release service group list lock + KeReleaseSpinLockFromDpcLevel(&This->m_Lock); } - -#if 0 -VOID -NTAPI -ServiceGroupThread(IN PVOID StartContext) -{ - NTSTATUS Status; - KWAIT_BLOCK WaitBlockArray[2]; - PVOID WaitObjects[2]; - CServiceGroup * This = (CServiceGroup*)StartContext; - - // Set thread state - InterlockedIncrement(&This->m_ThreadActive); - - // Setup the wait objects - WaitObjects[0] = &m_Timer; - WaitObjects[1] = &m_Event; - - do - { - // Wait on our objects - Status = KeWaitForMultipleObjects(2, WaitObjects, WaitAny, Executive, KernelMode, FALSE, NULL, WaitBlockArray); - - switch(Status) - { - case STATUS_WAIT_0: - IServiceGroupDpc(&This->m_Dpc, (PVOID)This, NULL, NULL); - break; - case STATUS_WAIT_1: - PsTerminateSystemThread(STATUS_SUCCESS); - return; - } - }while(TRUE); -} - -#endif VOID NTAPI CServiceGroup::SupportDelayedService() { - //NTSTATUS Status; - //HANDLE ThreadHandle; - PC_ASSERT_IRQL(DISPATCH_LEVEL); - if (m_Initialized) - return; + // initialize the timer + KeInitializeTimer(&m_Timer); - KeInitializeTimerEx(&m_Timer, NotificationTimer); - -#if 0 - Status = PsCreateSystemThread(&ThreadHandle, THREAD_ALL_ACCESS, NULL, 0, NULL, ServiceGroupThread, (PVOID)This); - if (NT_SUCCESS(Status)) - { - ZwClose(ThreadHandle); - m_Initialized = TRUE; - } -#endif + // use the timer to perform service requests + m_TimerInitialized = TRUE; } VOID @@ -270,17 +298,14 @@ CServiceGroup::RequestDelayedService( { LARGE_INTEGER DueTime; + // sanity check PC_ASSERT_IRQL(DISPATCH_LEVEL); + PC_ASSERT(m_TimerInitialized); DueTime.QuadPart = ullDelay; - if (m_Initialized) - { - if (KeGetCurrentIrql() <= DISPATCH_LEVEL) - KeSetTimer(&m_Timer, DueTime, &m_Dpc); - else - KeInsertQueueDpc(&m_Dpc, NULL, NULL); - } + // set the timer + KeSetTimer(&m_Timer, DueTime, &m_Dpc); } VOID @@ -288,11 +313,10 @@ NTAPI CServiceGroup::CancelDelayedService() { PC_ASSERT_IRQL(DISPATCH_LEVEL); + PC_ASSERT(m_TimerInitialized); - if (m_Initialized) - { - KeCancelTimer(&m_Timer); - } + // cancel the timer + KeCancelTimer(&m_Timer); } NTSTATUS @@ -303,19 +327,31 @@ PcNewServiceGroup( { CServiceGroup * This; NTSTATUS Status; + DPRINT("PcNewServiceGroup entered\n"); - This = new(NonPagedPool, TAG_PORTCLASS)CServiceGroup(OuterUnknown); - if (!This) - return STATUS_INSUFFICIENT_RESOURCES; + //FIXME support aggregation + PC_ASSERT(OuterUnknown == NULL); + // allocate a service group object + This = new(NonPagedPool, TAG_PORTCLASS)CServiceGroup(OuterUnknown); + + if (!This) + { + // out of memory + return STATUS_INSUFFICIENT_RESOURCES; + } + + // request IServiceSink interface Status = This->QueryInterface(IID_IServiceSink, (PVOID*)OutServiceGroup); if (!NT_SUCCESS(Status)) { + // failed to acquire service sink interface delete This; return Status; } + // done return Status; } From 029c6e67a9cbe2dd47371219c78b7dc489675a64 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 14 May 2010 17:08:20 +0000 Subject: [PATCH 077/151] [WINLOGON] - Store all environment variables that were passed from msgina.dll in the volatile environment key. - Add the APPDATA environment variable to the volatile environment. Unfortunately SHGetFolderPath does not seem to expand the appdata path. Bug or Feature?? - Create the environment block for the shell process after the volatile environment key has been filled, so its variables are included. - Yet another step to fixing bug #4102. svn path=/trunk/; revision=47198 --- reactos/base/system/winlogon/environment.c | 151 +++++++++++++-------- reactos/base/system/winlogon/sas.c | 14 +- reactos/base/system/winlogon/winlogon.h | 4 +- 3 files changed, 101 insertions(+), 68 deletions(-) diff --git a/reactos/base/system/winlogon/environment.c b/reactos/base/system/winlogon/environment.c index 4d349fee237..769767c965e 100644 --- a/reactos/base/system/winlogon/environment.c +++ b/reactos/base/system/winlogon/environment.c @@ -11,6 +11,7 @@ /* INCLUDES *****************************************************************/ #include "winlogon.h" +#include #include @@ -18,18 +19,98 @@ WINE_DEFAULT_DEBUG_CHANNEL(winlogon); /* GLOBALS ******************************************************************/ +typedef HRESULT (WINAPI *PFSHGETFOLDERPATHW)(HWND, int, HANDLE, DWORD, LPWSTR); + /* FUNCTIONS ****************************************************************/ -BOOL -CreateUserEnvironment(IN PWLSESSION Session, - IN LPVOID *lpEnvironment, - IN LPWSTR *lpFullEnv) +static VOID +BuildVolatileEnvironment(IN PWLSESSION Session, + IN HKEY hKey) { + HINSTANCE hShell32 = NULL; + PFSHGETFOLDERPATHW pfSHGetFolderPathW = NULL; + WCHAR szPath[MAX_PATH + 1]; LPCWSTR wstr; - SIZE_T EnvBlockSize = 0, ProfileSize = 0; - LPVOID lpEnviron = NULL; - LPWSTR lpFullEnviron = NULL; + SIZE_T size; + + WCHAR szEnvKey[MAX_PATH]; + WCHAR szEnvValue[1024]; + + SIZE_T length; + LPWSTR eqptr, endptr; + + if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && + Session->Profile->pszEnvironment != NULL) + { + wstr = Session->Profile->pszEnvironment; + while (*wstr != UNICODE_NULL) + { + size = wcslen(wstr) + 1; + + eqptr = wcschr(wstr, L'='); + + if (eqptr != NULL) + { + endptr = eqptr; + + endptr--; + while (iswspace(*endptr)) + endptr--; + + length = (SIZE_T)(endptr - wstr + 1); + + wcsncpy(szEnvKey, wstr, length); + szEnvKey[length] = 0; + + eqptr++; + while (iswspace(*eqptr)) + eqptr++; + wcscpy(szEnvValue, eqptr); + + RegSetValueExW(hKey, + szEnvKey, + 0, + REG_SZ, + (LPBYTE)szEnvValue, + (wcslen(szEnvValue) + 1) * sizeof(WCHAR)); + } + + wstr += size; + } + } + + + hShell32 = LoadLibraryW(L"shell32.dll"); + if (hShell32 != NULL) + { + pfSHGetFolderPathW = (PFSHGETFOLDERPATHW)GetProcAddress(hShell32, + "SHGetFolderPathW"); + if (pfSHGetFolderPathW != NULL) + { + if (pfSHGetFolderPathW(NULL, + CSIDL_APPDATA | CSIDL_FLAG_DONT_VERIFY, + Session->UserToken, + 0, + szPath) == S_OK) + { + RegSetValueExW(hKey, + L"APPDATA", + 0, + REG_SZ, + (LPBYTE)szPath, + (wcslen(szPath) + 1) * sizeof(WCHAR)); + } + } + + FreeLibrary(hShell32); + } +} + + +BOOL +CreateUserEnvironment(IN PWLSESSION Session) +{ HKEY hKey; DWORD dwDisp; LONG lError; @@ -37,56 +118,6 @@ CreateUserEnvironment(IN PWLSESSION Session, TRACE("WL: CreateUserEnvironment called\n"); - /* Create environment block for the user */ - if (!CreateEnvironmentBlock(&lpEnviron, - Session->UserToken, - TRUE)) - { - WARN("WL: CreateEnvironmentBlock() failed\n"); - return FALSE; - } - - if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment) - { - /* Count required size for full environment */ - wstr = (LPCWSTR)lpEnviron; - while (*wstr != UNICODE_NULL) - { - SIZE_T size = wcslen(wstr) + 1; - wstr += size; - EnvBlockSize += size; - } - - wstr = Session->Profile->pszEnvironment; - while (*wstr != UNICODE_NULL) - { - SIZE_T size = wcslen(wstr) + 1; - wstr += size; - ProfileSize += size; - } - - /* Allocate enough memory */ - lpFullEnviron = HeapAlloc(GetProcessHeap(), 0, (EnvBlockSize + ProfileSize + 1) * sizeof(WCHAR)); - if (!lpFullEnviron) - { - TRACE("HeapAlloc() failed\n"); - return FALSE; - } - - /* Fill user environment block */ - CopyMemory(lpFullEnviron, - lpEnviron, - EnvBlockSize * sizeof(WCHAR)); - CopyMemory(&lpFullEnviron[EnvBlockSize], - Session->Profile->pszEnvironment, - ProfileSize * sizeof(WCHAR)); - lpFullEnviron[EnvBlockSize + ProfileSize] = UNICODE_NULL; - } - else - { - lpFullEnviron = (LPWSTR)lpEnviron; - } - /* Impersonate the new user */ ImpersonateLoggedOnUser(Session->UserToken); @@ -107,6 +138,9 @@ CreateUserEnvironment(IN PWLSESSION Session, &dwDisp); if (lError == ERROR_SUCCESS) { + BuildVolatileEnvironment(Session, + hKey); + RegCloseKey(hKey); } else @@ -120,9 +154,6 @@ CreateUserEnvironment(IN PWLSESSION Session, /* Revert the impersonation */ RevertToSelf(); - *lpEnvironment = lpEnviron; - *lpFullEnv = lpFullEnviron; - TRACE("WL: CreateUserEnvironment done\n"); return TRUE; diff --git a/reactos/base/system/winlogon/sas.c b/reactos/base/system/winlogon/sas.c index baecf988a73..d4dbad881f6 100644 --- a/reactos/base/system/winlogon/sas.c +++ b/reactos/base/system/winlogon/sas.c @@ -170,7 +170,6 @@ HandleLogon( { PROFILEINFOW ProfileInfo; LPVOID lpEnvironment = NULL; - LPWSTR lpFullEnv = NULL; BOOLEAN Old; BOOL ret = FALSE; @@ -208,12 +207,19 @@ HandleLogon( } /* Create environment block for the user */ - if (!CreateUserEnvironment(Session, &lpEnvironment, &lpFullEnv)) + if (!CreateUserEnvironment(Session)) { WARN("WL: SetUserEnvironment() failed\n"); goto cleanup; } + /* Create environment block for the user */ + if (!CreateEnvironmentBlock(&lpEnvironment, Session->UserToken, TRUE)) + { + WARN("WL: CreateEnvironmentBlock() failed\n"); + goto cleanup; + } + DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS); UpdatePerUserSystemParameters(0, TRUE); @@ -233,7 +239,7 @@ HandleLogon( Session->Gina.Context, L"Default", NULL, /* FIXME */ - lpFullEnv)) + lpEnvironment)) { //WCHAR StatusMsg[256]; WARN("WL: WlxActivateUserShell() failed\n"); @@ -260,8 +266,6 @@ cleanup: { UnloadUserProfile(WLSession->UserToken, ProfileInfo.hProfile); } - if (lpFullEnv != lpEnvironment) - HeapFree(GetProcessHeap(), 0, lpFullEnv); if (lpEnvironment) DestroyEnvironmentBlock(lpEnvironment); RemoveStatusMessage(Session); diff --git a/reactos/base/system/winlogon/winlogon.h b/reactos/base/system/winlogon/winlogon.h index c03bf697925..45e73254428 100644 --- a/reactos/base/system/winlogon/winlogon.h +++ b/reactos/base/system/winlogon/winlogon.h @@ -182,9 +182,7 @@ UpdatePerUserSystemParameters(DWORD dwUnknown, /* environment.c */ BOOL -CreateUserEnvironment(IN PWLSESSION Session, - IN LPVOID *lpEnvironment, - IN LPWSTR *lpFullEnv); +CreateUserEnvironment(IN PWLSESSION Session); /* sas.c */ BOOL From 449bd3cb852860c265fafcdd99d1eb4f21b7bac5 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 14 May 2010 17:12:35 +0000 Subject: [PATCH 078/151] [MSGINA] - Fix the order of controls to match the expected tab order. This makes the focus stop jumping around like crazy when you press the Tab key. svn path=/trunk/; revision=47199 --- reactos/dll/win32/msgina/lang/bg-BG.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/cs-CZ.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/de-DE.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/en-US.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/es-ES.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/fr-FR.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/id-ID.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/it-IT.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/ja-JP.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/no-NO.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/pl-PL.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/ro-RO.rc | 32 +++++++++++++------------- reactos/dll/win32/msgina/lang/ru-RU.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/sk-SK.rc | 18 +++++++-------- reactos/dll/win32/msgina/lang/uk-UA.rc | 18 +++++++-------- 15 files changed, 142 insertions(+), 142 deletions(-) diff --git a/reactos/dll/win32/msgina/lang/bg-BG.rc b/reactos/dll/win32/msgina/lang/bg-BG.rc index fc0e8300ddb..16c3c31cfab 100644 --- a/reactos/dll/win32/msgina/lang/bg-BG.rc +++ b/reactos/dll/win32/msgina/lang/bg-BG.rc @@ -22,14 +22,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT ":",IDC_STATIC,36,75,45,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT ":",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "",IDCANCEL,115,122,50,14 PUSHBUTTON "",IDC_SHUTDOWN,179,122,50,14 - LTEXT ":",IDC_STATIC,36,75,45,8 - LTEXT ":",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -37,13 +37,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "",IDCANCEL,130,95,99,14 - PUSHBUTTON "",IDC_LOGOFF,90,76,75,14 - PUSHBUTTON "",IDC_SHUTDOWN,170,76,75,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT " ?",IDC_STATIC,86,60,87,8 PUSHBUTTON " ",IDC_LOCK,25,95,99,14 + PUSHBUTTON "",IDC_LOGOFF,90,76,75,14 + PUSHBUTTON "",IDC_SHUTDOWN,170,76,75,14 PUSHBUTTON " ",IDC_TASKMGR,10,76,75,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "",IDCANCEL,130,95,99,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/cs-CZ.rc b/reactos/dll/win32/msgina/lang/cs-CZ.rc index 7ecf432f4a8..79391bb58bf 100644 --- a/reactos/dll/win32/msgina/lang/cs-CZ.rc +++ b/reactos/dll/win32/msgina/lang/cs-CZ.rc @@ -27,14 +27,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Pihlen" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Jmno:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Heslo:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Storno",IDCANCEL,115,122,50,14 PUSHBUTTON "Vypnout",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Jmno:",IDC_STATIC,36,75,40,8 - LTEXT "Heslo:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -42,13 +42,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Bezpenost" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Storno",IDCANCEL,170,95,70,14 - PUSHBUTTON "Odhlsit",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Vypnout",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Co chcete udlat?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Uzamknout pota",IDC_LOCK,10,76,70,14 + PUSHBUTTON "Odhlsit",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Vypnout",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "Sprvce loh",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Storno",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/de-DE.rc b/reactos/dll/win32/msgina/lang/de-DE.rc index 9d3704138b5..3dad1cee158 100644 --- a/reactos/dll/win32/msgina/lang/de-DE.rc +++ b/reactos/dll/win32/msgina/lang/de-DE.rc @@ -22,14 +22,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Logon" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Benutzername:",IDC_STATIC,26, 75, 54, 8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Passwort:",IDC_STATIC,43, 93, 38, 8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,41, 122, 50, 14,BS_DEFPUSHBUTTON PUSHBUTTON "Abbrechen",IDCANCEL,103, 122, 50, 14 PUSHBUTTON "Herunterfahren",IDC_SHUTDOWN,165, 122, 64, 14 - LTEXT "Benutzername:",IDC_STATIC,26, 75, 54, 8 - LTEXT "Passwort:",IDC_STATIC,43, 93, 38, 8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -37,13 +37,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Sicherheit" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Abbrechen",IDCANCEL,170,95,70,14 - PUSHBUTTON "Abmelden",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Herunterfahren",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Was wollen Sie tun?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Computer sperren",IDC_LOCK,10,76,70,14 + PUSHBUTTON "Abmelden",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Herunterfahren",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "Taskmanager",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Abbrechen",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/en-US.rc b/reactos/dll/win32/msgina/lang/en-US.rc index ed5a0e2ea42..4324b99098c 100644 --- a/reactos/dll/win32/msgina/lang/en-US.rc +++ b/reactos/dll/win32/msgina/lang/en-US.rc @@ -22,14 +22,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Logon" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Username:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Password:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Cancel",IDCANCEL,115,122,50,14 PUSHBUTTON "Shutdown",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Username:",IDC_STATIC,36,75,40,8 - LTEXT "Password:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -37,13 +37,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Security" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Cancel",IDCANCEL,170,95,70,14 - PUSHBUTTON "Log off",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Shutdown",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "What do you want to do?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Lock computer",IDC_LOCK,10,76,70,14 + PUSHBUTTON "Log off",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Shutdown",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "Task manager",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Cancel",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/es-ES.rc b/reactos/dll/win32/msgina/lang/es-ES.rc index 68a4f57212a..05f89339be1 100644 --- a/reactos/dll/win32/msgina/lang/es-ES.rc +++ b/reactos/dll/win32/msgina/lang/es-ES.rc @@ -27,14 +27,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Acceder" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Usuario:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Contrasea:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "Aceptar",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Cancelar",IDCANCEL,115,122,50,14 PUSHBUTTON "Cerrar",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Usuario:",IDC_STATIC,36,75,40,8 - LTEXT "Contrasea:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0, 0, 261, 116 @@ -42,13 +42,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Seguridad" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Cancelar",IDCANCEL, 186, 95, 70, 14 - PUSHBUTTON "Salir",IDC_LOGOFF, 92, 76, 88, 14 - PUSHBUTTON "Cerrar",IDC_SHUTDOWN, 186, 76, 70, 14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Qu quieres hacer?",IDC_STATIC, 94, 60, 87, 8 PUSHBUTTON "Bloquear computadora",IDC_LOCK, 4, 76, 83, 14 + PUSHBUTTON "Salir",IDC_LOGOFF, 92, 76, 88, 14 + PUSHBUTTON "Cerrar",IDC_SHUTDOWN, 186, 76, 70, 14 PUSHBUTTON "Administrador de tareas",IDC_TASKMGR, 92, 95, 88, 14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Cancelar",IDCANCEL, 186, 95, 70, 14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/fr-FR.rc b/reactos/dll/win32/msgina/lang/fr-FR.rc index a0bda097c78..c4d453edefa 100644 --- a/reactos/dll/win32/msgina/lang/fr-FR.rc +++ b/reactos/dll/win32/msgina/lang/fr-FR.rc @@ -22,14 +22,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Connexion" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Utilisateur:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Mot de passe:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Annuler",IDCANCEL,115,122,50,14 PUSHBUTTON "teindre",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Utilisateur:",IDC_STATIC,36,75,40,8 - LTEXT "Mot de passe:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0, 0, 258, 116 @@ -37,13 +37,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Scurit" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Annuler",IDCANCEL, 184, 95, 70, 14 - PUSHBUTTON "Dconnecter",IDC_LOGOFF, 93, 76, 85, 14 - PUSHBUTTON "teindre",IDC_SHUTDOWN, 184, 76, 70, 14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Que voulez vous faire?",IDC_STATIC, 94, 60, 87, 8 PUSHBUTTON "Verrouiller l'ordinateur",IDC_LOCK, 4, 76, 82, 14 + PUSHBUTTON "Dconnecter",IDC_LOGOFF, 93, 76, 85, 14 + PUSHBUTTON "teindre",IDC_SHUTDOWN, 184, 76, 70, 14 PUSHBUTTON "Gestionnaire de tches",IDC_TASKMGR, 93, 95, 85, 14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Annuler",IDCANCEL, 184, 95, 70, 14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/id-ID.rc b/reactos/dll/win32/msgina/lang/id-ID.rc index be8b462e790..c73970da164 100644 --- a/reactos/dll/win32/msgina/lang/id-ID.rc +++ b/reactos/dll/win32/msgina/lang/id-ID.rc @@ -22,14 +22,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Masuk" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Nama pengguna:",IDC_STATIC,22, 75, 61, 8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Kata sandi:",IDC_STATIC, 40, 93, 42, 8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Batal",IDCANCEL,115,122,50,14 PUSHBUTTON "Matikan",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Nama pengguna:",IDC_STATIC,22, 75, 61, 8 - LTEXT "Kata sandi:",IDC_STATIC, 40, 93, 42, 8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -37,13 +37,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Keamanan" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Batal",IDCANCEL,170,95,70,14 - PUSHBUTTON "Keluar",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Matikan",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Apa yang ingin anda lakukan?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Kunci komputer",IDC_LOCK,10,76,70,14 + PUSHBUTTON "Keluar",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Matikan",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "Manager Tugas",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Batal",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/it-IT.rc b/reactos/dll/win32/msgina/lang/it-IT.rc index 8246a87c0f1..dd1858b93df 100644 --- a/reactos/dll/win32/msgina/lang/it-IT.rc +++ b/reactos/dll/win32/msgina/lang/it-IT.rc @@ -30,14 +30,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Logon" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Utente:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Password:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Annulla",IDCANCEL,115,122,50,14 PUSHBUTTON "Spegnimento",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Utente:",IDC_STATIC,36,75,40,8 - LTEXT "Password:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -45,13 +45,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Sicurezza" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Annulla",IDCANCEL,170,95,70,14 - PUSHBUTTON "Fine sessione",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Spegnimento",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Cosa volete fare?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Bloccare il computer",IDC_LOCK,10,76,70,14 + PUSHBUTTON "Fine sessione",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Spegnimento",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "Task manager",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Annulla",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/ja-JP.rc b/reactos/dll/win32/msgina/lang/ja-JP.rc index 76843fc3dc1..071c9476ece 100644 --- a/reactos/dll/win32/msgina/lang/ja-JP.rc +++ b/reactos/dll/win32/msgina/lang/ja-JP.rc @@ -22,14 +22,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "OI" FONT 9, "MS UI Gothic",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "[U[:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "pX[h:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "LZ",IDCANCEL,115,122,50,14 PUSHBUTTON "Vbg_E",IDC_SHUTDOWN,179,122,50,14 - LTEXT "[U[:",IDC_STATIC,36,75,40,8 - LTEXT "pX[h:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -37,13 +37,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "ZLeB" FONT 9, "MS UI Gothic",400,0,1 BEGIN - PUSHBUTTON "LZ",IDCANCEL,170,95,70,14 - PUSHBUTTON "OIt",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Vbg_E",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "܂?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Rs[^̃bN",IDC_LOCK,10,76,70,14 + PUSHBUTTON "OIt",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Vbg_E",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "^XN }l[W",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "LZ",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/no-NO.rc b/reactos/dll/win32/msgina/lang/no-NO.rc index 4de3810fe25..15594a92ea6 100644 --- a/reactos/dll/win32/msgina/lang/no-NO.rc +++ b/reactos/dll/win32/msgina/lang/no-NO.rc @@ -22,14 +22,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Logg p ReactOS" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Brukernavn:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Passord:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Avbryt",IDCANCEL,115,122,50,14 PUSHBUTTON "Avslutt",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Brukernavn:",IDC_STATIC,36,75,40,8 - LTEXT "Passord:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0, 0, 247, 116 @@ -37,13 +37,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "ReactOS-sikkerhet" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Avbryt",IDCANCEL, 170, 95, 70, 14 - PUSHBUTTON "Logg av...",IDC_LOGOFF, 86, 76, 78, 14 - PUSHBUTTON "Avslutt...",IDC_SHUTDOWN, 170, 76, 70, 14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Hva vil du gjre?",IDC_STATIC, 92, 60, 87, 8 PUSHBUTTON "Ls datamaskinen...",IDC_LOCK, 7, 76, 74, 14 + PUSHBUTTON "Logg av...",IDC_LOGOFF, 86, 76, 78, 14 + PUSHBUTTON "Avslutt...",IDC_SHUTDOWN, 170, 76, 70, 14 PUSHBUTTON "Oppgavebehandling...",IDC_TASKMGR, 86, 95, 78, 14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Avbryt",IDCANCEL, 170, 95, 70, 14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/pl-PL.rc b/reactos/dll/win32/msgina/lang/pl-PL.rc index cd477b68fb8..8c33319d571 100644 --- a/reactos/dll/win32/msgina/lang/pl-PL.rc +++ b/reactos/dll/win32/msgina/lang/pl-PL.rc @@ -29,14 +29,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Logon" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Nazwa uytkownika:",IDC_STATIC, 11, 75, 70, 8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Haso:",IDC_STATIC, 56, 93, 27, 8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Anuluj",IDCANCEL,115,122,50,14 PUSHBUTTON "Wycz",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Nazwa uytkownika:",IDC_STATIC, 11, 75, 70, 8 - LTEXT "Haso:",IDC_STATIC, 56, 93, 27, 8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -44,13 +44,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Bezpieczestwo" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Anuluj",IDCANCEL,170,95,70,14 - PUSHBUTTON "Wyloguj",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Wycz",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "Co chcesz teraz zrobi?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Blokada komputera",IDC_LOCK,10,76,70,14 + PUSHBUTTON "Wyloguj",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Wycz",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "Meneder zada",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Anuluj",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/ro-RO.rc b/reactos/dll/win32/msgina/lang/ro-RO.rc index 156e8940c0f..b02a01c484b 100644 --- a/reactos/dll/win32/msgina/lang/ro-RO.rc +++ b/reactos/dll/win32/msgina/lang/ro-RO.rc @@ -1,10 +1,10 @@ -LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL #pragma code_page(65001) IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "Vă rugăm așteptați..." +CAPTION "Va rugam a?tepta?i..." FONT 8,"MS Shell Dlg",400,0,1 BEGIN LTEXT "",IDC_STATUSLABEL,7,8,234,12,SS_WORDELLIPSIS @@ -16,7 +16,7 @@ CAPTION "Bun venit la ReactOS" FONT 8,"MS Shell Dlg",400,0,1 BEGIN ICON IDI_LOCKICON, -1, 7, 5, 32, 32 - LTEXT "Apăsați combinația de taste Ctrl-Alt-Del",IDC_STATIC, 38, 10, 144, 14 + LTEXT "Apasa?i combina?ia de taste Ctrl-Alt-Del",IDC_STATIC, 38, 10, 144, 14 END IDD_LOGGEDOUT_DLG DIALOGEX 0,0,275,147 @@ -24,14 +24,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Autentificare" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Nume utilizator:",IDC_STATIC,36,75,40,8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Parola:",IDC_STATIC,36,93,42,8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Anulare",IDCANCEL,115,122,50,14 PUSHBUTTON "Închidere",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Nume utilizator:",IDC_STATIC,36,75,40,8 - LTEXT "Parolă:",IDC_STATIC,36,93,42,8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -39,23 +39,23 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Securitate" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Anulare",IDCANCEL,170,95,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + LTEXT "Ce vre?i sa face?i?",IDC_STATIC,86,60,87,8 + PUSHBUTTON "Blocare computer",IDC_LOCK,10,76,70,14 PUSHBUTTON "Deautentificare",IDC_LOGOFF,90,76,70,14 PUSHBUTTON "Închidere",IDC_SHUTDOWN,170,76,70,14 - LTEXT "Ce vreți să faceți?",IDC_STATIC,86,60,87,8 - PUSHBUTTON "Blocare computer",IDC_LOCK,10,76,70,14 - PUSHBUTTON "Gestionar activități",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Gestionar activita?i",IDC_TASKMGR,90,95,70,14 + PUSHBUTTON "Anulare",IDCANCEL,170,95,70,14 END STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Bun venit!" IDS_LOCKEDSAS "Computerul este acum blocat." - IDS_PRESSCTRLALTDELETE "Apăsați Control+Alt+Delete pentru a vă autentifica." + IDS_PRESSCTRLALTDELETE "Apasa?i Control+Alt+Delete pentru a va autentifica." IDS_ASKFORUSER "Nume utilizator: " - IDS_ASKFORPASSWORD "Parolă: " - IDS_FORCELOGOFF "Această acțiune va închide sesiunea utilizatorului curent și va pierde datele nesalvate de acesta. Sigur continuați?" + IDS_ASKFORPASSWORD "Parola: " + IDS_FORCELOGOFF "Aceasta ac?iune va închide sesiunea utilizatorului curent ?i va pierde datele nesalvate de acesta. Sigur continua?i?" END #pragma code_page(default) diff --git a/reactos/dll/win32/msgina/lang/ru-RU.rc b/reactos/dll/win32/msgina/lang/ru-RU.rc index cb1c1df1acd..d795535b54b 100644 --- a/reactos/dll/win32/msgina/lang/ru-RU.rc +++ b/reactos/dll/win32/msgina/lang/ru-RU.rc @@ -24,14 +24,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + RTEXT " :", IDC_STATIC, 6, 75, 70, 8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + RTEXT ":", IDC_STATIC, 6, 93, 70, 8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK", IDOK, 47, 122, 50, 14, BS_DEFPUSHBUTTON PUSHBUTTON "", IDCANCEL, 109, 122, 50, 14 PUSHBUTTON "", IDC_SHUTDOWN, 171, 122, 58, 14 - RTEXT " :", IDC_STATIC, 6, 75, 70, 8 - RTEXT ":", IDC_STATIC, 6, 93, 70, 8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0, 0, 275, 116 @@ -39,13 +39,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "", IDCANCEL, 198, 95, 70, 14 - PUSHBUTTON " ", IDC_LOGOFF, 102, 76, 86, 14 - PUSHBUTTON "",IDC_SHUTDOWN, 198, 76, 70, 14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT " :", IDC_STATIC, 7, 60, 123, 8 PUSHBUTTON "", IDC_LOCK, 7, 76, 86, 14 + PUSHBUTTON " ", IDC_LOGOFF, 102, 76, 86, 14 + PUSHBUTTON "",IDC_SHUTDOWN, 198, 76, 70, 14 PUSHBUTTON " ",IDC_TASKMGR, 102, 95, 86, 14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "", IDCANCEL, 198, 95, 70, 14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/sk-SK.rc b/reactos/dll/win32/msgina/lang/sk-SK.rc index ab4d82577fa..4298f1a389d 100644 --- a/reactos/dll/win32/msgina/lang/sk-SK.rc +++ b/reactos/dll/win32/msgina/lang/sk-SK.rc @@ -26,14 +26,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Prihlsenie" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT "Meno pouvatea:",IDC_STATIC,18, 75, 64, 8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT "Heslo:",IDC_STATIC,56, 93, 24, 8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Zrui",IDCANCEL,115,122,50,14 PUSHBUTTON "Vypn",IDC_SHUTDOWN,179,122,50,14 - LTEXT "Meno pouvatea:",IDC_STATIC,18, 75, 64, 8 - LTEXT "Heslo:",IDC_STATIC,56, 93, 24, 8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 @@ -41,13 +41,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "Bezpenos" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "Zrui",IDCANCEL,170,95,70,14 - PUSHBUTTON "Odhlsi",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Vypn",IDC_SHUTDOWN,170,76,70,14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT "o chcete urobi?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Uzamkn pota",IDC_LOCK,10,76,70,14 + PUSHBUTTON "Odhlsi",IDC_LOGOFF,90,76,70,14 + PUSHBUTTON "Vypn",IDC_SHUTDOWN,170,76,70,14 PUSHBUTTON "Sprvca loh",IDC_TASKMGR,90,95,70,14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "Zrui",IDCANCEL,170,95,70,14 END STRINGTABLE diff --git a/reactos/dll/win32/msgina/lang/uk-UA.rc b/reactos/dll/win32/msgina/lang/uk-UA.rc index 49dc902602a..0fa79c3b624 100644 --- a/reactos/dll/win32/msgina/lang/uk-UA.rc +++ b/reactos/dll/win32/msgina/lang/uk-UA.rc @@ -30,14 +30,14 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "" FONT 8,"MS Shell Dlg",400,0,1 BEGIN + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 + LTEXT ":",IDC_STATIC,33, 75, 48, 8 + EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL + LTEXT ":",IDC_STATIC,48, 93, 34, 8 + EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,37, 122, 50, 14,BS_DEFPUSHBUTTON PUSHBUTTON "",IDCANCEL,93, 122, 50, 14 PUSHBUTTON " ...",IDC_SHUTDOWN,148, 122, 86, 14 - LTEXT ":",IDC_STATIC,33, 75, 48, 8 - LTEXT ":",IDC_STATIC,48, 93, 34, 8 - EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 END IDD_LOGGEDON_DLG DIALOGEX 0, 0, 257, 116 @@ -45,13 +45,13 @@ STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS CAPTION "" FONT 8,"MS Shell Dlg",400,0,1 BEGIN - PUSHBUTTON "",IDCANCEL, 165, 95, 86, 14 - PUSHBUTTON " ...",IDC_LOGOFF, 80, 76, 80, 14 - PUSHBUTTON " ...",IDC_SHUTDOWN, 165, 76, 86, 14 + CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 LTEXT " ?",IDC_STATIC, 86, 60, 87, 8 PUSHBUTTON "",IDC_LOCK, 6, 76, 70, 14 + PUSHBUTTON " ...",IDC_LOGOFF, 80, 76, 80, 14 + PUSHBUTTON " ...",IDC_SHUTDOWN, 165, 76, 86, 14 PUSHBUTTON " ",IDC_TASKMGR, 80, 95, 80, 14 - CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 + PUSHBUTTON "",IDCANCEL, 165, 95, 86, 14 END STRINGTABLE From 12eb6e6cba8de7aaee4f0c2d1fe4e5f1877eaa9a Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Fri, 14 May 2010 17:46:14 +0000 Subject: [PATCH 079/151] [MKHIVE] Check parameters before accessing them, update usage information svn path=/trunk/; revision=47200 --- reactos/tools/mkhive/mkhive.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reactos/tools/mkhive/mkhive.c b/reactos/tools/mkhive/mkhive.c index 038a65fb2cf..c3f9f91ecc8 100644 --- a/reactos/tools/mkhive/mkhive.c +++ b/reactos/tools/mkhive/mkhive.c @@ -49,9 +49,10 @@ void usage (void) { - printf ("Usage: mkhive [addinf]\n\n"); + printf ("Usage: mkhive [addinf]\n\n"); printf (" srcdir - inf files are read from this directory\n"); printf (" dstdir - binary hive files are created in this directory\n"); + printf (" arch - architecture\n"); printf (" addinf - additional inf files with full path\n"); } @@ -88,14 +89,14 @@ int main (int argc, char *argv[]) char FileName[PATH_MAX]; int Param; - printf ("Binary hive maker: %s\n", argv[3]); - if (argc < 4) { usage (); return 1; } + printf ("Binary hive maker: %s\n", argv[3]); + RegInitializeRegistry (); convert_path (FileName, argv[1]); From d28f0be86eb164da4e2c91c70389d495509a06eb Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Fri, 14 May 2010 20:56:43 +0000 Subject: [PATCH 080/151] [INFLIBNEW] Free allocated memory on error svn path=/trunk/; revision=47206 --- reactos/lib/newinflib/infhostgen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/lib/newinflib/infhostgen.c b/reactos/lib/newinflib/infhostgen.c index e6269ff6318..3e3d915a04f 100644 --- a/reactos/lib/newinflib/infhostgen.c +++ b/reactos/lib/newinflib/infhostgen.c @@ -189,6 +189,7 @@ InfHostOpenFile(PHINF InfHandle, if (FileLength != fread(FileBuffer, (size_t)1, (size_t)FileLength, File)) { DPRINT1("fread() failed (errno %d)\n", errno); + FREE(FileBuffer); fclose(File); return -1; } From c7721ce9422043043bacec3b8a6948c900a1692e Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Fri, 14 May 2010 21:13:33 +0000 Subject: [PATCH 081/151] [MKHIVE] - Active the planned cleanup function to motivate people to actually free resources: mkhive currently leaks ~500kb of memory after a usual run - Improve debug print svn path=/trunk/; revision=47207 --- reactos/tools/mkhive/mkhive.c | 2 +- reactos/tools/mkhive/registry.c | 11 ++++++++++- reactos/tools/mkhive/registry.h | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/reactos/tools/mkhive/mkhive.c b/reactos/tools/mkhive/mkhive.c index c3f9f91ecc8..41c15a53a0b 100644 --- a/reactos/tools/mkhive/mkhive.c +++ b/reactos/tools/mkhive/mkhive.c @@ -173,7 +173,7 @@ int main (int argc, char *argv[]) return 1; } - //RegShutdownRegistry (); + RegShutdownRegistry (); printf (" Done.\n"); diff --git a/reactos/tools/mkhive/registry.c b/reactos/tools/mkhive/registry.c index 6813a67d195..07339afe3f1 100644 --- a/reactos/tools/mkhive/registry.c +++ b/reactos/tools/mkhive/registry.c @@ -250,7 +250,7 @@ RegDeleteKeyW( IN HKEY hKey, IN LPCWSTR lpSubKey) { - DPRINT1("FIXME!\n"); + DPRINT1("FIXME: implement RegDeleteKeyW!\n"); return ERROR_SUCCESS; } @@ -682,4 +682,13 @@ RegInitializeRegistry(VOID) &ControlSetKey); } +VOID +RegShutdownRegistry(VOID) +{ + /* FIXME: clean up the complete hive */ + + free(RootKey->Name); + free(RootKey); +} + /* EOF */ diff --git a/reactos/tools/mkhive/registry.h b/reactos/tools/mkhive/registry.h index 696126bbc1e..40df369b54d 100644 --- a/reactos/tools/mkhive/registry.h +++ b/reactos/tools/mkhive/registry.h @@ -121,4 +121,7 @@ RegGetValueCount (HKEY Key); VOID RegInitializeRegistry(VOID); +VOID +RegShutdownRegistry(VOID); + /* EOF */ From 9863fd3445e840742b2ad2c2b56d83d6d17b058f Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Fri, 14 May 2010 21:20:40 +0000 Subject: [PATCH 082/151] [NEWINFLIB] Fix an off-by-one bug, which lead to the crash of mkhive after parsing ~3 files on Windows or ~5 files on Linux See issue #5338 for more details. svn path=/trunk/; revision=47208 --- reactos/lib/newinflib/infhostrtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/lib/newinflib/infhostrtl.c b/reactos/lib/newinflib/infhostrtl.c index c62d40a8d56..ddc9b84884a 100644 --- a/reactos/lib/newinflib/infhostrtl.c +++ b/reactos/lib/newinflib/infhostrtl.c @@ -36,7 +36,7 @@ RtlMultiByteToUnicodeN( *ResultSize = Size * sizeof(WCHAR); WideString = (PUCHAR)UnicodeString; - for (i = 0; i <= Size; i++) + for (i = 0; i < Size; i++) { WideString[2 * i + 0] = (UCHAR)MbString[i]; WideString[2 * i + 1] = 0; From 88e3cf6fbe6b6374ce594d6d1b80e93ed7b4c22b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Fri, 14 May 2010 23:13:13 +0000 Subject: [PATCH 083/151] [GDI32_WINETEST] Skip test in gdi32_winetest metafile, that crashes See issue #5392 for more details. svn path=/trunk/; revision=47209 --- rostests/winetests/gdi32/metafile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rostests/winetests/gdi32/metafile.c b/rostests/winetests/gdi32/metafile.c index 9ce3ece13dc..792e64708fc 100755 --- a/rostests/winetests/gdi32/metafile.c +++ b/rostests/winetests/gdi32/metafile.c @@ -1427,10 +1427,11 @@ static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits, const ENHMETARECORD *emr1 = (const ENHMETARECORD *)(bits + offset1); const ENHMETARECORD *emr2 = (const ENHMETARECORD *)(buf + offset2); - trace("%s: EMF record %u, size %u/record %u, size %u\n", - desc, emr1->iType, emr1->nSize, emr2->iType, emr2->nSize); + skip("skipping match_emf_record(), bug 5392\n"); +// trace("%s: EMF record %u, size %u/record %u, size %u\n", +// desc, emr1->iType, emr1->nSize, emr2->iType, emr2->nSize); - if (!match_emf_record(emr1, emr2, desc, ignore_scaling)) return -1; +// if (!match_emf_record(emr1, emr2, desc, ignore_scaling)) return -1; /* We have already bailed out if iType or nSize don't match */ offset1 += emr1->nSize; From e23160a43c9cb81cda642400bff1172a51cd2c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 14 May 2010 23:19:16 +0000 Subject: [PATCH 084/151] [ROSTESTS] - more tests for direct DC creation/deletion svn path=/trunk/; revision=47210 --- .../w32knapi/ntgdi/NtGdiCreateCompatibleDC.c | 2 ++ .../w32knapi/ntgdi/NtGdiDeleteObjectApp.c | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c index 3597eb67dca..130e1005bd1 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c @@ -21,6 +21,8 @@ Test_NtGdiCreateCompatibleDC(PTESTINFO pti) /* The default pen should be GetStockObject(BLACK_PEN) */ hObj = SelectObject(hDC, GetStockObject(WHITE_PEN)); TEST(hObj == GetStockObject(BLACK_PEN)); + + TEST(NtGdiDeleteObjectApp(hDC) != 0); TEST(NtGdiDeleteObjectApp(hDC) != 0); diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c index 0084b109a9a..351de95e029 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c @@ -5,6 +5,7 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti) HDC hdc; HBITMAP hbmp; HBRUSH hbrush; + HPEN hpen; /* Try to delete 0 */ SetLastError(0); @@ -23,7 +24,31 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti) TEST(NtGdiDeleteObjectApp(hdc) == 1); TEST(GetLastError() == 0); TEST(IsHandleValid(hdc) == 0); - + + /* Delete a display DC */ + SetLastError(0); + hdc = CreateDC("DISPLAY", NULL, NULL, NULL); + ASSERT(IsHandleValid(hdc) == 1); + TEST((hpen=SelectObject(hdc, GetStockObject(WHITE_PEN))) != NULL); + SelectObject(hdc, hpen); + TEST(NtGdiDeleteObjectApp(hdc) != 0); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hdc) == 1); + TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); + TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); + + /* Once more */ + SetLastError(0); + hdc = GetDC(0); + ASSERT(IsHandleValid(hdc) == 1); + TEST(NtGdiDeleteObjectApp(hdc) != 0); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hdc) == 1); + TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); + TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); + /* Make sure */ + TEST(NtUserCallOneParam((DWORD_PTR)hdc, ONEPARAM_ROUTINE_RELEASEDC) == 0); + /* Delete a display DC */ SetLastError(0); hdc = CreateDC("DISPLAY", NULL, NULL, NULL); From 9993f9c793a5e6f277dbbd394330f5af906990ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Fri, 14 May 2010 23:21:04 +0000 Subject: [PATCH 085/151] [ROSTESTS] - something went wrong with previous commit... svn path=/trunk/; revision=47211 --- .../w32knapi/ntgdi/NtGdiDeleteObjectApp.c | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c index 351de95e029..7403ab4ccf4 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c @@ -49,26 +49,6 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti) /* Make sure */ TEST(NtUserCallOneParam((DWORD_PTR)hdc, ONEPARAM_ROUTINE_RELEASEDC) == 0); - /* Delete a display DC */ - SetLastError(0); - hdc = CreateDC("DISPLAY", NULL, NULL, NULL); - ASSERT(IsHandleValid(hdc) == 1); - TEST(NtGdiDeleteObjectApp(hdc) != 0); - TEST(GetLastError() == 0); - TEST(IsHandleValid(hdc) == 1); - TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); - TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); - - /* Once more */ - SetLastError(0); - hdc = GetDC(0); - ASSERT(IsHandleValid(hdc) == 1); - TEST(NtGdiDeleteObjectApp(hdc) != 0); - TEST(GetLastError() == 0); - TEST(IsHandleValid(hdc) == 1); - TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL); - TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError()); - /* Delete a brush */ SetLastError(0); hbrush = CreateSolidBrush(0x123456); From e093be68976f0d81a23a9ef8682e51ca8481cda0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 15 May 2010 00:12:14 +0000 Subject: [PATCH 086/151] [GDIPLUS_WINETEST] Comment out GdipDisposeImage in 3 places, where it was crashing See issue #5395 for more details. svn path=/trunk/; revision=47212 --- rostests/winetests/gdiplus/graphics.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rostests/winetests/gdiplus/graphics.c b/rostests/winetests/gdiplus/graphics.c index 57ce638093c..91e95bf1940 100644 --- a/rostests/winetests/gdiplus/graphics.c +++ b/rostests/winetests/gdiplus/graphics.c @@ -2353,7 +2353,8 @@ static void test_GdipGetNearestColor(void) expect(Ok, status); expect(0xdeadbeef, color); GdipDeleteGraphics(graphics); - GdipDisposeImage((GpImage*)bitmap); + skip("skipping GdipDisposeImage, see bug 5395\n"); + //GdipDisposeImage((GpImage*)bitmap); status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppARGB, NULL, &bitmap); expect(Ok, status); @@ -2363,7 +2364,8 @@ static void test_GdipGetNearestColor(void) expect(Ok, status); expect(0xdeadbeef, color); GdipDeleteGraphics(graphics); - GdipDisposeImage((GpImage*)bitmap); + skip("skipping GdipDisposeImage, see bug 5395\n"); + //GdipDisposeImage((GpImage*)bitmap); status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppPARGB, NULL, &bitmap); expect(Ok, status); @@ -2373,7 +2375,8 @@ static void test_GdipGetNearestColor(void) expect(Ok, status); expect(0xdeadbeef, color); GdipDeleteGraphics(graphics); - GdipDisposeImage((GpImage*)bitmap); + skip("skipping GdipDisposeImage, see bug 5395\n"); + //GdipDisposeImage((GpImage*)bitmap); status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppRGB565, NULL, &bitmap); expect(Ok, status); From 1e9beb680984b8a0ebf16668c98a9a8cec08bb7a Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 15 May 2010 01:05:09 +0000 Subject: [PATCH 087/151] [WIN32CSR] Fix display of harderror message box for STATUS_UNHANDLED_EXCEPTION svn path=/trunk/; revision=47213 --- .../subsystems/win32/csrss/win32csr/harderror.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/reactos/subsystems/win32/csrss/win32csr/harderror.c b/reactos/subsystems/win32/csrss/win32csr/harderror.c index a1b5a5dc5d3..4b46e340842 100644 --- a/reactos/subsystems/win32/csrss/win32csr/harderror.c +++ b/reactos/subsystems/win32/csrss/win32csr/harderror.c @@ -223,7 +223,7 @@ CsrpFormatMessages( ANSI_STRING FormatA; PRTL_MESSAGE_RESOURCE_ENTRY MessageResource; PWSTR FormatString; - ULONG Size; + ULONG Size, ExceptionCode; /* Get the file name of the client process */ CsrpGetClientFileName(&FileNameU, hProcess); @@ -310,8 +310,10 @@ CsrpFormatMessages( /* Check if this is an exception message */ if (Message->Status == STATUS_UNHANDLED_EXCEPTION) { + ExceptionCode = Parameters[0]; + /* Handle special cases */ - if (Parameters[0] == STATUS_ACCESS_VIOLATION) + if (ExceptionCode == STATUS_ACCESS_VIOLATION) { Parameters[0] = Parameters[1]; Parameters[1] = Parameters[3]; @@ -319,7 +321,7 @@ CsrpFormatMessages( else Parameters[2] = (ULONG_PTR)L"read"; MessageResource = NULL; } - else if (Parameters[0] == STATUS_IN_PAGE_ERROR) + else if (ExceptionCode == STATUS_IN_PAGE_ERROR) { Parameters[0] = Parameters[1]; Parameters[1] = Parameters[3]; @@ -339,7 +341,7 @@ CsrpFormatMessages( Status = RtlFindMessage(GetModuleHandleW(L"ntdll"), (ULONG_PTR)RT_MESSAGETABLE, LANG_NEUTRAL, - Parameters[0], + ExceptionCode, &MessageResource); if (NT_SUCCESS(Status)) @@ -356,6 +358,7 @@ CsrpFormatMessages( RtlInitAnsiString(&FormatA, MessageResource->Text); RtlAnsiStringToUnicodeString(&FormatU, &FormatA, TRUE); } + FormatString = FormatU.Buffer; } else { @@ -368,9 +371,8 @@ CsrpFormatMessages( } /* Calculate length of text buffer */ - TextStringU->MaximumLength = wcslen(FormatString) * sizeof(WCHAR) + - SizeOfStrings + 42 * sizeof(WCHAR); - + TextStringU->MaximumLength = FormatU.Length + SizeOfStrings + 42 * sizeof(WCHAR); + /* Allocate a buffer for the text */ TextStringU->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, From 8653f565158fc93df23b7ebc2ab7bb892a506c12 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 15 May 2010 01:30:24 +0000 Subject: [PATCH 088/151] [OLEAUT32_WINETEST] Skip crashing tests test_apm and test_enhmetafile See issue #5396 for more details. svn path=/trunk/; revision=47214 --- rostests/winetests/oleaut32/olepicture.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rostests/winetests/oleaut32/olepicture.c b/rostests/winetests/oleaut32/olepicture.c index 2dc1b05cf92..d68c25a6601 100644 --- a/rostests/winetests/oleaut32/olepicture.c +++ b/rostests/winetests/oleaut32/olepicture.c @@ -720,9 +720,11 @@ START_TEST(olepicture) if (0) test_pic(pngimage, sizeof(pngimage)); test_empty_image(); test_empty_image_2(); - test_apm(); + skip("skipping test_apm, see bug 5396\n"); + //test_apm(); test_metafile(); - test_enhmetafile(); + skip("skipping test_enhmetafile, see bug 5396\n"); + //test_enhmetafile(); test_Invoke(); test_OleCreatePictureIndirect(); From d3f8544eca4edd49ac90ee5b888a742533ddcb68 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 15 May 2010 03:02:10 +0000 Subject: [PATCH 089/151] [NTOSKRNL] Fix paramter parsing in KdbpGetCommandLineSettings. Fixes KDSERIAL svn path=/trunk/; revision=47215 --- reactos/ntoskrnl/kdbg/kdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/kdbg/kdb.c b/reactos/ntoskrnl/kdbg/kdb.c index 058e1128e0e..9fb099c8b10 100644 --- a/reactos/ntoskrnl/kdbg/kdb.c +++ b/reactos/ntoskrnl/kdbg/kdb.c @@ -1697,7 +1697,7 @@ KdbpGetCommandLineSettings( while (p1 && (p2 = strchr(p1, ' '))) { - p2++; + p2 += 2; if (!_strnicmp(p2, "KDSERIAL", 8)) { From ad9cb3cc3467b27d0ac42ae8b40e38afc3844bb3 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 15 May 2010 03:21:54 +0000 Subject: [PATCH 090/151] [NTOSKRNL] - Fix a bug that broke /NODEBUG and /CRASHDEBUG svn path=/trunk/; revision=47216 --- reactos/ntoskrnl/kd/kdinit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/kd/kdinit.c b/reactos/ntoskrnl/kd/kdinit.c index 6c5f240761b..5fcc0ee8cd2 100644 --- a/reactos/ntoskrnl/kd/kdinit.c +++ b/reactos/ntoskrnl/kd/kdinit.c @@ -166,8 +166,8 @@ KdInitSystem(ULONG BootPhase, /* XXX Check for settings that we support */ if (strstr(CommandLine, "BREAK")) KdpEarlyBreak = TRUE; if (strstr(CommandLine, "NODEBUG")) KdDebuggerEnabled = FALSE; - if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE; - if (strstr(CommandLine, "DEBUG")) + else if (strstr(CommandLine, "CRASHDEBUG")) KdDebuggerEnabled = FALSE; + else if (strstr(CommandLine, "DEBUG")) { /* Enable on the serial port */ KdDebuggerEnabled = TRUE; From 31dfebe9a7f8f5c88e0159249cb11ac5c7921293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 15 May 2010 09:59:42 +0000 Subject: [PATCH 091/151] Revert part of 47209. Hope this time is the good one svn path=/trunk/; revision=47218 --- rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c index 130e1005bd1..ac4ed28b8d5 100644 --- a/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c +++ b/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c @@ -24,8 +24,6 @@ Test_NtGdiCreateCompatibleDC(PTESTINFO pti) TEST(NtGdiDeleteObjectApp(hDC) != 0); - TEST(NtGdiDeleteObjectApp(hDC) != 0); - return APISTATUS_NORMAL; } From e5b5b481709a15c86da1548b2bff3e14ba320a9a Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 15 May 2010 16:02:14 +0000 Subject: [PATCH 092/151] [WINLOGON] - Add a hack to fix the APPDATA environment variable. This hack will be removed after bug #5372 has been fixed. Fixes bug #4102. svn path=/trunk/; revision=47220 --- reactos/base/system/winlogon/environment.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/reactos/base/system/winlogon/environment.c b/reactos/base/system/winlogon/environment.c index 769767c965e..7a22e494d27 100644 --- a/reactos/base/system/winlogon/environment.c +++ b/reactos/base/system/winlogon/environment.c @@ -31,15 +31,15 @@ BuildVolatileEnvironment(IN PWLSESSION Session, HINSTANCE hShell32 = NULL; PFSHGETFOLDERPATHW pfSHGetFolderPathW = NULL; WCHAR szPath[MAX_PATH + 1]; + WCHAR szExpandedPath[MAX_PATH + 1]; LPCWSTR wstr; SIZE_T size; - WCHAR szEnvKey[MAX_PATH]; WCHAR szEnvValue[1024]; - SIZE_T length; LPWSTR eqptr, endptr; + /* Parse the environment variables and add them to the volatile environment key */ if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment != NULL) { @@ -80,7 +80,7 @@ BuildVolatileEnvironment(IN PWLSESSION Session, } } - + /* Load shell32.dll and call SHGetFolderPathW to get the users appdata folder path */ hShell32 = LoadLibraryW(L"shell32.dll"); if (hShell32 != NULL) { @@ -94,12 +94,21 @@ BuildVolatileEnvironment(IN PWLSESSION Session, 0, szPath) == S_OK) { + /* FIXME: Expand %USERPROFILE% here. SHGetFolderPathW should do it for us. See Bug #5372.*/ + TRACE("APPDATA path: %S\n", szPath); + ExpandEnvironmentStringsForUserW(Session->UserToken, + szPath, + szExpandedPath, + MAX_PATH); + + /* Add the appdata folder path to the users volatile environment key */ + TRACE("APPDATA expanded path: %S\n", szExpandedPath); RegSetValueExW(hKey, L"APPDATA", 0, REG_SZ, - (LPBYTE)szPath, - (wcslen(szPath) + 1) * sizeof(WCHAR)); + (LPBYTE)szExpandedPath, + (wcslen(szExpandedPath) + 1) * sizeof(WCHAR)); } } From 94c135b485985f595caecb5ce23ddd150072c55e Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sat, 15 May 2010 17:17:05 +0000 Subject: [PATCH 093/151] [PORTCLS] - Pass subdevice interface to PcNewRegistryKey - Fix multiple bugs in PcNewRegistryKey such as - If key type is GeneralRegistryKey, the function is supposed to create a new key - If key type is HwProfileRegistryKey, the type must be or'd with PLUGPLAY_REGKEY_DEVICE - Implement opening keys of type DeviceInterfaceRegistryKey - Free key handle if there is not enough memory to create a registry key object - Add more comments svn path=/trunk/; revision=47222 --- .../wdm/audio/backpln/portcls/port_dmus.cpp | 2 +- .../audio/backpln/portcls/port_topology.cpp | 2 +- .../audio/backpln/portcls/port_wavecyclic.cpp | 2 +- .../audio/backpln/portcls/port_wavepci.cpp | 2 +- .../wdm/audio/backpln/portcls/port_wavert.cpp | 2 +- .../wdm/audio/backpln/portcls/private.hpp | 2 +- .../wdm/audio/backpln/portcls/registry.cpp | 62 +++++++++++++++++-- 7 files changed, 62 insertions(+), 12 deletions(-) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.cpp b/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.cpp index 8c08b1f9c3d..3f4fb918259 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/port_dmus.cpp @@ -340,7 +340,7 @@ CPortDMus::NewRegistryKey( RegistryKeyType, DesiredAccess, m_pDeviceObject, - NULL,//FIXME + (ISubdevice*)this, ObjectAttributes, CreateOptions, Disposition); diff --git a/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp b/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp index 2c80a430f22..ab4322aa943 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp @@ -299,7 +299,7 @@ CPortTopology::NewRegistryKey( RegistryKeyType, DesiredAccess, m_pDeviceObject, - NULL,//FIXME + (ISubdevice*)this, ObjectAttributes, CreateOptions, Disposition); diff --git a/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp b/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp index 23bfba91681..6566fe67299 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp @@ -340,7 +340,7 @@ CPortWaveCyclic::NewRegistryKey( DPRINT("IPortWaveCyclic_fnNewRegistryKey called w/o initialized\n"); return STATUS_UNSUCCESSFUL; } - return PcNewRegistryKey(OutRegistryKey, OuterUnknown, RegistryKeyType, DesiredAccess, m_pDeviceObject, NULL /*FIXME*/, ObjectAttributes, CreateOptions, Disposition); + return PcNewRegistryKey(OutRegistryKey, OuterUnknown, RegistryKeyType, DesiredAccess, m_pDeviceObject, (ISubdevice*)this, ObjectAttributes, CreateOptions, Disposition); } diff --git a/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp b/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp index 81d6ed9bfbf..986ffcf9d40 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp @@ -359,7 +359,7 @@ CPortWavePci::NewRegistryKey( RegistryKeyType, DesiredAccess, m_pDeviceObject, - NULL,//FIXME + (ISubdevice*)this, ObjectAttributes, CreateOptions, Disposition); diff --git a/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp b/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp index 8910dc1cb19..305d097276c 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp @@ -329,7 +329,7 @@ CPortWaveRT::NewRegistryKey( DPRINT("IPortWaveRT_fnNewRegistryKey called w/o initialized\n"); return STATUS_UNSUCCESSFUL; } - return PcNewRegistryKey(OutRegistryKey, OuterUnknown, RegistryKeyType, DesiredAccess, m_pDeviceObject, NULL /*FIXME*/, ObjectAttributes, CreateOptions, Disposition); + return PcNewRegistryKey(OutRegistryKey, OuterUnknown, RegistryKeyType, DesiredAccess, m_pDeviceObject, (ISubdevice*)this, ObjectAttributes, CreateOptions, Disposition); } //--------------------------------------------------------------- // ISubdevice interface diff --git a/reactos/drivers/wdm/audio/backpln/portcls/private.hpp b/reactos/drivers/wdm/audio/backpln/portcls/private.hpp index 17adc4c8af5..874d2266d20 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/private.hpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/private.hpp @@ -14,7 +14,7 @@ #include #include -#define NDEBUG +#define YDEBUG #include #include diff --git a/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp b/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp index eadcc89eaf3..86c2d3f8784 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/registry.cpp @@ -270,6 +270,9 @@ PcNewRegistryKey( NTSTATUS Status = STATUS_UNSUCCESSFUL; CRegistryKey * RegistryKey; PPCLASS_DEVICE_EXTENSION DeviceExt; + PSUBDEVICE_DESCRIPTOR SubDeviceDescriptor; + ISubdevice * Device; + PSYMBOLICLINK_ENTRY SymEntry; DPRINT("PcNewRegistryKey entered\n"); @@ -294,8 +297,8 @@ PcNewRegistryKey( // object attributes is mandatory return STATUS_INVALID_PARAMETER; } - // try to open the key - Status = ZwOpenKey(&hHandle, DesiredAccess, ObjectAttributes); + // try to create the key + Status = ZwCreateKey(&hHandle, DesiredAccess, ObjectAttributes, 0, NULL, CreateOptions, Disposition); } else if (RegistryKeyType == DeviceRegistryKey || RegistryKeyType == DriverRegistryKey || @@ -305,7 +308,7 @@ PcNewRegistryKey( if (RegistryKeyType == HwProfileRegistryKey) { // IoOpenDeviceRegistryKey used different constant - RegistryKeyType = PLUGPLAY_REGKEY_CURRENT_HWPROFILE; + RegistryKeyType = PLUGPLAY_REGKEY_CURRENT_HWPROFILE | PLUGPLAY_REGKEY_DEVICE; } // obtain the new device extension @@ -315,24 +318,71 @@ PcNewRegistryKey( } else if (RegistryKeyType == DeviceInterfaceRegistryKey) { - // FIXME - UNIMPLEMENTED - DbgBreakPoint(); + if (SubDevice == NULL) + { + // invalid parameter + return STATUS_INVALID_PARAMETER; + } + + // look up our undocumented interface + Status = ((PUNKNOWN)SubDevice)->QueryInterface(IID_ISubdevice, (LPVOID*)&Device); + + if (!NT_SUCCESS(Status)) + { + DPRINT("No ISubdevice interface\n"); + // invalid parameter + return STATUS_INVALID_PARAMETER; + } + + // get the subdevice descriptor + Status = Device->GetDescriptor(&SubDeviceDescriptor); + if (!NT_SUCCESS(Status)) + { + DPRINT("Failed to get subdevice descriptor %x\n", Status); + ((PUNKNOWN)SubDevice)->Release(); + return STATUS_UNSUCCESSFUL; + } + + // is there an registered device interface + if (IsListEmpty(&SubDeviceDescriptor->SymbolicLinkList)) + { + DPRINT("No device interface registered\n"); + ((PUNKNOWN)SubDevice)->Release(); + return STATUS_UNSUCCESSFUL; + } + + // get the first symbolic link + SymEntry = (PSYMBOLICLINK_ENTRY)CONTAINING_RECORD(SubDeviceDescriptor->SymbolicLinkList.Flink, SYMBOLICLINK_ENTRY, Entry); + + // open device interface + Status = IoOpenDeviceInterfaceRegistryKey(&SymEntry->SymbolicLink, DesiredAccess, &hHandle); + + // release subdevice interface + ((PUNKNOWN)SubDevice)->Release(); } + // check for success if (!NT_SUCCESS(Status)) { + DPRINT1("PcNewRegistryKey failed with %lx\n", Status); return Status; } + // allocate new registry key object RegistryKey = new(NonPagedPool, TAG_PORTCLASS)CRegistryKey(OuterUnknown, hHandle); if (!RegistryKey) + { + // not enough memory + ZwClose(hHandle); return STATUS_INSUFFICIENT_RESOURCES; + } + // query for interface Status = RegistryKey->QueryInterface(IID_IRegistryKey, (PVOID*)OutRegistryKey); if (!NT_SUCCESS(Status)) { + // out of memory delete RegistryKey; } From 425201146ce322bea55d05ea2395efae8db0f9bc Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sat, 15 May 2010 17:57:09 +0000 Subject: [PATCH 094/151] [PORTCLS] - Disable debugging svn path=/trunk/; revision=47223 --- reactos/drivers/wdm/audio/backpln/portcls/private.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/drivers/wdm/audio/backpln/portcls/private.hpp b/reactos/drivers/wdm/audio/backpln/portcls/private.hpp index 874d2266d20..17adc4c8af5 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/private.hpp +++ b/reactos/drivers/wdm/audio/backpln/portcls/private.hpp @@ -14,7 +14,7 @@ #include #include -#define YDEBUG +#define NDEBUG #include #include From 33284498eca2cfff2057cdfd02fd6d693d674fca Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 15 May 2010 18:30:05 +0000 Subject: [PATCH 095/151] [win32k] - The description and changes made regarding WM_ACTIVATEAPP messages in r47126 were partially incorrect, the code was mostly correct. svn path=/trunk/; revision=47224 --- .../subsystems/win32/win32k/ntuser/focus.c | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/focus.c b/reactos/subsystems/win32/win32k/ntuser/focus.c index 7a8eeeb32d6..10bea039446 100644 --- a/reactos/subsystems/win32/win32k/ntuser/focus.c +++ b/reactos/subsystems/win32/win32k/ntuser/focus.c @@ -105,19 +105,43 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate) if (Window && WindowPrev) { + PWINDOW_OBJECT cWindow; + HWND *List, *phWnd; HANDLE OldTID = IntGetWndThreadId(WindowPrev); HANDLE NewTID = IntGetWndThreadId(Window); DPRINT1("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID); if (Window->Wnd->style & WS_MINIMIZE) { - DPRINT1("Widow was nminimized\n"); + DPRINT("Widow was minimized\n"); } if (OldTID != NewTID) { - co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID); - co_IntSendMessageNoWait(hWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID); + List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow())); + if (List) + { + for (phWnd = List; *phWnd; ++phWnd) + { + cWindow = UserGetWindowObject(*phWnd); + + if (cWindow && (IntGetWndThreadId(cWindow) == OldTID)) + { // FALSE if the window is being deactivated, + // ThreadId that owns the window being activated. + co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID); + } + } + for (phWnd = List; *phWnd; ++phWnd) + { + cWindow = UserGetWindowObject(*phWnd); + if (cWindow && (IntGetWndThreadId(cWindow) == NewTID)) + { // TRUE if the window is being activated, + // ThreadId that owns the window being deactivated. + co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID); + } + } + ExFreePool(List); + } } UserDerefObjectCo(WindowPrev); // Now allow the previous window to die. } From 0e5b61c53412c4db03a6a6d095cb075d1d372801 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sat, 15 May 2010 19:05:58 +0000 Subject: [PATCH 096/151] [SYSAUDIO] - Don't build the pin descriptor as this will make problems with dynamic audio devices which dynamically adjust their audio pins - Remove dead code svn path=/trunk/; revision=47225 --- reactos/drivers/wdm/audio/sysaudio/control.c | 60 +------ reactos/drivers/wdm/audio/sysaudio/deviface.c | 163 ------------------ reactos/drivers/wdm/audio/sysaudio/main.c | 4 +- reactos/drivers/wdm/audio/sysaudio/pin.c | 58 ++++++- reactos/drivers/wdm/audio/sysaudio/sysaudio.h | 18 +- 5 files changed, 60 insertions(+), 243 deletions(-) diff --git a/reactos/drivers/wdm/audio/sysaudio/control.c b/reactos/drivers/wdm/audio/sysaudio/control.c index b096d4d9dcc..6a2466c46cc 100644 --- a/reactos/drivers/wdm/audio/sysaudio/control.c +++ b/reactos/drivers/wdm/audio/sysaudio/control.c @@ -97,7 +97,6 @@ HandleSysAudioFilterPinProperties( NTSTATUS Status; PKSAUDIO_DEVICE_ENTRY Entry; ULONG BytesReturned; - PKSP_PIN Pin; // in order to access pin properties of a sysaudio device // the caller must provide a KSP_PIN struct, where @@ -110,8 +109,6 @@ HandleSysAudioFilterPinProperties( return SetIrpIoStatus(Irp, STATUS_BUFFER_TOO_SMALL, sizeof(KSPROPERTY) + sizeof(ULONG)); } - Pin = (PKSP_PIN)Property; - Entry = GetListEntry(&DeviceExtension->KsAudioDeviceList, ((KSP_PIN*)Property)->Reserved); if (!Entry) { @@ -119,64 +116,15 @@ HandleSysAudioFilterPinProperties( return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); } - if (!Entry->Pins) - { - /* expected pins */ - return SetIrpIoStatus(Irp, STATUS_UNSUCCESSFUL, 0); - } - - if (Entry->PinDescriptorsCount <= Pin->PinId) - { - /* invalid pin id */ - return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER, 0); - } - - if (Property->Id == KSPROPERTY_PIN_CTYPES) - { - if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) - { - /* too small buffer */ - return SetIrpIoStatus(Irp, STATUS_BUFFER_TOO_SMALL, sizeof(ULONG)); - } - /* store result */ - *((PULONG)Irp->UserBuffer) = Entry->PinDescriptorsCount; - return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(ULONG)); - } - else if (Property->Id == KSPROPERTY_PIN_COMMUNICATION) - { - if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KSPIN_COMMUNICATION)) - { - /* too small buffer */ - return SetIrpIoStatus(Irp, STATUS_BUFFER_TOO_SMALL, sizeof(KSPIN_COMMUNICATION)); - } - /* store result */ - *((KSPIN_COMMUNICATION*)Irp->UserBuffer) = Entry->PinDescriptors[Pin->PinId].Communication; - return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(KSPIN_COMMUNICATION)); - - } - else if (Property->Id == KSPROPERTY_PIN_DATAFLOW) - { - if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KSPIN_DATAFLOW)) - { - /* too small buffer */ - return SetIrpIoStatus(Irp, STATUS_BUFFER_TOO_SMALL, sizeof(KSPIN_DATAFLOW)); - } - /* store result */ - *((KSPIN_DATAFLOW*)Irp->UserBuffer) = Entry->PinDescriptors[Pin->PinId].DataFlow; - return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(KSPIN_DATAFLOW)); - } - else - { - /* forward request to the filter implementing the property */ - Status = KsSynchronousIoControlDevice(Entry->FileObject, KernelMode, IOCTL_KS_PROPERTY, + /* forward request to the filter implementing the property */ + Status = KsSynchronousIoControlDevice(Entry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)IoStack->Parameters.DeviceIoControl.Type3InputBuffer, IoStack->Parameters.DeviceIoControl.InputBufferLength, Irp->UserBuffer, IoStack->Parameters.DeviceIoControl.OutputBufferLength, &BytesReturned); - return SetIrpIoStatus(Irp, Status, BytesReturned); - } + return SetIrpIoStatus(Irp, Status, BytesReturned); } @@ -328,7 +276,7 @@ GetPinInstanceCount( PinRequest.Property.Set = KSPROPSETID_Pin; PinRequest.Property.Flags = KSPROPERTY_TYPE_GET; PinRequest.Property.Id = KSPROPERTY_PIN_CINSTANCES; - + ASSERT(Entry->FileObject); return KsSynchronousIoControlDevice(Entry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PinRequest, sizeof(KSP_PIN), (PVOID)PinInstances, sizeof(KSPIN_CINSTANCES), &BytesReturned); } diff --git a/reactos/drivers/wdm/audio/sysaudio/deviface.c b/reactos/drivers/wdm/audio/sysaudio/deviface.c index 48710319044..e1a0cfeaf04 100644 --- a/reactos/drivers/wdm/audio/sysaudio/deviface.c +++ b/reactos/drivers/wdm/audio/sysaudio/deviface.c @@ -14,139 +14,6 @@ const GUID KS_CATEGORY_AUDIO = {0x6994AD04L, 0x93EF, 0x11D0, { const GUID KS_CATEGORY_TOPOLOGY = {0xDDA54A40, 0x1E4C, 0x11D1, {0xA0, 0x50, 0x40, 0x57, 0x05, 0xC1, 0x00, 0x00}}; const GUID DMOCATEGORY_ACOUSTIC_ECHO_CANCEL = {0xBF963D80L, 0xC559, 0x11D0, {0x8A, 0x2B, 0x00, 0xA0, 0xC9, 0x25, 0x5A, 0xC1}}; -NTSTATUS -BuildPinDescriptor( - IN PKSAUDIO_DEVICE_ENTRY DeviceEntry, - IN ULONG Count) -{ - ULONG Index; - KSP_PIN PinRequest; - KSPIN_DATAFLOW DataFlow; - KSPIN_COMMUNICATION Communication; - ULONG NumWaveOutPin, NumWaveInPin; - NTSTATUS Status; - ULONG BytesReturned; - - NumWaveInPin = 0; - NumWaveOutPin = 0; - for(Index = 0; Index < Count; Index++) - { - /* retrieve data flow */ - PinRequest.PinId = Index; - PinRequest.Property.Set = KSPROPSETID_Pin; - PinRequest.Property.Flags = KSPROPERTY_TYPE_GET; - - /* get dataflow direction */ - PinRequest.Property.Id = KSPROPERTY_PIN_DATAFLOW; - Status = KsSynchronousIoControlDevice(DeviceEntry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PinRequest, sizeof(KSP_PIN), (PVOID)&DataFlow, sizeof(KSPIN_DATAFLOW), &BytesReturned); - if (NT_SUCCESS(Status)) - { - DeviceEntry->PinDescriptors[Index].DataFlow = DataFlow; - } - - /* get irp flow direction */ - PinRequest.Property.Id = KSPROPERTY_PIN_COMMUNICATION; - Status = KsSynchronousIoControlDevice(DeviceEntry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PinRequest, sizeof(KSP_PIN), (PVOID)&Communication, sizeof(KSPIN_COMMUNICATION), &BytesReturned); - if (NT_SUCCESS(Status)) - { - DeviceEntry->PinDescriptors[Index].Communication = Communication; - } - - if (Communication == KSPIN_COMMUNICATION_SINK && DataFlow == KSPIN_DATAFLOW_IN) - NumWaveOutPin++; - - if (Communication == KSPIN_COMMUNICATION_SINK && DataFlow == KSPIN_DATAFLOW_OUT) - NumWaveInPin++; - - /* FIXME query for interface, dataformat etc */ - } - - DPRINT("Num Pins %u Num WaveIn Pins %u Name WaveOut Pins %u\n", DeviceEntry->PinDescriptorsCount, NumWaveInPin, NumWaveOutPin); - return STATUS_SUCCESS; -} - -VOID -QueryFilterRoutine( - IN PKSAUDIO_DEVICE_ENTRY DeviceEntry) -{ - KSPROPERTY PropertyRequest; - ULONG Count; - NTSTATUS Status; - ULONG BytesReturned; - - DPRINT("Querying filter...\n"); - - PropertyRequest.Set = KSPROPSETID_Pin; - PropertyRequest.Flags = KSPROPERTY_TYPE_GET; - PropertyRequest.Id = KSPROPERTY_PIN_CTYPES; - - /* query for num of pins */ - Status = KsSynchronousIoControlDevice(DeviceEntry->FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&PropertyRequest, sizeof(KSPROPERTY), (PVOID)&Count, sizeof(ULONG), &BytesReturned); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to query number of pins Status %x\n", Status); - return; - } - - if (!Count) - { - DPRINT1("Filter has no pins!\n"); - return; - } - - /* allocate pin descriptor array */ - DeviceEntry->PinDescriptors = ExAllocatePool(NonPagedPool, Count * sizeof(KSPIN_DESCRIPTOR)); - if (!DeviceEntry->PinDescriptors) - { - /* no memory */ - return; - } - - /* zero array pin descriptor array */ - RtlZeroMemory(DeviceEntry->PinDescriptors, Count * sizeof(KSPIN_DESCRIPTOR)); - - /* build the device descriptor */ - Status = BuildPinDescriptor(DeviceEntry, Count); - if (!NT_SUCCESS(Status)) - return; - - - /* allocate pin array */ - DeviceEntry->Pins = ExAllocatePool(NonPagedPool, Count * sizeof(PIN_INFO)); - if (!DeviceEntry->Pins) - { - /* no memory */ - DPRINT1("Failed to allocate memory Pins %u Block %x\n", Count, Count * sizeof(PIN_INFO)); - return; - } - - /* clear array */ - RtlZeroMemory(DeviceEntry->Pins, sizeof(PIN_INFO) * Count); - DeviceEntry->PinDescriptorsCount = Count; - -} - -VOID -NTAPI -FilterPinWorkerRoutine( - IN PDEVICE_OBJECT DeviceObject, - IN PVOID Context) -{ - PKSAUDIO_DEVICE_ENTRY DeviceEntry; - PFILTER_WORKER_CONTEXT Ctx = (PFILTER_WORKER_CONTEXT)Context; - - DeviceEntry = Ctx->DeviceEntry; - - QueryFilterRoutine(DeviceEntry); - - /* free work item */ - IoFreeWorkItem(Ctx->WorkItem); - /* free work item context */ - ExFreePool(Ctx); - return; - -} - NTSTATUS OpenDevice( IN PUNICODE_STRING DeviceName, @@ -199,8 +66,6 @@ InsertAudioDevice( IN PUNICODE_STRING DeviceName) { NTSTATUS Status = STATUS_SUCCESS; - PFILTER_WORKER_CONTEXT Ctx = NULL; - PIO_WORKITEM WorkItem = NULL; PSYSAUDIODEVEXT DeviceExtension; PKSAUDIO_DEVICE_ENTRY DeviceEntry = NULL; @@ -215,24 +80,6 @@ InsertAudioDevice( /* initialize audio device entry */ RtlZeroMemory(DeviceEntry, sizeof(KSAUDIO_DEVICE_ENTRY)); - /* allocate filter ctx */ - Ctx = ExAllocatePool(NonPagedPool, sizeof(FILTER_WORKER_CONTEXT)); - if (!Ctx) - { - /* no memory */ - Status = STATUS_INSUFFICIENT_RESOURCES; - goto cleanup; - } - - /* allocate work item */ - WorkItem = IoAllocateWorkItem(DeviceObject); - if (!WorkItem) - { - /* no memory */ - Status = STATUS_INSUFFICIENT_RESOURCES; - goto cleanup; - } - /* set device name */ DeviceEntry->DeviceName.Length = 0; DeviceEntry->DeviceName.MaximumLength = DeviceName->MaximumLength + 10 * sizeof(WCHAR); @@ -255,9 +102,6 @@ InsertAudioDevice( goto cleanup; } - Ctx->DeviceEntry = DeviceEntry; - Ctx->WorkItem = WorkItem; - /* fetch device extension */ DeviceExtension = (PSYSAUDIODEVEXT)DeviceObject->DeviceExtension; /* insert new audio device */ @@ -265,16 +109,9 @@ InsertAudioDevice( InterlockedIncrement((PLONG)&DeviceExtension->NumberOfKsAudioDevices); DPRINT("Successfully opened audio device %u Device %S\n", DeviceExtension->NumberOfKsAudioDevices, DeviceEntry->DeviceName.Buffer); - IoQueueWorkItem(WorkItem, FilterPinWorkerRoutine, DelayedWorkQueue, (PVOID)Ctx); return Status; cleanup: - if (Ctx) - ExFreePool(Ctx); - - if (WorkItem) - IoFreeWorkItem(WorkItem); - if (DeviceEntry) { if (DeviceEntry->DeviceName.Buffer) diff --git a/reactos/drivers/wdm/audio/sysaudio/main.c b/reactos/drivers/wdm/audio/sysaudio/main.c index 6e0fceeb16b..de1e06e3ce4 100644 --- a/reactos/drivers/wdm/audio/sysaudio/main.c +++ b/reactos/drivers/wdm/audio/sysaudio/main.c @@ -53,10 +53,10 @@ SysAudio_Shutdown( /* close audio device handle */ ZwClose(DeviceEntry->Handle); + /* free device string */ RtlFreeUnicodeString(&DeviceEntry->DeviceName); - /* free pins */ - ExFreePool(DeviceEntry->Pins); + /* free audio device entry */ ExFreePool(DeviceEntry); } diff --git a/reactos/drivers/wdm/audio/sysaudio/pin.c b/reactos/drivers/wdm/audio/sysaudio/pin.c index a2271a98c12..36ce635708d 100644 --- a/reactos/drivers/wdm/audio/sysaudio/pin.c +++ b/reactos/drivers/wdm/audio/sysaudio/pin.c @@ -354,7 +354,7 @@ InstantiatePins( } #endif - DeviceEntry->Pins[Connect->PinId].References = 0; + //DeviceEntry->Pins[Connect->PinId].References = 0; /* initialize dispatch context */ DispatchContext->Handle = RealPinHandle; @@ -385,6 +385,44 @@ InstantiatePins( return Status; } +NTSTATUS +GetConnectRequest( + IN PIRP Irp, + OUT PKSPIN_CONNECT * Result) +{ + PIO_STACK_LOCATION IoStack; + ULONG ObjectLength, ParametersLength; + PVOID Buffer; + + /* get current irp stack */ + IoStack = IoGetCurrentIrpStackLocation(Irp); + + /* get object class length */ + ObjectLength = (wcslen(KSSTRING_Pin) + 2) * sizeof(WCHAR); + + /* check for minium length requirement */ + if (ObjectLength + sizeof(KSPIN_CONNECT) > IoStack->FileObject->FileName.MaximumLength) + return STATUS_UNSUCCESSFUL; + + /* extract parameters length */ + ParametersLength = IoStack->FileObject->FileName.MaximumLength - ObjectLength; + + /* allocate buffer */ + Buffer = ExAllocatePool(NonPagedPool, ParametersLength); + if (!Buffer) + return STATUS_INSUFFICIENT_RESOURCES; + + /* copy parameters */ + RtlMoveMemory(Buffer, &IoStack->FileObject->FileName.Buffer[ObjectLength / sizeof(WCHAR)], ParametersLength); + + /* store result */ + *Result = (PKSPIN_CONNECT)Buffer; + + return STATUS_SUCCESS; +} + + + NTSTATUS NTAPI DispatchCreateSysAudioPin( @@ -394,7 +432,7 @@ DispatchCreateSysAudioPin( NTSTATUS Status = STATUS_SUCCESS; PIO_STACK_LOCATION IoStack; PKSAUDIO_DEVICE_ENTRY DeviceEntry; - PKSPIN_CONNECT Connect = NULL; + PKSPIN_CONNECT Connect; PDISPATCH_CONTEXT DispatchContext; DPRINT("DispatchCreateSysAudioPin entered\n"); @@ -410,9 +448,6 @@ DispatchCreateSysAudioPin( /* get current attached virtual device */ DeviceEntry = (PKSAUDIO_DEVICE_ENTRY)IoStack->FileObject->RelatedFileObject->FsContext; - /* now validate pin connect request */ - Status = KsValidateConnectRequest(Irp, DeviceEntry->PinDescriptorsCount, DeviceEntry->PinDescriptors, &Connect); - /* check for success */ if (!NT_SUCCESS(Status)) { @@ -422,6 +457,19 @@ DispatchCreateSysAudioPin( return Status; } + /* get connect details */ + Status = GetConnectRequest(Irp, &Connect); + + /* check for success */ + if (!NT_SUCCESS(Status)) + { + /* failed to obtain connect details */ + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } + + /* allocate dispatch context */ DispatchContext = ExAllocatePool(NonPagedPool, sizeof(DISPATCH_CONTEXT)); if (!DispatchContext) diff --git a/reactos/drivers/wdm/audio/sysaudio/sysaudio.h b/reactos/drivers/wdm/audio/sysaudio/sysaudio.h index 01537b0a298..e5c11208dbf 100644 --- a/reactos/drivers/wdm/audio/sysaudio/sysaudio.h +++ b/reactos/drivers/wdm/audio/sysaudio/sysaudio.h @@ -24,9 +24,7 @@ typedef struct HANDLE Handle; // handle to audio device PFILE_OBJECT FileObject; // file objecto to audio device - PIN_INFO * Pins; // array of PIN_INFO - ULONG PinDescriptorsCount; // number of pin descriptors - KSPIN_DESCRIPTOR *PinDescriptors; // pin descriptors array + //PIN_INFO * Pins; // array of PIN_INFO }KSAUDIO_DEVICE_ENTRY, *PKSAUDIO_DEVICE_ENTRY; typedef struct @@ -62,20 +60,6 @@ typedef struct HANDLE hMixerPin; // handle to mixer pin }DISPATCH_CONTEXT, *PDISPATCH_CONTEXT; -typedef struct -{ - PIO_WORKITEM WorkItem; - PKSAUDIO_DEVICE_ENTRY DeviceEntry; -}FILTER_WORKER_CONTEXT, *PFILTER_WORKER_CONTEXT; - -typedef struct -{ - PIRP Irp; - IO_STATUS_BLOCK StatusBlock; -}COMPLETION_CONTEXT, *PCOMPLETION_CONTEXT; - - - NTSTATUS SysAudioAllocateDeviceHeader( IN SYSAUDIODEVEXT *DeviceExtension); From 9e2710ab67573a3c436f994858549af4057adeb1 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 15 May 2010 19:40:33 +0000 Subject: [PATCH 097/151] [win32k] - Change the first parameter type from HWND to PWINDOW_OBJECT for IntKillTimer as it makes more sense. Activate IntSetTimer, already done by James. - Add flag TMRF_DELETEPENDING. Destroy timers when this flag is set in ProcessTimers to allow any timers that have expired to have the WM_SYSTIMER/WM_TIMER messages posted to message queue before being destroyed. - Fix error in FindTimer, it was always returning a Timer and it needed to return NULL if the specified timer did not exist. - Fix error in PostTimerMessages, need to handle cases where the Window object is NULL which occurs when requesting messages for any window belonging to the thread. - In co_IntPeekMessage, simply call PostTimerMessages to have WM_SYSTIMER/WM_TIMER messages posted for expired timers. Remove call to old timer message handling. - TODO: Code using the old timer implementation needs removed. - Fixes bugs #2393, #3634, #2835. Commit dedicated to JT and Mr. Roboto. svn path=/trunk/; revision=47226 --- .../subsystems/win32/win32k/include/timer.h | 6 +- .../subsystems/win32/win32k/main/dllmain.c | 2 + .../subsystems/win32/win32k/ntuser/caret.c | 4 +- .../subsystems/win32/win32k/ntuser/message.c | 19 +- .../subsystems/win32/win32k/ntuser/timer.c | 168 ++++++++++++++---- 5 files changed, 140 insertions(+), 59 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/timer.h b/reactos/subsystems/win32/win32k/include/timer.h index 2b65b0e55d8..a41b8c30dbe 100644 --- a/reactos/subsystems/win32/win32k/include/timer.h +++ b/reactos/subsystems/win32/win32k/include/timer.h @@ -23,12 +23,14 @@ typedef struct _TIMER #define TMRF_ONESHOT 0x0010 #define TMRF_WAITING 0x0020 #define TMRF_TIFROMWND 0x0040 +#define TMRF_DELETEPENDING 0x8000 extern PKTIMER MasterTimer; NTSTATUS FASTCALL InitTimerImpl(VOID); -BOOL FASTCALL IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer); -UINT_PTR FASTCALL IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer); +BOOL FASTCALL DestroyTimersForThread(PTHREADINFO pti); +BOOL FASTCALL IntKillTimer(PWINDOW_OBJECT Window, UINT_PTR IDEvent, BOOL SystemTimer); +UINT_PTR FASTCALL IntSetTimer(PWINDOW_OBJECT Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type); PTIMER FASTCALL FindSystemTimer(PMSG); BOOL FASTCALL ValidateTimerCallback(PTHREADINFO,PWINDOW_OBJECT,WPARAM,LPARAM); VOID CALLBACK SystemTimerProc(HWND,UINT,UINT_PTR,DWORD); diff --git a/reactos/subsystems/win32/win32k/main/dllmain.c b/reactos/subsystems/win32/win32k/main/dllmain.c index 040d3cc76ed..3eb5753d231 100644 --- a/reactos/subsystems/win32/win32k/main/dllmain.c +++ b/reactos/subsystems/win32/win32k/main/dllmain.c @@ -290,6 +290,8 @@ Win32kThreadCallback(struct _ETHREAD *Thread, Win32Thread->TIF_flags |= TIF_INCLEANUP; DceFreeThreadDCE(Win32Thread); HOOK_DestroyThreadHooks(Thread); + /* Cleanup timers */ + DestroyTimersForThread(Win32Thread); UnregisterThreadHotKeys(Thread); /* what if this co_ func crash in umode? what will clean us up then? */ co_DestroyThreadWindows(Thread); diff --git a/reactos/subsystems/win32/win32k/ntuser/caret.c b/reactos/subsystems/win32/win32k/ntuser/caret.c index c75dc05c074..418ddb5323b 100644 --- a/reactos/subsystems/win32/win32k/ntuser/caret.c +++ b/reactos/subsystems/win32/win32k/ntuser/caret.c @@ -189,7 +189,7 @@ co_IntSetCaretPos(int X, int Y) ThreadQueue->CaretInfo->Pos.x = X; ThreadQueue->CaretInfo->Pos.y = Y; co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); - IntSetTimer(ThreadQueue->CaretInfo->hWnd, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE); + IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TMRF_SYSTEM); } return TRUE; } @@ -302,7 +302,7 @@ BOOL FASTCALL co_UserShowCaret(PWINDOW_OBJECT Window OPTIONAL) { co_IntSendMessage(ThreadQueue->CaretInfo->hWnd, WM_SYSTIMER, IDCARETTIMER, 0); } - IntSetTimer(ThreadQueue->CaretInfo->hWnd, IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TRUE); + IntSetTimer(UserGetWindowObject(ThreadQueue->CaretInfo->hWnd), IDCARETTIMER, IntGetCaretBlinkTime(), NULL, TMRF_SYSTEM); } return TRUE; diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 39b0470c795..12744d3a14f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -880,23 +880,8 @@ CheckMessages: goto MsgExit; } - if (ThreadQueue->WakeMask & QS_TIMER) - if (PostTimerMessages(Window)) // If there are timers ready, - goto CheckMessages; // go back and process them. - - // LOL! Polling Timer Queue? How much time is spent doing this? - /* Check for WM_(SYS)TIMER messages */ - Present = MsqGetTimerMessage( ThreadQueue, - Window, - MsgFilterMin, - MsgFilterMax, - &Msg->Msg, - RemoveMessages); - if (Present) - { - Msg->FreeLParam = FALSE; - goto MessageFound; - } + if (PostTimerMessages(Window)) + goto CheckMessages; if(Present) { diff --git a/reactos/subsystems/win32/win32k/ntuser/timer.c b/reactos/subsystems/win32/win32k/ntuser/timer.c index 6ad4ddeb8ca..da114f81b5f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/timer.c +++ b/reactos/subsystems/win32/win32k/ntuser/timer.c @@ -57,7 +57,7 @@ CreateTimer(VOID) { Ret = UserCreateObject(gHandleTable, NULL, &Handle, otTimer, sizeof(TIMER)); if (Ret) InsertTailList(&FirstpTmr->ptmrList, &Ret->ptmrList); - } + } return Ret; } @@ -68,8 +68,8 @@ RemoveTimer(PTIMER pTmr) { if (pTmr) { - RemoveEntryList(&pTmr->ptmrList); - UserDeleteObject( UserHMGetHandle(pTmr), otTimer); + /* Set the flag, it will be removed when ready */ + pTmr->flags |= TMRF_DELETEPENDING; return TRUE; } return FALSE; @@ -83,7 +83,7 @@ FindTimer(PWINDOW_OBJECT Window, BOOL Distroy) { PLIST_ENTRY pLE; - PTIMER pTmr = FirstpTmr; + PTIMER pTmr = FirstpTmr, RetTmr = NULL; KeEnterCriticalRegion(); do { @@ -96,8 +96,8 @@ FindTimer(PWINDOW_OBJECT Window, if (Distroy) { RemoveTimer(pTmr); - pTmr = (PTIMER)1; // We are here to remove the timer. } + RetTmr = pTmr; break; } @@ -106,7 +106,7 @@ FindTimer(PWINDOW_OBJECT Window, } while (pTmr != FirstpTmr); KeLeaveCriticalRegion(); - return pTmr; + return RetTmr; } PTIMER @@ -162,15 +162,15 @@ ValidateTimerCallback(PTHREADINFO pti, return TRUE; } -// Rename it to IntSetTimer after move. UINT_PTR FASTCALL -InternalSetTimer( PWINDOW_OBJECT Window, +IntSetTimer( PWINDOW_OBJECT Window, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, INT Type) { PTIMER pTmr; + UINT Ret= IDEvent; LARGE_INTEGER DueTime; DueTime.QuadPart = (LONGLONG)(-10000000); @@ -197,6 +197,24 @@ InternalSetTimer( PWINDOW_OBJECT Window, Elapse = 10; } + if ((Window == NULL) && (!(Type & TMRF_SYSTEM))) + { + IntLockWindowlessTimerBitmap(); + IDEvent = RtlFindClearBitsAndSet(&WindowLessTimersBitMap, 1, HintIndex); + + if (IDEvent == (UINT_PTR) -1) + { + IntUnlockWindowlessTimerBitmap(); + DPRINT1("Unable to find a free window-less timer id\n"); + SetLastWin32Error(ERROR_NO_SYSTEM_RESOURCES); + return 0; + } + + HintIndex = ++IDEvent; + IntUnlockWindowlessTimerBitmap(); + Ret = IDEvent; + } + pTmr = FindTimer(Window, IDEvent, Type, FALSE); if (!pTmr) { @@ -215,18 +233,23 @@ InternalSetTimer( PWINDOW_OBJECT Window, pTmr->pWnd = Window; pTmr->cmsCountdown = Elapse; pTmr->cmsRate = Elapse; - pTmr->flags = Type|TMRF_INIT; // Set timer to Init mode. pTmr->pfn = TimerFunc; pTmr->nID = IDEvent; + pTmr->flags = Type|TMRF_INIT; // Set timer to Init mode. + } - InsertTailList(&FirstpTmr->ptmrList, &pTmr->ptmrList); + pTmr->cmsCountdown = Elapse; + pTmr->cmsRate = Elapse; + if (pTmr->flags & TMRF_DELETEPENDING) + { + pTmr->flags &= ~TMRF_DELETEPENDING; } // Start the timer thread! - KeSetTimer(MasterTimer, DueTime, NULL); + if (pTmr == FirstpTmr) + KeSetTimer(MasterTimer, DueTime, NULL); - if (!pTmr->nID) return 1; - return pTmr->nID; + return Ret; } // @@ -248,7 +271,7 @@ StartTheTimers(VOID) { // Need to start gdi syncro timers then start timer with Hang App proc // that calles Idle process so the screen savers will know to run...... - InternalSetTimer(NULL, 0, 1000, SystemTimerProc, TMRF_RIT); + IntSetTimer(NULL, 0, 1000, SystemTimerProc, TMRF_RIT); } UINT_PTR @@ -256,14 +279,14 @@ FASTCALL SystemTimerSet( PWINDOW_OBJECT Window, UINT_PTR nIDEvent, UINT uElapse, - TIMERPROC lpTimerFunc) + TIMERPROC lpTimerFunc) { if (Window && Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess()) { SetLastWin32Error(ERROR_ACCESS_DENIED); return 0; } - return InternalSetTimer( Window, nIDEvent, uElapse, lpTimerFunc, TMRF_SYSTEM); + return IntSetTimer( Window, nIDEvent, uElapse, lpTimerFunc, TMRF_SYSTEM); } BOOL @@ -279,28 +302,23 @@ PostTimerMessages(PWINDOW_OBJECT Window) if (!pTmr) return FALSE; - if (Window && ((ULONG_PTR)Window != 1)) - { - if (!Window->Wnd) return FALSE; - } - pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; KeEnterCriticalRegion(); + do { if ( (pTmr->flags & TMRF_READY) && (pTmr->pti == pti) && - (pTmr->pWnd == Window)) + ((pTmr->pWnd == Window) || (Window == NULL) ) ) { - ASSERT((ULONG_PTR)Window != 1); - Msg.hwnd = Window->hSelf; + Msg.hwnd = (pTmr->pWnd) ? pTmr->pWnd->hSelf : 0; Msg.message = (pTmr->flags & TMRF_SYSTEM) ? WM_SYSTIMER : WM_TIMER; Msg.wParam = (WPARAM) pTmr->nID; Msg.lParam = (LPARAM) pTmr->pfn; - MsqPostMessage(ThreadQueue, &Msg, FALSE, QS_POSTMESSAGE); + MsqPostMessage(ThreadQueue, &Msg, FALSE, QS_TIMER); pTmr->flags &= ~TMRF_READY; ThreadQueue->WakeMask = ~QS_TIMER; Hit = TRUE; @@ -309,6 +327,7 @@ PostTimerMessages(PWINDOW_OBJECT Window) pLE = pTmr->ptmrList.Flink; pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList); } while (pTmr != FirstpTmr); + KeLeaveCriticalRegion(); return Hit; @@ -330,7 +349,7 @@ ProcessTimers(VOID) KeQueryTickCount(&TickCount); Time = MsqCalculateMessageTime(&TickCount); - DueTime.QuadPart = (LONGLONG)(-10000000); + DueTime.QuadPart = (LONGLONG)(-1000000); do { @@ -341,8 +360,10 @@ ProcessTimers(VOID) continue; } - if (pTmr->flags & TMRF_INIT) + if (pTmr->flags & TMRF_INIT) + { pTmr->flags &= ~TMRF_INIT; // Skip this run. + } else { if (pTmr->cmsCountdown < 0) @@ -363,16 +384,35 @@ ProcessTimers(VOID) // Set thread message queue for this timer. if (pTmr->pti->MessageQueue) { // Wakeup thread - pTmr->pti->MessageQueue->WakeMask |= QS_TIMER; - KeSetEvent(pTmr->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + if (pTmr->pti->MessageQueue->WakeMask & QS_POSTMESSAGE) + KeSetEvent(pTmr->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); } } } - pTmr->cmsCountdown = pTmr->cmsRate; + if (pTmr->flags & TMRF_DELETEPENDING) + { + DPRINT("Removing Timer %x from List\n", pTmr); + + /* FIXME: Fix this!!!! */ +/* + if (!pTmr->pWnd) + { + DPRINT1("Clearing Bits for WindowLess Timer\n"); + IntLockWindowlessTimerBitmap(); + RtlSetBits(&WindowLessTimersBitMap, pTmr->nID, 1); + IntUnlockWindowlessTimerBitmap(); + } +*/ + RemoveEntryList(&pTmr->ptmrList); + UserDeleteObject( UserHMGetHandle(pTmr), otTimer); + } + else + pTmr->cmsCountdown = pTmr->cmsRate; } else pTmr->cmsCountdown -= Time - TimeLast; } + pLE = pTmr->ptmrList.Flink; pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList); } while (pTmr != FirstpTmr); @@ -391,7 +431,7 @@ ProcessTimers(VOID) // // UINT_PTR FASTCALL -IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer) +InternalSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer) { PWINDOW_OBJECT Window; UINT_PTR Ret = 0; @@ -477,17 +517,66 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S return 0; } - +if (Ret == 0) ASSERT(FALSE); return Ret; } +BOOL FASTCALL +DestroyTimersForThread(PTHREADINFO pti) +{ + PLIST_ENTRY pLE; + PTIMER pTmr = FirstpTmr; + BOOL TimersRemoved = FALSE; + + if (FirstpTmr == NULL) + return FALSE; + + KeEnterCriticalRegion(); + + do + { + if ((pTmr) && (pTmr->pti == pti)) + { + pTmr->flags &= ~TMRF_READY; + pTmr->flags |= TMRF_DELETEPENDING; + TimersRemoved = TRUE; + } + pLE = pTmr->ptmrList.Flink; + pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList); + } while (pTmr != FirstpTmr); + + KeLeaveCriticalRegion(); + + return TimersRemoved; +} + BOOL FASTCALL -IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer) +IntKillTimer(PWINDOW_OBJECT Window, UINT_PTR IDEvent, BOOL SystemTimer) +{ + PTIMER pTmr = NULL; + DPRINT("IntKillTimer Window %x id %p systemtimer %s\n", + Window, IDEvent, SystemTimer ? "TRUE" : "FALSE"); + + if (IDEvent == 0) + return FALSE; + + pTmr = FindTimer(Window, IDEvent, SystemTimer ? TMRF_SYSTEM : 0, TRUE); + return pTmr ? TRUE : FALSE; +} + + +// +// +// Old Kill Timer +// +// +BOOL FASTCALL +InternalKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer) { PTHREADINFO pti; PWINDOW_OBJECT Window = NULL; - + DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n", Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE"); @@ -495,7 +584,7 @@ IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer) if (Wnd) { Window = UserGetWindowObject(Wnd); - + if (! MsqKillTimer(pti->MessageQueue, Wnd, IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER)) { @@ -574,7 +663,7 @@ NtUserSetTimer DPRINT("Enter NtUserSetTimer\n"); UserEnterExclusive(); - RETURN(IntSetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc, FALSE)); + RETURN(IntSetTimer(UserGetWindowObject(hWnd), nIDEvent, uElapse, lpTimerFunc, 0)); CLEANUP: DPRINT("Leave NtUserSetTimer, ret=%i\n", _ret_); @@ -591,12 +680,15 @@ NtUserKillTimer UINT_PTR uIDEvent ) { + PWINDOW_OBJECT Window; DECLARE_RETURN(BOOL); DPRINT("Enter NtUserKillTimer\n"); UserEnterExclusive(); - RETURN(IntKillTimer(hWnd, uIDEvent, FALSE)); + Window = UserGetWindowObject(hWnd); + + RETURN(IntKillTimer(Window, uIDEvent, FALSE)); CLEANUP: DPRINT("Leave NtUserKillTimer, ret=%i\n", _ret_); @@ -620,7 +712,7 @@ NtUserSetSystemTimer( UserEnterExclusive(); // This is wrong, lpTimerFunc is NULL! - RETURN(IntSetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc, TRUE)); + RETURN(IntSetTimer(UserGetWindowObject(hWnd), nIDEvent, uElapse, lpTimerFunc, TMRF_SYSTEM)); CLEANUP: DPRINT("Leave NtUserSetSystemTimer, ret=%i\n", _ret_); From 5e38f41aae6ad313eef4c07e233619a37ef4985f Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sat, 15 May 2010 20:37:24 +0000 Subject: [PATCH 098/151] [RBUILD] delete outdated codeblocks backend (codeblocks does not support all features needed to build ros) See issue #5381 for more details. svn path=/trunk/; revision=47227 --- reactos/Makefile | 5 - reactos/dll/win32/advapi32/reg/reg.c | 10 +- .../rbuild/backend/codeblocks/codeblocks.cpp | 908 ------------------ .../rbuild/backend/codeblocks/codeblocks.h | 100 -- reactos/tools/rbuild/rbuild.mak | 31 - reactos/tools/rbuild/rbuild.vcproj | 12 - 6 files changed, 1 insertion(+), 1065 deletions(-) delete mode 100644 reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp delete mode 100644 reactos/tools/rbuild/backend/codeblocks/codeblocks.h diff --git a/reactos/Makefile b/reactos/Makefile index 1e7cbd2fcbf..07148d023ad 100644 --- a/reactos/Makefile +++ b/reactos/Makefile @@ -472,11 +472,6 @@ rgenstat: $(RGENSTAT_TARGET) $(ECHO_RGENSTAT) $(Q)$(RGENSTAT_TARGET) apistatus.lst apistatus.xml -.PHONY: cb -cb: $(ROS_BUILDENGINE) - $(ECHO_RBUILD) - $(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) cb - .PHONY: msbuild msbuild: $(ROS_BUILDENGINE) $(ECHO_RBUILD) diff --git a/reactos/dll/win32/advapi32/reg/reg.c b/reactos/dll/win32/advapi32/reg/reg.c index e131cf2e43b..26036dc1963 100644 --- a/reactos/dll/win32/advapi32/reg/reg.c +++ b/reactos/dll/win32/advapi32/reg/reg.c @@ -4841,15 +4841,7 @@ RegSetValueExW(HKEY hKey, return RtlNtStatusToDosError(Status); } - if (lpValueName != NULL) - { - RtlInitUnicodeString(&ValueName, - lpValueName); - } - else - { - RtlInitUnicodeString(&ValueName, L""); - } + RtlInitUnicodeString(&ValueName, lpValueName); pValueName = &ValueName; if (is_string(dwType) && (cbData != 0)) diff --git a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp b/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp deleted file mode 100644 index b1fb3f1c406..00000000000 --- a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp +++ /dev/null @@ -1,908 +0,0 @@ -/* - * Copyright (C) 2006 Christoph von Wittich - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifdef _MSC_VER -#pragma warning ( disable : 4786 ) -#endif//_MSC_VER - -#include -#include -#include -#include - -#include - -#include "codeblocks.h" -#include "../mingw/mingw.h" - -using std::string; -using std::vector; -using std::ifstream; - -#ifdef OUT -#undef OUT -#endif//OUT - -#define IsStaticLibrary( module ) ( ( module.type == StaticLibrary ) || ( module.type == HostStaticLibrary ) ) - -static class CBFactory : public Backend::Factory -{ - public: - - CBFactory() : Factory("CB", "Code::Blocks") {} - Backend *operator() (Project &project, - Configuration& configuration) - { - return new CBBackend(project, configuration); - } - -} factory; - - -CBBackend::CBBackend(Project &project, - Configuration& configuration) : Backend(project, configuration) -{ - m_unitCount = 0; -} - -void CBBackend::Process() -{ - - while ( m_configurations.size () > 0 ) - { - const CBConfiguration* cfg = m_configurations.back(); - m_configurations.pop_back(); - delete cfg; - } - - m_configurations.push_back ( new CBConfiguration( Debug )); - m_configurations.push_back ( new CBConfiguration( Release )); - - string filename_wrkspace ( ProjectNode.name ); - filename_wrkspace += "_auto.workspace"; - - printf ( "Creating Code::Blocks workspace: %s\n", filename_wrkspace.c_str() ); - - ProcessModules(); - m_wrkspaceFile = fopen ( filename_wrkspace.c_str(), "wb" ); - - if ( !m_wrkspaceFile ) - { - printf ( "Could not create file '%s'.\n", filename_wrkspace.c_str() ); - return; - } - - _generate_workspace ( m_wrkspaceFile ); - - fclose ( m_wrkspaceFile ); - printf ( "Done.\n" ); -} - -void CBBackend::ProcessModules() -{ - for( std::map::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p ) - { - Module &module = *p->second; - MingwAddImplicitLibraries( module ); - _generate_cbproj ( module ); - } -} - -static std::string -GetExtension ( const std::string& filename ) -{ - size_t index = filename.find_last_of ( '/' ); - if (index == string::npos) index = 0; - string tmp = filename.substr( index, filename.size() - index ); - size_t ext_index = tmp.find_last_of( '.' ); - if (ext_index != string::npos) - return filename.substr ( index + ext_index, filename.size() ); - return ""; -} - -static bool FileExists(string &filename) -{ - ifstream file(filename.c_str()); - - if(!file.is_open()) - return false; - - file.close(); - return true; -} - -void CBBackend::ProcessFile(string &filepath) -{ - // Remove the .\ at the start of the filenames - if ( filepath[0] == '.' && strchr ( "/\\", filepath[1] ) ) - filepath.erase(0, 2); - - if(!FileExists(filepath)) - return; - - // Change the \ to / - for(size_t i = 0; i < filepath.length(); i++) - { - if(filepath[i] == '\\') - filepath[i] = '/'; - } - - // Remove the filename from the path - string folder = ""; - - size_t pos = filepath.rfind(string("/"), filepath.length() - 1); - - if(pos != string::npos) - { - folder = filepath; - folder.erase(pos, folder.length() - pos); - } - - FileUnit fileUnit; - fileUnit.filename = filepath; - fileUnit.folder = folder; - - m_fileUnits.push_back(fileUnit); - - if(folder != "") - AddFolders(folder); - - m_unitCount++; -} - -bool CBBackend::CheckFolderAdded(string &folder) -{ - for(size_t i = 0; i < m_folders.size(); i++) - { - if(m_folders[i] == folder) - return true; - } - - return false; -} - -void CBBackend::AddFolders(string &folder) -{ - // Check if this folder was already added. true if it was, false otherwise. - if(CheckFolderAdded(folder)) - return; - - m_folders.push_back(folder); - - size_t pos = folder.rfind(string("/"), folder.length() - 1); - - if(pos == string::npos) - return; - - folder.erase(pos, folder.length() - pos); - AddFolders(folder); -} - -void CBBackend::OutputFolders() -{ -#if 0 - m_devFile << "Folders="; - - for(size_t i = 0; i < m_folders.size(); i++) - { - if(i > 0) - m_devFile << ","; - - m_devFile << m_folders[i]; - } -#endif -} - -std::string -CBBackend::CbpFileName ( const Module& module ) const -{ - return DosSeparator( - ReplaceExtension ( module.output->relative_path + sSep + module.output->name, "_auto.cbp" ) - ); -} - -std::string -CBBackend::LayoutFileName ( const Module& module ) const -{ - return DosSeparator( - ReplaceExtension ( module.output->relative_path + sSep + module.output->name, "_auto.layout" ) - ); -} - -std::string -CBBackend::DependFileName ( const Module& module ) const -{ - return DosSeparator( - ReplaceExtension ( module.output->relative_path + sSep + module.output->name, "_auto.depend" ) - ); -} - -void -CBBackend::_get_object_files ( const Module& module, vector& out) const -{ - string basepath = module.output->relative_path; - size_t i; - string intenv = Environment::GetIntermediatePath () + sSep + basepath + sSep; - string outenv = Environment::GetOutputPath () + sSep + basepath + sSep; - - vector cfgs; - - if ( configuration.UseConfigurationInPath ) - { - cfgs.push_back ( intenv + "Debug" ); - cfgs.push_back ( intenv + "Release" ); - cfgs.push_back ( outenv + "Debug" ); - cfgs.push_back ( outenv + "Release" ); - } - else - { - cfgs.push_back ( intenv ); - cfgs.push_back ( outenv ); - } - - vector ifs_list; - ifs_list.push_back ( &module.project.non_if_data ); - ifs_list.push_back ( &module.non_if_data ); - while ( ifs_list.size () ) - { - const IfableData& data = *ifs_list.back(); - ifs_list.pop_back(); - const vector& files = data.files; - for ( i = 0; i < files.size (); i++ ) - { - string file = files[i]->file.relative_path + sSep + files[i]->file.name; - string::size_type pos = file.find_last_of (sSep); - if ( pos != string::npos ) - file.erase ( 0, pos+1 ); - if ( !stricmp ( Right(file,3).c_str(), ".rc" ) ) - file = ReplaceExtension ( file, ".res" ); - else - file = ReplaceExtension ( file, ".obj" ); - for ( size_t j = 0; j < cfgs.size () / 2; j++ ) - out.push_back ( cfgs[j] + sSep + file ); - } - - } -} - -void -CBBackend::_clean_project_files ( void ) -{ - for( std::map::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p ) - { - Module& module = *p->second; - vector out; - printf("Cleaning project %s %s\n", module.name.c_str (), module.output->relative_path.c_str () ); - - string basepath = module.output->relative_path; - remove ( CbpFileName ( module ).c_str () ); - remove ( DependFileName ( module ).c_str () ); - remove ( LayoutFileName ( module ).c_str () ); - - _get_object_files ( module, out ); - for ( size_t j = 0; j < out.size (); j++) - { - //printf("Cleaning file %s\n", out[j].c_str () ); - remove ( out[j].c_str () ); - } - } - - string filename_wrkspace = ProjectNode.name + ".workspace"; - - remove ( filename_wrkspace.c_str () ); -} - -void -CBBackend::_generate_workspace ( FILE* OUT ) -{ - fprintf ( OUT, "\r\n" ); - fprintf ( OUT, "\r\n" ); - fprintf ( OUT, "\t\r\n" ); - for( std::map::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p ) - { - Module& module = *p->second; - - if ((module.type != Iso) && - (module.type != LiveIso)) - { - std::string Cbp_file = CbpFileName ( module ); - fprintf ( OUT, "\t\t\r\n", Cbp_file.c_str()); - - /* dependencies */ - vector ifs_list; - ifs_list.push_back ( &module.project.non_if_data ); - ifs_list.push_back ( &module.non_if_data ); - while ( ifs_list.size() ) - { - const IfableData& data = *ifs_list.back(); - ifs_list.pop_back(); - const vector& libs = data.libraries; - for ( size_t j = 0; j < libs.size(); j++ ) - fprintf ( OUT, "\t\t\t\r\n", libs[j]->importedModule->output->relative_path.c_str(), sSep.c_str(), libs[j]->name.c_str() ); - } - fprintf ( OUT, "\t\t\r\n" ); - } - } - fprintf ( OUT, "\t\r\n" ); - fprintf ( OUT, "\r\n" ); -} - -void -CBBackend::_generate_cbproj ( const Module& module ) -{ - - size_t i; - - string cbproj_file = CbpFileName(module); - string outdir; - string intdir; - string path_basedir = module.GetPathToBaseDir (); - string intenv = Environment::GetIntermediatePath (); - string outenv = Environment::GetOutputPath (); - string module_type = GetExtension(*module.output); - string cbproj_path = module.output->relative_path; - string CompilerVar; - string baseaddr; - string windres_defines; - string widl_options; - string project_linker_flags = "-Wl,--enable-stdcall-fixup "; - project_linker_flags += GenerateProjectLinkerFlags(); - - bool lib = (module.type == ObjectLibrary) || - (module.type == RpcClient) || - (module.type == RpcServer) || - (module.type == RpcProxy) || - (module_type == ".lib") || - (module_type == ".a"); - bool dll = (module_type == ".dll") || (module_type == ".cpl"); - bool exe = (module_type == ".exe") || (module_type == ".scr"); - bool sys = (module_type == ".sys"); - - vector source_files, resource_files, includes, libraries, libpaths; - vector header_files, common_defines, compiler_flags; - vector vars, values; - - /* do not create project files for these targets - use virtual targets instead */ - switch (module.type) - { - case Iso: - case LiveIso: - return; - default: - break; - } - - compiler_flags.push_back ( "-Wall" ); - - // Always force disabling of sibling calls optimisation for GCC - // (TODO: Move to version-specific once this bug is fixed in GCC) - compiler_flags.push_back ( "-fno-optimize-sibling-calls" ); - - if ( module.pch != NULL ) - { - string pch_path = Path::RelativeFromDirectory ( - module.pch->file->name, - module.output->relative_path ); - - header_files.push_back ( pch_path ); - } - - if ( intenv == "obj-i386" ) - intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */ - else - intdir = intenv; - - if ( outenv == "output-i386" ) - outdir = path_basedir + "output-i386"; - else - outdir = outenv; - - vector ifs_list; - ifs_list.push_back ( &module.project.non_if_data ); - ifs_list.push_back ( &module.non_if_data ); - while ( ifs_list.size() ) - { - const IfableData& data = *ifs_list.back(); - ifs_list.pop_back(); - const vector& files = data.files; - for ( i = 0; i < files.size(); i++ ) - { - string fullpath = files[i]->file.relative_path + sSep + files[i]->file.name; - string file = string(".") + &fullpath[cbproj_path.size()]; - - if ( !stricmp ( Right(file,3).c_str(), ".rc" ) ) - resource_files.push_back ( file ); - else - source_files.push_back ( file ); - } - const vector& incs = data.includes; - for ( i = 0; i < incs.size(); i++ ) - { - string path = Path::RelativeFromDirectory ( - incs[i]->directory->relative_path, - module.output->relative_path ); - - includes.push_back ( path ); - widl_options += "-I" + path + " "; - } - const vector& libs = data.libraries; - for ( i = 0; i < libs.size(); i++ ) - { - string libpath = intdir + sSep + libs[i]->importedModule->output->relative_path; - libraries.push_back ( libs[i]->name ); - libpaths.push_back ( libpath ); - } - const vector& cflags = data.compilerFlags; - for ( i = 0; i < cflags.size(); i++ ) - { - compiler_flags.push_back ( cflags[i]->flag ); - } - const vector& defs = data.defines; - for ( i = 0; i < defs.size(); i++ ) - { - if ( defs[i]->value[0] ) - { - const string& escaped = _replace_str(defs[i]->value, "\"","""); - common_defines.push_back( defs[i]->name + "=" + escaped ); - windres_defines += "-D" + defs[i]->name + "=" + escaped + " "; - } - else - { - common_defines.push_back( defs[i]->name ); - windres_defines += "-D" + defs[i]->name + " "; - } - } - /*const vector& variables = data.properties; - for ( i = 0; i < variables.size(); i++ ) - { - vars.push_back( variables[i]->name ); - values.push_back( variables[i]->value ); - }*/ - for ( std::map::const_iterator p = data.properties.begin(); p != data.properties.end(); ++ p ) - { - Property& prop = *p->second; - if ( strstr ( module.baseaddress.c_str(), prop.name.c_str() ) ) - baseaddr = prop.value; - } - } - - if ( !module.allowWarnings ) - compiler_flags.push_back ( "-Werror" ); - - if ( IsStaticLibrary ( module ) && module.isStartupLib ) - compiler_flags.push_back ( "-Wno-main" ); - - - FILE* OUT = fopen ( cbproj_file.c_str(), "wb" ); - - fprintf ( OUT, "\r\n" ); - fprintf ( OUT, "\r\n" ); - fprintf ( OUT, "\t\r\n" ); - fprintf ( OUT, "\t\r\n" ); - fprintf ( OUT, "\t\t\r\n" ); - fprintf ( OUT, "\r\n" ); - - - fclose ( OUT ); -} - -CBConfiguration::CBConfiguration ( const OptimizationType optimization, const std::string &name ) -{ - this->optimization = optimization; - if ( name != "" ) - this->name = name; - else - { - if ( optimization == Debug ) - this->name = "Debug"; - else if ( optimization == Release ) - this->name = "Release"; - else - this->name = "Unknown"; - } -} - -std::string -CBBackend::_replace_str(std::string string1, const std::string &find_str, const std::string &replace_str) -{ - std::string::size_type pos = string1.find(find_str, 0); - int intLen = find_str.length(); - - while(std::string::npos != pos) - { - string1.replace(pos, intLen, replace_str); - pos = string1.find(find_str, intLen + pos); - } - - return string1; -} - -std::string -CBBackend::GenerateProjectLinkerFlags() const -{ - std::string lflags; - for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ ) - { - LinkerFlag& linkerFlag = *ProjectNode.linkerFlags[i]; - if ( lflags.length () > 0 ) - lflags += " "; - lflags += linkerFlag.flag; - } - return lflags; -} - -void -CBBackend::MingwAddImplicitLibraries( Module &module ) -{ - Library* pLibrary; - - if ( !module.isDefaultEntryPoint ) - return; - - if ( module.IsDLL () ) - { - //pLibrary = new Library ( module, "__mingw_dllmain" ); - //module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary ); - } - else - { - pLibrary = new Library ( module, module.isUnicode ? "mingw_wmain" : "mingw_main" ); - module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary ); - } - - pLibrary = new Library ( module, "mingw_common" ); - module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin() + 1, pLibrary ); - - if ( module.name != "msvcrt" ) - { - // always link in msvcrt to get the basic routines - pLibrary = new Library ( module, "msvcrt" ); - module.non_if_data.libraries.push_back ( pLibrary ); - } -} - -const Property* -CBBackend::_lookup_property ( const Module& module, const std::string& name ) const -{ - std::map::const_iterator p; - - /* Check local values */ - p = module.non_if_data.properties.find(name); - - if ( p != module.non_if_data.properties.end() ) - return p->second; - - // TODO FIXME - should we check local if-ed properties? - p = module.project.non_if_data.properties.find(name); - - if ( p != module.project.non_if_data.properties.end() ) - return p->second; - - // TODO FIXME - should we check global if-ed properties? - return NULL; -} - -bool -CBBackend::IsSpecDefinitionFile ( const Module& module ) const -{ - if ( module.importLibrary == NULL) - return false; - - size_t index = module.importLibrary->source->name.rfind ( ".spec" ); - return ( index != string::npos ); -} diff --git a/reactos/tools/rbuild/backend/codeblocks/codeblocks.h b/reactos/tools/rbuild/backend/codeblocks/codeblocks.h deleted file mode 100644 index c0d0c26309b..00000000000 --- a/reactos/tools/rbuild/backend/codeblocks/codeblocks.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2005 Trevor McCort - * Copyright (C) 2005 Casper S. Hornstrup - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#pragma once - -#include -#include -#include - -#include "../backend.h" - -class FileUnit -{ - public: - std::string filename; - std::string folder; -}; - -enum OptimizationType -{ - Debug, - Release -}; - -class CBConfiguration -{ - public: - CBConfiguration(const OptimizationType optimization, - const std::string &name = ""); - virtual ~CBConfiguration() {} - std::string name; - OptimizationType optimization; -}; - -class CBBackend : public Backend -{ - public: - - CBBackend(Project &project, - Configuration& configuration); - virtual ~CBBackend() {} - - virtual void Process(); - - private: - - void ProcessModules(); - void ProcessFile(std::string &filename); - - bool CheckFolderAdded(std::string &folder); - void AddFolders(std::string &folder); - - void OutputFolders(); - void OutputFileUnits(); - - std::string CbpFileName ( const Module& module ) const; - std::string LayoutFileName ( const Module& module ) const; - std::string DependFileName ( const Module& module ) const; - std::string GenerateProjectLinkerFlags () const; - void MingwAddImplicitLibraries( Module &module ); - bool IsSpecDefinitionFile ( const Module& module ) const; - std::vector m_configurations; - - std::vector m_fileUnits; - std::vector m_folders; - - int m_unitCount; - - FILE* m_wrkspaceFile; - - std::string _replace_str( - std::string string1, - const std::string &find_str, - const std::string &replace_str); - - void _generate_workspace ( FILE* OUT ); - void _generate_cbproj ( const Module& module ); - - void _clean_project_files ( void ); - void _get_object_files ( const Module& module, std::vector& out ) const; - void _install_files ( const std::string& vcdir, const std::string& config ); - bool _copy_file ( const std::string& inputname, const std::string& targetname ) const; - const Property* _lookup_property ( const Module& module, const std::string& name ) const; -}; diff --git a/reactos/tools/rbuild/rbuild.mak b/reactos/tools/rbuild/rbuild.mak index 1a3138f7d14..bf328f71fd1 100644 --- a/reactos/tools/rbuild/rbuild.mak +++ b/reactos/tools/rbuild/rbuild.mak @@ -84,24 +84,6 @@ $(RBUILD_TESTS_OUT): | $(RBUILD_OUT) ${mkdir} $@ endif -RBUILD_CODEBLOCKS_BASE = $(RBUILD_BACKEND_BASE_)codeblocks -RBUILD_CODEBLOCKS_BASE_ = $(RBUILD_CODEBLOCKS_BASE)$(SEP) -RBUILD_CODEBLOCKS_INT = $(INTERMEDIATE_)$(RBUILD_CODEBLOCKS_BASE) -RBUILD_CODEBLOCKS_INT_ = $(RBUILD_CODEBLOCKS_INT)$(SEP) -RBUILD_CODEBLOCKS_OUT = $(OUTPUT_)$(RBUILD_CODEBLOCKS_BASE) -RBUILD_CODEBLOCKS_OUT_ = $(RBUILD_CODEBLOCKS_OUT)$(SEP) - -$(RBUILD_CODEBLOCKS_INT): | $(RBUILD_BACKEND_INT) - $(ECHO_MKDIR) - ${mkdir} $@ - -ifneq ($(INTERMEDIATE),$(OUTPUT)) -$(RBUILD_CODEBLOCKS_OUT): | $(RBUILD_BACKEND_OUT) - $(ECHO_MKDIR) - ${mkdir} $@ -endif - - RBUILD_MSBUILD_BASE = $(RBUILD_BACKEND_BASE_)msbuild RBUILD_MSBUILD_BASE_ = $(RBUILD_MSBUILD_BASE)$(SEP) RBUILD_MSBUILD_INT = $(INTERMEDIATE_)$(RBUILD_MSBUILD_BASE) @@ -186,10 +168,6 @@ RBUILD_BACKEND_MINGW_BASE_SOURCES = $(addprefix $(RBUILD_MINGW_BASE_), \ rule.cpp \ ) -RBUILD_BACKEND_CODEBLOCKS_BASE_SOURCES = $(addprefix $(RBUILD_CODEBLOCKS_BASE_), \ - codeblocks.cpp \ - ) - RBUILD_BACKEND_DEPMAP_BASE_SOURCES = $(addprefix $(RBUILD_DEPMAP_BASE_), \ dependencymap.cpp \ ) @@ -215,7 +193,6 @@ RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \ RBUILD_BACKEND_SOURCES = \ $(RBUILD_BACKEND_MINGW_BASE_SOURCES) \ $(RBUILD_BACKEND_MSVC_BASE_SOURCES) \ - $(RBUILD_BACKEND_CODEBLOCKS_BASE_SOURCES) \ $(RBUILD_BACKEND_DEPMAP_BASE_SOURCES) \ $(RBUILD_BACKEND_VREPORT_BASE_SOURCES) \ $(RBUILD_BACKEND_MSBUILD_BASE_SOURCES) \ @@ -257,9 +234,6 @@ RBUILD_OBJECTS = \ RBUILD_BACKEND_MSVCCPP_HEADERS = \ msvc.h -RBUILD_BACKEND_CODEBLOCKS_HEADERS = \ - codeblocks.h - RBUILD_BACKEND_DEPMAP_HEADERS = \ dependencymap.h @@ -278,7 +252,6 @@ RBUILD_BACKEND_HEADERS = \ backend.h \ $(addprefix msvc$(SEP), $(RBUILD_BACKEND_MSVC_HEADERS)) \ $(addprefix mingw$(SEP), $(RBUILD_BACKEND_MINGW_HEADERS)) \ - $(addprefix codeblocks$(SEP), $(RBUILD_BACKEND_CODEBLOCKS_HEADERS)) \ $(addprefix msbuild$(SEP), $(RBUILD_BACKEND_MSBUILD_HEADERS)) \ $(addprefix versionreport$(SEP), $(RBUILD_BACKEND_VREPORT_HEADERS)) \ $(addprefix dependencymap$(SEP), $(RBUILD_BACKEND_DEPMAP_HEADERS)) @@ -470,10 +443,6 @@ $(RBUILD_MINGW_INT_)rule.o: $(RBUILD_MINGW_BASE_)rule.cpp $(RBUILD_HEADERS) | $( $(ECHO_HOSTCC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ -$(RBUILD_CODEBLOCKS_INT_)codeblocks.o: $(RBUILD_CODEBLOCKS_BASE_)codeblocks.cpp $(RBUILD_HEADERS) | $(RBUILD_CODEBLOCKS_INT) - $(ECHO_HOSTCC) - ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ - $(RBUILD_DEPMAP_INT_)dependencymap.o: $(RBUILD_DEPMAP_BASE_)dependencymap.cpp $(RBUILD_HEADERS) | $(RBUILD_DEPMAP_INT) $(ECHO_HOSTCC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ diff --git a/reactos/tools/rbuild/rbuild.vcproj b/reactos/tools/rbuild/rbuild.vcproj index 763850a1804..b85528e6c1f 100644 --- a/reactos/tools/rbuild/rbuild.vcproj +++ b/reactos/tools/rbuild/rbuild.vcproj @@ -443,18 +443,6 @@ > - - - - - - From b9c51834ec59f8e3449dc00105a4ae3f7039758f Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Sat, 15 May 2010 22:44:31 +0000 Subject: [PATCH 099/151] Remove incorrect reference to winsock.h. svn path=/trunk/; revision=47229 --- rosapps/applications/net/netreg/netreg.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/rosapps/applications/net/netreg/netreg.cpp b/rosapps/applications/net/netreg/netreg.cpp index 53e23369d7f..f7f5105761e 100644 --- a/rosapps/applications/net/netreg/netreg.cpp +++ b/rosapps/applications/net/netreg/netreg.cpp @@ -8,7 +8,6 @@ * 01-17-2005 arty -- initial */ #include -#include #include #include #include From de96a18171ee5693efe88908b36cc3f4b7f2e2ce Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 16 May 2010 00:24:07 +0000 Subject: [PATCH 100/151] [NDK] Add FIBER_CONTEXT_EIP constant svn path=/trunk/; revision=47231 --- reactos/include/ndk/i386/asm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/reactos/include/ndk/i386/asm.h b/reactos/include/ndk/i386/asm.h index eaaf2ae1bc4..f54529442e1 100644 --- a/reactos/include/ndk/i386/asm.h +++ b/reactos/include/ndk/i386/asm.h @@ -478,6 +478,7 @@ Author: #define FIBER_CONTEXT_ESI FIBER_CONTEXT + CONTEXT_ESI #define FIBER_CONTEXT_EDI FIBER_CONTEXT + CONTEXT_EDI #define FIBER_CONTEXT_EBP FIBER_CONTEXT + CONTEXT_EBP +#define FIBER_CONTEXT_EIP FIBER_CONTEXT + CONTEXT_EIP #define FIBER_CONTEXT_ESP FIBER_CONTEXT + CONTEXT_ESP #define FIBER_CONTEXT_DR6 FIBER_CONTEXT + CONTEXT_DR6 #define FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD FIBER_CONTEXT + CONTEXT_FLOAT_SAVE_STATUS_WORD From fa5c83b4517b2b29c87bbdbfcd83f799d2c91406 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 16 May 2010 00:30:11 +0000 Subject: [PATCH 101/151] [KERNEL32] - SwitchToFiber: instead of doing a ret to the return address on the stack (which wouldn't work for a newly created fiber) store the returnaddress in the Eip field old fiber context and do a jmp to the Eip of the new fiber. - BasepInitializeContext: set the Eip member of the Context to BaseFiberStartup for fibers CreateFiberEx: initialize the fiber context, instead of an unused context on the stack. - BaseFiberStartup: Use GetCurrentFiber, not GetFiberData to get the current fiber. Fixes kernel32_wintest fiber svn path=/trunk/; revision=47232 --- reactos/dll/win32/kernel32/misc/utils.c | 2 +- reactos/dll/win32/kernel32/thread/fiber.c | 9 ++++----- reactos/dll/win32/kernel32/thread/i386/fiber.S | 12 ++++++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/reactos/dll/win32/kernel32/misc/utils.c b/reactos/dll/win32/kernel32/misc/utils.c index cebd500232b..04fde77fc82 100644 --- a/reactos/dll/win32/kernel32/misc/utils.c +++ b/reactos/dll/win32/kernel32/misc/utils.c @@ -364,7 +364,7 @@ BasepInitializeContext(IN PCONTEXT Context, } else if (ContextType == 2) /* For Fibers */ { - //Context->Eip = (ULONG)BaseFiberStartup; + Context->Eip = (ULONG)BaseFiberStartup; } else /* For first thread in a Process */ { diff --git a/reactos/dll/win32/kernel32/thread/fiber.c b/reactos/dll/win32/kernel32/thread/fiber.c index 656bc6ee19d..6ba2016b648 100644 --- a/reactos/dll/win32/kernel32/thread/fiber.c +++ b/reactos/dll/win32/kernel32/thread/fiber.c @@ -146,9 +146,8 @@ CreateFiberEx(SIZE_T dwStackCommitSize, PFIBER pfCurFiber; NTSTATUS nErrCode; INITIAL_TEB usFiberInitialTeb; - CONTEXT ctxFiberContext; PVOID ActivationContextStack = NULL; - DPRINT1("Creating Fiber\n"); + DPRINT("Creating Fiber\n"); #ifdef SXS_SUPPORT_ENABLED /* Allocate the Activation Context Stack */ @@ -203,7 +202,7 @@ CreateFiberEx(SIZE_T dwStackCommitSize, } /* initialize the context for the fiber */ - BasepInitializeContext(&ctxFiberContext, + BasepInitializeContext(&pfCurFiber->Context, lpParameter, lpStartAddress, usFiberInitialTeb.StackBase, @@ -253,10 +252,10 @@ WINAPI BaseFiberStartup(VOID) { #ifdef _M_IX86 - PFIBER Fiber = GetFiberData(); + PFIBER Fiber = GetCurrentFiber(); /* Call the Thread Startup Routine */ - DPRINT1("Starting Fiber\n"); + DPRINT("Starting Fiber\n"); BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Eax, (LPVOID)Fiber->Context.Ebx); #else diff --git a/reactos/dll/win32/kernel32/thread/i386/fiber.S b/reactos/dll/win32/kernel32/thread/i386/fiber.S index cf8bbe06064..57358ffeed4 100644 --- a/reactos/dll/win32/kernel32/thread/i386/fiber.S +++ b/reactos/dll/win32/kernel32/thread/i386/fiber.S @@ -24,7 +24,11 @@ _SwitchToFiber@4: mov [eax+FIBER_CONTEXT_ESI], esi mov [eax+FIBER_CONTEXT_EDI], edi mov [eax+FIBER_CONTEXT_EBP], ebp - + + /* Save the return address */ + mov ebx, [esp] + mov [eax+FIBER_CONTEXT_EIP], ebx + /* Check if we're to save FPU State */ cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT jnz NoFpuStateSave @@ -115,7 +119,7 @@ NoFpuStateRestore: mov eax, [ecx+FIBER_FLS_DATA] mov [edx+TEB_FLS_DATA], eax - /* Return */ - ret 4 - + /* Jump to new fiber */ + jmp [ecx+FIBER_CONTEXT_EIP] + /* EOF */ From 5ab3830ab59134c65eaae79998248039d1af0efb Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sun, 16 May 2010 04:57:24 +0000 Subject: [PATCH 102/151] [regedit] - Implement RegFindRecurse, RegFindWalk and helpers to find registry keys. Remove RegNextKey as its no longer used. Other misc fixes. Fixes searching in regedit. Patch by Katayama_Hirofumi. svn path=/trunk/; revision=47233 --- reactos/base/applications/regedit/find.c | 610 +++++++++++++++++-- reactos/base/applications/regedit/listview.c | 35 +- reactos/base/applications/regedit/regproc.c | 141 ----- reactos/base/applications/regedit/regproc.h | 4 - 4 files changed, 590 insertions(+), 200 deletions(-) diff --git a/reactos/base/applications/regedit/find.c b/reactos/base/applications/regedit/find.c index d718007adb5..ad495efdd63 100644 --- a/reactos/base/applications/regedit/find.c +++ b/reactos/base/applications/regedit/find.c @@ -25,13 +25,531 @@ static const TCHAR s_szFindFlagsR[] = _T("FindFlagsReactOS"); static HWND s_hwndAbortDialog; static BOOL s_bAbort; +static DWORD s_dwFlags; +static TCHAR s_szName[MAX_PATH]; +static DWORD s_cbName; +static const TCHAR s_empty[] = {0}; +static const TCHAR s_backslash[] = {'\\', 0}; + +extern VOID SetValueName(HWND hwndLV, LPCTSTR pszValueName); + +BOOL DoEvents(VOID) +{ + MSG msg; + if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + if (msg.message == WM_QUIT) + s_bAbort = TRUE; + if (!IsDialogMessage(s_hwndAbortDialog, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + return s_bAbort; +} + +static LPTSTR lstrstri(LPCTSTR psz1, LPCTSTR psz2) +{ + INT i, cch1, cch2; + + cch1 = lstrlen(psz1); + cch2 = lstrlen(psz2); + for(i = 0; i <= cch1 - cch2; i++) + { + if (CompareString(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, + psz1 + i, cch2, psz2, cch2) == 2) + return (LPTSTR) (psz1 + i); + } + return NULL; +} + +static BOOL CompareName(LPCTSTR pszName1, LPCTSTR pszName2) +{ + if (s_dwFlags & RSF_WHOLESTRING) + { + if (s_dwFlags & RSF_MATCHCASE) + return lstrcmp(pszName1, pszName2) == 0; + else + return lstrcmpi(pszName1, pszName2) == 0; + } + else + { + if (s_dwFlags & RSF_MATCHCASE) + return _tcsstr(pszName1, pszName2) != NULL; + else + return lstrstri(pszName1, pszName2) != NULL; + } +} + +static BOOL +CompareData( + DWORD dwType, + LPCTSTR psz1, + LPCTSTR psz2) +{ + INT i, cch1 = lstrlen(psz1), cch2 = lstrlen(psz2); + if (dwType == REG_SZ || dwType == REG_EXPAND_SZ) + { + if (s_dwFlags & RSF_WHOLESTRING) + { + if (s_dwFlags & RSF_MATCHCASE) + return 2 == CompareString(LOCALE_SYSTEM_DEFAULT, 0, + psz1, cch1, psz2, cch2); + else + return 2 == CompareString(LOCALE_SYSTEM_DEFAULT, + NORM_IGNORECASE, psz1, cch1, psz2, cch2); + } + + for(i = 0; i <= cch1 - cch2; i++) + { + if (s_dwFlags & RSF_MATCHCASE) + { + if (2 == CompareString(LOCALE_SYSTEM_DEFAULT, 0, + psz1 + i, cch2, psz2, cch2)) + return TRUE; + } + else + { + if (2 == CompareString(LOCALE_SYSTEM_DEFAULT, + NORM_IGNORECASE, psz1 + i, cch2, psz2, cch2)) + return TRUE; + } + } + } + return FALSE; +} + +int compare(const void *x, const void *y) +{ + const LPCTSTR *a = (const LPCTSTR *)x; + const LPCTSTR *b = (const LPCTSTR *)y; + return lstrcmpi(*a, *b); +} + +BOOL RegFindRecurse( + HKEY hKey, + LPCTSTR pszSubKey, + LPCTSTR pszValueName, + LPTSTR *ppszFoundSubKey, + LPTSTR *ppszFoundValueName) +{ + HKEY hSubKey; + LONG lResult; + TCHAR szSubKey[MAX_PATH]; + DWORD i, c, cb, type; + BOOL fPast = FALSE; + LPTSTR *ppszNames = NULL; + LPBYTE pb = NULL; + + if (DoEvents()) + return FALSE; + + lstrcpy(szSubKey, pszSubKey); + hSubKey = NULL; + + lResult = RegOpenKeyEx(hKey, szSubKey, 0, KEY_ALL_ACCESS, &hSubKey); + if (lResult != ERROR_SUCCESS) + return FALSE; + + if (pszValueName == NULL) + pszValueName = s_empty; + + lResult = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, NULL, NULL, NULL, + &c, NULL, NULL, NULL, NULL); + if (lResult != ERROR_SUCCESS) + goto err; + ppszNames = (LPTSTR *) malloc(c * sizeof(LPTSTR)); + if (ppszNames == NULL) + goto err; + ZeroMemory(ppszNames, c * sizeof(LPTSTR)); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + s_cbName = MAX_PATH * sizeof(TCHAR); + lResult = RegEnumValue(hSubKey, i, s_szName, &s_cbName, NULL, NULL, + NULL, &cb); + if (lResult == ERROR_NO_MORE_ITEMS) + { + c = i; + break; + } + if (lResult != ERROR_SUCCESS) + goto err; + if (s_cbName >= MAX_PATH * sizeof(TCHAR)) + continue; + + ppszNames[i] = _tcsdup(s_szName); + } + + qsort(ppszNames, c, sizeof(LPTSTR), compare); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + if (!fPast && lstrcmpi(ppszNames[i], pszValueName) == 0) + { + fPast = TRUE; + continue; + } + if (!fPast) + continue; + + if ((s_dwFlags & RSF_LOOKATVALUES) && + CompareName(ppszNames[i], s_szFindWhat)) + { + *ppszFoundSubKey = _tcsdup(szSubKey); + if (ppszNames[i][0] == 0) + *ppszFoundValueName = NULL; + else + *ppszFoundValueName = _tcsdup(ppszNames[i]); + goto success; + } + + lResult = RegQueryValueEx(hSubKey, ppszNames[i], NULL, &type, + NULL, &cb); + if (lResult != ERROR_SUCCESS) + goto err; + pb = malloc(cb); + if (pb == NULL) + goto err; + lResult = RegQueryValueEx(hSubKey, ppszNames[i], NULL, &type, + pb, &cb); + if (lResult != ERROR_SUCCESS) + goto err; + + if ((s_dwFlags & RSF_LOOKATDATA) && + CompareData(type, (LPTSTR) pb, s_szFindWhat)) + { + *ppszFoundSubKey = _tcsdup(szSubKey); + if (ppszNames[i][0] == 0) + *ppszFoundValueName = NULL; + else + *ppszFoundValueName = _tcsdup(ppszNames[i]); + goto success; + } + free(pb); + pb = NULL; + } + + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + ppszNames = NULL; + + lResult = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, &c, NULL, NULL, + NULL, NULL, NULL, NULL, NULL); + if (lResult != ERROR_SUCCESS) + goto err; + ppszNames = (LPTSTR *) malloc(c * sizeof(LPTSTR)); + if (ppszNames == NULL) + goto err; + ZeroMemory(ppszNames, c * sizeof(LPTSTR)); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + s_cbName = MAX_PATH * sizeof(TCHAR); + lResult = RegEnumKeyEx(hSubKey, i, s_szName, &s_cbName, NULL, NULL, + NULL, NULL); + if (lResult == ERROR_NO_MORE_ITEMS) + { + c = i; + break; + } + if (lResult != ERROR_SUCCESS) + goto err; + if (s_cbName >= MAX_PATH * sizeof(TCHAR)) + continue; + + ppszNames[i] = _tcsdup(s_szName); + } + + qsort(ppszNames, c, sizeof(LPTSTR), compare); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + if ((s_dwFlags & RSF_LOOKATKEYS) && + CompareName(ppszNames[i], s_szFindWhat)) + { + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(ppszNames[i]) + 2) * + sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, ppszNames[i]); + *ppszFoundValueName = NULL; + goto success; + } + + if (RegFindRecurse(hSubKey, ppszNames[i], NULL, ppszFoundSubKey, + ppszFoundValueName)) + { + LPTSTR psz = *ppszFoundSubKey; + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(psz) + 2) * sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, psz); + free(psz); + goto success; + } + } + +err: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + free(pb); + RegCloseKey(hSubKey); + return FALSE; + +success: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + RegCloseKey(hSubKey); + return TRUE; +} + +BOOL RegFindWalk( + HKEY * phKey, + LPCTSTR pszSubKey, + LPCTSTR pszValueName, + LPTSTR *ppszFoundSubKey, + LPTSTR *ppszFoundValueName) +{ + LONG lResult; + DWORD i, c; + HKEY hBaseKey, hSubKey; + TCHAR szKeyName[MAX_PATH]; + TCHAR szSubKey[MAX_PATH]; + LPTSTR pch; + BOOL fPast; + LPTSTR *ppszNames = NULL; + + hBaseKey = *phKey; + if (RegFindRecurse(hBaseKey, pszSubKey, pszValueName, ppszFoundSubKey, + ppszFoundValueName)) + return TRUE; + + if (lstrlen(pszSubKey) >= MAX_PATH) + return FALSE; + + lstrcpy(szSubKey, pszSubKey); + while(szSubKey[0] != 0) + { + if (DoEvents()) + return FALSE; + + pch = _tcsrchr(szSubKey, _T('\\')); + if (pch == NULL) + { + lstrcpy(szKeyName, szSubKey); + szSubKey[0] = 0; + hSubKey = hBaseKey; + } + else + { + lstrcpyn(szKeyName, pch + 1, MAX_PATH); + *pch = 0; + lResult = RegOpenKeyEx(hBaseKey, szSubKey, 0, KEY_ALL_ACCESS, + &hSubKey); + if (lResult != ERROR_SUCCESS) + return FALSE; + } + + lResult = RegQueryInfoKey(hSubKey, NULL, NULL, NULL, &c, NULL, NULL, + NULL, NULL, NULL, NULL, NULL); + if (lResult != ERROR_SUCCESS) + goto err; + + ppszNames = (LPTSTR *) malloc(c * sizeof(LPTSTR)); + if (ppszNames == NULL) + goto err; + ZeroMemory(ppszNames, c * sizeof(LPTSTR)); + + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + s_cbName = MAX_PATH * sizeof(TCHAR); + lResult = RegEnumKeyExW(hSubKey, i, s_szName, &s_cbName, + NULL, NULL, NULL, NULL); + if (lResult == ERROR_NO_MORE_ITEMS) + { + c = i; + break; + } + if (lResult != ERROR_SUCCESS) + break; + ppszNames[i] = _tcsdup(s_szName); + } + + qsort(ppszNames, c, sizeof(LPTSTR), compare); + + fPast = FALSE; + for(i = 0; i < c; i++) + { + if (DoEvents()) + goto err; + + if (!fPast && lstrcmpi(ppszNames[i], szKeyName) == 0) + { + fPast = TRUE; + continue; + } + if (!fPast) + continue; + + if ((s_dwFlags & RSF_LOOKATKEYS) && + CompareName(ppszNames[i], s_szFindWhat)) + { + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(ppszNames[i]) + 2) * + sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, ppszNames[i]); + *ppszFoundValueName = NULL; + goto success; + } + + if (RegFindRecurse(hSubKey, ppszNames[i], NULL, + ppszFoundSubKey, ppszFoundValueName)) + { + LPTSTR psz = *ppszFoundSubKey; + *ppszFoundSubKey = malloc( + (lstrlen(szSubKey) + lstrlen(psz) + 2) * + sizeof(TCHAR)); + if (*ppszFoundSubKey == NULL) + goto err; + if (szSubKey[0]) + { + lstrcpy(*ppszFoundSubKey, szSubKey); + lstrcatW(*ppszFoundSubKey, s_backslash); + } + else + **ppszFoundSubKey = 0; + lstrcatW(*ppszFoundSubKey, psz); + free(psz); + goto success; + } + } + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + ppszNames = NULL; + + if (hBaseKey != hSubKey) + RegCloseKey(hSubKey); + } + + if (*phKey == HKEY_CLASSES_ROOT) + { + *phKey = HKEY_CURRENT_USER; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + return TRUE; + } + + if (*phKey == HKEY_CURRENT_USER) + { + *phKey = HKEY_LOCAL_MACHINE; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + goto success; + } + + if (*phKey == HKEY_LOCAL_MACHINE) + { + *phKey = HKEY_USERS; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + goto success; + } + + if (*phKey == HKEY_USERS) + { + *phKey = HKEY_CURRENT_CONFIG; + if (RegFindRecurse(*phKey, s_empty, NULL, ppszFoundSubKey, + ppszFoundValueName)) + goto success; + } + +err: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + if (hBaseKey != hSubKey) + RegCloseKey(hSubKey); + return FALSE; + +success: + if (ppszNames != NULL) + { + for(i = 0; i < c; i++) + free(ppszNames[i]); + free(ppszNames); + } + if (hBaseKey != hSubKey) + RegCloseKey(hSubKey); + return TRUE; +} static DWORD GetFindFlags(void) { HKEY hKey; - DWORD dwFlags = RSF_LOOKATKEYS; DWORD dwType, dwValue, cbData; + DWORD dwFlags = RSF_LOOKATKEYS | RSF_LOOKATVALUES | RSF_LOOKATDATA; if (RegOpenKey(HKEY_CURRENT_USER, g_szGeneralRegKey, &hKey) == ERROR_SUCCESS) { @@ -102,45 +620,48 @@ static INT_PTR CALLBACK AbortFindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, return 0; } -static BOOL RegSearchProc(LPVOID lpParam) -{ - MSG msg; - UNREFERENCED_PARAMETER(lpParam); - - if (s_hwndAbortDialog && PeekMessage(&msg, s_hwndAbortDialog, 0, 0, PM_REMOVE)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - return s_bAbort; -} - BOOL FindNext(HWND hWnd) { HKEY hKeyRoot; - LPCTSTR pszFindWhat; LPCTSTR pszKeyPath; - DWORD dwFlags; - LONG lResult; - TCHAR szSubKey[512]; - TCHAR szError[512]; - TCHAR szTitle[64]; + BOOL fSuccess; TCHAR szFullKey[512]; + LPCTSTR pszValueName; + LPTSTR pszFoundSubKey, pszFoundValueName; - pszFindWhat = s_szFindWhat; - dwFlags = GetFindFlags() & ~(RSF_LOOKATVALUES | RSF_LOOKATDATA); + s_dwFlags = GetFindFlags(); pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); - lstrcpyn(szSubKey, pszKeyPath, sizeof(szSubKey) / sizeof(szSubKey[0])); + if (pszKeyPath == NULL) + { + hKeyRoot = HKEY_CLASSES_ROOT; + pszKeyPath = s_empty; + } /* Create abort find dialog */ - s_hwndAbortDialog = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_FINDING), hWnd, AbortFindDialogProc); + s_hwndAbortDialog = CreateDialog(GetModuleHandle(NULL), + MAKEINTRESOURCE(IDD_FINDING), hWnd, AbortFindDialogProc); if (s_hwndAbortDialog) + { ShowWindow(s_hwndAbortDialog, SW_SHOW); + UpdateWindow(s_hwndAbortDialog); + } s_bAbort = FALSE; - lResult = RegSearch(hKeyRoot, szSubKey, sizeof(szSubKey) / sizeof(szSubKey[0]), - pszFindWhat, 0, dwFlags, RegSearchProc, NULL); + pszValueName = GetValueName(g_pChildWnd->hListWnd, -1); + + EnableWindow(hFrameWnd, FALSE); + EnableWindow(g_pChildWnd->hTreeWnd, FALSE); + EnableWindow(g_pChildWnd->hListWnd, FALSE); + EnableWindow(g_pChildWnd->hAddressBarWnd, FALSE); + + fSuccess = RegFindWalk(&hKeyRoot, pszKeyPath, pszValueName, + &pszFoundSubKey, &pszFoundValueName); + + EnableWindow(hFrameWnd, TRUE); + EnableWindow(g_pChildWnd->hTreeWnd, TRUE); + EnableWindow(g_pChildWnd->hListWnd, TRUE); + EnableWindow(g_pChildWnd->hAddressBarWnd, TRUE); if (s_hwndAbortDialog) { @@ -148,25 +669,15 @@ BOOL FindNext(HWND hWnd) s_hwndAbortDialog = NULL; } - /* Did the user click "Cancel"? If so, exit without displaying an error message */ - if (lResult == ERROR_OPERATION_ABORTED) - return FALSE; - - if (lResult != ERROR_SUCCESS) + if (fSuccess) { - LoadString(NULL, IDS_APP_TITLE, szTitle, sizeof(szTitle) / sizeof(szTitle[0])); - - if ((lResult != ERROR_NO_MORE_ITEMS) || !LoadString(NULL, IDS_FINISHEDFIND, szError, sizeof(szError) / sizeof(szError[0]))) - { - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, lResult, 0, - szError, sizeof(szError) / sizeof(szError[0]), NULL); - } - MessageBox(hWnd, szError, szTitle, MB_OK); - return FALSE; + RegKeyGetName(szFullKey, COUNT_OF(szFullKey), hKeyRoot, pszFoundSubKey); + SelectNode(g_pChildWnd->hTreeWnd, szFullKey); + SetValueName(g_pChildWnd->hListWnd, pszFoundValueName); + free(pszFoundSubKey); + free(pszFoundValueName); + SetFocus(g_pChildWnd->hListWnd); } - - RegKeyGetName(szFullKey, sizeof(szFullKey) / sizeof(szFullKey[0]), hKeyRoot, szSubKey); - SelectNode(g_pChildWnd->hTreeWnd, szFullKey); return TRUE; } @@ -183,26 +694,17 @@ static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR case WM_INITDIALOG: dwFlags = GetFindFlags(); - /* Looking at values is not yet implemented */ hControl = GetDlgItem(hDlg, IDC_LOOKAT_KEYS); if (hControl) SendMessage(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATKEYS) ? TRUE : FALSE, 0); - /* Looking at values is not yet implemented */ hControl = GetDlgItem(hDlg, IDC_LOOKAT_VALUES); if (hControl) - { - lStyle = GetWindowLongPtr(hControl, GWL_STYLE); - SetWindowLongPtr(hControl, GWL_STYLE, lStyle | WS_DISABLED); - } + SendMessage(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATVALUES) ? TRUE : FALSE, 0); - /* Looking at data is not yet implemented */ hControl = GetDlgItem(hDlg, IDC_LOOKAT_DATA); if (hControl) - { - lStyle = GetWindowLongPtr(hControl, GWL_STYLE); - SetWindowLongPtr(hControl, GWL_STYLE, lStyle | WS_DISABLED); - } + SendMessage(hControl, BM_SETCHECK, (dwFlags & RSF_LOOKATDATA) ? TRUE : FALSE, 0); /* Match whole string */ hControl = GetDlgItem(hDlg, IDC_MATCHSTRING); diff --git a/reactos/base/applications/regedit/listview.c b/reactos/base/applications/regedit/listview.c index 64a6e123ef4..6e95a863ff9 100644 --- a/reactos/base/applications/regedit/listview.c +++ b/reactos/base/applications/regedit/listview.c @@ -27,6 +27,7 @@ int Image_String = 0; int Image_Bin = 0; +INT iListViewSelect = -1; typedef struct tagLINE_INFO { @@ -76,6 +77,29 @@ LPCTSTR GetValueName(HWND hwndLV, int iStartAt) return lineinfo->name; } +VOID SetValueName(HWND hwndLV, LPCTSTR pszValueName) +{ + INT i, c; + LV_FINDINFO fi; + + c = ListView_GetItemCount(hwndLV); + for(i = 0; i < c; i++) + { + ListView_SetItemState(hwndLV, i, 0, LVIS_FOCUSED | LVIS_SELECTED); + } + if (pszValueName == NULL) + i = 0; + else + { + fi.flags = LVFI_STRING; + fi.psz = pszValueName; + i = ListView_FindItem(hwndLV, -1, &fi); + } + ListView_SetItemState(hwndLV, i, LVIS_FOCUSED | LVIS_SELECTED, + LVIS_FOCUSED | LVIS_SELECTED); + iListViewSelect = i; +} + BOOL IsDefaultValue(HWND hwndLV, int i) { PLINE_INFO lineinfo; @@ -497,6 +521,7 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath) DWORD val_count; HKEY hNewKey; LONG errCode; + INT i, c; BOOL AddedDefault = FALSE; if (!hwndLV) return FALSE; @@ -552,7 +577,15 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath) { AddEntryToList(hwndLV, _T(""), REG_SZ, NULL, 0, 0, FALSE); } - (void)ListView_SortItems(hwndLV, CompareFunc, (WPARAM)hwndLV); + ListView_SortItems(hwndLV, CompareFunc, (WPARAM)hwndLV); + c = ListView_GetItemCount(hwndLV); + for(i = 0; i < c; i++) + { + ListView_SetItemState(hwndLV, i, 0, LVIS_FOCUSED | LVIS_SELECTED); + } + ListView_SetItemState(hwndLV, iListViewSelect, + LVIS_FOCUSED | LVIS_SELECTED, + LVIS_FOCUSED | LVIS_SELECTED); RegCloseKey(hNewKey); SendMessage(hwndLV, WM_SETREDRAW, TRUE, 0); diff --git a/reactos/base/applications/regedit/regproc.c b/reactos/base/applications/regedit/regproc.c index c67e05df7a6..2ba45c29faf 100644 --- a/reactos/base/applications/regedit/regproc.c +++ b/reactos/base/applications/regedit/regproc.c @@ -1497,147 +1497,6 @@ done: return lResult; } -/****************************************************************************** - * Searching - */ - -static LONG RegNextKey(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength) -{ - LONG lResult; - LPTSTR s; - LPCTSTR pszOriginalKey; - TCHAR szKeyName[256]; - HKEY hSubKey, hBaseKey; - DWORD dwIndex = 0; - DWORD cbName; - FILETIME ft; - BOOL bFoundKey = FALSE; - - /* Try accessing a subkey */ - if (RegOpenKeyEx(hKey, lpSubKey, 0, KEY_ALL_ACCESS, &hSubKey) == ERROR_SUCCESS) - { - cbName = (DWORD) iSubKeyLength - _tcslen(lpSubKey) - 1; - lResult = RegEnumKeyEx(hSubKey, 0, lpSubKey + _tcslen(lpSubKey) + 1, - &cbName, NULL, NULL, NULL, &ft); - RegCloseKey(hSubKey); - - if (lResult == ERROR_SUCCESS) - { - lpSubKey[_tcslen(lpSubKey)] = '\\'; - bFoundKey = TRUE; - } - } - - if (!bFoundKey) - { - /* Go up and find the next sibling key */ - do - { - s = _tcsrchr(lpSubKey, TEXT('\\')); - if (s) - { - *s = '\0'; - pszOriginalKey = s + 1; - - hBaseKey = NULL; - RegOpenKeyEx(hKey, lpSubKey, 0, KEY_ALL_ACCESS, &hBaseKey); - } - else - { - pszOriginalKey = lpSubKey; - hBaseKey = hKey; - } - - if (hBaseKey) - { - dwIndex = 0; - do - { - lResult = RegEnumKey(hBaseKey, dwIndex++, szKeyName, sizeof(szKeyName) / sizeof(szKeyName[0])); - } - while((lResult == ERROR_SUCCESS) && _tcscmp(szKeyName, pszOriginalKey)); - - if (lResult == ERROR_SUCCESS) - { - lResult = RegEnumKey(hBaseKey, dwIndex++, szKeyName, sizeof(szKeyName) / sizeof(szKeyName[0])); - if (lResult == ERROR_SUCCESS) - { - bFoundKey = TRUE; - _sntprintf(lpSubKey + _tcslen(lpSubKey), iSubKeyLength - _tcslen(lpSubKey), _T("\\%s"), szKeyName); - } - } - RegCloseKey(hBaseKey); - } - } - while(!bFoundKey); - } - return bFoundKey ? ERROR_SUCCESS : ERROR_NO_MORE_ITEMS; -} - -static BOOL RegSearchCompare(LPCTSTR s1, LPCTSTR s2, DWORD dwSearchFlags) -{ - BOOL bResult; - if (dwSearchFlags & RSF_WHOLESTRING) - { - if (dwSearchFlags & RSF_MATCHCASE) - bResult = !_tcscmp(s1, s2); - else - bResult = !_tcsicmp(s1, s2); - } - else - { - if (dwSearchFlags & RSF_MATCHCASE) - bResult = (_tcsstr(s1, s2) != NULL); - else - { - /* My kingdom for _tcsistr() */ - bResult = FALSE; - while(*s1) - { - if (!_tcsnicmp(s1, s2, _tcslen(s2))) - { - bResult = TRUE; - break; - } - s1++; - } - } - } - return bResult; -} - -LONG RegSearch(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength, - LPCTSTR pszSearchString, DWORD dwValueIndex, - DWORD dwSearchFlags, BOOL (*pfnCallback)(LPVOID), LPVOID lpParam) -{ - LONG lResult; - LPCTSTR s; - - UNREFERENCED_PARAMETER(dwValueIndex); - - if (dwSearchFlags & (RSF_LOOKATVALUES | RSF_LOOKATDATA)) - return ERROR_CALL_NOT_IMPLEMENTED; /* NYI */ - - do - { - if (pfnCallback) - { - if (pfnCallback(lpParam)) - return ERROR_OPERATION_ABORTED; - } - - lResult = RegNextKey(hKey, lpSubKey, iSubKeyLength); - if (lResult != ERROR_SUCCESS) - return lResult; - - s = _tcsrchr(lpSubKey, TEXT('\\')); - s = s ? s + 1 : lpSubKey; - } - while(!(dwSearchFlags & RSF_LOOKATKEYS) || !RegSearchCompare(s, pszSearchString, dwSearchFlags)); - - return ERROR_SUCCESS; -} - /****************************************************************************** * Key naming and parsing */ diff --git a/reactos/base/applications/regedit/regproc.h b/reactos/base/applications/regedit/regproc.h index 15bb2484728..aae3a4a969b 100644 --- a/reactos/base/applications/regedit/regproc.h +++ b/reactos/base/applications/regedit/regproc.h @@ -92,10 +92,6 @@ LONG RegQueryStringValue(HKEY hKey, LPCTSTR lpSubKey, LPCTSTR lpValueName, LPTST #define RSF_LOOKATDATA 0x00000008 #define RSF_MATCHCASE 0x00010000 -LONG RegSearch(HKEY hKey, LPTSTR lpSubKey, size_t iSubKeyLength, - LPCTSTR pszSearchString, DWORD dwValueIndex, - DWORD dwSearchFlags, BOOL (*pfnCallback)(LPVOID), LPVOID lpParam); - BOOL RegKeyGetName(LPTSTR pszDest, size_t iDestLength, HKEY hRootKey, LPCTSTR lpSubKey); /* EOF */ From 5ea607ab590e494397b45130dcd52ff18cc41f46 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 16 May 2010 05:22:51 +0000 Subject: [PATCH 103/151] [AFD] - Fix a typo in r47156 - Fixes Firefox regression (bug 5384) - Thanks to mjmartin for testing svn path=/trunk/; revision=47234 --- reactos/drivers/network/afd/afd/read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/drivers/network/afd/afd/read.c b/reactos/drivers/network/afd/afd/read.c index 3c6ddaa861f..dccfa559ba8 100644 --- a/reactos/drivers/network/afd/afd/read.c +++ b/reactos/drivers/network/afd/afd/read.c @@ -187,7 +187,7 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) { } } - if( !FCB->Recv.Content ) { + if( FCB->Recv.Content ) { FCB->PollState |= AFD_EVENT_RECEIVE; } else FCB->PollState &= ~AFD_EVENT_RECEIVE; From 9271a5bcb079d244f85347286cce622f5ad8e876 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 16 May 2010 07:03:03 +0000 Subject: [PATCH 104/151] [kernel32] -OpenConsoleW: Don't crash when wsName is null svn path=/trunk/; revision=47235 --- reactos/dll/win32/kernel32/misc/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/kernel32/misc/console.c b/reactos/dll/win32/kernel32/misc/console.c index 7ead208edf2..594b8ac2abb 100644 --- a/reactos/dll/win32/kernel32/misc/console.c +++ b/reactos/dll/win32/kernel32/misc/console.c @@ -993,11 +993,11 @@ OpenConsoleW(LPCWSTR wsName, ULONG CsrRequest; NTSTATUS Status = STATUS_SUCCESS; - if (0 == _wcsicmp(wsName, L"CONIN$")) + if (wsName && 0 == _wcsicmp(wsName, L"CONIN$")) { CsrRequest = MAKE_CSR_API(GET_INPUT_HANDLE, CSR_NATIVE); } - else if (0 == _wcsicmp(wsName, L"CONOUT$")) + else if (wsName && 0 == _wcsicmp(wsName, L"CONOUT$")) { CsrRequest = MAKE_CSR_API(GET_OUTPUT_HANDLE, CSR_NATIVE); } From 250427a4d12d4d5e356dc4929f7313521f4222ad Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 16 May 2010 08:09:19 +0000 Subject: [PATCH 105/151] [user32_winetest] -deactivate a test that hangs svn path=/trunk/; revision=47236 --- rostests/winetests/user32/win.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rostests/winetests/user32/win.c b/rostests/winetests/user32/win.c index 96033a2746c..f6d86209f54 100644 --- a/rostests/winetests/user32/win.c +++ b/rostests/winetests/user32/win.c @@ -6037,7 +6037,7 @@ START_TEST(win) test_capture_1(); test_capture_2(); test_capture_3(hwndMain, hwndMain2); - test_capture_4(); + //test_capture_4(); test_CreateWindow(); test_parent_owner(); From 089c4ecbb9273e8e34871c57c3464b74aca5c080 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 16 May 2010 09:26:35 +0000 Subject: [PATCH 106/151] [win32] -Call HCBT_CREATEWND, WM_NCCREATE and WM_CREATE with correct style and position -Fixes some user32:win tests svn path=/trunk/; revision=47237 --- .../subsystems/win32/win32k/ntuser/window.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index f22c6dce047..526b15ac515 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -1998,14 +1998,16 @@ AllocErr: else dwExStyle &= ~WS_EX_WINDOWEDGE; + Wnd->style = dwStyle & ~WS_VISIBLE; + /* Correct the window style. */ - if (!(dwStyle & WS_CHILD)) + if ((Wnd->style & (WS_CHILD | WS_POPUP)) != WS_CHILD) { - dwStyle |= WS_CLIPSIBLINGS; + Wnd->style |= WS_CLIPSIBLINGS; DPRINT("3: Style is now %lx\n", dwStyle); - if (!(dwStyle & WS_POPUP)) + if (!(Wnd->style & WS_POPUP)) { - dwStyle |= WS_CAPTION; + Wnd->style |= WS_CAPTION; Window->state |= WINDOWOBJECT_NEED_SIZE; DPRINT("4: Style is now %lx\n", dwStyle); } @@ -2066,7 +2068,6 @@ AllocErr: Size.cy = nHeight; Wnd->ExStyle = dwExStyle; - Wnd->style = dwStyle & ~WS_VISIBLE; /* call hook */ Cs.lpCreateParams = lpParam; @@ -2099,6 +2100,8 @@ AllocErr: y = Cs.y; nWidth = Cs.cx; nHeight = Cs.cy; + + Cs.style = dwStyle; // FIXME: Need to set the Z order in the window link list if the hook callback changed it! // hwndInsertAfter = CbtCreate.hwndInsertAfter; @@ -2246,11 +2249,6 @@ AllocErr: /* FIXME: Initialize the window menu. */ /* Send a NCCREATE message. */ - Cs.cx = Size.cx; - Cs.cy = Size.cy; - Cs.x = Pos.x; - Cs.y = Pos.y; - DPRINT("[win32k.window] IntCreateWindowEx style %d, exstyle %d, parent %d\n", Cs.style, Cs.dwExStyle, Cs.hwndParent); DPRINT("IntCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, Size.cx, Size.cy); DPRINT("IntCreateWindowEx(): About to send NCCREATE message.\n"); From 2dde7c67136a5a3b6e186917cc0c200732af5b95 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sun, 16 May 2010 09:32:51 +0000 Subject: [PATCH 107/151] [user32] -CreateWindow should fail when called with WS_EX_MDICHILD and the specified parent is not an mdiclient svn path=/trunk/; revision=47238 --- reactos/dll/win32/user32/windows/window.c | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index 6ed38cce020..2aa01a9941d 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -287,6 +287,18 @@ CreateWindowExA(DWORD dwExStyle, POINT mPos[2]; UINT id = 0; HWND top_child; + PWND WndParent; + PCLS pcls; + + if(!(WndParent = ValidateHwnd(hWndParent)) || + !(pcls = DesktopPtrToUser(WndParent->pcls))) + return 0; + + if (pcls->fnid != FNID_MDICLIENT) + { + ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent); + return 0; + } /* lpParams of WM_[NC]CREATE is different for MDI children. * MDICREATESTRUCT members have the originally passed values. @@ -399,6 +411,24 @@ CreateWindowExW(DWORD dwExStyle, POINT mPos[2]; UINT id = 0; HWND top_child; + PWND WndParent; + PCLS pcls; + + WndParent = ValidateHwnd(hWndParent); + + if(!WndParent) + return 0; + + pcls = DesktopPtrToUser(WndParent->pcls); + + if(!pcls) + return 0; + + if (pcls->fnid != FNID_MDICLIENT) + { + ERR("WS_EX_MDICHILD, but parent %p is not MDIClient\n", hWndParent); + return 0; + } /* lpParams of WM_[NC]CREATE is different for MDI children. * MDICREATESTRUCT members have the originally passed values. From 110f06f6c0af53ca2cca7cec6d48f8158b682c01 Mon Sep 17 00:00:00 2001 From: Daniel Reimer Date: Sun, 16 May 2010 12:44:22 +0000 Subject: [PATCH 108/151] Update: DosBox to 0.74, Mirror of FireFox 2, IrfanView to 4.27, RosBE to 1.5.1, uTorrent to 2.0.2. svn path=/trunk/; revision=47240 --- reactos/base/applications/rapps/rapps/dosbox.txt | 4 ++-- reactos/base/applications/rapps/rapps/firefox2.txt | 12 ++++++------ reactos/base/applications/rapps/rapps/irfanview.txt | 4 ++-- .../applications/rapps/rapps/irfanviewplugins.txt | 6 +++--- reactos/base/applications/rapps/rapps/rosbe.txt | 4 ++-- reactos/base/applications/rapps/rapps/utorrent.txt | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/reactos/base/applications/rapps/rapps/dosbox.txt b/reactos/base/applications/rapps/rapps/dosbox.txt index 783779deeed..7a25f08dcb9 100644 --- a/reactos/base/applications/rapps/rapps/dosbox.txt +++ b/reactos/base/applications/rapps/rapps/dosbox.txt @@ -2,13 +2,13 @@ [Section] Name = DOSBox -Version = 0.73 +Version = 0.74 Licence = GPL Description = DOSBox is a DOS emulator. Size = 1.4MB Category = 15 URLSite = http://www.dosbox.com/ -URLDownload = http://ovh.dl.sourceforge.net/sourceforge/dosbox/DOSBox0.73-win32-installer.exe +URLDownload = http://ovh.dl.sourceforge.net/sourceforge/dosbox/DOSBox0.74-win32-installer.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/firefox2.txt b/reactos/base/applications/rapps/rapps/firefox2.txt index 0c6379485c7..3cf7dc27921 100644 --- a/reactos/base/applications/rapps/rapps/firefox2.txt +++ b/reactos/base/applications/rapps/rapps/firefox2.txt @@ -8,35 +8,35 @@ Description = The most popular and one of the best free Web Browsers out there. Size = 5.8M Category = 5 URLSite = http://www.mozilla.com/en-US/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/en-US/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/en-US/Firefox%20Setup%202.0.0.20.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. Size = 5.5M URLSite = http://www.mozilla-europe.org/de/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/de/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/de/Firefox%20Setup%202.0.0.20.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. Size = 5.6M URLSite = http://www.mozilla-europe.org/es/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/es-ES/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/es-ES/Firefox%20Setup%202.0.0.20.exe [Section.0414] Description = Mest populære og best også gratis nettleserene der ute. Size = 5.6M URLSite = http://www.mozilla-europe.org/no/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/nb-NO/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/nb-NO/Firefox%20Setup%202.0.0.20.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych. Size = 6.3M URLSite = http://www.mozilla-europe.org/pl/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/pl/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/pl/Firefox%20Setup%202.0.0.20.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных браузеров. Size = 6.4M URLSite = http://www.mozilla-europe.org/ru/ -URLDownload = http://mozilla.mirrors.easynews.com/mozilla/firefox/releases/2.0.0.20/win32/ru/Firefox%20Setup%202.0.0.20.exe +URLDownload = http://194.71.11.70/pub/www/clients/mozilla.org/firefox/releases/2.0.0.20/win32/ru/Firefox%20Setup%202.0.0.20.exe diff --git a/reactos/base/applications/rapps/rapps/irfanview.txt b/reactos/base/applications/rapps/rapps/irfanview.txt index 9f1d5743f68..c392d1eea3e 100644 --- a/reactos/base/applications/rapps/rapps/irfanview.txt +++ b/reactos/base/applications/rapps/rapps/irfanview.txt @@ -2,13 +2,13 @@ [Section] Name = IrfanView -Version = 4.25 +Version = 4.27 Licence = Freeware (for personal use) Description = Viewer for all kinds of graphics/audio files/video files. Size = 1.3MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://irfanview.tuwien.ac.at/iview425_setup.exe +URLDownload = http://irfanview.tuwien.ac.at/iview427_setup.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/irfanviewplugins.txt b/reactos/base/applications/rapps/rapps/irfanviewplugins.txt index 9d36ab8faa8..fc7ab238b6e 100644 --- a/reactos/base/applications/rapps/rapps/irfanviewplugins.txt +++ b/reactos/base/applications/rapps/rapps/irfanviewplugins.txt @@ -2,13 +2,13 @@ [Section] Name = IrfanView Plugins -Version = 4.25 +Version = 4.27 Licence = Freeware (for personal use) Description = Additional Plugins for supporting more file types. -Size = 7.7MB +Size = 7.8MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_425_setup.exe +URLDownload = http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_427_setup.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/rosbe.txt b/reactos/base/applications/rapps/rapps/rosbe.txt index 7d7918b5c78..384df84563a 100644 --- a/reactos/base/applications/rapps/rapps/rosbe.txt +++ b/reactos/base/applications/rapps/rapps/rosbe.txt @@ -2,13 +2,13 @@ [Section] Name = ReactOS Build Environment -Version = 1.5 +Version = 1.5.1 Licence = GPL Description = Allows you to build the ReactOS Source. For more instructions see ReactOS wiki. Size = 13.5MB Category = 7 URLSite = http://reactos.org/wiki/Build_Environment/ -URLDownload = http://ovh.dl.sourceforge.net/sourceforge/reactos/RosBE-1.5.exe +URLDownload = http://ovh.dl.sourceforge.net/sourceforge/reactos/RosBE-1.5.1.exe CDPath = none [Section.0407] diff --git a/reactos/base/applications/rapps/rapps/utorrent.txt b/reactos/base/applications/rapps/rapps/utorrent.txt index ffcded74c34..f987811b5a8 100644 --- a/reactos/base/applications/rapps/rapps/utorrent.txt +++ b/reactos/base/applications/rapps/rapps/utorrent.txt @@ -2,13 +2,13 @@ [Section] Name = µTorrent -Version = 2.0.1 +Version = 2.0.2 Licence = Freeware for non-commercial uses Description = Small and fast BitTorrent Client. -Size = 314K +Size = 315K Category = 5 URLSite = http://www.utorrent.com/ -URLDownload = http://download.utorrent.com/2.0.1/utorrent.exe +URLDownload = http://download.utorrent.com/2.0.2/utorrent.exe CDPath = none From f01aef274dbc87d647c47eb5d3a1185aa6179f95 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 16 May 2010 13:33:52 +0000 Subject: [PATCH 109/151] [RBUILD] close tag in generated vcxproj files (VS2010 support still incomplete) See issue #5199 for more details. svn path=/trunk/; revision=47241 --- reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp index cc8cedf367c..7a210206d86 100644 --- a/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp @@ -261,7 +261,7 @@ VCXProjMaker::_generate_proj_file ( const Module& module ) fprintf ( OUT, "\t\t%s\r\n", "Win32Proj" ); //FIXME: Win32Proj??? fprintf ( OUT, "\t\t%s\r\n", module.name.c_str() ); //FIXME: shouldn't this be the soltion name? fprintf ( OUT, "\t\r\n" ); - + fprintf ( OUT, "" ); } From ddf4c022d0337aab4dc1ffade287d6ab16dfe1c5 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sun, 16 May 2010 13:57:04 +0000 Subject: [PATCH 110/151] Translate "Common Files" string. Fixes a partially translated environment variable. svn path=/trunk/; revision=47242 --- reactos/dll/win32/userenv/lang/de-DE.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/userenv/lang/de-DE.rc b/reactos/dll/win32/userenv/lang/de-DE.rc index 3c28dc6f153..8795fd94c6f 100644 --- a/reactos/dll/win32/userenv/lang/de-DE.rc +++ b/reactos/dll/win32/userenv/lang/de-DE.rc @@ -44,5 +44,5 @@ BEGIN IDS_HISTORY "Lokale Einstellungen\\Verlauf" IDS_COOKIES "Cookies" IDS_PROGRAMFILES "%SystemDrive%\\Programme" - IDS_COMMONFILES "Common Files" + IDS_COMMONFILES "Gemeinsame Dateien" END From 46b55c3dc2cd9c042331e71d3b4f6d055131650c Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Sun, 16 May 2010 14:08:04 +0000 Subject: [PATCH 111/151] Translate Common files for french as well. svn path=/trunk/; revision=47243 --- reactos/dll/win32/userenv/lang/fr-FR.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/userenv/lang/fr-FR.rc b/reactos/dll/win32/userenv/lang/fr-FR.rc index e95f2b0c52b..a3baf6ea524 100644 --- a/reactos/dll/win32/userenv/lang/fr-FR.rc +++ b/reactos/dll/win32/userenv/lang/fr-FR.rc @@ -44,5 +44,5 @@ BEGIN IDS_HISTORY "Local Settings\\Historique" IDS_COOKIES "Cookies" IDS_PROGRAMFILES "%SystemDrive%\\Program Files" - IDS_COMMONFILES "Common Files" + IDS_COMMONFILES "Fichiers communs" END From 4833210740f746c91a54259aca937dd1d0f8c9a5 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 16 May 2010 22:24:26 +0000 Subject: [PATCH 112/151] [KERNEL32] Protect GlobalLock, GlobalUnlock and GlobalSize with SEH, use IsBadReadPtr in GlobalLock. Inspired by wine code. Fixes user32_winetest dde crash. svn path=/trunk/; revision=47246 --- reactos/dll/win32/kernel32/mem/global.c | 209 +++++++++++++----------- 1 file changed, 118 insertions(+), 91 deletions(-) diff --git a/reactos/dll/win32/kernel32/mem/global.c b/reactos/dll/win32/kernel32/mem/global.c index 9537cbc774a..f2cfca5b01c 100644 --- a/reactos/dll/win32/kernel32/mem/global.c +++ b/reactos/dll/win32/kernel32/mem/global.c @@ -380,44 +380,53 @@ GlobalLock(HGLOBAL hMem) /* Check if this was a simple allocated heap entry */ if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) { - /* Then simply return the pointer */ - return hMem; + /* Verify and return the pointer */ + return IsBadReadPtr(hMem, 1) ? NULL : hMem; } /* Otherwise, lock the heap */ RtlLockHeap(hProcessHeap); - /* Get the handle entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); + _SEH2_TRY + { + /* Get the handle entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); - /* Make sure it's valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* It's not, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - Ptr = NULL; - } - else - { - /* Otherwise, get the pointer */ - Ptr = HandleEntry->Object; - if (Ptr) + /* Make sure it's valid */ + if (!BaseHeapValidateEntry(HandleEntry)) { - /* Increase the lock count, unless we've went too far */ - if (HandleEntry->LockCount++ == GMEM_LOCKCOUNT) - { - /* In which case we simply unlock once */ - HandleEntry->LockCount--; - } + /* It's not, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + Ptr = NULL; } else { - /* The handle is still there but the memory was already freed */ - SetLastError(ERROR_DISCARDED); + /* Otherwise, get the pointer */ + Ptr = HandleEntry->Object; + if (Ptr) + { + /* Increase the lock count, unless we've went too far */ + if (HandleEntry->LockCount++ == GMEM_LOCKCOUNT) + { + /* In which case we simply unlock once */ + HandleEntry->LockCount--; + } + } + else + { + /* The handle is still there but the memory was already freed */ + SetLastError(ERROR_DISCARDED); + } } } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastError(ERROR_INVALID_HANDLE); + Ptr = NULL; + } + _SEH2_END /* All done. Unlock the heap and return the pointer */ RtlUnlockHeap(hProcessHeap); @@ -702,65 +711,74 @@ GlobalSize(HGLOBAL hMem) /* Lock the heap */ RtlLockHeap(hProcessHeap); - /* Check if this is a simple RTL Heap Managed block */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + _SEH2_TRY { - /* Then we'll query RTL Heap */ - RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags); - BASE_TRACE_PTR(Handle, hMem); - - /* - * Check if RTL Heap didn't give us a handle or said that this heap - * isn't movable. - */ - if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) + /* Check if this is a simple RTL Heap Managed block */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) { - /* This implies we're not a handle heap, so use the generic call */ - dwSize = RtlSizeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem); + /* Then we'll query RTL Heap */ + RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags); + BASE_TRACE_PTR(Handle, hMem); + + /* + * Check if RTL Heap didn't give us a handle or said that this heap + * isn't movable. + */ + if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) + { + /* This implies we're not a handle heap, so use the generic call */ + dwSize = RtlSizeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem); + } + else + { + /* Otherwise we're a handle heap, so get the internal handle */ + hMem = Handle; + } } - else + + /* Make sure that this is an entry in our handle database */ + if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) { - /* Otherwise we're a handle heap, so get the internal handle */ - hMem = Handle; + /* Get the entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure the handle is valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* Fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + } + else if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) + { + /* We've reused this block, but we've saved the size for you */ + dwSize = HandleEntry->OldSize; + } + else + { + /* Otherwise, query RTL about it */ + dwSize = RtlSizeHeap(hProcessHeap, + HEAP_NO_SERIALIZE, + HandleEntry->Object); + } } - } - /* Make sure that this is an entry in our handle database */ - if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) - { - /* Get the entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure the handle is valid */ - if (!BaseHeapValidateEntry(HandleEntry)) + /* Check if by now, we still haven't gotten any useful size */ + if (dwSize == MAXULONG_PTR) { /* Fail */ BASE_TRACE_FAILURE(); SetLastError(ERROR_INVALID_HANDLE); - } - else if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) - { - /* We've reused this block, but we've saved the size for you */ - dwSize = HandleEntry->OldSize; - } - else - { - /* Otherwise, query RTL about it */ - dwSize = RtlSizeHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - HandleEntry->Object); + dwSize = 0; } } - - /* Check if by now, we still haven't gotten any useful size */ - if (dwSize == MAXULONG_PTR) + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - /* Fail */ - BASE_TRACE_FAILURE(); SetLastError(ERROR_INVALID_HANDLE); dwSize = 0; } + _SEH2_END /* All done! Unlock heap and return the size */ RtlUnlockHeap(hProcessHeap); @@ -798,31 +816,40 @@ GlobalUnlock(HGLOBAL hMem) HandleEntry = BaseHeapGetEntry(hMem); BASE_TRACE_HANDLE(HandleEntry, hMem); - /* Make sure it's valid */ - if (!BaseHeapValidateEntry(HandleEntry)) + _SEH2_TRY { - /* It's not, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); + /* Make sure it's valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* It's not, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + RetVal = FALSE; + } + else + { + /* Otherwise, decrement lock count, unless we're already at 0*/ + if (!HandleEntry->LockCount--) + { + /* In which case we simply lock it back and fail */ + HandleEntry->LockCount++; + SetLastError(ERROR_NOT_LOCKED); + RetVal = FALSE; + } + else if (!HandleEntry->LockCount) + { + /* Nothing to unlock */ + SetLastError(NO_ERROR); + RetVal = FALSE; + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastError(ERROR_INVALID_PARAMETER); RetVal = FALSE; } - else - { - /* Otherwise, decrement lock count, unless we're already at 0*/ - if (!HandleEntry->LockCount--) - { - /* In which case we simply lock it back and fail */ - HandleEntry->LockCount++; - SetLastError(ERROR_NOT_LOCKED); - RetVal = FALSE; - } - else if (!HandleEntry->LockCount) - { - /* Nothing to unlock */ - SetLastError(NO_ERROR); - RetVal = FALSE; - } - } + _SEH2_END /* All done. Unlock the heap and return the pointer */ RtlUnlockHeap(hProcessHeap); From 39c39d457f8a39fc9f92f68ea07106c5e70fffc6 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 16 May 2010 23:07:44 +0000 Subject: [PATCH 113/151] [ReactOS-arm.rbuild] - add newinflib to arm builds svn path=/trunk/; revision=47248 --- reactos/ReactOS-arm.rbuild | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reactos/ReactOS-arm.rbuild b/reactos/ReactOS-arm.rbuild index 6d7abe77d6e..29bddc97feb 100644 --- a/reactos/ReactOS-arm.rbuild +++ b/reactos/ReactOS-arm.rbuild @@ -74,6 +74,9 @@ + + + From 6666b6b68b79650efa86915e51da73e6685e2db1 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Mon, 17 May 2010 00:01:26 +0000 Subject: [PATCH 114/151] [win32k] - Check that the thread is not in cleanup before attempting to do anything related to it. Add a couple asserts for sanity. svn path=/trunk/; revision=47249 --- reactos/subsystems/win32/win32k/ntuser/timer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/timer.c b/reactos/subsystems/win32/win32k/ntuser/timer.c index da114f81b5f..fdfddc667ec 100644 --- a/reactos/subsystems/win32/win32k/ntuser/timer.c +++ b/reactos/subsystems/win32/win32k/ntuser/timer.c @@ -368,7 +368,8 @@ ProcessTimers(VOID) { if (pTmr->cmsCountdown < 0) { - if (!(pTmr->flags & TMRF_READY)) + ASSERT(pTmr->pti); + if ((!(pTmr->flags & TMRF_READY)) && (!(pTmr->pti->TIF_flags & TIF_INCLEANUP))) { if (pTmr->flags & TMRF_ONESHOT) pTmr->flags |= TMRF_WAITING; @@ -384,8 +385,8 @@ ProcessTimers(VOID) // Set thread message queue for this timer. if (pTmr->pti->MessageQueue) { // Wakeup thread - if (pTmr->pti->MessageQueue->WakeMask & QS_POSTMESSAGE) - KeSetEvent(pTmr->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + ASSERT(pTmr->pti->MessageQueue->NewMessages != NULL); + KeSetEvent(pTmr->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); } } } From 1503e2b8c93f0549cf3002f4aa5370958f7e45c6 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Mon, 17 May 2010 02:15:50 +0000 Subject: [PATCH 115/151] [regedit] - If a search was never done, show the find dialog when pressing F3. Patch by Radek Liska. See Bug #5391. - Return the result of the FindNext and if it is false inform the user that search is complete. svn path=/trunk/; revision=47251 --- reactos/base/applications/regedit/find.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/reactos/base/applications/regedit/find.c b/reactos/base/applications/regedit/find.c index ad495efdd63..226da07ea5b 100644 --- a/reactos/base/applications/regedit/find.c +++ b/reactos/base/applications/regedit/find.c @@ -629,6 +629,12 @@ BOOL FindNext(HWND hWnd) LPCTSTR pszValueName; LPTSTR pszFoundSubKey, pszFoundValueName; + if (_tcslen(s_szFindWhat) == 0) + { + FindDialog(hWnd); + return TRUE; + } + s_dwFlags = GetFindFlags(); pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hKeyRoot); @@ -678,7 +684,7 @@ BOOL FindNext(HWND hWnd) free(pszFoundValueName); SetFocus(g_pChildWnd->hListWnd); } - return TRUE; + return fSuccess; } static INT_PTR CALLBACK FindDialogProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -801,7 +807,9 @@ void FindDialog(HWND hWnd) if (DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_FIND), hWnd, FindDialogProc, 0) != 0) { - FindNext(hWnd); + if (FindNext(hWnd) == FALSE) + MessageBoxW(NULL,L"Finished searching through the registry\n", + L"Registry Editor", MB_ICONINFORMATION); } } From e7a46576e247ee75271d45c62648ca04625750ea Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Mon, 17 May 2010 12:31:06 +0000 Subject: [PATCH 116/151] [regedit] - Woops, forgot to change the messages to use resource files instead. Thanks Gregor Schneider. svn path=/trunk/; revision=47252 --- reactos/base/applications/regedit/find.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/reactos/base/applications/regedit/find.c b/reactos/base/applications/regedit/find.c index 226da07ea5b..e20d01684f8 100644 --- a/reactos/base/applications/regedit/find.c +++ b/reactos/base/applications/regedit/find.c @@ -808,8 +808,13 @@ void FindDialog(HWND hWnd) hWnd, FindDialogProc, 0) != 0) { if (FindNext(hWnd) == FALSE) - MessageBoxW(NULL,L"Finished searching through the registry\n", - L"Registry Editor", MB_ICONINFORMATION); + { + TCHAR msg[128], caption[128]; + + LoadString(hInst, IDS_FINISHEDFIND, msg, sizeof(msg)/sizeof(TCHAR)); + LoadString(hInst, IDS_APP_TITLE, caption, sizeof(caption)/sizeof(TCHAR)); + MessageBox(0, msg, caption, MB_ICONINFORMATION); + } } } From 1b8056c3a35ce1a3621804dc2ca03508ad0454e7 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 17 May 2010 14:52:00 +0000 Subject: [PATCH 117/151] [HAL] comment out some amd64 specific stuff from rbuild files. svn path=/trunk/; revision=47254 --- reactos/hal/halx86/hal_generic.rbuild | 12 ++++++------ reactos/hal/halx86/halamd64.rbuild | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/reactos/hal/halx86/hal_generic.rbuild b/reactos/hal/halx86/hal_generic.rbuild index 8dd5f7bc57d..3532d001d18 100644 --- a/reactos/hal/halx86/hal_generic.rbuild +++ b/reactos/hal/halx86/hal_generic.rbuild @@ -37,15 +37,15 @@ - . + x86bios.c - halinit.c - irq.S - misc.c - apic.c + + + + systimer.S - usage.c + diff --git a/reactos/hal/halx86/halamd64.rbuild b/reactos/hal/halx86/halamd64.rbuild index ad96c0f1cf9..92c4f29983d 100644 --- a/reactos/hal/halx86/halamd64.rbuild +++ b/reactos/hal/halx86/halamd64.rbuild @@ -13,7 +13,7 @@ hal_generic hal_generic_acpi ntoskrnl - x86emu + spinlock.c From d5ebb5d18d632a5ab2c884706c9604eacf8ac9e2 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Mon, 17 May 2010 18:43:21 +0000 Subject: [PATCH 118/151] [WIN32CSR] - Fix a FIXME: convert ASCII char to Unicode char with input codepage - Rename define parameters to make sense (prefix s - source, d - destination) svn path=/trunk/; revision=47255 --- reactos/subsystems/win32/csrss/win32csr/conio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/subsystems/win32/csrss/win32csr/conio.c b/reactos/subsystems/win32/csrss/win32csr/conio.c index 6206a538786..493ac172db0 100644 --- a/reactos/subsystems/win32/csrss/win32csr/conio.c +++ b/reactos/subsystems/win32/csrss/win32csr/conio.c @@ -26,11 +26,14 @@ #define ConsoleInputUnicodeCharToAnsiChar(Console, dChar, sWChar) \ WideCharToMultiByte((Console)->CodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL) +#define ConsoleInputAnsiCharToUnicodeChar(Console, dWChar, sChar) \ + MultiByteToWideChar((Console)->CodePage, 0, (sChar), 1, (dWChar), 1) + #define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar) \ WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL) -#define ConsoleAnsiCharToUnicodeChar(Console, sWChar, dChar) \ - MultiByteToWideChar((Console)->OutputCodePage, 0, (dChar), 1, (sWChar), 1) +#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar) \ + MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1) /* FUNCTIONS *****************************************************************/ @@ -616,7 +619,7 @@ CSR_API(CsrReadConsole) else { if(Request->Data.ReadConsoleRequest.Unicode) - UnicodeBuffer[i] = Input->InputEvent.Event.KeyEvent.uChar.AsciiChar; /* FIXME */ + ConsoleInputAnsiCharToUnicodeChar(Console, &UnicodeBuffer[i], &Input->InputEvent.Event.KeyEvent.uChar.AsciiChar); else Buffer[i] = Input->InputEvent.Event.KeyEvent.uChar.AsciiChar; } From ba5f9da4a0162f32f9b929c8394051a586938124 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 17 May 2010 20:21:27 +0000 Subject: [PATCH 119/151] Assign remaining services to the LocalSystem account. svn path=/trunk/; revision=47256 --- reactos/boot/bootdata/hivesys_i386.inf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reactos/boot/bootdata/hivesys_i386.inf b/reactos/boot/bootdata/hivesys_i386.inf index b19128dc360..988fed4fc6b 100644 --- a/reactos/boot/bootdata/hivesys_i386.inf +++ b/reactos/boot/bootdata/hivesys_i386.inf @@ -973,6 +973,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Description",0x00000000,"P HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Group",0x00000000,"Audio" HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ImagePath",0x00020000,"%SystemRoot%\system32\audiosrv.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Type",0x00010001,0x00000010 @@ -1219,6 +1220,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","DisplayName",0x00000000,"Simpl HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Group",0x00000000,"Network" HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ImagePath",0x00020000,"%SystemRoot%\system32\tcpsvcs.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Type",0x00010001,0x00000020 @@ -1228,6 +1230,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"React HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Group",0x00000000,"Network" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ImagePath",0x00020000,"%SystemRoot%\system32\telnetd.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Type",0x00010001,0x00000020 @@ -1308,6 +1311,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Description",0x00000000,"Con HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Group",0x00000000,"Windows Installer" HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","ImagePath",0x00020000,"system32\msiexec.exe /V" +HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\MSIserver","Type",0x00010001,0x00000020 From d30bfb803ded99a4808e34a21cf7c3ea828fff7d Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 17 May 2010 22:45:28 +0000 Subject: [PATCH 120/151] [USER32_WINETEST] skip TrackPopupMenu, which leads to a hang on reactos See issue #5405 for more details. svn path=/trunk/; revision=47259 --- rostests/winetests/user32/menu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rostests/winetests/user32/menu.c b/rostests/winetests/user32/menu.c index 761d70c7a2f..26a2862934f 100755 --- a/rostests/winetests/user32/menu.c +++ b/rostests/winetests/user32/menu.c @@ -3002,6 +3002,9 @@ static void test_menu_cancelmode(void) ok( g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle); } ok( g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle); + + skip("skipping TrackPopupMenu, that hangs on reactos\n"); +#if 0 /* menu owner is child window */ g_hwndtosend = hwndchild; ret = TrackPopupMenu( menu, 0x100, 100,100, 0, hwndchild, NULL); @@ -3014,6 +3017,7 @@ static void test_menu_cancelmode(void) g_hwndtosend = hwnd; ret = TrackPopupMenu( menu, 0x100, 100,100, 0, hwndchild, NULL); ok( g_got_enteridle == 2, "received %d WM_ENTERIDLE messages, should be 2\n", g_got_enteridle); +#endif /* cleanup */ DestroyMenu( menu); DestroyWindow( hwndchild); From eaa70d83182735086ab7b2b2a4092a6d666bc310 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 17 May 2010 22:56:24 +0000 Subject: [PATCH 121/151] [USER32] Patch by Benedikt Freisen: Fix wrong vertical position when painting 3D bottom line in menus. See issue #4906 for more details. svn path=/trunk/; revision=47260 --- reactos/dll/win32/user32/windows/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/user32/windows/menu.c b/reactos/dll/win32/user32/windows/menu.c index 1178558dda0..d5723bb3271 100644 --- a/reactos/dll/win32/user32/windows/menu.c +++ b/reactos/dll/win32/user32/windows/menu.c @@ -2206,8 +2206,8 @@ DrawMenuBarTemp(HWND Wnd, HDC DC, LPRECT Rect, HMENU Menu, HFONT Font) SelectObject(DC, GetStockObject(DC_PEN)); SetDCPenColor(DC, GetSysColor(COLOR_3DFACE)); - MoveToEx(DC, Rect->left, Rect->bottom, NULL); - LineTo(DC, Rect->right, Rect->bottom); + MoveToEx(DC, Rect->left, Rect->bottom - 1, NULL); + LineTo(DC, Rect->right, Rect->bottom - 1); if (0 == MenuInfo.MenuItemCount) { From 4ffa471abf23e53ed719b69b5f84388d62aec815 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 18 May 2010 01:23:57 +0000 Subject: [PATCH 122/151] [QMGR] - Don't bulldoze our netsvcs key to install a service that doesn't even work yet svn path=/trunk/; revision=47262 --- reactos/dll/win32/qmgr/qmgr.inf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/qmgr/qmgr.inf b/reactos/dll/win32/qmgr/qmgr.inf index ef51f9b3d99..e6922ed7f4d 100644 --- a/reactos/dll/win32/qmgr/qmgr.inf +++ b/reactos/dll/win32/qmgr/qmgr.inf @@ -12,5 +12,5 @@ HKCR,"AppID\BITS","AppID",,"%CLSID_BackgroundCopyQMgr%" HKCR,"AppID\%CLSID_BackgroundCopyQMgr%","LocalService",,"BITS" HKCR,"CLSID\%CLSID_BackgroundCopyManager%","AppID",,"%CLSID_BackgroundCopyQMgr%" -HKLM,"Software\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"BITS" +;HKLM,"Software\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"BITS" HKLM,"System\CurrentControlSet\Services\BITS\Parameters","ServiceDll",0x00020000,"qmgr.dll" From 9a41b998c7b5aee3bd04169e36a32bf37e0a77be Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Tue, 18 May 2010 06:34:48 +0000 Subject: [PATCH 123/151] [Kernel32] - Implement UTF7 Support. Patch by Katayama Hirofumi. svn path=/trunk/; revision=47263 --- reactos/dll/win32/kernel32/misc/nls.c | 343 +++++++++++++++++++++++++- 1 file changed, 339 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/kernel32/misc/nls.c b/reactos/dll/win32/kernel32/misc/nls.c index 58a5b81c294..4e082011b17 100644 --- a/reactos/dll/win32/kernel32/misc/nls.c +++ b/reactos/dll/win32/kernel32/misc/nls.c @@ -1260,6 +1260,170 @@ IsValidCodePage(UINT CodePage) return GetCPFileNameFromRegistry(CodePage, NULL, 0); } +static const signed char +base64inv[] = +{ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, + -1, 0, 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, -1, -1, -1, -1, -1, + -1, 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, -1, -1, -1, -1, -1 +}; + +static VOID Utf7Base64Decode(BYTE *pbDest, LPCSTR pszSrc, INT cchSrc) +{ + INT i, j, n; + BYTE b; + + for(i = 0; i < cchSrc / 4 * 4; i += 4) + { + for(j = n = 0; j < 4; ) + { + b = (BYTE) base64inv[(BYTE) *pszSrc++]; + n |= (((INT) b) << ((3 - j) * 6)); + j++; + } + for(j = 0; j < 3; j++) + *pbDest++ = (BYTE) ((n >> (8 * (2 - j))) & 0xFF); + } + for(j = n = 0; j < cchSrc % 4; ) + { + b = (BYTE) base64inv[(BYTE) *pszSrc++]; + n |= (((INT) b) << ((3 - j) * 6)); + j++; + } + for(j = 0; j < ((cchSrc % 4) * 6 / 8); j++) + *pbDest++ = (BYTE) ((n >> (8 * (2 - j))) & 0xFF); +} + +static VOID myswab(LPVOID pv, INT cw) +{ + LPBYTE pb = (LPBYTE) pv; + BYTE b; + while(cw > 0) + { + b = *pb; + *pb = pb[1]; + pb[1] = b; + pb += 2; + cw--; + } +} + +static INT Utf7ToWideCharSize(LPCSTR pszUtf7, INT cchUtf7) +{ + INT n, c, cch; + CHAR ch; + LPCSTR pch; + + c = 0; + while(cchUtf7 > 0) + { + ch = *pszUtf7++; + if (ch == '+') + { + ch = *pszUtf7; + if (ch == '-') + { + c++; + pszUtf7++; + cchUtf7 -= 2; + continue; + } + cchUtf7--; + pch = pszUtf7; + while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && + base64inv[*pszUtf7] >= 0) + { + cchUtf7--; + pszUtf7++; + } + cch = pszUtf7 - pch; + n = (cch * 3) / 8; + c += n; + if (cchUtf7 > 0 && *pszUtf7 == '-') + { + pszUtf7++; + cchUtf7--; + } + } + else + { + c++; + cchUtf7--; + } + } + + return c; +} + +static INT Utf7ToWideChar(LPCSTR pszUtf7, INT cchUtf7, LPWSTR pszWide, INT cchWide) +{ + INT n, c, cch; + CHAR ch; + LPCSTR pch; + WORD *pwsz; + + c = Utf7ToWideCharSize(pszUtf7, cchUtf7); + if (cchWide == 0) + return c; + + if (cchWide < c) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + while(cchUtf7 > 0) + { + ch = *pszUtf7++; + if (ch == '+') + { + if (*pszUtf7 == '-') + { + *pszWide++ = L'+'; + pszUtf7++; + cchUtf7 -= 2; + continue; + } + cchUtf7--; + pch = pszUtf7; + while(cchUtf7 > 0 && (BYTE) *pszUtf7 < 0x80 && + base64inv[*pszUtf7] >= 0) + { + cchUtf7--; + pszUtf7++; + } + cch = pszUtf7 - pch; + n = (cch * 3) / 8; + pwsz = (WORD *) HeapAlloc(GetProcessHeap(), 0, (n + 1) * sizeof(WORD)); + if (pwsz == NULL) + return 0; + ZeroMemory(pwsz, n * sizeof(WORD)); + Utf7Base64Decode((BYTE *) pwsz, pch, cch); + myswab(pwsz, n); + CopyMemory(pszWide, pwsz, n * sizeof(WORD)); + HeapFree(GetProcessHeap(), 0, pwsz); + pszWide += n; + if (cchUtf7 > 0 && *pszUtf7 == '-') + { + pszUtf7++; + cchUtf7--; + } + } + else + { + *pszWide++ = (WCHAR) ch; + cchUtf7--; + } + } + + return c; +} + /** * @name MultiByteToWideChar * @@ -1325,8 +1489,13 @@ MultiByteToWideChar(UINT CodePage, WideCharCount); case CP_UTF7: - DPRINT1("MultiByteToWideChar for CP_UTF7 is not implemented!\n"); - return 0; + if (Flags) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + return Utf7ToWideChar(MultiByteString, MultiByteCount, + WideCharString, WideCharCount); case CP_SYMBOL: return IntMultiByteToWideCharSYMBOL(Flags, @@ -1344,6 +1513,162 @@ MultiByteToWideChar(UINT CodePage, } } +static const char mustshift[] = +{ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 +}; + +static const char base64[] = +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +static INT WideCharToUtf7Size(LPCWSTR pszWide, INT cchWide) +{ + WCHAR wch; + INT c = 0; + BOOL fShift = FALSE; + + while(cchWide > 0) + { + wch = *pszWide; + if (wch < 0x80 && !mustshift[wch]) + { + c++; + cchWide--; + pszWide++; + } + else + { + if (wch == L'+') + { + c++; + c++; + cchWide--; + pszWide++; + continue; + } + if (!fShift) + { + c++; + fShift = TRUE; + } + pszWide++; + cchWide--; + c += 3; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + pszWide++; + cchWide--; + c += 3; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + pszWide++; + cchWide--; + c += 2; + } + } + if (cchWide > 0 && *pszWide < 0x80 && !mustshift[*pszWide]) + { + c++; + fShift = FALSE; + } + } + } + if (fShift) + c++; + + return c; +} + +static INT WideCharToUtf7(LPCWSTR pszWide, INT cchWide, LPSTR pszUtf7, INT cchUtf7) +{ + WCHAR wch; + INT c, n; + WCHAR wsz[3]; + BOOL fShift = FALSE; + + c = WideCharToUtf7Size(pszWide, cchWide); + if (cchUtf7 == 0) + return c; + + if (cchUtf7 < c) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + while(cchWide > 0) + { + wch = *pszWide; + if (wch < 0x80 && !mustshift[wch]) + { + *pszUtf7++ = (CHAR) wch; + cchWide--; + pszWide++; + } + else + { + if (wch == L'+') + { + *pszUtf7++ = '+'; + *pszUtf7++ = '-'; + cchWide--; + pszWide++; + continue; + } + if (!fShift) + { + *pszUtf7++ = '+'; + fShift = TRUE; + } + wsz[0] = *pszWide++; + cchWide--; + n = 1; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + wsz[1] = *pszWide++; + cchWide--; + n++; + if (cchWide > 0 && (*pszWide >= 0x80 || mustshift[*pszWide])) + { + wsz[2] = *pszWide++; + cchWide--; + n++; + } + } + *pszUtf7++ = base64[wsz[0] >> 10]; + *pszUtf7++ = base64[(wsz[0] >> 4) & 0x3F]; + *pszUtf7++ = base64[(wsz[0] << 2 | wsz[1] >> 14) & 0x3F]; + if (n >= 2) + { + *pszUtf7++ = base64[(wsz[1] >> 8) & 0x3F]; + *pszUtf7++ = base64[(wsz[1] >> 2) & 0x3F]; + *pszUtf7++ = base64[(wsz[1] << 4 | wsz[2] >> 12) & 0x3F]; + if (n >= 3) + { + *pszUtf7++ = base64[(wsz[2] >> 6) & 0x3F]; + *pszUtf7++ = base64[wsz[2] & 0x3F]; + } + } + if (cchWide > 0 && *pszWide < 0x80 && !mustshift[*pszWide]) + { + *pszUtf7++ = '-'; + fShift = FALSE; + } + } + } + if (fShift) + *pszUtf7 = '-'; + + return c; +} + /** * @name WideCharToMultiByte * @@ -1423,8 +1748,18 @@ WideCharToMultiByte(UINT CodePage, UsedDefaultChar); case CP_UTF7: - DPRINT1("WideCharToMultiByte for CP_UTF7 is not implemented!\n"); - return 0; + if (DefaultChar != NULL || UsedDefaultChar != NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (Flags) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + return WideCharToUtf7(WideCharString, WideCharCount, + MultiByteString, MultiByteCount); case CP_SYMBOL: if ((DefaultChar!=NULL) || (UsedDefaultChar!=NULL)) From 0ac861114eb408c03c8c110704244c719c4eb3db Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Tue, 18 May 2010 09:01:08 +0000 Subject: [PATCH 124/151] [Win32k] - Rename co_InflateRect to RECTL_vInflateRect and move it to rect.c - Sync WinPosFillMinMaxInfoStruct with wine Fixes some user32:win tests svn path=/trunk/; revision=47264 --- .../subsystems/win32/win32k/include/rect.h | 4 + reactos/subsystems/win32/win32k/ntuser/menu.c | 19 +-- .../subsystems/win32/win32k/ntuser/winpos.c | 128 +++++++++++++++--- .../subsystems/win32/win32k/objects/rect.c | 9 ++ 4 files changed, 124 insertions(+), 36 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/rect.h b/reactos/subsystems/win32/win32k/include/rect.h index 156dd55f120..e24bc4b0127 100644 --- a/reactos/subsystems/win32/win32k/include/rect.h +++ b/reactos/subsystems/win32/win32k/include/rect.h @@ -56,3 +56,7 @@ RECTL_bIntersectRect(RECTL *prclDst, const RECTL *prcl1, const RECTL *prcl2); VOID FASTCALL RECTL_vMakeWellOrdered(RECTL *prcl); + +VOID +FASTCALL +RECTL_vInflateRect(RECTL *rect, INT dx, INT dy); diff --git a/reactos/subsystems/win32/win32k/ntuser/menu.c b/reactos/subsystems/win32/win32k/ntuser/menu.c index 3b1cd6a740b..4da4922419d 100644 --- a/reactos/subsystems/win32/win32k/ntuser/menu.c +++ b/reactos/subsystems/win32/win32k/ntuser/menu.c @@ -1296,15 +1296,6 @@ IntCleanupMenus(struct _EPROCESS *Process, PPROCESSINFO Win32Process) return TRUE; } -VOID APIENTRY -co_InflateRect(RECTL *rect, int dx, int dy) -{ - rect->left -= dx; - rect->top -= dy; - rect->right += dx; - rect->bottom += dy; -} - BOOLEAN APIENTRY intGetTitleBarInfo(PWINDOW_OBJECT pWindowObject, PTITLEBARINFO bti) { @@ -1334,17 +1325,17 @@ intGetTitleBarInfo(PWINDOW_OBJECT pWindowObject, PTITLEBARINFO bti) if (HAS_THICKFRAME( dwStyle, dwExStyle )) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXFRAME) and UserGetSystemMetrics(SM_CYFRAME) */ - co_InflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) ); + RECTL_vInflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) ); } else if (HAS_DLGFRAME( dwStyle, dwExStyle )) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXDLGFRAME) and UserGetSystemMetrics(SM_CYDLGFRAME) */ - co_InflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME)); + RECTL_vInflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME)); } else if (HAS_THINFRAME( dwStyle, dwExStyle)) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */ - co_InflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER) ); + RECTL_vInflateRect( &bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER) ); } /* We have additional border information if the window @@ -1355,13 +1346,13 @@ intGetTitleBarInfo(PWINDOW_OBJECT pWindowObject, PTITLEBARINFO bti) if (dwExStyle & WS_EX_CLIENTEDGE) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXEDGE) and UserGetSystemMetrics(SM_CYEDGE) */ - co_InflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXEDGE), -UserGetSystemMetrics(SM_CYEDGE)); + RECTL_vInflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXEDGE), -UserGetSystemMetrics(SM_CYEDGE)); } if (dwExStyle & WS_EX_STATICEDGE) { /* FIXME : Note this value should exists in pWindowObject for UserGetSystemMetrics(SM_CXBORDER) and UserGetSystemMetrics(SM_CYBORDER) */ - co_InflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); + RECTL_vInflateRect (&bti->rcTitleBar, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); } } } diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index 6b5b0d9d6f6..0ed7e248f2c 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -400,36 +400,120 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos) return(SwpFlags); } +BOOL +UserHasWindowEdge(DWORD Style, DWORD ExStyle) +{ + if (Style & WS_MINIMIZE) + return TRUE; + if (ExStyle & WS_EX_DLGMODALFRAME) + return TRUE; + if (ExStyle & WS_EX_STATICEDGE) + return FALSE; + if (Style & WS_THICKFRAME) + return TRUE; + Style &= WS_CAPTION; + if (Style == WS_DLGFRAME || Style == WS_CAPTION) + return TRUE; + return FALSE; +} + +VOID +UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient) +{ + DWORD Border = 0; + + if (UserHasWindowEdge(Style, ExStyle)) + Border += 2; + else if (ExStyle & WS_EX_STATICEDGE) + Border += 1; + if ((ExStyle & WS_EX_CLIENTEDGE) && WithClient) + Border += 2; + if (Style & WS_CAPTION || ExStyle & WS_EX_DLGMODALFRAME) + Border ++; + Size->cx = Size->cy = Border; + if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE)) + { + Size->cx += UserGetSystemMetrics(SM_CXFRAME) - UserGetSystemMetrics(SM_CXDLGFRAME); + Size->cy += UserGetSystemMetrics(SM_CYFRAME) - UserGetSystemMetrics(SM_CYDLGFRAME); + } + Size->cx *= UserGetSystemMetrics(SM_CXBORDER); + Size->cy *= UserGetSystemMetrics(SM_CYBORDER); +} + +BOOL WINAPI +UserAdjustWindowRectEx(LPRECT lpRect, + DWORD dwStyle, + BOOL bMenu, + DWORD dwExStyle) +{ + SIZE BorderSize; + + if (bMenu) + { + lpRect->top -= UserGetSystemMetrics(SM_CYMENU); + } + if ((dwStyle & WS_CAPTION) == WS_CAPTION) + { + if (dwExStyle & WS_EX_TOOLWINDOW) + lpRect->top -= UserGetSystemMetrics(SM_CYSMCAPTION); + else + lpRect->top -= UserGetSystemMetrics(SM_CYCAPTION); + } + UserGetWindowBorders(dwStyle, dwExStyle, &BorderSize, TRUE); + RECTL_vInflateRect( + lpRect, + BorderSize.cx, + BorderSize.cy); + + return TRUE; +} + static VOID FASTCALL WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info) { - UINT XInc, YInc; - RECTL WorkArea; - PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP Desktop = pti->rpdesk; /* Or rather get it from the window? */ + INT xinc, yinc; + LONG style = Window->Wnd->style; + LONG adjustedStyle; + LONG exstyle = Window->Wnd->ExStyle; + RECT rc; - IntGetDesktopWorkArea(Desktop, &WorkArea); + /* Compute default values */ - /* Get default values. */ - Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK); - Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK); + rc = Window->Wnd->rcWindow; + Info->ptReserved.x = rc.left; + Info->ptReserved.y = rc.top; - IntGetWindowBorderMeasures(Window, &XInc, &YInc); - Info->ptMaxSize.x = WorkArea.right - WorkArea.left + 2 * XInc; - Info->ptMaxSize.y = WorkArea.bottom - WorkArea.top + 2 * YInc; - Info->ptMaxTrackSize.x = Info->ptMaxSize.x; - Info->ptMaxTrackSize.y = Info->ptMaxSize.y; + if ((style & WS_CAPTION) == WS_CAPTION) + adjustedStyle = style & ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */ + else + adjustedStyle = style; - if (Window->Wnd->InternalPosInitialized) - { - Info->ptMaxPosition = Window->Wnd->InternalPos.MaxPos; - } - else - { - Info->ptMaxPosition.x = WorkArea.left - XInc; - Info->ptMaxPosition.y = WorkArea.top - YInc; - } + if(Window->Wnd->spwndParent) + IntGetClientRect(Window->spwndParent, &rc); + UserAdjustWindowRectEx(&rc, adjustedStyle, ((style & WS_POPUP) && Window->Wnd->IDMenu), exstyle); + + xinc = -rc.left; + yinc = -rc.top; + + Info->ptMaxSize.x = rc.right - rc.left; + Info->ptMaxSize.y = rc.bottom - rc.top; + if (style & (WS_DLGFRAME | WS_BORDER)) + { + Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK); + Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK); + } + else + { + Info->ptMinTrackSize.x = 2 * xinc; + Info->ptMinTrackSize.y = 2 * yinc; + } + Info->ptMaxTrackSize.x = UserGetSystemMetrics(SM_CXMAXTRACK); + Info->ptMaxTrackSize.y = UserGetSystemMetrics(SM_CYMAXTRACK); + Info->ptMaxPosition.x = -xinc; + Info->ptMaxPosition.y = -yinc; + + //if (!EMPTYPOINT(win->max_pos)) MinMax.ptMaxPosition = win->max_pos; } UINT FASTCALL diff --git a/reactos/subsystems/win32/win32k/objects/rect.c b/reactos/subsystems/win32/win32k/objects/rect.c index ea58e63f0a9..e3012185ca7 100644 --- a/reactos/subsystems/win32/win32k/objects/rect.c +++ b/reactos/subsystems/win32/win32k/objects/rect.c @@ -102,5 +102,14 @@ RECTL_vMakeWellOrdered(RECTL *prcl) } } +VOID +FASTCALL +RECTL_vInflateRect(RECTL *rect, INT dx, INT dy) +{ + rect->left -= dx; + rect->top -= dy; + rect->right += dx; + rect->bottom += dy; +} /* EOF */ From aa35f26fa98977bf87be3b1dfd425faefd4183c4 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Tue, 18 May 2010 17:40:38 +0000 Subject: [PATCH 125/151] [REGEDIT] - Japanese resource fix by Katayama Hirofumi - Adopt making the abort search button default for all languages See issue #5409 for more details. svn path=/trunk/; revision=47265 --- reactos/base/applications/regedit/lang/bg-BG.rc | 2 +- reactos/base/applications/regedit/lang/cs-CZ.rc | 2 +- reactos/base/applications/regedit/lang/de-DE.rc | 2 +- reactos/base/applications/regedit/lang/el-GR.rc | 2 +- reactos/base/applications/regedit/lang/en-US.rc | 2 +- reactos/base/applications/regedit/lang/es-ES.rc | 2 +- reactos/base/applications/regedit/lang/fr-FR.rc | 2 +- reactos/base/applications/regedit/lang/hu-HU.rc | 2 +- reactos/base/applications/regedit/lang/id-ID.rc | 2 +- reactos/base/applications/regedit/lang/it-IT.rc | 2 +- reactos/base/applications/regedit/lang/ja-JP.rc | 6 +++--- reactos/base/applications/regedit/lang/ko-KR.rc | 2 +- reactos/base/applications/regedit/lang/nl-NL.rc | 2 +- reactos/base/applications/regedit/lang/no-NO.rc | 2 +- reactos/base/applications/regedit/lang/pl-PL.rc | 2 +- reactos/base/applications/regedit/lang/pt-BR.rc | 2 +- reactos/base/applications/regedit/lang/pt-PT.rc | 2 +- reactos/base/applications/regedit/lang/ru-RU.rc | 2 +- reactos/base/applications/regedit/lang/sk-SK.rc | 2 +- reactos/base/applications/regedit/lang/sl-SI.rc | 2 +- reactos/base/applications/regedit/lang/sv-SE.rc | 2 +- reactos/base/applications/regedit/lang/th-TH.rc | 2 +- reactos/base/applications/regedit/lang/uk-UA.rc | 2 +- reactos/base/applications/regedit/lang/zh-CN.rc | 2 +- 24 files changed, 26 insertions(+), 26 deletions(-) diff --git a/reactos/base/applications/regedit/lang/bg-BG.rc b/reactos/base/applications/regedit/lang/bg-BG.rc index 16c3f5ec0c4..c7bd4215245 100644 --- a/reactos/base/applications/regedit/lang/bg-BG.rc +++ b/reactos/base/applications/regedit/lang/bg-BG.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&",IDCANCEL,93,29,45,14 LTEXT " ...",IDC_STATIC,33,12,105,8 END diff --git a/reactos/base/applications/regedit/lang/cs-CZ.rc b/reactos/base/applications/regedit/lang/cs-CZ.rc index 8376b262eaa..8f36dadaf0d 100644 --- a/reactos/base/applications/regedit/lang/cs-CZ.rc +++ b/reactos/base/applications/regedit/lang/cs-CZ.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/de-DE.rc b/reactos/base/applications/regedit/lang/de-DE.rc index 2b0a22cd2af..3b2b646f738 100644 --- a/reactos/base/applications/regedit/lang/de-DE.rc +++ b/reactos/base/applications/regedit/lang/de-DE.rc @@ -438,7 +438,7 @@ CAPTION "Suchen" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Abbrechen",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Abbrechen",IDCANCEL,93,29,45,14 LTEXT "Durchsuche die Registry...",IDC_STATIC,33,12,85,8 END diff --git a/reactos/base/applications/regedit/lang/el-GR.rc b/reactos/base/applications/regedit/lang/el-GR.rc index bb8f6bb3aa5..34e4202d15d 100644 --- a/reactos/base/applications/regedit/lang/el-GR.rc +++ b/reactos/base/applications/regedit/lang/el-GR.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&",IDCANCEL,93,29,45,14 LTEXT " registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/en-US.rc b/reactos/base/applications/regedit/lang/en-US.rc index 5bc1ca6c4a6..b7e948f8a9a 100644 --- a/reactos/base/applications/regedit/lang/en-US.rc +++ b/reactos/base/applications/regedit/lang/en-US.rc @@ -435,7 +435,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/es-ES.rc b/reactos/base/applications/regedit/lang/es-ES.rc index 48db017a168..b7e703048da 100644 --- a/reactos/base/applications/regedit/lang/es-ES.rc +++ b/reactos/base/applications/regedit/lang/es-ES.rc @@ -441,7 +441,7 @@ CAPTION "Buscar" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 LTEXT "Buscando en el registro...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/fr-FR.rc b/reactos/base/applications/regedit/lang/fr-FR.rc index 3ee1d3bad64..ed997425aff 100644 --- a/reactos/base/applications/regedit/lang/fr-FR.rc +++ b/reactos/base/applications/regedit/lang/fr-FR.rc @@ -430,7 +430,7 @@ CAPTION "Chercher" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "Annuler",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "Annuler",IDCANCEL,93,29,45,14 LTEXT "Recherche dans le registre...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/hu-HU.rc b/reactos/base/applications/regedit/lang/hu-HU.rc index a59356e2f4d..3c7277b79ab 100644 --- a/reactos/base/applications/regedit/lang/hu-HU.rc +++ b/reactos/base/applications/regedit/lang/hu-HU.rc @@ -439,7 +439,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/id-ID.rc b/reactos/base/applications/regedit/lang/id-ID.rc index 4f602ff4d77..c6b9bb1cb49 100644 --- a/reactos/base/applications/regedit/lang/id-ID.rc +++ b/reactos/base/applications/regedit/lang/id-ID.rc @@ -438,7 +438,7 @@ CAPTION "Cari" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Batal",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Batal",IDCANCEL,93,29,45,14 LTEXT "Mencari registri...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/it-IT.rc b/reactos/base/applications/regedit/lang/it-IT.rc index c5f274986a9..47960b8da5b 100644 --- a/reactos/base/applications/regedit/lang/it-IT.rc +++ b/reactos/base/applications/regedit/lang/it-IT.rc @@ -443,7 +443,7 @@ CAPTION "Trova" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Annulla",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Annulla",IDCANCEL,93,29,45,14 LTEXT "Ricerca in corso nel registro...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/ja-JP.rc b/reactos/base/applications/regedit/lang/ja-JP.rc index 25c8a04ae39..3108fb8aa34 100644 --- a/reactos/base/applications/regedit/lang/ja-JP.rc +++ b/reactos/base/applications/regedit/lang/ja-JP.rc @@ -423,9 +423,9 @@ BEGIN CONTROL "f[^(&D)",IDC_LOOKAT_DATA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,60,42,8 CONTROL "SɈv̂(&W)",IDC_MATCHSTRING,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,83,32,94,13 + BS_AUTOCHECKBOX | WS_TABSTOP,83,32,109,13 CONTROL "啶Əʂ(&C)",IDC_MATCHCASE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,83,48,90,12 + WS_TABSTOP,83,48,108,12 END IDD_FINDING DIALOGEX 0, 0, 145, 50 @@ -435,7 +435,7 @@ CAPTION " FONT 9, "MS UI Gothic", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "LZ(&C)",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "LZ(&C)",IDCANCEL,93,29,45,14 LTEXT "WXǧ...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/ko-KR.rc b/reactos/base/applications/regedit/lang/ko-KR.rc index b4bd99c2fe6..5aef6a1b358 100644 --- a/reactos/base/applications/regedit/lang/ko-KR.rc +++ b/reactos/base/applications/regedit/lang/ko-KR.rc @@ -423,7 +423,7 @@ CAPTION "ã FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "(&C)",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "(&C)",IDCANCEL,93,29,45,14 LTEXT "Ʈ ˻...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/nl-NL.rc b/reactos/base/applications/regedit/lang/nl-NL.rc index 0596b96fd36..158a4ec4d24 100644 --- a/reactos/base/applications/regedit/lang/nl-NL.rc +++ b/reactos/base/applications/regedit/lang/nl-NL.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/no-NO.rc b/reactos/base/applications/regedit/lang/no-NO.rc index 4d5073eb232..ac3e7faa330 100644 --- a/reactos/base/applications/regedit/lang/no-NO.rc +++ b/reactos/base/applications/regedit/lang/no-NO.rc @@ -438,7 +438,7 @@ CAPTION "S FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Avbryt",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Avbryt",IDCANCEL,93,29,45,14 LTEXT "Sker i registret...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/pl-PL.rc b/reactos/base/applications/regedit/lang/pl-PL.rc index bfa9294fecc..ebf6da04151 100644 --- a/reactos/base/applications/regedit/lang/pl-PL.rc +++ b/reactos/base/applications/regedit/lang/pl-PL.rc @@ -443,7 +443,7 @@ CAPTION "Znajd FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Anuluj",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Anuluj",IDCANCEL,93,29,45,14 LTEXT "Przeszukiwanie rejestru...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/pt-BR.rc b/reactos/base/applications/regedit/lang/pt-BR.rc index 4d26aae272e..9c1f7245ec4 100644 --- a/reactos/base/applications/regedit/lang/pt-BR.rc +++ b/reactos/base/applications/regedit/lang/pt-BR.rc @@ -439,7 +439,7 @@ CAPTION "Localizar" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancelar",IDCANCEL,93,29,45,14 LTEXT "Pesquisando o registro...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/pt-PT.rc b/reactos/base/applications/regedit/lang/pt-PT.rc index 5f2806df457..081ba3b0800 100644 --- a/reactos/base/applications/regedit/lang/pt-PT.rc +++ b/reactos/base/applications/regedit/lang/pt-PT.rc @@ -439,7 +439,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/ru-RU.rc b/reactos/base/applications/regedit/lang/ru-RU.rc index e14ec89cee4..3d38ed24f01 100644 --- a/reactos/base/applications/regedit/lang/ru-RU.rc +++ b/reactos/base/applications/regedit/lang/ru-RU.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT, IDC_STATIC, 7, 7, 20, 20 - PUSHBUTTON "&", IDCANCEL, 93, 29, 45, 14 + DEFPUSHBUTTON "&", IDCANCEL, 93, 29, 45, 14 LTEXT " ...", IDC_STATIC, 33, 12, 83, 8 END diff --git a/reactos/base/applications/regedit/lang/sk-SK.rc b/reactos/base/applications/regedit/lang/sk-SK.rc index b1a8cf6686d..1ef4df97081 100644 --- a/reactos/base/applications/regedit/lang/sk-SK.rc +++ b/reactos/base/applications/regedit/lang/sk-SK.rc @@ -423,7 +423,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Zrui",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Zrui",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/sl-SI.rc b/reactos/base/applications/regedit/lang/sl-SI.rc index 356d08426d6..5c529ffe6fb 100644 --- a/reactos/base/applications/regedit/lang/sl-SI.rc +++ b/reactos/base/applications/regedit/lang/sl-SI.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/sv-SE.rc b/reactos/base/applications/regedit/lang/sv-SE.rc index 09c06639d31..efce60a4190 100644 --- a/reactos/base/applications/regedit/lang/sv-SE.rc +++ b/reactos/base/applications/regedit/lang/sv-SE.rc @@ -435,7 +435,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/th-TH.rc b/reactos/base/applications/regedit/lang/th-TH.rc index 72220f9a150..d69da60f90e 100644 --- a/reactos/base/applications/regedit/lang/th-TH.rc +++ b/reactos/base/applications/regedit/lang/th-TH.rc @@ -438,7 +438,7 @@ CAPTION "Find" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&Cancel",IDCANCEL,93,29,45,14 LTEXT "Searching the registry...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/uk-UA.rc b/reactos/base/applications/regedit/lang/uk-UA.rc index ff7d13965e4..e7d53f0f883 100644 --- a/reactos/base/applications/regedit/lang/uk-UA.rc +++ b/reactos/base/applications/regedit/lang/uk-UA.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "&",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "&",IDCANCEL,93,29,45,14 LTEXT " ...",IDC_STATIC,33,12,83,8 END diff --git a/reactos/base/applications/regedit/lang/zh-CN.rc b/reactos/base/applications/regedit/lang/zh-CN.rc index 875aff13ed8..87a1e6fd5e4 100644 --- a/reactos/base/applications/regedit/lang/zh-CN.rc +++ b/reactos/base/applications/regedit/lang/zh-CN.rc @@ -438,7 +438,7 @@ CAPTION " FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - PUSHBUTTON "ȡ(&C)",IDCANCEL,93,29,45,14 + DEFPUSHBUTTON "ȡ(&C)",IDCANCEL,93,29,45,14 LTEXT "ע...",IDC_STATIC,33,12,83,8 END From 430ba4ba96615c19bf348f78f3e32df876abd0d2 Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Tue, 18 May 2010 22:35:00 +0000 Subject: [PATCH 126/151] Add SvcHost registry entries. svn path=/trunk/; revision=47266 --- reactos/boot/bootdata/hivesft_arm.inf | 4 ++++ reactos/boot/bootdata/hivesft_i386.inf | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/reactos/boot/bootdata/hivesft_arm.inf b/reactos/boot/bootdata/hivesft_arm.inf index a3a273ff646..aabd6e10a34 100644 --- a/reactos/boot/bootdata/hivesft_arm.inf +++ b/reactos/boot/bootdata/hivesft_arm.inf @@ -1126,4 +1126,8 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\Device\shellex\P ; Keyboard layout switcher ;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","kbswitch",0x00000000,"kbswitch.exe" +; SvcHost services +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"" + ; EOF diff --git a/reactos/boot/bootdata/hivesft_i386.inf b/reactos/boot/bootdata/hivesft_i386.inf index 006796e8779..b65d55aa471 100644 --- a/reactos/boot/bootdata/hivesft_i386.inf +++ b/reactos/boot/bootdata/hivesft_i386.inf @@ -1262,4 +1262,8 @@ HKLM,"SOFTWARE\Microsoft\Ole","EnableRemoteConnect",0x00000000,"N" ; Keyboard layout switcher ;HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Run","kbswitch",0x00000000,"kbswitch.exe" +; SvcHost services +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"" + ; EOF From 43d6b32a83986e7bad45fc1dfadec5e9e3297e51 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 18 May 2010 22:43:02 +0000 Subject: [PATCH 127/151] [SETUPAPI] - Fix an incorrect length value that corrupted REG_MULTI_SZ values when they had strings appended - I'm not sure if this is synced with WINE, but if it is, they need this patch too svn path=/trunk/; revision=47267 --- reactos/dll/win32/setupapi/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/setupapi/install.c b/reactos/dll/win32/setupapi/install.c index a89081c7d6d..0d1fd062321 100644 --- a/reactos/dll/win32/setupapi/install.c +++ b/reactos/dll/win32/setupapi/install.c @@ -250,7 +250,7 @@ static void append_multi_sz_value( HKEY hkey, const WCHAR *value, const WCHAR *s if (total != size) { TRACE( "setting value %s to %s\n", debugstr_w(value), debugstr_w(buffer) ); - RegSetValueExW( hkey, value, 0, REG_MULTI_SZ, (BYTE *)buffer, total ); + RegSetValueExW( hkey, value, 0, REG_MULTI_SZ, (BYTE *)buffer, total + sizeof(WCHAR) ); } done: HeapFree( GetProcessHeap(), 0, buffer ); From 4b41a0b347a2c88300288391b6bcb0c82eead77b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 18 May 2010 22:48:09 +0000 Subject: [PATCH 128/151] [QMGR] - Add the FLG_ADDREG_APPEND flag when writing the netsvcs value because, unlike WINE, we are actually going to have values in there svn path=/trunk/; revision=47268 --- reactos/dll/win32/qmgr/qmgr.inf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/qmgr/qmgr.inf b/reactos/dll/win32/qmgr/qmgr.inf index e6922ed7f4d..c3d0380cd90 100644 --- a/reactos/dll/win32/qmgr/qmgr.inf +++ b/reactos/dll/win32/qmgr/qmgr.inf @@ -12,5 +12,5 @@ HKCR,"AppID\BITS","AppID",,"%CLSID_BackgroundCopyQMgr%" HKCR,"AppID\%CLSID_BackgroundCopyQMgr%","LocalService",,"BITS" HKCR,"CLSID\%CLSID_BackgroundCopyManager%","AppID",,"%CLSID_BackgroundCopyQMgr%" -;HKLM,"Software\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010000,"BITS" +HKLM,"Software\Microsoft\Windows NT\CurrentVersion\SvcHost","netsvcs",0x00010008,"BITS" HKLM,"System\CurrentControlSet\Services\BITS\Parameters","ServiceDll",0x00020000,"qmgr.dll" From 0a81d8d27b8dc0fcd5d8154f72191dfb919de6b0 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Wed, 19 May 2010 09:18:24 +0000 Subject: [PATCH 129/151] [win32k] -WM_WINDOWPOSCHANGED should contain the final window position svn path=/trunk/; revision=47273 --- reactos/subsystems/win32/win32k/ntuser/winpos.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index 0ed7e248f2c..864466c25df 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -1416,7 +1416,16 @@ co_WinPosSetWindowPos( } if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) + { + /* WM_WINDOWPOSCHANGED is sent even if SWP_NOSENDCHANGING is set + and always contains final window position. + */ + WinPos.x = NewWindowRect.left; + WinPos.y = NewWindowRect.top; + WinPos.cx = NewWindowRect.right - NewWindowRect.left; + WinPos.cy = NewWindowRect.bottom - NewWindowRect.top; co_IntSendMessageNoWait(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos); + } return TRUE; } From 1cb77963b287f968fe943ea4086ab13b949f9452 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Wed, 19 May 2010 11:50:21 +0000 Subject: [PATCH 130/151] [win32k] -Store the monitor work area in the monitor and not in the desktop svn path=/trunk/; revision=47275 --- .../subsystems/win32/win32k/include/desktop.h | 5 --- .../subsystems/win32/win32k/ntuser/desktop.c | 36 ------------------- .../subsystems/win32/win32k/ntuser/monitor.c | 12 ++----- .../win32/win32k/ntuser/sysparams.c | 22 ++++++------ .../subsystems/win32/win32k/ntuser/window.c | 2 +- .../subsystems/win32/win32k/ntuser/winpos.c | 6 ++-- 6 files changed, 16 insertions(+), 67 deletions(-) diff --git a/reactos/subsystems/win32/win32k/include/desktop.h b/reactos/subsystems/win32/win32k/include/desktop.h index ecdd4209376..406ee7bef0e 100644 --- a/reactos/subsystems/win32/win32k/include/desktop.h +++ b/reactos/subsystems/win32/win32k/include/desktop.h @@ -24,8 +24,6 @@ typedef struct _DESKTOP DWORD dwMouseHoverTime; /* ReactOS */ - /* Rectangle of the work area */ - RECTL WorkArea; /* Pointer to the active queue. */ PVOID ActiveMessageQueue; /* Handle of the desktop window. */ @@ -69,9 +67,6 @@ IntDesktopObjectParse(IN PVOID ParseObject, VOID APIENTRY IntDesktopObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters); -VOID FASTCALL -IntGetDesktopWorkArea(PDESKTOP Desktop, RECTL *Rect); - LRESULT CALLBACK IntDesktopWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index c5d76b215a5..df04a4f5313 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -419,35 +419,6 @@ IntValidateDesktopHandle( return Status; } -VOID FASTCALL -IntGetDesktopWorkArea(PDESKTOP Desktop, RECTL *Rect) -{ - RECTL *Ret; - - ASSERT(Desktop); - - Ret = &Desktop->WorkArea; - if((Ret->right == -1) && ScreenDeviceContext) - { - PDC dc; - SURFACE *psurf; - dc = DC_LockDc(ScreenDeviceContext); - /* FIXME - Handle dc == NULL!!!! */ - psurf = dc->dclevel.pSurface; - if (psurf) - { - Ret->right = psurf->SurfObj.sizlBitmap.cx; - Ret->bottom = psurf->SurfObj.sizlBitmap.cy; - } - DC_UnlockDc(dc); - } - - if(Rect) - { - *Rect = *Ret; - } -} - PDESKTOP FASTCALL IntGetActiveDesktop(VOID) { @@ -1052,13 +1023,6 @@ NtUserCreateDesktop( lpszDesktopName->Buffer, lpszDesktopName->Length); - // init desktop area - DesktopObject->WorkArea.left = 0; - DesktopObject->WorkArea.top = 0; - DesktopObject->WorkArea.right = -1; - DesktopObject->WorkArea.bottom = -1; - IntGetDesktopWorkArea(DesktopObject, NULL); - /* Initialize some local (to win32k) desktop state. */ InitializeListHead(&DesktopObject->PtiList); DesktopObject->ActiveMessageQueue = NULL; diff --git a/reactos/subsystems/win32/win32k/ntuser/monitor.c b/reactos/subsystems/win32/win32k/ntuser/monitor.c index 541b3bfeb41..e0e290447ae 100644 --- a/reactos/subsystems/win32/win32k/ntuser/monitor.c +++ b/reactos/subsystems/win32/win32k/ntuser/monitor.c @@ -344,10 +344,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect, RECTL MonitorRect, IntersectionRect; ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&Monitor->Lock); - MonitorRect.left = 0; /* FIXME: get origin */ - MonitorRect.top = 0; /* FIXME: get origin */ - MonitorRect.right = MonitorRect.left + Monitor->GdiDevice->gdiinfo.ulHorzRes; - MonitorRect.bottom = MonitorRect.top + Monitor->GdiDevice->gdiinfo.ulVertRes; + MonitorRect = Monitor->rcMonitor; ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&Monitor->Lock); DPRINT("MonitorRect: left = %d, top = %d, right = %d, bottom = %d\n", @@ -677,11 +674,8 @@ NtUserGetMonitorInfo( } /* fill monitor info */ - MonitorInfo.rcMonitor.left = 0; /* FIXME: get origin */ - MonitorInfo.rcMonitor.top = 0; /* FIXME: get origin */ - MonitorInfo.rcMonitor.right = MonitorInfo.rcMonitor.left + Monitor->GdiDevice->gdiinfo.ulHorzRes; - MonitorInfo.rcMonitor.bottom = MonitorInfo.rcMonitor.top + Monitor->GdiDevice->gdiinfo.ulVertRes; - MonitorInfo.rcWork = MonitorInfo.rcMonitor; /* FIXME: use DEVMODE panning to calculate work area? */ + MonitorInfo.rcMonitor = Monitor->rcMonitor; + MonitorInfo.rcWork = Monitor->rcWork; MonitorInfo.dwFlags = 0; if (Monitor->IsPrimary) diff --git a/reactos/subsystems/win32/win32k/ntuser/sysparams.c b/reactos/subsystems/win32/win32k/ntuser/sysparams.c index c39d06a4894..6fa98f9563b 100644 --- a/reactos/subsystems/win32/win32k/ntuser/sysparams.c +++ b/reactos/subsystems/win32/win32k/ntuser/sysparams.c @@ -895,26 +895,24 @@ SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl) } return (UINT_PTR)KEY_METRIC; - case SPI_GETWORKAREA: // FIXME: the workarea should be part of the MONITOR + case SPI_GETWORKAREA: { - PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP pdesktop = pti->rpdesk; - RECTL rclWorkarea; + PMONITOR pmonitor = IntGetPrimaryMonitor(); - if(!pdesktop) + if(!pmonitor) return 0; - IntGetDesktopWorkArea(pdesktop, &rclWorkarea); - return SpiGet(pvParam, &rclWorkarea, sizeof(RECTL), fl); + return SpiGet(pvParam, &pmonitor->rcWork, sizeof(RECTL), fl); } - case SPI_SETWORKAREA: // FIXME: the workarea should be part of the MONITOR + case SPI_SETWORKAREA: { - PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP pdesktop = pti->rpdesk; + /*FIXME: we should set the work area of the monitor + that contains the specified rectangle*/ + PMONITOR pmonitor = IntGetPrimaryMonitor(); RECT rcWorkArea; - if(!pdesktop) + if(!pmonitor) return 0; if (!SpiSet(&rcWorkArea, pvParam, sizeof(RECTL), fl)) @@ -929,7 +927,7 @@ SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl) rcWorkArea.bottom <= rcWorkArea.top) return 0; - pdesktop->WorkArea = rcWorkArea; + pmonitor->rcWork = rcWorkArea; if (fl & SPIF_UPDATEINIFILE) { // FIXME: what to do? diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 526b15ac515..943a2868a1e 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -2112,7 +2112,7 @@ AllocErr: PRTL_USER_PROCESS_PARAMETERS ProcessParams; BOOL CalculatedDefPosSize = FALSE; - IntGetDesktopWorkArea(Window->pti->rpdesk, &WorkArea); + UserSystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0); rc = WorkArea; ProcessParams = PsGetCurrentProcess()->Peb->ProcessParameters; diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index 864466c25df..510e814b0b0 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -258,19 +258,17 @@ WinPosInitInternalPos(PWINDOW_OBJECT Window, POINT *pt, RECTL *RestoreRect) if (!Wnd->InternalPosInitialized) { RECTL WorkArea; - PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - PDESKTOP Desktop = pti->rpdesk; /* Or rather get it from the window? */ Parent = Window->spwndParent; if(Parent) { if(IntIsDesktopWindow(Parent)) - IntGetDesktopWorkArea(Desktop, &WorkArea); + UserSystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0); else WorkArea = Parent->Wnd->rcClient; } else - IntGetDesktopWorkArea(Desktop, &WorkArea); + UserSystemParametersInfo(SPI_GETWORKAREA, 0, &WorkArea, 0); Wnd->InternalPos.NormalRect = Window->Wnd->rcWindow; IntGetWindowBorderMeasures(Window, &XInc, &YInc); From 6f63efe38d1e01a88fc054e25398b8f39fa4706a Mon Sep 17 00:00:00 2001 From: Gabriel Ilardi Date: Wed, 19 May 2010 12:03:41 +0000 Subject: [PATCH 131/151] [userenv] - Fix Italian commonfiles - Fix a typo and some Spanish environment variables svn path=/trunk/; revision=47276 --- reactos/dll/win32/userenv/lang/es-ES.rc | 6 +++--- reactos/dll/win32/userenv/lang/it-IT.rc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/userenv/lang/es-ES.rc b/reactos/dll/win32/userenv/lang/es-ES.rc index 448fe4145b5..dcfd07f92d8 100644 --- a/reactos/dll/win32/userenv/lang/es-ES.rc +++ b/reactos/dll/win32/userenv/lang/es-ES.rc @@ -37,10 +37,10 @@ BEGIN IDS_MYDOCUMENTS "Mis Documentos" IDS_MYPICTURES "Mis Documentos\\Mis imgenes" IDS_MYMUSIC "Mis Documentos\\Mi msica" - IDS_MYVIDEOS "Mis Documentos\\Mis vdeos" + IDS_MYVIDEOS "Mis Documentos\\Mis videos" IDS_TEMPLATES "Plantillas" - IDS_RECENT "Reciente" - IDS_SENDTO "SendTo" + IDS_RECENT "Documentos recientes" + IDS_SENDTO "Enviar a" IDS_PRINTHOOD "Impresoras" IDS_NETHOOD "Entorno de red" IDS_LOCALSETTINGS "Configuracin local" diff --git a/reactos/dll/win32/userenv/lang/it-IT.rc b/reactos/dll/win32/userenv/lang/it-IT.rc index 91448130eee..fa6106f922e 100644 --- a/reactos/dll/win32/userenv/lang/it-IT.rc +++ b/reactos/dll/win32/userenv/lang/it-IT.rc @@ -38,5 +38,5 @@ BEGIN IDS_HISTORY "Impostazioni locali\\Cronologia" IDS_COOKIES "Cookies" IDS_PROGRAMFILES "%SystemDrive%\\Programmi" - IDS_COMMONFILES "File condivisi" + IDS_COMMONFILES "File comuni" END From 2d1481080bde85ec59d5e1f96afabab4d63e08b1 Mon Sep 17 00:00:00 2001 From: Gabriel Ilardi Date: Wed, 19 May 2010 12:53:03 +0000 Subject: [PATCH 132/151] [userenv] german translation of sendto Patch by Egon Ashrafinia See issue #5411 for more details. svn path=/trunk/; revision=47277 --- reactos/dll/win32/userenv/lang/de-DE.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/userenv/lang/de-DE.rc b/reactos/dll/win32/userenv/lang/de-DE.rc index 8795fd94c6f..55f626ea564 100644 --- a/reactos/dll/win32/userenv/lang/de-DE.rc +++ b/reactos/dll/win32/userenv/lang/de-DE.rc @@ -34,7 +34,7 @@ BEGIN IDS_MYVIDEOS "Eigene Dateien\\Eigene Videos" IDS_TEMPLATES "Vorlagen" IDS_RECENT "Recent" - IDS_SENDTO "SendTo" + IDS_SENDTO "Senden an" IDS_PRINTHOOD "Druckumgebung" IDS_NETHOOD "Netzwerkumgebung" IDS_LOCALSETTINGS "Lokale Einstellungen" From 3bafe5c68b5fb28f7bbbfa2ecabe0b634988398d Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Wed, 19 May 2010 18:47:39 +0000 Subject: [PATCH 133/151] [win32k] -Sync co_WinPosGetMinMaxInfo with wine svn path=/trunk/; revision=47280 --- .../subsystems/win32/win32k/ntuser/winpos.c | 84 +++++++++++-------- 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index 510e814b0b0..67e5eadc92f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -466,21 +466,25 @@ UserAdjustWindowRectEx(LPRECT lpRect, return TRUE; } -static -VOID FASTCALL -WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info) +UINT FASTCALL +co_WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos, + POINT* MinTrack, POINT* MaxTrack) { + MINMAXINFO MinMax; + PMONITOR monitor; INT xinc, yinc; LONG style = Window->Wnd->style; LONG adjustedStyle; LONG exstyle = Window->Wnd->ExStyle; RECT rc; + ASSERT_REFS_CO(Window); + /* Compute default values */ rc = Window->Wnd->rcWindow; - Info->ptReserved.x = rc.left; - Info->ptReserved.y = rc.top; + MinMax.ptReserved.x = rc.left; + MinMax.ptReserved.y = rc.top; if ((style & WS_CAPTION) == WS_CAPTION) adjustedStyle = style & ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */ @@ -494,38 +498,54 @@ WinPosFillMinMaxInfoStruct(PWINDOW_OBJECT Window, MINMAXINFO *Info) xinc = -rc.left; yinc = -rc.top; - Info->ptMaxSize.x = rc.right - rc.left; - Info->ptMaxSize.y = rc.bottom - rc.top; + MinMax.ptMaxSize.x = rc.right - rc.left; + MinMax.ptMaxSize.y = rc.bottom - rc.top; if (style & (WS_DLGFRAME | WS_BORDER)) { - Info->ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK); - Info->ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK); + MinMax.ptMinTrackSize.x = UserGetSystemMetrics(SM_CXMINTRACK); + MinMax.ptMinTrackSize.y = UserGetSystemMetrics(SM_CYMINTRACK); } else { - Info->ptMinTrackSize.x = 2 * xinc; - Info->ptMinTrackSize.y = 2 * yinc; + MinMax.ptMinTrackSize.x = 2 * xinc; + MinMax.ptMinTrackSize.y = 2 * yinc; } - Info->ptMaxTrackSize.x = UserGetSystemMetrics(SM_CXMAXTRACK); - Info->ptMaxTrackSize.y = UserGetSystemMetrics(SM_CYMAXTRACK); - Info->ptMaxPosition.x = -xinc; - Info->ptMaxPosition.y = -yinc; + MinMax.ptMaxTrackSize.x = UserGetSystemMetrics(SM_CXMAXTRACK); + MinMax.ptMaxTrackSize.y = UserGetSystemMetrics(SM_CYMAXTRACK); + MinMax.ptMaxPosition.x = -xinc; + MinMax.ptMaxPosition.y = -yinc; //if (!EMPTYPOINT(win->max_pos)) MinMax.ptMaxPosition = win->max_pos; -} - -UINT FASTCALL -co_WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos, - POINT* MinTrack, POINT* MaxTrack) -{ - MINMAXINFO MinMax; - - ASSERT_REFS_CO(Window); - - WinPosFillMinMaxInfoStruct(Window, &MinMax); co_IntSendMessage(Window->hSelf, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax); + /* if the app didn't change the values, adapt them for the current monitor */ + if ((monitor = IntGetPrimaryMonitor())) + { + RECT rc_work; + + rc_work = monitor->rcMonitor; + + if (style & WS_MAXIMIZEBOX) + { + if ((style & WS_CAPTION) == WS_CAPTION || !(style & (WS_CHILD | WS_POPUP))) + rc_work = monitor->rcWork; + } + + if (MinMax.ptMaxSize.x == UserGetSystemMetrics(SM_CXSCREEN) + 2 * xinc && + MinMax.ptMaxSize.y == UserGetSystemMetrics(SM_CYSCREEN) + 2 * yinc) + { + MinMax.ptMaxSize.x = (rc_work.right - rc_work.left) + 2 * xinc; + MinMax.ptMaxSize.y = (rc_work.bottom - rc_work.top) + 2 * yinc; + } + if (MinMax.ptMaxPosition.x == -xinc && MinMax.ptMaxPosition.y == -yinc) + { + MinMax.ptMaxPosition.x = rc_work.left - xinc; + MinMax.ptMaxPosition.y = rc_work.top - yinc; + } + } + + MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x, MinMax.ptMinTrackSize.x); MinMax.ptMaxTrackSize.y = max(MinMax.ptMaxTrackSize.y, @@ -1827,15 +1847,9 @@ NtUserGetMinMaxInfo( WinPosInitInternalPos(Window, &Size, &Wnd->rcWindow); - if(SendMessage) - { - co_WinPosGetMinMaxInfo(Window, &SafeMinMax.ptMaxSize, &SafeMinMax.ptMaxPosition, - &SafeMinMax.ptMinTrackSize, &SafeMinMax.ptMaxTrackSize); - } - else - { - WinPosFillMinMaxInfoStruct(Window, &SafeMinMax); - } + co_WinPosGetMinMaxInfo(Window, &SafeMinMax.ptMaxSize, &SafeMinMax.ptMaxPosition, + &SafeMinMax.ptMinTrackSize, &SafeMinMax.ptMaxTrackSize); + Status = MmCopyToCaller(MinMaxInfo, &SafeMinMax, sizeof(MINMAXINFO)); if(!NT_SUCCESS(Status)) { From 1e017bbd409b64d207f2dc33d25f64f6d6d5e973 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Wed, 19 May 2010 19:08:25 +0000 Subject: [PATCH 134/151] [win32k] -Correctly adjust values returned from co_WinPosGetMinMaxInfo svn path=/trunk/; revision=47281 --- .../subsystems/win32/win32k/ntuser/window.c | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 943a2868a1e..965b007b8b9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -2219,22 +2219,16 @@ AllocErr: POINT MaxSize, MaxPos, MinTrack, MaxTrack; /* WinPosGetMinMaxInfo sends the WM_GETMINMAXINFO message */ - co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, - &MaxTrack); - if (MaxSize.x < Size.cx) - Size.cx = MaxSize.x; - if (MaxSize.y < Size.cy) - Size.cy = MaxSize.y; - if (Size.cx < MinTrack.x ) - Size.cx = MinTrack.x; - if (Size.cy < MinTrack.y ) - Size.cy = MinTrack.y; - if (Size.cx < 0) - Size.cx = 0; - if (Size.cy < 0) - Size.cy = 0; + co_WinPosGetMinMaxInfo(Window, &MaxSize, &MaxPos, &MinTrack, &MaxTrack); + if (Size.cx > MaxTrack.x) Size.cx = MaxTrack.x; + if (Size.cy > MaxTrack.y) Size.cy = MaxTrack.y; + if (Size.cx < MinTrack.x) Size.cx = MinTrack.x; + if (Size.cy < MinTrack.y) Size.cy = MinTrack.y; } + if (Size.cx < 0) Size.cx = 0; + if (Size.cy < 0) Size.cy = 0; + Wnd->rcWindow.left = Pos.x; Wnd->rcWindow.top = Pos.y; Wnd->rcWindow.right = Pos.x + Size.cx; From 8064ef296754cd53d0e1aad32f0d374408bd2e28 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 19 May 2010 22:15:49 +0000 Subject: [PATCH 135/151] [WIN32CSR] Silence a debugprint svn path=/trunk/; revision=47282 --- reactos/subsystems/win32/csrss/win32csr/guiconsole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c index e1ad5f50bb5..243246d5d47 100644 --- a/reactos/subsystems/win32/csrss/win32csr/guiconsole.c +++ b/reactos/subsystems/win32/csrss/win32csr/guiconsole.c @@ -2321,7 +2321,7 @@ GuiInitConsole(PCSRSS_CONSOLE Console) /* wait untill initialization has finished */ WaitForSingleObject(GuiData->hGuiInitEvent, INFINITE); - DPRINT1("received event Console %p GuiData %p X %d Y %d\n", Console, Console->PrivateData, Console->Size.X, Console->Size.Y); + DPRINT("received event Console %p GuiData %p X %d Y %d\n", Console, Console->PrivateData, Console->Size.X, Console->Size.Y); CloseHandle(GuiData->hGuiInitEvent); GuiData->hGuiInitEvent = NULL; From 8576b9c8e06818accade36440b71f7f6f852bb37 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Thu, 20 May 2010 12:25:50 +0000 Subject: [PATCH 136/151] [win32k] -Remove an incorrect debug message and silence one svn path=/trunk/; revision=47283 --- reactos/subsystems/win32/win32k/ntuser/focus.c | 2 +- reactos/subsystems/win32/win32k/ntuser/input.c | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/focus.c b/reactos/subsystems/win32/win32k/ntuser/focus.c index 10bea039446..ee9c2ff93ad 100644 --- a/reactos/subsystems/win32/win32k/ntuser/focus.c +++ b/reactos/subsystems/win32/win32k/ntuser/focus.c @@ -110,7 +110,7 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate) HANDLE OldTID = IntGetWndThreadId(WindowPrev); HANDLE NewTID = IntGetWndThreadId(Window); - DPRINT1("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID); + DPRINT("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID); if (Window->Wnd->style & WS_MINIMIZE) { DPRINT("Widow was minimized\n"); diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index e86d14a33bc..c75ecb2714f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -1340,10 +1340,7 @@ IntKeyboardInput(KEYBDINPUT *ki) /* All messages have to contain the cursor point. */ pti = PsGetCurrentThreadWin32Thread(); Msg.pt = gpsi->ptCursor; - - DPRINT1("Kbd Hook msg %d wParam %d lParam 0x%08x dropped by WH_KEYBOARD_LL hook\n", - Msg.message, vk_hook, Msg.lParam); - + KbdHookData.vkCode = vk_hook; KbdHookData.scanCode = ki->wScan; KbdHookData.flags = flags >> 8; From c88634cff4cc12ddec48f6b858cde4910c8f1d22 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Thu, 20 May 2010 21:07:53 +0000 Subject: [PATCH 137/151] [win32k] - Set MasterTimer initial value to NULL and Initialize MasterTimer at the beginning of RawInputThreadMain before doing anything else. - Add ASSERTs to catch if MasterTimer is NULL. svn path=/trunk/; revision=47284 --- reactos/subsystems/win32/win32k/ntuser/input.c | 18 +++++++++--------- reactos/subsystems/win32/win32k/ntuser/timer.c | 2 ++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index c75ecb2714f..7cd94f2c5f9 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -22,7 +22,7 @@ extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread); /* GLOBALS *******************************************************************/ PTHREADINFO ptiRawInput; -PKTIMER MasterTimer; +PKTIMER MasterTimer = NULL; PATTACHINFO gpai = NULL; static HANDLE MouseDeviceHandle; @@ -868,6 +868,14 @@ RawInputThreadMain(PVOID StartContext) NTSTATUS Status; LARGE_INTEGER DueTime; + MasterTimer = ExAllocatePoolWithTag(NonPagedPool, sizeof(KTIMER), TAG_INPUT); + if (!MasterTimer) + { + DPRINT1("Win32K: Failed making Raw Input thread a win32 thread.\n"); + return; + } + KeInitializeTimer(MasterTimer); + DueTime.QuadPart = (LONGLONG)(-10000000); do @@ -879,14 +887,6 @@ RawInputThreadMain(PVOID StartContext) Objects[0] = &InputThreadsStart; - - MasterTimer = ExAllocatePoolWithTag(NonPagedPool, sizeof(KTIMER), TAG_INPUT); - if (!MasterTimer) - { - DPRINT1("Win32K: Failed making Raw Input thread a win32 thread.\n"); - return; - } - KeInitializeTimer(MasterTimer); Objects[1] = MasterTimer; // This thread requires win32k! diff --git a/reactos/subsystems/win32/win32k/ntuser/timer.c b/reactos/subsystems/win32/win32k/ntuser/timer.c index fdfddc667ec..2d7b8d003d7 100644 --- a/reactos/subsystems/win32/win32k/ntuser/timer.c +++ b/reactos/subsystems/win32/win32k/ntuser/timer.c @@ -245,6 +245,7 @@ IntSetTimer( PWINDOW_OBJECT Window, pTmr->flags &= ~TMRF_DELETEPENDING; } + ASSERT(MasterTimer != NULL); // Start the timer thread! if (pTmr == FirstpTmr) KeSetTimer(MasterTimer, DueTime, NULL); @@ -419,6 +420,7 @@ ProcessTimers(VOID) } while (pTmr != FirstpTmr); // Restart the timer thread! + ASSERT(MasterTimer != NULL); KeSetTimer(MasterTimer, DueTime, NULL); TimeLast = Time; From a8e5ba3485f620caecff20bc1984cbd90cb61bf8 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Thu, 20 May 2010 21:45:15 +0000 Subject: [PATCH 138/151] [win32k] - Move the initialization of MasterTimer into InitInputImp which is called from win32k DriverEntry routine instead of initializing it in the secondary thread RawInputThreadMain. svn path=/trunk/; revision=47285 --- reactos/subsystems/win32/win32k/ntuser/input.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/input.c b/reactos/subsystems/win32/win32k/ntuser/input.c index 7cd94f2c5f9..006b0f123b0 100644 --- a/reactos/subsystems/win32/win32k/ntuser/input.c +++ b/reactos/subsystems/win32/win32k/ntuser/input.c @@ -868,14 +868,6 @@ RawInputThreadMain(PVOID StartContext) NTSTATUS Status; LARGE_INTEGER DueTime; - MasterTimer = ExAllocatePoolWithTag(NonPagedPool, sizeof(KTIMER), TAG_INPUT); - if (!MasterTimer) - { - DPRINT1("Win32K: Failed making Raw Input thread a win32 thread.\n"); - return; - } - KeInitializeTimer(MasterTimer); - DueTime.QuadPart = (LONGLONG)(-10000000); do @@ -937,6 +929,15 @@ InitInputImpl(VOID) KeInitializeEvent(&InputThreadsStart, NotificationEvent, FALSE); + MasterTimer = ExAllocatePoolWithTag(NonPagedPool, sizeof(KTIMER), TAG_INPUT); + if (!MasterTimer) + { + DPRINT1("Win32K: Failed making Raw Input thread a win32 thread.\n"); + ASSERT(FALSE); + return STATUS_UNSUCCESSFUL; + } + KeInitializeTimer(MasterTimer); + /* Initialize the default keyboard layout */ if(!UserInitDefaultKeyboardLayout()) { From 5ef4b66b1a6c9b178ded7d576337207ea271207c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 21 May 2010 05:44:35 +0000 Subject: [PATCH 139/151] [DHCP] - Delete the old dhcp service - Part 1 of x svn path=/trunk/; revision=47286 --- reactos/base/services/dhcp/adapter.c | 446 ---- reactos/base/services/dhcp/alloc.c | 93 - reactos/base/services/dhcp/api.c | 197 -- reactos/base/services/dhcp/compat.c | 67 - reactos/base/services/dhcp/design.txt | 33 - reactos/base/services/dhcp/dhclient.c | 2170 ----------------- reactos/base/services/dhcp/dhcp.rbuild | 30 - reactos/base/services/dhcp/dhcp.rc | 6 - reactos/base/services/dhcp/dhcpmain.c | 72 - reactos/base/services/dhcp/dispatch.c | 356 --- reactos/base/services/dhcp/hash.c | 165 -- reactos/base/services/dhcp/include/cdefs.h | 57 - reactos/base/services/dhcp/include/debug.h | 51 - reactos/base/services/dhcp/include/dhcp.h | 169 -- reactos/base/services/dhcp/include/dhcpd.h | 485 ---- reactos/base/services/dhcp/include/dhctoken.h | 136 -- reactos/base/services/dhcp/include/hash.h | 56 - reactos/base/services/dhcp/include/inet.h | 52 - reactos/base/services/dhcp/include/osdep.h | 294 --- reactos/base/services/dhcp/include/predec.h | 4 - reactos/base/services/dhcp/include/privsep.h | 47 - reactos/base/services/dhcp/include/rosdhcp.h | 94 - reactos/base/services/dhcp/include/site.h | 100 - reactos/base/services/dhcp/include/stdint.h | 10 - reactos/base/services/dhcp/include/sysconf.h | 52 - reactos/base/services/dhcp/include/tree.h | 66 - reactos/base/services/dhcp/include/version.h | 3 - reactos/base/services/dhcp/memory.c | 919 ------- reactos/base/services/dhcp/options.c | 723 ------ reactos/base/services/dhcp/pipe.c | 120 - reactos/base/services/dhcp/privsep.c | 225 -- reactos/base/services/dhcp/socket.c | 39 - reactos/base/services/dhcp/tables.c | 692 ------ reactos/base/services/dhcp/timer.c | 2 - reactos/base/services/dhcp/tree.c | 412 ---- reactos/base/services/dhcp/util.c | 166 -- 36 files changed, 8609 deletions(-) delete mode 100644 reactos/base/services/dhcp/adapter.c delete mode 100644 reactos/base/services/dhcp/alloc.c delete mode 100644 reactos/base/services/dhcp/api.c delete mode 100644 reactos/base/services/dhcp/compat.c delete mode 100644 reactos/base/services/dhcp/design.txt delete mode 100644 reactos/base/services/dhcp/dhclient.c delete mode 100644 reactos/base/services/dhcp/dhcp.rbuild delete mode 100644 reactos/base/services/dhcp/dhcp.rc delete mode 100644 reactos/base/services/dhcp/dhcpmain.c delete mode 100644 reactos/base/services/dhcp/dispatch.c delete mode 100644 reactos/base/services/dhcp/hash.c delete mode 100644 reactos/base/services/dhcp/include/cdefs.h delete mode 100644 reactos/base/services/dhcp/include/debug.h delete mode 100644 reactos/base/services/dhcp/include/dhcp.h delete mode 100644 reactos/base/services/dhcp/include/dhcpd.h delete mode 100644 reactos/base/services/dhcp/include/dhctoken.h delete mode 100644 reactos/base/services/dhcp/include/hash.h delete mode 100644 reactos/base/services/dhcp/include/inet.h delete mode 100644 reactos/base/services/dhcp/include/osdep.h delete mode 100644 reactos/base/services/dhcp/include/predec.h delete mode 100644 reactos/base/services/dhcp/include/privsep.h delete mode 100644 reactos/base/services/dhcp/include/rosdhcp.h delete mode 100644 reactos/base/services/dhcp/include/site.h delete mode 100644 reactos/base/services/dhcp/include/stdint.h delete mode 100644 reactos/base/services/dhcp/include/sysconf.h delete mode 100644 reactos/base/services/dhcp/include/tree.h delete mode 100644 reactos/base/services/dhcp/include/version.h delete mode 100644 reactos/base/services/dhcp/memory.c delete mode 100644 reactos/base/services/dhcp/options.c delete mode 100644 reactos/base/services/dhcp/pipe.c delete mode 100644 reactos/base/services/dhcp/privsep.c delete mode 100644 reactos/base/services/dhcp/socket.c delete mode 100644 reactos/base/services/dhcp/tables.c delete mode 100644 reactos/base/services/dhcp/timer.c delete mode 100644 reactos/base/services/dhcp/tree.c delete mode 100644 reactos/base/services/dhcp/util.c diff --git a/reactos/base/services/dhcp/adapter.c b/reactos/base/services/dhcp/adapter.c deleted file mode 100644 index ea848bc8bcc..00000000000 --- a/reactos/base/services/dhcp/adapter.c +++ /dev/null @@ -1,446 +0,0 @@ -#include "rosdhcp.h" - -static SOCKET DhcpSocket = INVALID_SOCKET; -static LIST_ENTRY AdapterList; -static WSADATA wsd; - -PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { - int i = 0; - DWORD Error; - HKEY MainKey; - PCHAR *Out, OutKeyName; - DWORD CharTotal = 0, AppendLen = 1 + strlen(Append); - DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; - - Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); - - if( Error ) return NULL; - - Error = RegQueryInfoKey - ( MainKey, - NULL, NULL, NULL, - &MaxSubKeys, &MaxSubKeyLen, - NULL, NULL, NULL, NULL, NULL, NULL ); - - DH_DbgPrint(MID_TRACE,("MaxSubKeys: %d, MaxSubKeyLen %d\n", - MaxSubKeys, MaxSubKeyLen)); - - CharTotal = (sizeof(PCHAR) + MaxSubKeyLen + AppendLen) * (MaxSubKeys + 1); - - DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n", - AppendLen, CharTotal)); - - Out = (CHAR**) malloc( CharTotal ); - OutKeyName = ((PCHAR)&Out[MaxSubKeys+1]); - - if( !Out ) { RegCloseKey( MainKey ); return NULL; } - - i = 0; - do { - Out[i] = OutKeyName; - Error = RegEnumKey( MainKey, i, OutKeyName, MaxSubKeyLen ); - if( !Error ) { - strcat( OutKeyName, Append ); - DH_DbgPrint(MID_TRACE,("[%d]: %s\n", i, OutKeyName)); - OutKeyName += strlen(OutKeyName) + 1; - i++; - } else Out[i] = 0; - } while( Error == ERROR_SUCCESS ); - - RegCloseKey( MainKey ); - - return Out; -} - -PCHAR RegReadString( HKEY Root, PCHAR Subkey, PCHAR Value ) { - PCHAR SubOut = NULL; - DWORD SubOutLen = 0, Error = 0; - HKEY ValueKey = NULL; - - DH_DbgPrint(MID_TRACE,("Looking in %x:%s:%s\n", Root, Subkey, Value )); - - if( Subkey && strlen(Subkey) ) { - if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS ) - goto regerror; - } else ValueKey = Root; - - DH_DbgPrint(MID_TRACE,("Got Key %x\n", ValueKey)); - - if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, - (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) - goto regerror; - - DH_DbgPrint(MID_TRACE,("Value %s has size %d\n", Value, SubOutLen)); - - if( !(SubOut = (CHAR*) malloc(SubOutLen)) ) - goto regerror; - - if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, - (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) - goto regerror; - - DH_DbgPrint(MID_TRACE,("Value %s is %s\n", Value, SubOut)); - - goto cleanup; - -regerror: - if( SubOut ) { free( SubOut ); SubOut = NULL; } -cleanup: - if( ValueKey && ValueKey != Root ) { - DH_DbgPrint(MID_TRACE,("Closing key %x\n", ValueKey)); - RegCloseKey( ValueKey ); - } - - DH_DbgPrint(MID_TRACE,("Returning %x with error %d\n", SubOut, Error)); - - return SubOut; -} - -HKEY FindAdapterKey( PDHCP_ADAPTER Adapter ) { - int i = 0; - PCHAR EnumKeyName = - "SYSTEM\\CurrentControlSet\\Control\\Class\\" - "{4D36E972-E325-11CE-BFC1-08002BE10318}"; - PCHAR TargetKeyNameStart = - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; - PCHAR TargetKeyName = NULL; - PCHAR *EnumKeysLinkage = GetSubkeyNames( EnumKeyName, "\\Linkage" ); - PCHAR *EnumKeysTop = GetSubkeyNames( EnumKeyName, "" ); - PCHAR RootDevice = NULL; - HKEY EnumKey, OutKey = NULL; - DWORD Error = ERROR_SUCCESS; - - if( !EnumKeysLinkage || !EnumKeysTop ) goto cleanup; - - Error = RegOpenKey( HKEY_LOCAL_MACHINE, EnumKeyName, &EnumKey ); - - if( Error ) goto cleanup; - - for( i = 0; EnumKeysLinkage[i]; i++ ) { - RootDevice = RegReadString - ( EnumKey, EnumKeysLinkage[i], "RootDevice" ); - - if( RootDevice && - !strcmp( RootDevice, Adapter->DhclientInfo.name ) ) { - TargetKeyName = - (CHAR*) malloc( strlen( TargetKeyNameStart ) + - strlen( RootDevice ) + 1); - if( !TargetKeyName ) goto cleanup; - sprintf( TargetKeyName, "%s%s", - TargetKeyNameStart, RootDevice ); - Error = RegCreateKeyExA( HKEY_LOCAL_MACHINE, TargetKeyName, 0, NULL, 0, KEY_READ, NULL, &OutKey, NULL ); - break; - } else { - free( RootDevice ); RootDevice = 0; - } - } - -cleanup: - if( RootDevice ) free( RootDevice ); - if( EnumKeysLinkage ) free( EnumKeysLinkage ); - if( EnumKeysTop ) free( EnumKeysTop ); - if( TargetKeyName ) free( TargetKeyName ); - - return OutKey; -} - -BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) { - HKEY AdapterKey = NULL; - PCHAR IPAddress = NULL, Netmask = NULL, DefaultGateway = NULL; - NTSTATUS Status = STATUS_SUCCESS; - DWORD Error = ERROR_SUCCESS; - - Adapter->DhclientState.config = &Adapter->DhclientConfig; - strncpy(Adapter->DhclientInfo.name, (char*)Adapter->IfMib.bDescr, - sizeof(Adapter->DhclientInfo.name)); - - AdapterKey = FindAdapterKey( Adapter ); - if( AdapterKey ) - IPAddress = RegReadString( AdapterKey, NULL, "IPAddress" ); - - if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) { - /* Non-automatic case */ - DH_DbgPrint - (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n", - Adapter->DhclientInfo.name, - Adapter->BindStatus, - IPAddress)); - - Adapter->DhclientState.state = S_STATIC; - - Netmask = RegReadString( AdapterKey, NULL, "Subnetmask" ); - - Status = AddIPAddress( inet_addr( IPAddress ), - inet_addr( Netmask ? Netmask : "255.255.255.0" ), - Adapter->IfMib.dwIndex, - &Adapter->NteContext, - &Adapter->NteInstance ); - - DefaultGateway = RegReadString( AdapterKey, NULL, "DefaultGateway" ); - - if( DefaultGateway ) { - Adapter->RouterMib.dwForwardDest = 0; - Adapter->RouterMib.dwForwardMask = 0; - Adapter->RouterMib.dwForwardMetric1 = 1; - Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; - Adapter->RouterMib.dwForwardNextHop = inet_addr(DefaultGateway); - Error = CreateIpForwardEntry( &Adapter->RouterMib ); - if( Error ) - warning("Failed to set default gateway %s: %ld\n", - DefaultGateway, Error); - } - - if( DefaultGateway ) free( DefaultGateway ); - if( Netmask ) free( Netmask ); - } else { - /* Automatic case */ - DH_DbgPrint - (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (dynamic)\n", - Adapter->DhclientInfo.name, - Adapter->BindStatus)); - - Adapter->DhclientInfo.client->state = S_INIT; - } - - if( IPAddress ) free( IPAddress ); - - return TRUE; -} - -void AdapterInit() { - WSAStartup(0x0101,&wsd); - - InitializeListHead( &AdapterList ); -} - -int -InterfaceConnected(MIB_IFROW IfEntry) -{ - if (IfEntry.dwOperStatus == IF_OPER_STATUS_CONNECTED || - IfEntry.dwOperStatus == IF_OPER_STATUS_OPERATIONAL) - return 1; - - DH_DbgPrint(MID_TRACE,("Interface %d is down\n", IfEntry.dwIndex)); - return 0; -} - -/* - * XXX Figure out the way to bind a specific adapter to a socket. - */ -BOOLEAN AdapterDiscover() { - PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE)); - DWORD Error, Size = sizeof(MIB_IFTABLE); - PDHCP_ADAPTER Adapter = NULL; - struct interface_info *ifi = NULL; - int i; - BOOLEAN ret = TRUE; - - DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n")); - - while( (Error = GetIfTable(Table, &Size, 0 )) == - ERROR_INSUFFICIENT_BUFFER ) { - DH_DbgPrint(MID_TRACE,("Error %d, New Buffer Size: %d\n", Error, Size)); - free( Table ); - Table = (PMIB_IFTABLE) malloc( Size ); - } - - if( Error != NO_ERROR ) { - ret = FALSE; - goto term; - } - - DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries)); - - for( i = Table->dwNumEntries - 1; i >= 0; i-- ) { - DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n", - Table->table[i].dwIndex)); - - if ((Adapter = AdapterFindByHardwareAddress(Table->table[i].bPhysAddr, Table->table[i].dwPhysAddrLen))) - { - /* This is an existing adapter */ - if (InterfaceConnected(Table->table[i])) { - /* We're still active so we stay in the list */ - ifi = &Adapter->DhclientInfo; - } else { - /* We've lost our link so out we go */ - RemoveEntryList(&Adapter->ListEntry); - free(Adapter); - } - - continue; - } - - Adapter = (DHCP_ADAPTER*) calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 ); - - if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET && InterfaceConnected(Table->table[i])) { - memcpy( &Adapter->IfMib, &Table->table[i], - sizeof(Adapter->IfMib) ); - Adapter->DhclientInfo.client = &Adapter->DhclientState; - Adapter->DhclientInfo.rbuf = Adapter->recv_buf; - Adapter->DhclientInfo.rbuf_max = Table->table[i].dwMtu; - Adapter->DhclientInfo.rbuf_len = - Adapter->DhclientInfo.rbuf_offset = 0; - memcpy(Adapter->DhclientInfo.hw_address.haddr, - Adapter->IfMib.bPhysAddr, - Adapter->IfMib.dwPhysAddrLen); - Adapter->DhclientInfo.hw_address.hlen = - Adapter->IfMib.dwPhysAddrLen; - /* I'm not sure where else to set this, but - some DHCP servers won't take a zero. - We checked the hardware type earlier in - the if statement. */ - Adapter->DhclientInfo.hw_address.htype = - HTYPE_ETHER; - - if( DhcpSocket == INVALID_SOCKET ) { - DhcpSocket = - Adapter->DhclientInfo.rfdesc = - Adapter->DhclientInfo.wfdesc = - socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); - - if (DhcpSocket != INVALID_SOCKET) { - Adapter->ListenAddr.sin_family = AF_INET; - Adapter->ListenAddr.sin_port = htons(LOCAL_PORT); - Adapter->BindStatus = - (bind( Adapter->DhclientInfo.rfdesc, - (struct sockaddr *)&Adapter->ListenAddr, - sizeof(Adapter->ListenAddr) ) == 0) ? - 0 : WSAGetLastError(); - } else { - error("socket() failed: %d\n", WSAGetLastError()); - } - } else { - Adapter->DhclientInfo.rfdesc = - Adapter->DhclientInfo.wfdesc = DhcpSocket; - } - - Adapter->DhclientConfig.timeout = DHCP_PANIC_TIMEOUT; - Adapter->DhclientConfig.initial_interval = DHCP_DISCOVER_INTERVAL; - Adapter->DhclientConfig.retry_interval = DHCP_DISCOVER_INTERVAL; - Adapter->DhclientConfig.select_interval = 1; - Adapter->DhclientConfig.reboot_timeout = DHCP_REBOOT_TIMEOUT; - Adapter->DhclientConfig.backoff_cutoff = DHCP_BACKOFF_MAX; - Adapter->DhclientState.interval = - Adapter->DhclientConfig.retry_interval; - - if( PrepareAdapterForService( Adapter ) ) { - Adapter->DhclientInfo.next = ifi; - ifi = &Adapter->DhclientInfo; - - read_client_conf(&Adapter->DhclientInfo); - - if (Adapter->DhclientInfo.client->state == S_INIT) - { - add_protocol(Adapter->DhclientInfo.name, - Adapter->DhclientInfo.rfdesc, - got_one, &Adapter->DhclientInfo); - - state_init(&Adapter->DhclientInfo); - } - - InsertTailList( &AdapterList, &Adapter->ListEntry ); - } else { free( Adapter ); Adapter = 0; } - } else { free( Adapter ); Adapter = 0; } - - if( !Adapter ) - DH_DbgPrint(MID_TRACE,("Adapter %d was rejected\n", - Table->table[i].dwIndex)); - } - - DH_DbgPrint(MID_TRACE,("done with AdapterInit\n")); - -term: - if( Table ) free( Table ); - return ret; -} - -void AdapterStop() { - PLIST_ENTRY ListEntry; - PDHCP_ADAPTER Adapter; - while( !IsListEmpty( &AdapterList ) ) { - ListEntry = (PLIST_ENTRY)RemoveHeadList( &AdapterList ); - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - free( Adapter ); - } - WSACleanup(); -} - -PDHCP_ADAPTER AdapterFindIndex( unsigned int indx ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for( ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink ) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if( Adapter->IfMib.dwIndex == indx ) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterFindName( const WCHAR *name ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for( ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink ) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if( !wcsicmp( Adapter->IfMib.wszName, name ) ) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterFindInfo( struct interface_info *ip ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for( ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink ) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if( ip == &Adapter->DhclientInfo ) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for(ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if (Adapter->DhclientInfo.hw_address.hlen == hlen && - !memcmp(Adapter->DhclientInfo.hw_address.haddr, - haddr, - hlen)) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterGetFirst() { - if( IsListEmpty( &AdapterList ) ) return NULL; else { - return CONTAINING_RECORD - ( AdapterList.Flink, DHCP_ADAPTER, ListEntry ); - } -} - -PDHCP_ADAPTER AdapterGetNext( PDHCP_ADAPTER This ) -{ - if( This->ListEntry.Flink == &AdapterList ) return NULL; - return CONTAINING_RECORD - ( This->ListEntry.Flink, DHCP_ADAPTER, ListEntry ); -} - -void if_register_send(struct interface_info *ip) { - -} - -void if_register_receive(struct interface_info *ip) { -} diff --git a/reactos/base/services/dhcp/alloc.c b/reactos/base/services/dhcp/alloc.c deleted file mode 100644 index 97027fa4445..00000000000 --- a/reactos/base/services/dhcp/alloc.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $OpenBSD: alloc.c,v 1.9 2004/05/04 20:28:40 deraadt Exp $ */ - -/* Memory allocation... */ - -/* - * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#include "rosdhcp.h" -#include "dhcpd.h" - -struct string_list * -new_string_list(size_t size) -{ - struct string_list *rval; - - rval = calloc(1, sizeof(struct string_list) + size); - if (rval != NULL) - rval->string = ((char *)rval) + sizeof(struct string_list); - return (rval); -} - -struct hash_table * -new_hash_table(int count) -{ - struct hash_table *rval; - - rval = calloc(1, sizeof(struct hash_table) - - (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *)) + - (count * sizeof(struct hash_bucket *))); - if (rval == NULL) - return (NULL); - rval->hash_count = count; - return (rval); -} - -struct hash_bucket * -new_hash_bucket(void) -{ - struct hash_bucket *rval = calloc(1, sizeof(struct hash_bucket)); - - return (rval); -} - -void -dfree(void *ptr, char *name) -{ - if (!ptr) { - warning("dfree %s: free on null pointer.", name); - return; - } - free(ptr); -} - -void -free_hash_bucket(struct hash_bucket *ptr, char *name) -{ - dfree(ptr, name); -} diff --git a/reactos/base/services/dhcp/api.c b/reactos/base/services/dhcp/api.c deleted file mode 100644 index 268466980b6..00000000000 --- a/reactos/base/services/dhcp/api.c +++ /dev/null @@ -1,197 +0,0 @@ -/* $Id: $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: subsys/system/dhcp/api.c - * PURPOSE: DHCP client api handlers - * PROGRAMMER: arty - */ - -#include "rosdhcp.h" -#include -#include - -#define NDEBUG -#include - -static CRITICAL_SECTION ApiCriticalSection; - -VOID ApiInit() { - InitializeCriticalSection( &ApiCriticalSection ); -} - -VOID ApiLock() { - EnterCriticalSection( &ApiCriticalSection ); -} - -VOID ApiUnlock() { - LeaveCriticalSection( &ApiCriticalSection ); -} - -/* This represents the service portion of the DHCP client API */ - -DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - add_protocol( Adapter->DhclientInfo.name, - Adapter->DhclientInfo.rfdesc, got_one, - &Adapter->DhclientInfo ); - Adapter->DhclientInfo.client->state = S_INIT; - state_reboot(&Adapter->DhclientInfo); - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if (Adapter) { - Reply.QueryHWInfo.AdapterIndex = Req->AdapterIndex; - Reply.QueryHWInfo.MediaType = Adapter->IfMib.dwType; - Reply.QueryHWInfo.Mtu = Adapter->IfMib.dwMtu; - Reply.QueryHWInfo.Speed = Adapter->IfMib.dwSpeed; - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - struct protocol* proto; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - if (Adapter->NteContext) - DeleteIPAddress( Adapter->NteContext ); - - proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); - if (proto) - remove_protocol(proto); - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - if( !Adapter || Adapter->DhclientState.state == S_STATIC ) { - Reply.Reply = 0; - ApiUnlock(); - return Send( &Reply ); - } - - Reply.Reply = 1; - - add_protocol( Adapter->DhclientInfo.name, - Adapter->DhclientInfo.rfdesc, got_one, - &Adapter->DhclientInfo ); - Adapter->DhclientInfo.client->state = S_INIT; - state_reboot(&Adapter->DhclientInfo); - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - NTSTATUS Status; - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - struct protocol* proto; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - if (Adapter->NteContext) - DeleteIPAddress( Adapter->NteContext ); - Adapter->DhclientState.state = S_STATIC; - proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); - if (proto) - remove_protocol(proto); - Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress, - Req->Body.StaticRefreshParams.Netmask, - Req->AdapterIndex, - &Adapter->NteContext, - &Adapter->NteInstance ); - Reply.Reply = NT_SUCCESS(Status); - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - Reply.GetAdapterInfo.DhcpEnabled = (S_STATIC != Adapter->DhclientState.state); - if (S_BOUND == Adapter->DhclientState.state) { - if (sizeof(Reply.GetAdapterInfo.DhcpServer) == - Adapter->DhclientState.active->serveraddress.len) { - memcpy(&Reply.GetAdapterInfo.DhcpServer, - Adapter->DhclientState.active->serveraddress.iabuf, - Adapter->DhclientState.active->serveraddress.len); - } else { - DPRINT1("Unexpected server address len %d\n", - Adapter->DhclientState.active->serveraddress.len); - Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); - } - Reply.GetAdapterInfo.LeaseObtained = Adapter->DhclientState.active->obtained; - Reply.GetAdapterInfo.LeaseExpires = Adapter->DhclientState.active->expiry; - } else { - Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); - Reply.GetAdapterInfo.LeaseObtained = 0; - Reply.GetAdapterInfo.LeaseExpires = 0; - } - } - - ApiUnlock(); - - return Send( &Reply ); -} diff --git a/reactos/base/services/dhcp/compat.c b/reactos/base/services/dhcp/compat.c deleted file mode 100644 index 83c9c12ea8c..00000000000 --- a/reactos/base/services/dhcp/compat.c +++ /dev/null @@ -1,67 +0,0 @@ -#include "rosdhcp.h" -#include "dhcpd.h" -#include "stdint.h" - -size_t strlcpy(char *d, const char *s, size_t bufsize) -{ - size_t len = strlen(s); - size_t ret = len; - if (bufsize > 0) { - if (len >= bufsize) - len = bufsize-1; - memcpy(d, s, len); - d[len] = 0; - } - return ret; -} - -// not really random :( -u_int32_t arc4random() -{ - static int did_srand = 0; - u_int32_t ret; - - if (!did_srand) { - srand(0); - did_srand = 1; - } - - ret = rand() << 10 ^ rand(); - return ret; -} - - -int inet_aton(const char *cp, struct in_addr *inp) -/* inet_addr code from ROS, slightly modified. */ -{ - ULONG Octets[4] = {0,0,0,0}; - ULONG i = 0; - - if(!cp) - return 0; - - while(*cp) - { - CHAR c = *cp; - cp++; - - if(c == '.') - { - i++; - continue; - } - - if(c < '0' || c > '9') - return 0; - - Octets[i] *= 10; - Octets[i] += (c - '0'); - - if(Octets[i] > 255) - return 0; - } - - inp->S_un.S_addr = (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0]; - return 1; -} - diff --git a/reactos/base/services/dhcp/design.txt b/reactos/base/services/dhcp/design.txt deleted file mode 100644 index 17c9a29194b..00000000000 --- a/reactos/base/services/dhcp/design.txt +++ /dev/null @@ -1,33 +0,0 @@ -Acknowledgements: - - Tinus provided the initial port of these dhclient file. - -Ok I need these things: - -1) Adapter concept thingy - - Needs a name and index - Current IP address etc - interface_info - - Must be able to get one from an adapter index or name - Must query the ip address and such - Must be able to set the address - -2) System state doodad - - List of adapters - List of parameter changes - List of persistent stuff - - Must be able to initialize from the registry - (persistent stuff, some adapter info) - Save changes to persistent set - -3) Parameter change set - - TODO - -4) Persistent queries - - TODO \ No newline at end of file diff --git a/reactos/base/services/dhcp/dhclient.c b/reactos/base/services/dhcp/dhclient.c deleted file mode 100644 index db263bc4ab5..00000000000 --- a/reactos/base/services/dhcp/dhclient.c +++ /dev/null @@ -1,2170 +0,0 @@ -/* $OpenBSD: dhclient.c,v 1.62 2004/12/05 18:35:51 deraadt Exp $ */ - -/* - * Copyright 2004 Henning Brauer - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - * - * This client was substantially modified and enhanced by Elliot Poger - * for use on Linux while he was working on the MosquitoNet project at - * Stanford. - * - * The current version owes much to Elliot's Linux enhancements, but - * was substantially reorganized and partially rewritten by Ted Lemon - * so as to use the same networking framework that the Internet Software - * Consortium DHCP server uses. Much system-specific configuration code - * was moved into a shell script so that as support for more operating - * systems is added, it will not be necessary to port and maintain - * system-specific configuration code to these operating systems - instead, - * the shell script can invoke the native tools to accomplish the same - * purpose. - */ - -#include "rosdhcp.h" -#include -#include "dhcpd.h" -#include "privsep.h" -#include "debug.h" - -#define PERIOD 0x2e -#define hyphenchar(c) ((c) == 0x2d) -#define bslashchar(c) ((c) == 0x5c) -#define periodchar(c) ((c) == PERIOD) -#define asterchar(c) ((c) == 0x2a) -#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) || \ - ((c) >= 0x61 && (c) <= 0x7a)) -#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) - -#define borderchar(c) (alphachar(c) || digitchar(c)) -#define middlechar(c) (borderchar(c) || hyphenchar(c)) -#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) - -unsigned long debug_trace_level = 0; /* DEBUG_ULTRA */ - -char *path_dhclient_conf = _PATH_DHCLIENT_CONF; -char *path_dhclient_db = NULL; - -int log_perror = 1; -int privfd; -//int nullfd = -1; - -struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; -struct in_addr inaddr_any; -struct sockaddr_in sockaddr_broadcast; - -/* - * ASSERT_STATE() does nothing now; it used to be - * assert (state_is == state_shouldbe). - */ -#define ASSERT_STATE(state_is, state_shouldbe) {} - -#define TIME_MAX 2147483647 - -int log_priority; -int no_daemon; -int unknown_ok = 1; -int routefd; - -void usage(void); -int check_option(struct client_lease *l, int option); -int ipv4addrs(char * buf); -int res_hnok(const char *dn); -char *option_as_string(unsigned int code, unsigned char *data, int len); -int fork_privchld(int, int); -int check_arp( struct interface_info *ip, struct client_lease *lp ); - -#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) - -time_t scripttime; - - -static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv); -static WCHAR ServiceName[] = L"DHCP"; -static SERVICE_TABLE_ENTRYW ServiceTable[] = -{ - {ServiceName, ServiceMain}, - {NULL, NULL} -}; - -SERVICE_STATUS_HANDLE ServiceStatusHandle; -SERVICE_STATUS ServiceStatus; - - -/* XXX Implement me */ -int check_arp( struct interface_info *ip, struct client_lease *lp ) { - return 1; -} - - -static VOID -UpdateServiceStatus(DWORD dwState) -{ - ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - ServiceStatus.dwCurrentState = dwState; - - ServiceStatus.dwControlsAccepted = 0; - - ServiceStatus.dwWin32ExitCode = 0; - ServiceStatus.dwServiceSpecificExitCode = 0; - ServiceStatus.dwCheckPoint = 0; - - if (dwState == SERVICE_START_PENDING || - dwState == SERVICE_STOP_PENDING || - dwState == SERVICE_PAUSE_PENDING || - dwState == SERVICE_CONTINUE_PENDING) - ServiceStatus.dwWaitHint = 10000; - else - ServiceStatus.dwWaitHint = 0; - - SetServiceStatus(ServiceStatusHandle, - &ServiceStatus); -} - - -static DWORD WINAPI -ServiceControlHandler(DWORD dwControl, - DWORD dwEventType, - LPVOID lpEventData, - LPVOID lpContext) -{ - switch (dwControl) - { - case SERVICE_CONTROL_STOP: - UpdateServiceStatus(SERVICE_STOP_PENDING); - UpdateServiceStatus(SERVICE_STOPPED); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_PAUSE: - UpdateServiceStatus(SERVICE_PAUSED); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_CONTINUE: - UpdateServiceStatus(SERVICE_START_PENDING); - UpdateServiceStatus(SERVICE_RUNNING); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_INTERROGATE: - SetServiceStatus(ServiceStatusHandle, - &ServiceStatus); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_SHUTDOWN: - UpdateServiceStatus(SERVICE_STOP_PENDING); - UpdateServiceStatus(SERVICE_STOPPED); - return ERROR_SUCCESS; - - default : - return ERROR_CALL_NOT_IMPLEMENTED; - } -} - - -static VOID CALLBACK -ServiceMain(DWORD argc, LPWSTR *argv) -{ - ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, - ServiceControlHandler, - NULL); - if (!ServiceStatusHandle) - { - return; - } - - UpdateServiceStatus(SERVICE_START_PENDING); - - UpdateServiceStatus(SERVICE_RUNNING); - - dispatch(); -} - - -int -main(int argc, char *argv[]) -{ - ApiInit(); - AdapterInit(); - PipeInit(); - - tzset(); - - memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); - sockaddr_broadcast.sin_family = AF_INET; - sockaddr_broadcast.sin_port = htons(REMOTE_PORT); - sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; - inaddr_any.s_addr = INADDR_ANY; - - DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); - - bootp_packet_handler = do_packet; - - DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); - - StartServiceCtrlDispatcherW(ServiceTable); - - /* not reached */ - return (0); -} - -void -usage(void) -{ -// extern char *__progname; - -// fprintf(stderr, "usage: %s [-dqu] ", __progname); - fprintf(stderr, "usage: dhclient [-dqu] "); - fprintf(stderr, "[-c conffile] [-l leasefile] interface\n"); - exit(1); -} - -/* - * Individual States: - * - * Each routine is called from the dhclient_state_machine() in one of - * these conditions: - * -> entering INIT state - * -> recvpacket_flag == 0: timeout in this state - * -> otherwise: received a packet in this state - * - * Return conditions as handled by dhclient_state_machine(): - * Returns 1, sendpacket_flag = 1: send packet, reset timer. - * Returns 1, sendpacket_flag = 0: just reset the timer (wait for a milestone). - * Returns 0: finish the nap which was interrupted for no good reason. - * - * Several per-interface variables are used to keep track of the process: - * active_lease: the lease that is being used on the interface - * (null pointer if not configured yet). - * offered_leases: leases corresponding to DHCPOFFER messages that have - * been sent to us by DHCP servers. - * acked_leases: leases corresponding to DHCPACK messages that have been - * sent to us by DHCP servers. - * sendpacket: DHCP packet we're trying to send. - * destination: IP address to send sendpacket to - * In addition, there are several relevant per-lease variables. - * T1_expiry, T2_expiry, lease_expiry: lease milestones - * In the active lease, these control the process of renewing the lease; - * In leases on the acked_leases list, this simply determines when we - * can no longer legitimately use the lease. - */ - -void -state_reboot(void *ipp) -{ - struct interface_info *ip = ipp; - ULONG foo = (ULONG) GetTickCount(); - - /* If we don't remember an active lease, go straight to INIT. */ - if (!ip->client->active || ip->client->active->is_bootp) { - state_init(ip); - return; - } - - /* We are in the rebooting state. */ - ip->client->state = S_REBOOTING; - - /* make_request doesn't initialize xid because it normally comes - from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER, - so pick an xid now. */ - ip->client->xid = RtlRandom(&foo); - - /* Make a DHCPREQUEST packet, and set appropriate per-interface - flags. */ - make_request(ip, ip->client->active); - ip->client->destination = iaddr_broadcast; - time(&ip->client->first_sending); - ip->client->interval = ip->client->config->initial_interval; - - /* Zap the medium list... */ - ip->client->medium = NULL; - - /* Send out the first DHCPREQUEST packet. */ - send_request(ip); -} - -/* - * Called when a lease has completely expired and we've - * been unable to renew it. - */ -void -state_init(void *ipp) -{ - struct interface_info *ip = ipp; - - ASSERT_STATE(state, S_INIT); - - /* Make a DHCPDISCOVER packet, and set appropriate per-interface - flags. */ - make_discover(ip, ip->client->active); - ip->client->xid = ip->client->packet.xid; - ip->client->destination = iaddr_broadcast; - ip->client->state = S_SELECTING; - time(&ip->client->first_sending); - ip->client->interval = ip->client->config->initial_interval; - - /* Add an immediate timeout to cause the first DHCPDISCOVER packet - to go out. */ - send_discover(ip); -} - -/* - * state_selecting is called when one or more DHCPOFFER packets - * have been received and a configurable period of time has passed. - */ -void -state_selecting(void *ipp) -{ - struct interface_info *ip = ipp; - struct client_lease *lp, *next, *picked; - time_t cur_time; - - ASSERT_STATE(state, S_SELECTING); - - time(&cur_time); - - /* Cancel state_selecting and send_discover timeouts, since either - one could have got us here. */ - cancel_timeout(state_selecting, ip); - cancel_timeout(send_discover, ip); - - /* We have received one or more DHCPOFFER packets. Currently, - the only criterion by which we judge leases is whether or - not we get a response when we arp for them. */ - picked = NULL; - for (lp = ip->client->offered_leases; lp; lp = next) { - next = lp->next; - - /* Check to see if we got an ARPREPLY for the address - in this particular lease. */ - if (!picked) { - if( !check_arp(ip,lp) ) goto freeit; - picked = lp; - picked->next = NULL; - } else { -freeit: - free_client_lease(lp); - } - } - ip->client->offered_leases = NULL; - - /* If we just tossed all the leases we were offered, go back - to square one. */ - if (!picked) { - ip->client->state = S_INIT; - state_init(ip); - return; - } - - /* If it was a BOOTREPLY, we can just take the address right now. */ - if (!picked->options[DHO_DHCP_MESSAGE_TYPE].len) { - ip->client->new = picked; - - /* Make up some lease expiry times - XXX these should be configurable. */ - ip->client->new->expiry = cur_time + 12000; - ip->client->new->renewal += cur_time + 8000; - ip->client->new->rebind += cur_time + 10000; - - ip->client->state = S_REQUESTING; - - /* Bind to the address we received. */ - bind_lease(ip); - return; - } - - /* Go to the REQUESTING state. */ - ip->client->destination = iaddr_broadcast; - ip->client->state = S_REQUESTING; - ip->client->first_sending = cur_time; - ip->client->interval = ip->client->config->initial_interval; - - /* Make a DHCPREQUEST packet from the lease we picked. */ - make_request(ip, picked); - ip->client->xid = ip->client->packet.xid; - - /* Toss the lease we picked - we'll get it back in a DHCPACK. */ - free_client_lease(picked); - - /* Add an immediate timeout to send the first DHCPREQUEST packet. */ - send_request(ip); -} - -/* state_requesting is called when we receive a DHCPACK message after - having sent out one or more DHCPREQUEST packets. */ - -void -dhcpack(struct packet *packet) -{ - struct interface_info *ip = packet->interface; - struct client_lease *lease; - time_t cur_time; - - time(&cur_time); - - /* If we're not receptive to an offer right now, or if the offer - has an unrecognizable transaction id, then just drop it. */ - if (packet->interface->client->xid != packet->raw->xid || - (packet->interface->hw_address.hlen != packet->raw->hlen) || - (memcmp(packet->interface->hw_address.haddr, - packet->raw->chaddr, packet->raw->hlen))) - return; - - if (ip->client->state != S_REBOOTING && - ip->client->state != S_REQUESTING && - ip->client->state != S_RENEWING && - ip->client->state != S_REBINDING) - return; - - note("DHCPACK from %s", piaddr(packet->client_addr)); - - lease = packet_to_lease(packet); - if (!lease) { - note("packet_to_lease failed."); - return; - } - - ip->client->new = lease; - - /* Stop resending DHCPREQUEST. */ - cancel_timeout(send_request, ip); - - /* Figure out the lease time. */ - if (ip->client->new->options[DHO_DHCP_LEASE_TIME].data) - ip->client->new->expiry = getULong( - ip->client->new->options[DHO_DHCP_LEASE_TIME].data); - else - ip->client->new->expiry = DHCP_DEFAULT_LEASE_TIME; - /* A number that looks negative here is really just very large, - because the lease expiry offset is unsigned. */ - if (ip->client->new->expiry < 0) - ip->client->new->expiry = TIME_MAX; - /* XXX should be fixed by resetting the client state */ - if (ip->client->new->expiry < 60) - ip->client->new->expiry = 60; - - /* Take the server-provided renewal time if there is one; - otherwise figure it out according to the spec. */ - if (ip->client->new->options[DHO_DHCP_RENEWAL_TIME].len) - ip->client->new->renewal = getULong( - ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data); - else - ip->client->new->renewal = ip->client->new->expiry / 2; - - /* Same deal with the rebind time. */ - if (ip->client->new->options[DHO_DHCP_REBINDING_TIME].len) - ip->client->new->rebind = getULong( - ip->client->new->options[DHO_DHCP_REBINDING_TIME].data); - else - ip->client->new->rebind = ip->client->new->renewal + - ip->client->new->renewal / 2 + ip->client->new->renewal / 4; - -#ifdef __REACTOS__ - ip->client->new->obtained = cur_time; -#endif - ip->client->new->expiry += cur_time; - /* Lease lengths can never be negative. */ - if (ip->client->new->expiry < cur_time) - ip->client->new->expiry = TIME_MAX; - ip->client->new->renewal += cur_time; - if (ip->client->new->renewal < cur_time) - ip->client->new->renewal = TIME_MAX; - ip->client->new->rebind += cur_time; - if (ip->client->new->rebind < cur_time) - ip->client->new->rebind = TIME_MAX; - - bind_lease(ip); -} - -void set_name_servers( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { - CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; - HKEY RegKey; - - strcat(Buffer, Adapter->DhclientInfo.name); - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &RegKey ) != ERROR_SUCCESS) - return; - - - if( new_lease->options[DHO_DOMAIN_NAME_SERVERS].len ) { - - struct iaddr nameserver; - char *nsbuf; - int i, addrs = - new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG); - - nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) ); - - if( nsbuf) { - nsbuf[0] = 0; - for( i = 0; i < addrs; i++ ) { - nameserver.len = sizeof(ULONG); - memcpy( nameserver.iabuf, - new_lease->options[DHO_DOMAIN_NAME_SERVERS].data + - (i * sizeof(ULONG)), sizeof(ULONG) ); - strcat( nsbuf, piaddr(nameserver) ); - if( i != addrs-1 ) strcat( nsbuf, "," ); - } - - DH_DbgPrint(MID_TRACE,("Setting DhcpNameserver: %s\n", nsbuf)); - - RegSetValueExA( RegKey, "DhcpNameServer", 0, REG_SZ, - (LPBYTE)nsbuf, strlen(nsbuf) + 1 ); - free( nsbuf ); - } - - } else { - RegDeleteValueW( RegKey, L"DhcpNameServer" ); - } - - RegCloseKey( RegKey ); - -} - -void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { - CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; - struct iaddr netmask; - HKEY hkey; - int i; - DWORD dwEnableDHCP; - - strcat(Buffer, Adapter->DhclientInfo.name); - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &hkey) != ERROR_SUCCESS) - hkey = NULL; - - - if( Adapter->NteContext ) - DeleteIPAddress( Adapter->NteContext ); - - /* Set up our default router if we got one from the DHCP server */ - if( new_lease->options[DHO_SUBNET_MASK].len ) { - NTSTATUS Status; - - memcpy( netmask.iabuf, - new_lease->options[DHO_SUBNET_MASK].data, - new_lease->options[DHO_SUBNET_MASK].len ); - Status = AddIPAddress - ( *((ULONG*)new_lease->address.iabuf), - *((ULONG*)netmask.iabuf), - Adapter->IfMib.dwIndex, - &Adapter->NteContext, - &Adapter->NteInstance ); - if (hkey) { - RegSetValueExA(hkey, "DhcpIPAddress", 0, REG_SZ, (LPBYTE)piaddr(new_lease->address), strlen(piaddr(new_lease->address))+1); - Buffer[0] = '\0'; - for(i = 0; i < new_lease->options[DHO_SUBNET_MASK].len; i++) - { - sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_SUBNET_MASK].data[i]); - if (i + 1 < new_lease->options[DHO_SUBNET_MASK].len) - strcat(Buffer, "."); - } - RegSetValueExA(hkey, "DhcpSubnetMask", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); - RegSetValueExA(hkey, "IPAddress", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); - RegSetValueExA(hkey, "SubnetMask", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); - dwEnableDHCP = 1; - RegSetValueExA(hkey, "EnableDHCP", 0, REG_DWORD, (LPBYTE)&dwEnableDHCP, sizeof(DWORD)); - } - - if( !NT_SUCCESS(Status) ) - warning("AddIPAddress: %lx\n", Status); - } - - if( new_lease->options[DHO_ROUTERS].len ) { - NTSTATUS Status; - - Adapter->RouterMib.dwForwardDest = 0; /* Default route */ - Adapter->RouterMib.dwForwardMask = 0; - Adapter->RouterMib.dwForwardMetric1 = 1; - Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; - - if( Adapter->RouterMib.dwForwardNextHop ) { - /* If we set a default route before, delete it before continuing */ - DeleteIpForwardEntry( &Adapter->RouterMib ); - } - - Adapter->RouterMib.dwForwardNextHop = - *((ULONG*)new_lease->options[DHO_ROUTERS].data); - - Status = CreateIpForwardEntry( &Adapter->RouterMib ); - - if( !NT_SUCCESS(Status) ) - warning("CreateIpForwardEntry: %lx\n", Status); - - if (hkey) { - Buffer[0] = '\0'; - for(i = 0; i < new_lease->options[DHO_ROUTERS].len; i++) - { - sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_ROUTERS].data[i]); - if (i + 1 < new_lease->options[DHO_ROUTERS].len) - strcat(Buffer, "."); - } - RegSetValueExA(hkey, "DhcpDefaultGateway", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); - RegSetValueExA(hkey, "DefaultGateway", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); - } - } - - if (hkey) - RegCloseKey(hkey); -} - - -void -bind_lease(struct interface_info *ip) -{ - PDHCP_ADAPTER Adapter; - struct client_lease *new_lease = ip->client->new; - time_t cur_time; - - time(&cur_time); - - /* Remember the medium. */ - ip->client->new->medium = ip->client->medium; - ip->client->active = ip->client->new; - ip->client->new = NULL; - - /* Set up a timeout to start the renewal process. */ - /* Timeout of zero means no timeout (some implementations seem to use - * one day). - */ - if( ip->client->active->renewal - cur_time ) - add_timeout(ip->client->active->renewal, state_bound, ip); - - note("bound to %s -- renewal in %ld seconds.", - piaddr(ip->client->active->address), - (long int)(ip->client->active->renewal - cur_time)); - - ip->client->state = S_BOUND; - - Adapter = AdapterFindInfo( ip ); - - if( Adapter ) setup_adapter( Adapter, new_lease ); - else { - warning("Could not find adapter for info %p\n", ip); - return; - } - set_name_servers( Adapter, new_lease ); -} - -/* - * state_bound is called when we've successfully bound to a particular - * lease, but the renewal time on that lease has expired. We are - * expected to unicast a DHCPREQUEST to the server that gave us our - * original lease. - */ -void -state_bound(void *ipp) -{ - struct interface_info *ip = ipp; - - ASSERT_STATE(state, S_BOUND); - - /* T1 has expired. */ - make_request(ip, ip->client->active); - ip->client->xid = ip->client->packet.xid; - - if (ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) { - memcpy(ip->client->destination.iabuf, ip->client->active-> - options[DHO_DHCP_SERVER_IDENTIFIER].data, 4); - ip->client->destination.len = 4; - } else - ip->client->destination = iaddr_broadcast; - - time(&ip->client->first_sending); - ip->client->interval = ip->client->config->initial_interval; - ip->client->state = S_RENEWING; - - /* Send the first packet immediately. */ - send_request(ip); -} - -void -bootp(struct packet *packet) -{ - struct iaddrlist *ap; - - if (packet->raw->op != BOOTREPLY) - return; - - /* If there's a reject list, make sure this packet's sender isn't - on it. */ - for (ap = packet->interface->client->config->reject_list; - ap; ap = ap->next) { - if (addr_eq(packet->client_addr, ap->addr)) { - note("BOOTREPLY from %s rejected.", piaddr(ap->addr)); - return; - } - } - dhcpoffer(packet); -} - -void -dhcp(struct packet *packet) -{ - struct iaddrlist *ap; - void (*handler)(struct packet *); - char *type; - - switch (packet->packet_type) { - case DHCPOFFER: - handler = dhcpoffer; - type = "DHCPOFFER"; - break; - case DHCPNAK: - handler = dhcpnak; - type = "DHCPNACK"; - break; - case DHCPACK: - handler = dhcpack; - type = "DHCPACK"; - break; - default: - return; - } - - /* If there's a reject list, make sure this packet's sender isn't - on it. */ - for (ap = packet->interface->client->config->reject_list; - ap; ap = ap->next) { - if (addr_eq(packet->client_addr, ap->addr)) { - note("%s from %s rejected.", type, piaddr(ap->addr)); - return; - } - } - (*handler)(packet); -} - -void -dhcpoffer(struct packet *packet) -{ - struct interface_info *ip = packet->interface; - struct client_lease *lease, *lp; - int i; - int arp_timeout_needed = 0, stop_selecting; - char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? - "DHCPOFFER" : "BOOTREPLY"; - time_t cur_time; - - time(&cur_time); - - /* If we're not receptive to an offer right now, or if the offer - has an unrecognizable transaction id, then just drop it. */ - if (ip->client->state != S_SELECTING || - packet->interface->client->xid != packet->raw->xid || - (packet->interface->hw_address.hlen != packet->raw->hlen) || - (memcmp(packet->interface->hw_address.haddr, - packet->raw->chaddr, packet->raw->hlen))) - return; - - note("%s from %s", name, piaddr(packet->client_addr)); - - - /* If this lease doesn't supply the minimum required parameters, - blow it off. */ - for (i = 0; ip->client->config->required_options[i]; i++) { - if (!packet->options[ip->client->config-> - required_options[i]].len) { - note("%s isn't satisfactory.", name); - return; - } - } - - /* If we've already seen this lease, don't record it again. */ - for (lease = ip->client->offered_leases; - lease; lease = lease->next) { - if (lease->address.len == sizeof(packet->raw->yiaddr) && - !memcmp(lease->address.iabuf, - &packet->raw->yiaddr, lease->address.len)) { - debug("%s already seen.", name); - return; - } - } - - lease = packet_to_lease(packet); - if (!lease) { - note("packet_to_lease failed."); - return; - } - - /* If this lease was acquired through a BOOTREPLY, record that - fact. */ - if (!packet->options[DHO_DHCP_MESSAGE_TYPE].len) - lease->is_bootp = 1; - - /* Record the medium under which this lease was offered. */ - lease->medium = ip->client->medium; - - /* Send out an ARP Request for the offered IP address. */ - if( !check_arp( ip, lease ) ) { - note("Arp check failed\n"); - return; - } - - /* Figure out when we're supposed to stop selecting. */ - stop_selecting = - ip->client->first_sending + ip->client->config->select_interval; - - /* If this is the lease we asked for, put it at the head of the - list, and don't mess with the arp request timeout. */ - if (lease->address.len == ip->client->requested_address.len && - !memcmp(lease->address.iabuf, - ip->client->requested_address.iabuf, - ip->client->requested_address.len)) { - lease->next = ip->client->offered_leases; - ip->client->offered_leases = lease; - } else { - /* If we already have an offer, and arping for this - offer would take us past the selection timeout, - then don't extend the timeout - just hope for the - best. */ - if (ip->client->offered_leases && - (cur_time + arp_timeout_needed) > stop_selecting) - arp_timeout_needed = 0; - - /* Put the lease at the end of the list. */ - lease->next = NULL; - if (!ip->client->offered_leases) - ip->client->offered_leases = lease; - else { - for (lp = ip->client->offered_leases; lp->next; - lp = lp->next) - ; /* nothing */ - lp->next = lease; - } - } - - /* If we're supposed to stop selecting before we've had time - to wait for the ARPREPLY, add some delay to wait for - the ARPREPLY. */ - if (stop_selecting - cur_time < arp_timeout_needed) - stop_selecting = cur_time + arp_timeout_needed; - - /* If the selecting interval has expired, go immediately to - state_selecting(). Otherwise, time out into - state_selecting at the select interval. */ - if (stop_selecting <= 0) - state_selecting(ip); - else { - add_timeout(stop_selecting, state_selecting, ip); - cancel_timeout(send_discover, ip); - } -} - -/* Allocate a client_lease structure and initialize it from the parameters - in the specified packet. */ - -struct client_lease * -packet_to_lease(struct packet *packet) -{ - struct client_lease *lease; - int i; - - lease = malloc(sizeof(struct client_lease)); - - if (!lease) { - warning("dhcpoffer: no memory to record lease."); - return (NULL); - } - - memset(lease, 0, sizeof(*lease)); - - /* Copy the lease options. */ - for (i = 0; i < 256; i++) { - if (packet->options[i].len) { - lease->options[i].data = - malloc(packet->options[i].len + 1); - if (!lease->options[i].data) { - warning("dhcpoffer: no memory for option %d", i); - free_client_lease(lease); - return (NULL); - } else { - memcpy(lease->options[i].data, - packet->options[i].data, - packet->options[i].len); - lease->options[i].len = - packet->options[i].len; - lease->options[i].data[lease->options[i].len] = - 0; - } - if (!check_option(lease,i)) { - /* ignore a bogus lease offer */ - warning("Invalid lease option - ignoring offer"); - free_client_lease(lease); - return (NULL); - } - } - } - - lease->address.len = sizeof(packet->raw->yiaddr); - memcpy(lease->address.iabuf, &packet->raw->yiaddr, lease->address.len); -#ifdef __REACTOS__ - lease->serveraddress.len = sizeof(packet->raw->siaddr); - memcpy(lease->serveraddress.iabuf, &packet->raw->siaddr, lease->address.len); -#endif - - /* If the server name was filled out, copy it. */ - if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || - !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) && - packet->raw->sname[0]) { - lease->server_name = malloc(DHCP_SNAME_LEN + 1); - if (!lease->server_name) { - warning("dhcpoffer: no memory for server name."); - free_client_lease(lease); - return (NULL); - } - memcpy(lease->server_name, packet->raw->sname, DHCP_SNAME_LEN); - lease->server_name[DHCP_SNAME_LEN]='\0'; - if (!res_hnok(lease->server_name) ) { - warning("Bogus server name %s", lease->server_name ); - free_client_lease(lease); - return (NULL); - } - - } - - /* Ditto for the filename. */ - if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || - !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)) && - packet->raw->file[0]) { - /* Don't count on the NUL terminator. */ - lease->filename = malloc(DHCP_FILE_LEN + 1); - if (!lease->filename) { - warning("dhcpoffer: no memory for filename."); - free_client_lease(lease); - return (NULL); - } - memcpy(lease->filename, packet->raw->file, DHCP_FILE_LEN); - lease->filename[DHCP_FILE_LEN]='\0'; - } - return lease; -} - -void -dhcpnak(struct packet *packet) -{ - struct interface_info *ip = packet->interface; - - /* If we're not receptive to an offer right now, or if the offer - has an unrecognizable transaction id, then just drop it. */ - if (packet->interface->client->xid != packet->raw->xid || - (packet->interface->hw_address.hlen != packet->raw->hlen) || - (memcmp(packet->interface->hw_address.haddr, - packet->raw->chaddr, packet->raw->hlen))) - return; - - if (ip->client->state != S_REBOOTING && - ip->client->state != S_REQUESTING && - ip->client->state != S_RENEWING && - ip->client->state != S_REBINDING) - return; - - note("DHCPNAK from %s", piaddr(packet->client_addr)); - - if (!ip->client->active) { - note("DHCPNAK with no active lease.\n"); - return; - } - - free_client_lease(ip->client->active); - ip->client->active = NULL; - - /* Stop sending DHCPREQUEST packets... */ - cancel_timeout(send_request, ip); - - ip->client->state = S_INIT; - state_init(ip); -} - -/* Send out a DHCPDISCOVER packet, and set a timeout to send out another - one after the right interval has expired. If we don't get an offer by - the time we reach the panic interval, call the panic function. */ - -void -send_discover(void *ipp) -{ - struct interface_info *ip = ipp; - int interval, increase = 1; - time_t cur_time; - - DH_DbgPrint(MID_TRACE,("Doing discover on interface %p\n",ip)); - - time(&cur_time); - - /* Figure out how long it's been since we started transmitting. */ - interval = cur_time - ip->client->first_sending; - - /* If we're past the panic timeout, call the script and tell it - we haven't found anything for this interface yet. */ - if (interval > ip->client->config->timeout) { - state_panic(ip); - return; - } - - /* If we're selecting media, try the whole list before doing - the exponential backoff, but if we've already received an - offer, stop looping, because we obviously have it right. */ - if (!ip->client->offered_leases && - ip->client->config->media) { - int fail = 0; - - if (ip->client->medium) { - ip->client->medium = ip->client->medium->next; - increase = 0; - } - if (!ip->client->medium) { - if (fail) - error("No valid media types for %s!", ip->name); - ip->client->medium = ip->client->config->media; - increase = 1; - } - - note("Trying medium \"%s\" %d", ip->client->medium->string, - increase); - /* XXX Support other media types eventually */ - } - - /* - * If we're supposed to increase the interval, do so. If it's - * currently zero (i.e., we haven't sent any packets yet), set - * it to one; otherwise, add to it a random number between zero - * and two times itself. On average, this means that it will - * double with every transmission. - */ - if (increase) { - if (!ip->client->interval) - ip->client->interval = - ip->client->config->initial_interval; - else { - ip->client->interval += (rand() >> 2) % - (2 * ip->client->interval); - } - - /* Don't backoff past cutoff. */ - if (ip->client->interval > - ip->client->config->backoff_cutoff) - ip->client->interval = - ((ip->client->config->backoff_cutoff / 2) - + ((rand() >> 2) % - ip->client->config->backoff_cutoff)); - } else if (!ip->client->interval) - ip->client->interval = - ip->client->config->initial_interval; - - /* If the backoff would take us to the panic timeout, just use that - as the interval. */ - if (cur_time + ip->client->interval > - ip->client->first_sending + ip->client->config->timeout) - ip->client->interval = - (ip->client->first_sending + - ip->client->config->timeout) - cur_time + 1; - - /* Record the number of seconds since we started sending. */ - if (interval < 65536) - ip->client->packet.secs = htons(interval); - else - ip->client->packet.secs = htons(65535); - ip->client->secs = ip->client->packet.secs; - - note("DHCPDISCOVER on %s to %s port %d interval %ld", - ip->name, inet_ntoa(sockaddr_broadcast.sin_addr), - ntohs(sockaddr_broadcast.sin_port), (long int)ip->client->interval); - - /* Send out a packet. */ - (void)send_packet(ip, &ip->client->packet, ip->client->packet_length, - inaddr_any, &sockaddr_broadcast, NULL); - - DH_DbgPrint(MID_TRACE,("discover timeout: now %x -> then %x\n", - cur_time, cur_time + ip->client->interval)); - - add_timeout(cur_time + ip->client->interval, send_discover, ip); -} - -/* - * state_panic gets called if we haven't received any offers in a preset - * amount of time. When this happens, we try to use existing leases - * that haven't yet expired, and failing that, we call the client script - * and hope it can do something. - */ -void -state_panic(void *ipp) -{ - struct interface_info *ip = ipp; - struct client_lease *loop = ip->client->active; - struct client_lease *lp; - time_t cur_time; - - note("No DHCPOFFERS received."); - - time(&cur_time); - - /* We may not have an active lease, but we may have some - predefined leases that we can try. */ - if (!ip->client->active && ip->client->leases) - goto activate_next; - - /* Run through the list of leases and see if one can be used. */ - while (ip->client->active) { - if (ip->client->active->expiry > cur_time) { - note("Trying recorded lease %s", - piaddr(ip->client->active->address)); - /* Run the client script with the existing - parameters. */ - script_init("TIMEOUT", - ip->client->active->medium); - script_write_params("new_", ip->client->active); - if (ip->client->alias) - script_write_params("alias_", - ip->client->alias); - - /* If the old lease is still good and doesn't - yet need renewal, go into BOUND state and - timeout at the renewal time. */ - if (cur_time < - ip->client->active->renewal) { - ip->client->state = S_BOUND; - note("bound: renewal in %ld seconds.", - (long int)(ip->client->active->renewal - - cur_time)); - add_timeout( - ip->client->active->renewal, - state_bound, ip); - } else { - ip->client->state = S_BOUND; - note("bound: immediate renewal."); - state_bound(ip); - } - return; - } - - /* If there are no other leases, give up. */ - if (!ip->client->leases) { - ip->client->leases = ip->client->active; - ip->client->active = NULL; - break; - } - -activate_next: - /* Otherwise, put the active lease at the end of the - lease list, and try another lease.. */ - for (lp = ip->client->leases; lp->next; lp = lp->next) - ; - lp->next = ip->client->active; - if (lp->next) - lp->next->next = NULL; - ip->client->active = ip->client->leases; - ip->client->leases = ip->client->leases->next; - - /* If we already tried this lease, we've exhausted the - set of leases, so we might as well give up for - now. */ - if (ip->client->active == loop) - break; - else if (!loop) - loop = ip->client->active; - } - - /* No leases were available, or what was available didn't work, so - tell the shell script that we failed to allocate an address, - and try again later. */ - note("No working leases in persistent database - sleeping.\n"); - ip->client->state = S_INIT; - add_timeout(cur_time + ip->client->config->retry_interval, state_init, - ip); - /* XXX Take any failure actions necessary */ -} - -void -send_request(void *ipp) -{ - struct interface_info *ip = ipp; - struct sockaddr_in destination; - struct in_addr from; - int interval; - time_t cur_time; - - time(&cur_time); - - /* Figure out how long it's been since we started transmitting. */ - interval = cur_time - ip->client->first_sending; - - /* If we're in the INIT-REBOOT or REQUESTING state and we're - past the reboot timeout, go to INIT and see if we can - DISCOVER an address... */ - /* XXX In the INIT-REBOOT state, if we don't get an ACK, it - means either that we're on a network with no DHCP server, - or that our server is down. In the latter case, assuming - that there is a backup DHCP server, DHCPDISCOVER will get - us a new address, but we could also have successfully - reused our old address. In the former case, we're hosed - anyway. This is not a win-prone situation. */ - if ((ip->client->state == S_REBOOTING || - ip->client->state == S_REQUESTING) && - interval > ip->client->config->reboot_timeout) { - ip->client->state = S_INIT; - cancel_timeout(send_request, ip); - state_init(ip); - return; - } - - /* If we're in the reboot state, make sure the media is set up - correctly. */ - if (ip->client->state == S_REBOOTING && - !ip->client->medium && - ip->client->active->medium ) { - script_init("MEDIUM", ip->client->active->medium); - - /* If the medium we chose won't fly, go to INIT state. */ - /* XXX Nothing for now */ - - /* Record the medium. */ - ip->client->medium = ip->client->active->medium; - } - - /* If the lease has expired, relinquish the address and go back - to the INIT state. */ - if (ip->client->state != S_REQUESTING && - cur_time > ip->client->active->expiry) { - PDHCP_ADAPTER Adapter = AdapterFindInfo( ip ); - /* Run the client script with the new parameters. */ - /* No script actions necessary in the expiry case */ - /* Now do a preinit on the interface so that we can - discover a new address. */ - - if( Adapter ) - DeleteIPAddress( Adapter->NteContext ); - - ip->client->state = S_INIT; - state_init(ip); - return; - } - - /* Do the exponential backoff... */ - if (!ip->client->interval) - ip->client->interval = ip->client->config->initial_interval; - else - ip->client->interval += ((rand() >> 2) % - (2 * ip->client->interval)); - - /* Don't backoff past cutoff. */ - if (ip->client->interval > - ip->client->config->backoff_cutoff) - ip->client->interval = - ((ip->client->config->backoff_cutoff / 2) + - ((rand() >> 2) % ip->client->interval)); - - /* If the backoff would take us to the expiry time, just set the - timeout to the expiry time. */ - if (ip->client->state != S_REQUESTING && - cur_time + ip->client->interval > - ip->client->active->expiry) - ip->client->interval = - ip->client->active->expiry - cur_time + 1; - - /* If the lease T2 time has elapsed, or if we're not yet bound, - broadcast the DHCPREQUEST rather than unicasting. */ - memset(&destination, 0, sizeof(destination)); - if (ip->client->state == S_REQUESTING || - ip->client->state == S_REBOOTING || - cur_time > ip->client->active->rebind) - destination.sin_addr.s_addr = INADDR_BROADCAST; - else - memcpy(&destination.sin_addr.s_addr, - ip->client->destination.iabuf, - sizeof(destination.sin_addr.s_addr)); - destination.sin_port = htons(REMOTE_PORT); - destination.sin_family = AF_INET; -// destination.sin_len = sizeof(destination); - - if (ip->client->state != S_REQUESTING) - memcpy(&from, ip->client->active->address.iabuf, - sizeof(from)); - else - from.s_addr = INADDR_ANY; - - /* Record the number of seconds since we started sending. */ - if (ip->client->state == S_REQUESTING) - ip->client->packet.secs = ip->client->secs; - else { - if (interval < 65536) - ip->client->packet.secs = htons(interval); - else - ip->client->packet.secs = htons(65535); - } - - note("DHCPREQUEST on %s to %s port %d", ip->name, - inet_ntoa(destination.sin_addr), ntohs(destination.sin_port)); - - /* Send out a packet. */ - (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, - from, &destination, NULL); - - add_timeout(cur_time + ip->client->interval, send_request, ip); -} - -void -send_decline(void *ipp) -{ - struct interface_info *ip = ipp; - - note("DHCPDECLINE on %s to %s port %d", ip->name, - inet_ntoa(sockaddr_broadcast.sin_addr), - ntohs(sockaddr_broadcast.sin_port)); - - /* Send out a packet. */ - (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, - inaddr_any, &sockaddr_broadcast, NULL); -} - -void -make_discover(struct interface_info *ip, struct client_lease *lease) -{ - unsigned char discover = DHCPDISCOVER; - struct tree_cache *options[256]; - struct tree_cache option_elements[256]; - int i; - ULONG foo = (ULONG) GetTickCount(); - - memset(option_elements, 0, sizeof(option_elements)); - memset(options, 0, sizeof(options)); - memset(&ip->client->packet, 0, sizeof(ip->client->packet)); - - /* Set DHCP_MESSAGE_TYPE to DHCPDISCOVER */ - i = DHO_DHCP_MESSAGE_TYPE; - options[i] = &option_elements[i]; - options[i]->value = &discover; - options[i]->len = sizeof(discover); - options[i]->buf_size = sizeof(discover); - options[i]->timeout = 0xFFFFFFFF; - - /* Request the options we want */ - i = DHO_DHCP_PARAMETER_REQUEST_LIST; - options[i] = &option_elements[i]; - options[i]->value = ip->client->config->requested_options; - options[i]->len = ip->client->config->requested_option_count; - options[i]->buf_size = - ip->client->config->requested_option_count; - options[i]->timeout = 0xFFFFFFFF; - - /* If we had an address, try to get it again. */ - if (lease) { - ip->client->requested_address = lease->address; - i = DHO_DHCP_REQUESTED_ADDRESS; - options[i] = &option_elements[i]; - options[i]->value = lease->address.iabuf; - options[i]->len = lease->address.len; - options[i]->buf_size = lease->address.len; - options[i]->timeout = 0xFFFFFFFF; - } else - ip->client->requested_address.len = 0; - - /* Send any options requested in the config file. */ - for (i = 0; i < 256; i++) - if (!options[i] && - ip->client->config->send_options[i].data) { - options[i] = &option_elements[i]; - options[i]->value = - ip->client->config->send_options[i].data; - options[i]->len = - ip->client->config->send_options[i].len; - options[i]->buf_size = - ip->client->config->send_options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - - /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, - options, 0, 0, 0, NULL, 0); - if (ip->client->packet_length < BOOTP_MIN_LEN) - ip->client->packet_length = BOOTP_MIN_LEN; - - ip->client->packet.op = BOOTREQUEST; - ip->client->packet.htype = ip->hw_address.htype; - ip->client->packet.hlen = ip->hw_address.hlen; - ip->client->packet.hops = 0; - ip->client->packet.xid = RtlRandom(&foo); - ip->client->packet.secs = 0; /* filled in by send_discover. */ - ip->client->packet.flags = 0; - - memset(&(ip->client->packet.ciaddr), - 0, sizeof(ip->client->packet.ciaddr)); - memset(&(ip->client->packet.yiaddr), - 0, sizeof(ip->client->packet.yiaddr)); - memset(&(ip->client->packet.siaddr), - 0, sizeof(ip->client->packet.siaddr)); - memset(&(ip->client->packet.giaddr), - 0, sizeof(ip->client->packet.giaddr)); - memcpy(ip->client->packet.chaddr, - ip->hw_address.haddr, ip->hw_address.hlen); -} - - -void -make_request(struct interface_info *ip, struct client_lease * lease) -{ - unsigned char request = DHCPREQUEST; - struct tree_cache *options[256]; - struct tree_cache option_elements[256]; - int i; - - memset(options, 0, sizeof(options)); - memset(&ip->client->packet, 0, sizeof(ip->client->packet)); - - /* Set DHCP_MESSAGE_TYPE to DHCPREQUEST */ - i = DHO_DHCP_MESSAGE_TYPE; - options[i] = &option_elements[i]; - options[i]->value = &request; - options[i]->len = sizeof(request); - options[i]->buf_size = sizeof(request); - options[i]->timeout = 0xFFFFFFFF; - - /* Request the options we want */ - i = DHO_DHCP_PARAMETER_REQUEST_LIST; - options[i] = &option_elements[i]; - options[i]->value = ip->client->config->requested_options; - options[i]->len = ip->client->config->requested_option_count; - options[i]->buf_size = - ip->client->config->requested_option_count; - options[i]->timeout = 0xFFFFFFFF; - - /* If we are requesting an address that hasn't yet been assigned - to us, use the DHCP Requested Address option. */ - if (ip->client->state == S_REQUESTING) { - /* Send back the server identifier... */ - i = DHO_DHCP_SERVER_IDENTIFIER; - options[i] = &option_elements[i]; - options[i]->value = lease->options[i].data; - options[i]->len = lease->options[i].len; - options[i]->buf_size = lease->options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - if (ip->client->state == S_REQUESTING || - ip->client->state == S_REBOOTING) { - ip->client->requested_address = lease->address; - i = DHO_DHCP_REQUESTED_ADDRESS; - options[i] = &option_elements[i]; - options[i]->value = lease->address.iabuf; - options[i]->len = lease->address.len; - options[i]->buf_size = lease->address.len; - options[i]->timeout = 0xFFFFFFFF; - } else - ip->client->requested_address.len = 0; - - /* Send any options requested in the config file. */ - for (i = 0; i < 256; i++) - if (!options[i] && - ip->client->config->send_options[i].data) { - options[i] = &option_elements[i]; - options[i]->value = - ip->client->config->send_options[i].data; - options[i]->len = - ip->client->config->send_options[i].len; - options[i]->buf_size = - ip->client->config->send_options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - - /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, - options, 0, 0, 0, NULL, 0); - if (ip->client->packet_length < BOOTP_MIN_LEN) - ip->client->packet_length = BOOTP_MIN_LEN; - - ip->client->packet.op = BOOTREQUEST; - ip->client->packet.htype = ip->hw_address.htype; - ip->client->packet.hlen = ip->hw_address.hlen; - ip->client->packet.hops = 0; - ip->client->packet.xid = ip->client->xid; - ip->client->packet.secs = 0; /* Filled in by send_request. */ - - /* If we own the address we're requesting, put it in ciaddr; - otherwise set ciaddr to zero. */ - if (ip->client->state == S_BOUND || - ip->client->state == S_RENEWING || - ip->client->state == S_REBINDING) { - memcpy(&ip->client->packet.ciaddr, - lease->address.iabuf, lease->address.len); - ip->client->packet.flags = 0; - } else { - memset(&ip->client->packet.ciaddr, 0, - sizeof(ip->client->packet.ciaddr)); - ip->client->packet.flags = 0; - } - - memset(&ip->client->packet.yiaddr, 0, - sizeof(ip->client->packet.yiaddr)); - memset(&ip->client->packet.siaddr, 0, - sizeof(ip->client->packet.siaddr)); - memset(&ip->client->packet.giaddr, 0, - sizeof(ip->client->packet.giaddr)); - memcpy(ip->client->packet.chaddr, - ip->hw_address.haddr, ip->hw_address.hlen); -} - -void -make_decline(struct interface_info *ip, struct client_lease *lease) -{ - struct tree_cache *options[256], message_type_tree; - struct tree_cache requested_address_tree; - struct tree_cache server_id_tree, client_id_tree; - unsigned char decline = DHCPDECLINE; - int i; - - memset(options, 0, sizeof(options)); - memset(&ip->client->packet, 0, sizeof(ip->client->packet)); - - /* Set DHCP_MESSAGE_TYPE to DHCPDECLINE */ - i = DHO_DHCP_MESSAGE_TYPE; - options[i] = &message_type_tree; - options[i]->value = &decline; - options[i]->len = sizeof(decline); - options[i]->buf_size = sizeof(decline); - options[i]->timeout = 0xFFFFFFFF; - - /* Send back the server identifier... */ - i = DHO_DHCP_SERVER_IDENTIFIER; - options[i] = &server_id_tree; - options[i]->value = lease->options[i].data; - options[i]->len = lease->options[i].len; - options[i]->buf_size = lease->options[i].len; - options[i]->timeout = 0xFFFFFFFF; - - /* Send back the address we're declining. */ - i = DHO_DHCP_REQUESTED_ADDRESS; - options[i] = &requested_address_tree; - options[i]->value = lease->address.iabuf; - options[i]->len = lease->address.len; - options[i]->buf_size = lease->address.len; - options[i]->timeout = 0xFFFFFFFF; - - /* Send the uid if the user supplied one. */ - i = DHO_DHCP_CLIENT_IDENTIFIER; - if (ip->client->config->send_options[i].len) { - options[i] = &client_id_tree; - options[i]->value = ip->client->config->send_options[i].data; - options[i]->len = ip->client->config->send_options[i].len; - options[i]->buf_size = ip->client->config->send_options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - - - /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, - options, 0, 0, 0, NULL, 0); - if (ip->client->packet_length < BOOTP_MIN_LEN) - ip->client->packet_length = BOOTP_MIN_LEN; - - ip->client->packet.op = BOOTREQUEST; - ip->client->packet.htype = ip->hw_address.htype; - ip->client->packet.hlen = ip->hw_address.hlen; - ip->client->packet.hops = 0; - ip->client->packet.xid = ip->client->xid; - ip->client->packet.secs = 0; /* Filled in by send_request. */ - ip->client->packet.flags = 0; - - /* ciaddr must always be zero. */ - memset(&ip->client->packet.ciaddr, 0, - sizeof(ip->client->packet.ciaddr)); - memset(&ip->client->packet.yiaddr, 0, - sizeof(ip->client->packet.yiaddr)); - memset(&ip->client->packet.siaddr, 0, - sizeof(ip->client->packet.siaddr)); - memset(&ip->client->packet.giaddr, 0, - sizeof(ip->client->packet.giaddr)); - memcpy(ip->client->packet.chaddr, - ip->hw_address.haddr, ip->hw_address.hlen); -} - -void -free_client_lease(struct client_lease *lease) -{ - int i; - - if (lease->server_name) - free(lease->server_name); - if (lease->filename) - free(lease->filename); - for (i = 0; i < 256; i++) { - if (lease->options[i].len) - free(lease->options[i].data); - } - free(lease); -} - -FILE *leaseFile; - -void -rewrite_client_leases(struct interface_info *ifi) -{ - struct client_lease *lp; - - if (!leaseFile) { - leaseFile = fopen(path_dhclient_db, "w"); - if (!leaseFile) - error("can't create %s", path_dhclient_db); - } else { - fflush(leaseFile); - rewind(leaseFile); - } - - for (lp = ifi->client->leases; lp; lp = lp->next) - write_client_lease(ifi, lp, 1); - if (ifi->client->active) - write_client_lease(ifi, ifi->client->active, 1); - - fflush(leaseFile); -} - -void -write_client_lease(struct interface_info *ip, struct client_lease *lease, - int rewrite) -{ - static int leases_written; - struct tm *t; - int i; - - if (!rewrite) { - if (leases_written++ > 20) { - rewrite_client_leases(ip); - leases_written = 0; - } - } - - /* If the lease came from the config file, we don't need to stash - a copy in the lease database. */ - if (lease->is_static) - return; - - if (!leaseFile) { /* XXX */ - leaseFile = fopen(path_dhclient_db, "w"); - if (!leaseFile) { - error("can't create %s", path_dhclient_db); - return; - } - } - - fprintf(leaseFile, "lease {\n"); - if (lease->is_bootp) - fprintf(leaseFile, " bootp;\n"); - fprintf(leaseFile, " interface \"%s\";\n", ip->name); - fprintf(leaseFile, " fixed-address %s;\n", piaddr(lease->address)); - if (lease->filename) - fprintf(leaseFile, " filename \"%s\";\n", lease->filename); - if (lease->server_name) - fprintf(leaseFile, " server-name \"%s\";\n", - lease->server_name); - if (lease->medium) - fprintf(leaseFile, " medium \"%s\";\n", lease->medium->string); - for (i = 0; i < 256; i++) - if (lease->options[i].len) - fprintf(leaseFile, " option %s %s;\n", - dhcp_options[i].name, - pretty_print_option(i, lease->options[i].data, - lease->options[i].len, 1, 1)); - - t = gmtime(&lease->renewal); - if (t) - fprintf(leaseFile, " renew %d %d/%d/%d %02d:%02d:%02d;\n", - t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - t = gmtime(&lease->rebind); - if (t) - fprintf(leaseFile, " rebind %d %d/%d/%d %02d:%02d:%02d;\n", - t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - t = gmtime(&lease->expiry); - if (t) - fprintf(leaseFile, " expire %d %d/%d/%d %02d:%02d:%02d;\n", - t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - fprintf(leaseFile, "}\n"); - fflush(leaseFile); -} - -void -script_init(char *reason, struct string_list *medium) -{ - size_t len, mediumlen = 0; - struct imsg_hdr hdr; - struct buf *buf; - int errs; - - if (medium != NULL && medium->string != NULL) - mediumlen = strlen(medium->string); - - hdr.code = IMSG_SCRIPT_INIT; - hdr.len = sizeof(struct imsg_hdr) + - sizeof(size_t) + mediumlen + - sizeof(size_t) + strlen(reason); - - if ((buf = buf_open(hdr.len)) == NULL) - return; - - errs = 0; - errs += buf_add(buf, &hdr, sizeof(hdr)); - errs += buf_add(buf, &mediumlen, sizeof(mediumlen)); - if (mediumlen > 0) - errs += buf_add(buf, medium->string, mediumlen); - len = strlen(reason); - errs += buf_add(buf, &len, sizeof(len)); - errs += buf_add(buf, reason, len); - - if (errs) - error("buf_add: %d", WSAGetLastError()); - - if (buf_close(privfd, buf) == -1) - error("buf_close: %d", WSAGetLastError()); -} - -void -priv_script_init(struct interface_info *ip, char *reason, char *medium) -{ - if (ip) { - // XXX Do we need to do anything? - } -} - -void -priv_script_write_params(struct interface_info *ip, char *prefix, struct client_lease *lease) -{ - u_int8_t dbuf[1500]; - int i, len = 0; - -#if 0 - script_set_env(ip->client, prefix, "ip_address", - piaddr(lease->address)); -#endif - - if (lease->options[DHO_SUBNET_MASK].len && - (lease->options[DHO_SUBNET_MASK].len < - sizeof(lease->address.iabuf))) { - struct iaddr netmask, subnet, broadcast; - - memcpy(netmask.iabuf, lease->options[DHO_SUBNET_MASK].data, - lease->options[DHO_SUBNET_MASK].len); - netmask.len = lease->options[DHO_SUBNET_MASK].len; - - subnet = subnet_number(lease->address, netmask); - if (subnet.len) { -#if 0 - script_set_env(ip->client, prefix, "network_number", - piaddr(subnet)); -#endif - if (!lease->options[DHO_BROADCAST_ADDRESS].len) { - broadcast = broadcast_addr(subnet, netmask); - if (broadcast.len) -#if 0 - script_set_env(ip->client, prefix, - "broadcast_address", - piaddr(broadcast)); -#else - ; -#endif - } - } - } - -#if 0 - if (lease->filename) - script_set_env(ip->client, prefix, "filename", lease->filename); - if (lease->server_name) - script_set_env(ip->client, prefix, "server_name", - lease->server_name); -#endif - - for (i = 0; i < 256; i++) { - u_int8_t *dp = NULL; - - if (ip->client->config->defaults[i].len) { - if (lease->options[i].len) { - switch ( - ip->client->config->default_actions[i]) { - case ACTION_DEFAULT: - dp = lease->options[i].data; - len = lease->options[i].len; - break; - case ACTION_SUPERSEDE: -supersede: - dp = ip->client-> - config->defaults[i].data; - len = ip->client-> - config->defaults[i].len; - break; - case ACTION_PREPEND: - len = ip->client-> - config->defaults[i].len + - lease->options[i].len; - if (len >= sizeof(dbuf)) { - warning("no space to %s %s", - "prepend option", - dhcp_options[i].name); - goto supersede; - } - dp = dbuf; - memcpy(dp, - ip->client-> - config->defaults[i].data, - ip->client-> - config->defaults[i].len); - memcpy(dp + ip->client-> - config->defaults[i].len, - lease->options[i].data, - lease->options[i].len); - dp[len] = '\0'; - break; - case ACTION_APPEND: - len = ip->client-> - config->defaults[i].len + - lease->options[i].len + 1; - if (len > sizeof(dbuf)) { - warning("no space to %s %s", - "append option", - dhcp_options[i].name); - goto supersede; - } - dp = dbuf; - memcpy(dp, - lease->options[i].data, - lease->options[i].len); - memcpy(dp + lease->options[i].len, - ip->client-> - config->defaults[i].data, - ip->client-> - config->defaults[i].len); - dp[len-1] = '\0'; - } - } else { - dp = ip->client-> - config->defaults[i].data; - len = ip->client-> - config->defaults[i].len; - } - } else if (lease->options[i].len) { - len = lease->options[i].len; - dp = lease->options[i].data; - } else { - len = 0; - } -#if 0 - if (len) { - char name[256]; - - if (dhcp_option_ev_name(name, sizeof(name), - &dhcp_options[i])) - script_set_env(ip->client, prefix, name, - pretty_print_option(i, dp, len, 0, 0)); - } -#endif - } -#if 0 - snprintf(tbuf, sizeof(tbuf), "%d", (int)lease->expiry); - script_set_env(ip->client, prefix, "expiry", tbuf); -#endif -} - -void -script_write_params(char *prefix, struct client_lease *lease) -{ - size_t fn_len = 0, sn_len = 0, pr_len = 0; - struct imsg_hdr hdr; - struct buf *buf; - int errs, i; - - if (lease->filename != NULL) - fn_len = strlen(lease->filename); - if (lease->server_name != NULL) - sn_len = strlen(lease->server_name); - if (prefix != NULL) - pr_len = strlen(prefix); - - hdr.code = IMSG_SCRIPT_WRITE_PARAMS; - hdr.len = sizeof(hdr) + sizeof(struct client_lease) + - sizeof(size_t) + fn_len + sizeof(size_t) + sn_len + - sizeof(size_t) + pr_len; - - for (i = 0; i < 256; i++) - hdr.len += sizeof(int) + lease->options[i].len; - - scripttime = time(NULL); - - if ((buf = buf_open(hdr.len)) == NULL) - return; - - errs = 0; - errs += buf_add(buf, &hdr, sizeof(hdr)); - errs += buf_add(buf, lease, sizeof(struct client_lease)); - errs += buf_add(buf, &fn_len, sizeof(fn_len)); - errs += buf_add(buf, lease->filename, fn_len); - errs += buf_add(buf, &sn_len, sizeof(sn_len)); - errs += buf_add(buf, lease->server_name, sn_len); - errs += buf_add(buf, &pr_len, sizeof(pr_len)); - errs += buf_add(buf, prefix, pr_len); - - for (i = 0; i < 256; i++) { - errs += buf_add(buf, &lease->options[i].len, - sizeof(lease->options[i].len)); - errs += buf_add(buf, lease->options[i].data, - lease->options[i].len); - } - - if (errs) - error("buf_add: %d", WSAGetLastError()); - - if (buf_close(privfd, buf) == -1) - error("buf_close: %d", WSAGetLastError()); -} - -int -dhcp_option_ev_name(char *buf, size_t buflen, struct dhcp_option *option) -{ - int i; - - for (i = 0; option->name[i]; i++) { - if (i + 1 == buflen) - return 0; - if (option->name[i] == '-') - buf[i] = '_'; - else - buf[i] = option->name[i]; - } - - buf[i] = 0; - return 1; -} - -#if 0 -void -go_daemon(void) -{ - static int state = 0; - - if (no_daemon || state) - return; - - state = 1; - - /* Stop logging to stderr... */ - log_perror = 0; - - if (daemon(1, 0) == -1) - error("daemon"); - - /* we are chrooted, daemon(3) fails to open /dev/null */ - if (nullfd != -1) { - dup2(nullfd, STDIN_FILENO); - dup2(nullfd, STDOUT_FILENO); - dup2(nullfd, STDERR_FILENO); - close(nullfd); - nullfd = -1; - } -} -#endif - -int -check_option(struct client_lease *l, int option) -{ - char *opbuf; - char *sbuf; - - /* we use this, since this is what gets passed to dhclient-script */ - - opbuf = pretty_print_option(option, l->options[option].data, - l->options[option].len, 0, 0); - - sbuf = option_as_string(option, l->options[option].data, - l->options[option].len); - - switch (option) { - case DHO_SUBNET_MASK: - case DHO_TIME_SERVERS: - case DHO_NAME_SERVERS: - case DHO_ROUTERS: - case DHO_DOMAIN_NAME_SERVERS: - case DHO_LOG_SERVERS: - case DHO_COOKIE_SERVERS: - case DHO_LPR_SERVERS: - case DHO_IMPRESS_SERVERS: - case DHO_RESOURCE_LOCATION_SERVERS: - case DHO_SWAP_SERVER: - case DHO_BROADCAST_ADDRESS: - case DHO_NIS_SERVERS: - case DHO_NTP_SERVERS: - case DHO_NETBIOS_NAME_SERVERS: - case DHO_NETBIOS_DD_SERVER: - case DHO_FONT_SERVERS: - case DHO_DHCP_SERVER_IDENTIFIER: - if (!ipv4addrs(opbuf)) { - warning("Invalid IP address in option(%d): %s", option, opbuf); - return (0); - } - return (1) ; - case DHO_HOST_NAME: - case DHO_DOMAIN_NAME: - case DHO_NIS_DOMAIN: - if (!res_hnok(sbuf)) - warning("Bogus Host Name option %d: %s (%s)", option, - sbuf, opbuf); - return (1); - case DHO_PAD: - case DHO_TIME_OFFSET: - case DHO_BOOT_SIZE: - case DHO_MERIT_DUMP: - case DHO_ROOT_PATH: - case DHO_EXTENSIONS_PATH: - case DHO_IP_FORWARDING: - case DHO_NON_LOCAL_SOURCE_ROUTING: - case DHO_POLICY_FILTER: - case DHO_MAX_DGRAM_REASSEMBLY: - case DHO_DEFAULT_IP_TTL: - case DHO_PATH_MTU_AGING_TIMEOUT: - case DHO_PATH_MTU_PLATEAU_TABLE: - case DHO_INTERFACE_MTU: - case DHO_ALL_SUBNETS_LOCAL: - case DHO_PERFORM_MASK_DISCOVERY: - case DHO_MASK_SUPPLIER: - case DHO_ROUTER_DISCOVERY: - case DHO_ROUTER_SOLICITATION_ADDRESS: - case DHO_STATIC_ROUTES: - case DHO_TRAILER_ENCAPSULATION: - case DHO_ARP_CACHE_TIMEOUT: - case DHO_IEEE802_3_ENCAPSULATION: - case DHO_DEFAULT_TCP_TTL: - case DHO_TCP_KEEPALIVE_INTERVAL: - case DHO_TCP_KEEPALIVE_GARBAGE: - case DHO_VENDOR_ENCAPSULATED_OPTIONS: - case DHO_NETBIOS_NODE_TYPE: - case DHO_NETBIOS_SCOPE: - case DHO_X_DISPLAY_MANAGER: - case DHO_DHCP_REQUESTED_ADDRESS: - case DHO_DHCP_LEASE_TIME: - case DHO_DHCP_OPTION_OVERLOAD: - case DHO_DHCP_MESSAGE_TYPE: - case DHO_DHCP_PARAMETER_REQUEST_LIST: - case DHO_DHCP_MESSAGE: - case DHO_DHCP_MAX_MESSAGE_SIZE: - case DHO_DHCP_RENEWAL_TIME: - case DHO_DHCP_REBINDING_TIME: - case DHO_DHCP_CLASS_IDENTIFIER: - case DHO_DHCP_CLIENT_IDENTIFIER: - case DHO_DHCP_USER_CLASS_ID: - case DHO_END: - return (1); - default: - warning("unknown dhcp option value 0x%x", option); - return (unknown_ok); - } -} - -int -res_hnok(const char *dn) -{ - int pch = PERIOD, ch = *dn++; - - while (ch != '\0') { - int nch = *dn++; - - if (periodchar(ch)) { - ; - } else if (periodchar(pch)) { - if (!borderchar(ch)) - return (0); - } else if (periodchar(nch) || nch == '\0') { - if (!borderchar(ch)) - return (0); - } else { - if (!middlechar(ch)) - return (0); - } - pch = ch, ch = nch; - } - return (1); -} - -/* Does buf consist only of dotted decimal ipv4 addrs? - * return how many if so, - * otherwise, return 0 - */ -int -ipv4addrs(char * buf) -{ - char *tmp; - struct in_addr jnk; - int i = 0; - - note("Input: %s", buf); - - do { - tmp = strtok(buf, " "); - note("got %s", tmp); - if( tmp && inet_aton(tmp, &jnk) ) i++; - buf = NULL; - } while( tmp ); - - return (i); -} - - -char * -option_as_string(unsigned int code, unsigned char *data, int len) -{ - static char optbuf[32768]; /* XXX */ - char *op = optbuf; - int opleft = sizeof(optbuf); - unsigned char *dp = data; - - if (code > 255) - error("option_as_string: bad code %d", code); - - for (; dp < data + len; dp++) { - if (!isascii(*dp) || !isprint(*dp)) { - if (dp + 1 != data + len || *dp != 0) { - _snprintf(op, opleft, "\\%03o", *dp); - op += 4; - opleft -= 4; - } - } else if (*dp == '"' || *dp == '\'' || *dp == '$' || - *dp == '`' || *dp == '\\') { - *op++ = '\\'; - *op++ = *dp; - opleft -= 2; - } else { - *op++ = *dp; - opleft--; - } - } - if (opleft < 1) - goto toobig; - *op = 0; - return optbuf; -toobig: - warning("dhcp option too large"); - return ""; -} - diff --git a/reactos/base/services/dhcp/dhcp.rbuild b/reactos/base/services/dhcp/dhcp.rbuild deleted file mode 100644 index ffa05b78465..00000000000 --- a/reactos/base/services/dhcp/dhcp.rbuild +++ /dev/null @@ -1,30 +0,0 @@ - - - - . - include - - ntdll - ws2_32 - iphlpapi - advapi32 - oldnames - adapter.c - alloc.c - api.c - compat.c - dhclient.c - dispatch.c - hash.c - options.c - pipe.c - privsep.c - socket.c - tables.c - timer.c - util.c - dhcp.rc - - rosdhcp.h - - diff --git a/reactos/base/services/dhcp/dhcp.rc b/reactos/base/services/dhcp/dhcp.rc deleted file mode 100644 index 35e404f893e..00000000000 --- a/reactos/base/services/dhcp/dhcp.rc +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id: regsvr32.rc 12852 2005-01-06 13:58:04Z mf $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "DHCP Client Service" -#define REACTOS_STR_INTERNAL_NAME "dhcp\0" -#define REACTOS_STR_ORIGINAL_FILENAME "dhcp.exe\0" -#include diff --git a/reactos/base/services/dhcp/dhcpmain.c b/reactos/base/services/dhcp/dhcpmain.c deleted file mode 100644 index c1a1b30328e..00000000000 --- a/reactos/base/services/dhcp/dhcpmain.c +++ /dev/null @@ -1,72 +0,0 @@ -/* $Id:$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Service - * FILE: subsys/system/dhcp - * PURPOSE: DHCP client service entry point - * PROGRAMMER: Art Yerkes (arty@users.sf.net) - * UPDATE HISTORY: - * Created 03/08/2005 - */ - -#include -#include "dhcpd.h" -#include "version.h" - -typedef struct _DHCP_API_REQUEST { - int type; - UINT flags; - LPDHCPAPI_CLASSID class_id; - DHCP_API_PARAMS_ARRAY vendor_params; - DHCP_API_PARAMS_ARRAY general_params; - LPWSTR request_id, adapter_name; -} DHCP_API_REQUEST; - -typedef struct _DHCP_MANAGED_ADAPTER { - LPWSTR adapter_name, hostname, dns_server; - UINT adapter_index; - struct sockaddr_in address, netmask; - struct interface_info *dhcp_info; -} DHCP_MANAGED_ADAPTER; - -#define DHCP_REQUESTPARAM WM_USER + 0 -#define DHCP_PARAMCHANGE WM_USER + 1 -#define DHCP_CANCELREQUEST WM_USER + 2 -#define DHCP_NOPARAMCHANGE WM_USER + 3 -#define DHCP_MANAGEADAPTER WM_USER + 4 -#define DHCP_UNMANAGEADAPTER WM_USER + 5 - -UINT DhcpEventTimer; -HANDLE DhcpServiceThread; -DWORD DhcpServiceThreadId; -LIST_ENTRY ManagedAdapters; - -LRESULT WINAPI ServiceThread( PVOID Data ) { - MSG msg; - - while( GetMessage( &msg, 0, 0, 0 ) ) { - switch( msg.message ) { - case DHCP_MANAGEADAPTER: - - break; - - case DHCP_UNMANAGEADAPTER: - break; - - case DHCP_REQUESTPARAM: - break; - - case DHCP_CANCELREQUEST: - break; - - case DHCP_PARAMCHANGE: - break; - - case DHCP_NOPARAMCHANGE: - break; - } - } -} - -int main( int argc, char **argv ) { -} diff --git a/reactos/base/services/dhcp/dispatch.c b/reactos/base/services/dhcp/dispatch.c deleted file mode 100644 index c26ead72701..00000000000 --- a/reactos/base/services/dhcp/dispatch.c +++ /dev/null @@ -1,356 +0,0 @@ -/* $OpenBSD: dispatch.c,v 1.31 2004/09/21 04:07:03 david Exp $ */ - -/* - * Copyright 2004 Henning Brauer - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#include "rosdhcp.h" -#include "dhcpd.h" -//#include - -//#include -//#include -//#include - -struct protocol *protocols = NULL; -struct timeout *timeouts = NULL; -static struct timeout *free_timeouts = NULL; -void (*bootp_packet_handler)(struct interface_info *, - struct dhcp_packet *, int, unsigned int, - struct iaddr, struct hardware *); - -/* - * Wait for packets to come in using poll(). When a packet comes in, - * call receive_packet to receive the packet and possibly strip hardware - * addressing information from it, and then call through the - * bootp_packet_handler hook to try to do something with it. - */ -void -dispatch(void) -{ - int count, to_msec, err; - struct protocol *l; - fd_set fds; - time_t howlong, cur_time; - struct timeval timeval; - - if (!AdapterDiscover()) { - AdapterStop(); - return; - } - - ApiLock(); - - do { - /* - * Call any expired timeouts, and then if there's still - * a timeout registered, time out the select call then. - */ - time(&cur_time); - - if (timeouts) { - struct timeout *t; - - if (timeouts->when <= cur_time) { - t = timeouts; - timeouts = timeouts->next; - (*(t->func))(t->what); - t->next = free_timeouts; - free_timeouts = t; - continue; - } - - /* - * Figure timeout in milliseconds, and check for - * potential overflow, so we can cram into an - * int for poll, while not polling with a - * negative timeout and blocking indefinitely. - */ - howlong = timeouts->when - cur_time; - if (howlong > INT_MAX / 1000) - howlong = INT_MAX / 1000; - to_msec = howlong * 1000; - } else - to_msec = 5000; - - /* Set up the descriptors to be polled. */ - FD_ZERO(&fds); - - for (l = protocols; l; l = l->next) - FD_SET(l->fd, &fds); - - /* Wait for a packet or a timeout... XXX */ - timeval.tv_sec = to_msec / 1000; - timeval.tv_usec = to_msec % 1000; - - ApiUnlock(); - - if (protocols) - count = select(0, &fds, NULL, NULL, &timeval); - else { - Sleep(to_msec); - count = 0; - } - - ApiLock(); - - DH_DbgPrint(MID_TRACE,("Select: %d\n", count)); - - /* Not likely to be transitory... */ - if (count == SOCKET_ERROR) { - err = WSAGetLastError(); - error("poll: %d", err); - break; - } - - for (l = protocols; l; l = l->next) { - struct interface_info *ip; - ip = l->local; - if (FD_ISSET(l->fd, &fds)) { - if (ip && (l->handler != got_one || - !ip->dead)) { - DH_DbgPrint(MID_TRACE,("Handling %x\n", l)); - (*(l->handler))(l); - } - } - } - } while (1); - - ApiUnlock(); /* Not reached currently */ -} - -void -got_one(struct protocol *l) -{ - struct sockaddr_in from; - struct hardware hfrom; - struct iaddr ifrom; - ssize_t result; - union { - /* - * Packet input buffer. Must be as large as largest - * possible MTU. - */ - unsigned char packbuf[4095]; - struct dhcp_packet packet; - } u; - struct interface_info *ip = l->local; - PDHCP_ADAPTER adapter; - - if ((result = receive_packet(ip, u.packbuf, sizeof(u), &from, - &hfrom)) == -1) { - warning("receive_packet failed on %s: %d", ip->name, - WSAGetLastError()); - ip->errors++; - if (ip->errors > 20) { - /* our interface has gone away. */ - warning("Interface %s no longer appears valid.", - ip->name); - ip->dead = 1; - close(l->fd); - remove_protocol(l); - adapter = AdapterFindInfo(ip); - if (adapter) { - RemoveEntryList(&adapter->ListEntry); - free(adapter); - } - } - return; - } - if (result == 0) - return; - - if (bootp_packet_handler) { - ifrom.len = 4; - memcpy(ifrom.iabuf, &from.sin_addr, ifrom.len); - - - adapter = AdapterFindByHardwareAddress(u.packet.chaddr, - u.packet.hlen); - - if (!adapter) { - warning("Discarding packet with a non-matching target physical address\n"); - return; - } - - (*bootp_packet_handler)(&adapter->DhclientInfo, &u.packet, result, - from.sin_port, ifrom, &hfrom); - } -} - -void -add_timeout(time_t when, void (*where)(void *), void *what) -{ - struct timeout *t, *q; - - DH_DbgPrint(MID_TRACE,("Adding timeout %x %p %x\n", when, where, what)); - /* See if this timeout supersedes an existing timeout. */ - t = NULL; - for (q = timeouts; q; q = q->next) { - if (q->func == where && q->what == what) { - if (t) - t->next = q->next; - else - timeouts = q->next; - break; - } - t = q; - } - - /* If we didn't supersede a timeout, allocate a timeout - structure now. */ - if (!q) { - if (free_timeouts) { - q = free_timeouts; - free_timeouts = q->next; - q->func = where; - q->what = what; - } else { - q = malloc(sizeof(struct timeout)); - if (!q) { - error("Can't allocate timeout structure!"); - return; - } - q->func = where; - q->what = what; - } - } - - q->when = when; - - /* Now sort this timeout into the timeout list. */ - - /* Beginning of list? */ - if (!timeouts || timeouts->when > q->when) { - q->next = timeouts; - timeouts = q; - return; - } - - /* Middle of list? */ - for (t = timeouts; t->next; t = t->next) { - if (t->next->when > q->when) { - q->next = t->next; - t->next = q; - return; - } - } - - /* End of list. */ - t->next = q; - q->next = NULL; -} - -void -cancel_timeout(void (*where)(void *), void *what) -{ - struct timeout *t, *q; - - /* Look for this timeout on the list, and unlink it if we find it. */ - t = NULL; - for (q = timeouts; q; q = q->next) { - if (q->func == where && q->what == what) { - if (t) - t->next = q->next; - else - timeouts = q->next; - break; - } - t = q; - } - - /* If we found the timeout, put it on the free list. */ - if (q) { - q->next = free_timeouts; - free_timeouts = q; - } -} - -/* Add a protocol to the list of protocols... */ -void -add_protocol(char *name, int fd, void (*handler)(struct protocol *), - void *local) -{ - struct protocol *p; - - p = malloc(sizeof(*p)); - if (!p) - error("can't allocate protocol struct for %s", name); - - p->fd = fd; - p->handler = handler; - p->local = local; - p->next = protocols; - protocols = p; -} - -void -remove_protocol(struct protocol *proto) -{ - struct protocol *p, *next, *prev; - - prev = NULL; - for (p = protocols; p; p = next) { - next = p->next; - if (p == proto) { - if (prev) - prev->next = p->next; - else - protocols = p->next; - free(p); - } - } -} - -struct protocol * -find_protocol_by_adapter(struct interface_info *info) -{ - struct protocol *p; - - for( p = protocols; p; p = p->next ) { - if( p->local == (void *)info ) return p; - } - - return NULL; -} - -int -interface_link_status(char *ifname) -{ - return (1); -} diff --git a/reactos/base/services/dhcp/hash.c b/reactos/base/services/dhcp/hash.c deleted file mode 100644 index 84c8c6a7ade..00000000000 --- a/reactos/base/services/dhcp/hash.c +++ /dev/null @@ -1,165 +0,0 @@ -/* hash.c - - Routines for manipulating hash tables... */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define lint -#ifndef lint -static char copyright[] = -"$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" - -static __inline int do_hash PROTO ((unsigned char *, int, int)); - -struct hash_table *new_hash () -{ - struct hash_table *rv = new_hash_table (DEFAULT_HASH_SIZE); - if (!rv) - return rv; - memset (&rv -> buckets [0], 0, - DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *)); - return rv; -} - -static __inline int do_hash (name, len, size) - unsigned char *name; - int len; - int size; -{ - register int accum = 0; - register unsigned char *s = name; - int i = len; - while (i--) { - /* Add the character in... */ - accum += *s++; - /* Add carry back in... */ - while (accum > 255) { - accum = (accum & 255) + (accum >> 8); - } - } - return accum % size; -} - -void add_hash (table, name, len, pointer) - struct hash_table *table; - int len; - unsigned char *name; - unsigned char *pointer; -{ - int hashno; - struct hash_bucket *bp; - - if (!table) - return; - if (!len) - len = strlen ((char *)name); - - hashno = do_hash (name, len, table -> hash_count); - bp = new_hash_bucket (); - - if (!bp) { - warn ("Can't add %s to hash table.", name); - return; - } - bp -> name = name; - bp -> value = pointer; - bp -> next = table -> buckets [hashno]; - bp -> len = len; - table -> buckets [hashno] = bp; -} - -void delete_hash_entry (table, name, len) - struct hash_table *table; - int len; - unsigned char *name; -{ - int hashno; - struct hash_bucket *bp, *pbp = (struct hash_bucket *)0; - - if (!table) - return; - if (!len) - len = strlen ((char *)name); - - hashno = do_hash (name, len, table -> hash_count); - - /* Go through the list looking for an entry that matches; - if we find it, delete it. */ - for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { - if ((!bp -> len && - !strcmp ((char *)bp -> name, (char *)name)) || - (bp -> len == len && - !memcmp (bp -> name, name, len))) { - if (pbp) { - pbp -> next = bp -> next; - } else { - table -> buckets [hashno] = bp -> next; - } - free_hash_bucket (bp, "delete_hash_entry"); - break; - } - pbp = bp; /* jwg, 9/6/96 - nice catch! */ - } -} - -unsigned char *hash_lookup (table, name, len) - struct hash_table *table; - unsigned char *name; - int len; -{ - int hashno; - struct hash_bucket *bp; - - if (!table) - return (unsigned char *)0; - - if (!len) - len = strlen ((char *)name); - - hashno = do_hash (name, len, table -> hash_count); - - for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { - if (len == bp -> len && !memcmp (bp -> name, name, len)) - return bp -> value; - } - return (unsigned char *)0; -} diff --git a/reactos/base/services/dhcp/include/cdefs.h b/reactos/base/services/dhcp/include/cdefs.h deleted file mode 100644 index 2bc67a5251a..00000000000 --- a/reactos/base/services/dhcp/include/cdefs.h +++ /dev/null @@ -1,57 +0,0 @@ -/* cdefs.h - - Standard C definitions... */ - -/* - * Copyright (c) 1996 The Internet Software Consortium. - * All Rights Reserved. - * Copyright (c) 1995 RadioMail Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of RadioMail Corporation, the Internet Software - * Consortium nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY RADIOMAIL CORPORATION, THE INTERNET - * SOFTWARE CONSORTIUM AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL RADIOMAIL CORPORATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software was written for RadioMail Corporation by Ted Lemon - * under a contract with Vixie Enterprises. Further modifications have - * been made for the Internet Software Consortium under a contract - * with Vixie Laboratories. - */ - -#if (defined (__GNUC__) || defined (__STDC__)) && !defined (BROKEN_ANSI) -#define PROTO(x) x -#define KandR(x) -#define ANSI_DECL(x) x -#if defined (__GNUC__) -#define INLINE inline -#else -#define INLINE -#endif /* __GNUC__ */ -#else -#define PROTO(x) () -#define KandR(x) x -#define ANSI_DECL(x) -#define INLINE -#endif /* __GNUC__ || __STDC__ */ diff --git a/reactos/base/services/dhcp/include/debug.h b/reactos/base/services/dhcp/include/debug.h deleted file mode 100644 index de374aaba45..00000000000 --- a/reactos/base/services/dhcp/include/debug.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS TCP/IP protocol driver - * FILE: include/debug.h - * PURPOSE: Debugging support macros - * DEFINES: DBG - Enable debug output - * NASSERT - Disable assertions - */ - -#pragma once - -#define NORMAL_MASK 0x000000FF -#define SPECIAL_MASK 0xFFFFFF00 -#define MIN_TRACE 0x00000001 -#define MID_TRACE 0x00000002 -#define MAX_TRACE 0x00000003 - -#define DEBUG_ADAPTER 0x00000100 -#define DEBUG_ULTRA 0xFFFFFFFF - -#if DBG - -extern unsigned long debug_trace_level; - -#ifdef _MSC_VER - -#define DH_DbgPrint(_t_, _x_) \ - if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ - ((debug_trace_level & _t_) > NORMAL_MASK)) { \ - DbgPrint("(%s:%d) ", __FILE__, __LINE__); \ - DbgPrint _x_ ; \ - } - -#else /* _MSC_VER */ - -#define DH_DbgPrint(_t_, _x_) \ - if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ - ((debug_trace_level & _t_) > NORMAL_MASK)) { \ - DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \ - DbgPrint _x_ ; \ - } - -#endif /* _MSC_VER */ - -#else /* DBG */ - -#define DH_DbgPrint(_t_, _x_) - -#endif /* DBG */ - -/* EOF */ diff --git a/reactos/base/services/dhcp/include/dhcp.h b/reactos/base/services/dhcp/include/dhcp.h deleted file mode 100644 index 8ac8ed3a9e6..00000000000 --- a/reactos/base/services/dhcp/include/dhcp.h +++ /dev/null @@ -1,169 +0,0 @@ -/* $OpenBSD: dhcp.h,v 1.5 2004/05/04 15:49:49 deraadt Exp $ */ - -/* Protocol structures... */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ - 20 + /* IP header */ \ - 8) /* UDP header */ -#define DHCP_SNAME_LEN 64 -#define DHCP_FILE_LEN 128 -#define DHCP_FIXED_NON_UDP 236 -#define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) - /* Everything but options. */ -#define DHCP_MTU_MAX 1500 -#define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) - -#define BOOTP_MIN_LEN 300 -#define DHCP_MIN_LEN 548 - -struct dhcp_packet { - u_int8_t op; /* Message opcode/type */ - u_int8_t htype; /* Hardware addr type (see net/if_types.h) */ - u_int8_t hlen; /* Hardware addr length */ - u_int8_t hops; /* Number of relay agent hops from client */ - u_int32_t xid; /* Transaction ID */ - u_int16_t secs; /* Seconds since client started looking */ - u_int16_t flags; /* Flag bits */ - struct in_addr ciaddr; /* Client IP address (if already in use) */ - struct in_addr yiaddr; /* Client IP address */ - struct in_addr siaddr; /* IP address of next server to talk to */ - struct in_addr giaddr; /* DHCP relay agent IP address */ - unsigned char chaddr[16]; /* Client hardware address */ - char sname[DHCP_SNAME_LEN]; /* Server name */ - char file[DHCP_FILE_LEN]; /* Boot filename */ - unsigned char options[DHCP_OPTION_LEN]; - /* Optional parameters - (actual length dependent on MTU). */ -}; - -/* BOOTP (rfc951) message types */ -#define BOOTREQUEST 1 -#define BOOTREPLY 2 - -/* Possible values for flags field... */ -#define BOOTP_BROADCAST 32768L - -/* Possible values for hardware type (htype) field... */ -#define HTYPE_ETHER 1 /* Ethernet */ -#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ -#define HTYPE_FDDI 8 /* FDDI... */ - -/* Magic cookie validating dhcp options field (and bootp vendor - extensions field). */ -#define DHCP_OPTIONS_COOKIE "\143\202\123\143" - - -/* DHCP Option codes: */ - -#define DHO_PAD 0 -#define DHO_SUBNET_MASK 1 -#define DHO_TIME_OFFSET 2 -#define DHO_ROUTERS 3 -#define DHO_TIME_SERVERS 4 -#define DHO_NAME_SERVERS 5 -#define DHO_DOMAIN_NAME_SERVERS 6 -#define DHO_LOG_SERVERS 7 -#define DHO_COOKIE_SERVERS 8 -#define DHO_LPR_SERVERS 9 -#define DHO_IMPRESS_SERVERS 10 -#define DHO_RESOURCE_LOCATION_SERVERS 11 -#define DHO_HOST_NAME 12 -#define DHO_BOOT_SIZE 13 -#define DHO_MERIT_DUMP 14 -#define DHO_DOMAIN_NAME 15 -#define DHO_SWAP_SERVER 16 -#define DHO_ROOT_PATH 17 -#define DHO_EXTENSIONS_PATH 18 -#define DHO_IP_FORWARDING 19 -#define DHO_NON_LOCAL_SOURCE_ROUTING 20 -#define DHO_POLICY_FILTER 21 -#define DHO_MAX_DGRAM_REASSEMBLY 22 -#define DHO_DEFAULT_IP_TTL 23 -#define DHO_PATH_MTU_AGING_TIMEOUT 24 -#define DHO_PATH_MTU_PLATEAU_TABLE 25 -#define DHO_INTERFACE_MTU 26 -#define DHO_ALL_SUBNETS_LOCAL 27 -#define DHO_BROADCAST_ADDRESS 28 -#define DHO_PERFORM_MASK_DISCOVERY 29 -#define DHO_MASK_SUPPLIER 30 -#define DHO_ROUTER_DISCOVERY 31 -#define DHO_ROUTER_SOLICITATION_ADDRESS 32 -#define DHO_STATIC_ROUTES 33 -#define DHO_TRAILER_ENCAPSULATION 34 -#define DHO_ARP_CACHE_TIMEOUT 35 -#define DHO_IEEE802_3_ENCAPSULATION 36 -#define DHO_DEFAULT_TCP_TTL 37 -#define DHO_TCP_KEEPALIVE_INTERVAL 38 -#define DHO_TCP_KEEPALIVE_GARBAGE 39 -#define DHO_NIS_DOMAIN 40 -#define DHO_NIS_SERVERS 41 -#define DHO_NTP_SERVERS 42 -#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43 -#define DHO_NETBIOS_NAME_SERVERS 44 -#define DHO_NETBIOS_DD_SERVER 45 -#define DHO_NETBIOS_NODE_TYPE 46 -#define DHO_NETBIOS_SCOPE 47 -#define DHO_FONT_SERVERS 48 -#define DHO_X_DISPLAY_MANAGER 49 -#define DHO_DHCP_REQUESTED_ADDRESS 50 -#define DHO_DHCP_LEASE_TIME 51 -#define DHO_DHCP_OPTION_OVERLOAD 52 -#define DHO_DHCP_MESSAGE_TYPE 53 -#define DHO_DHCP_SERVER_IDENTIFIER 54 -#define DHO_DHCP_PARAMETER_REQUEST_LIST 55 -#define DHO_DHCP_MESSAGE 56 -#define DHO_DHCP_MAX_MESSAGE_SIZE 57 -#define DHO_DHCP_RENEWAL_TIME 58 -#define DHO_DHCP_REBINDING_TIME 59 -#define DHO_DHCP_CLASS_IDENTIFIER 60 -#define DHO_DHCP_CLIENT_IDENTIFIER 61 -#define DHO_DHCP_USER_CLASS_ID 77 -#define DHO_END 255 - -/* DHCP message types. */ -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPDECLINE 4 -#define DHCPACK 5 -#define DHCPNAK 6 -#define DHCPRELEASE 7 -#define DHCPINFORM 8 diff --git a/reactos/base/services/dhcp/include/dhcpd.h b/reactos/base/services/dhcp/include/dhcpd.h deleted file mode 100644 index d6a2fa405b8..00000000000 --- a/reactos/base/services/dhcp/include/dhcpd.h +++ /dev/null @@ -1,485 +0,0 @@ -/* $OpenBSD: dhcpd.h,v 1.33 2004/05/06 22:29:15 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Henning Brauer - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#pragma once - -#include -#include -#include "stdint.h" - -#define IFNAMSIZ MAX_INTERFACE_NAME_LEN - -#define ETH_ALEN 6 -#define ETHER_ADDR_LEN ETH_ALEN -#include -struct ether_header -{ - u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */ - u_int16_t ether_type; /* packet type ID field */ -}; -#include - -struct ip - { - unsigned int ip_hl:4; /* header length */ - unsigned int ip_v:4; /* version */ - u_int8_t ip_tos; /* type of service */ - u_short ip_len; /* total length */ - u_short ip_id; /* identification */ - u_short ip_off; /* fragment offset field */ -#define IP_RF 0x8000 /* reserved fragment flag */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_int8_t ip_ttl; /* time to live */ - u_int8_t ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src, ip_dst; /* source and dest address */ - }; - -struct udphdr { - u_int16_t uh_sport; /* source port */ - u_int16_t uh_dport; /* destination port */ - u_int16_t uh_ulen; /* udp length */ - u_int16_t uh_sum; /* udp checksum */ -}; - -#define ETHERTYPE_IP 0x0800 -#define IPTOS_LOWDELAY 0x10 -#define ARPHRD_ETHER 1 - -// FIXME: I have no idea what this should be! -#define SIZE_T_MAX 1600 - -#define USE_SOCKET_RECEIVE -#define USE_SOCKET_SEND - -#include -#include -//#include -#include -#include -#include -//#include -#include -#include -#include -#include -//#include - -#include "dhcp.h" -#include "tree.h" - -#define LOCAL_PORT 68 -#define REMOTE_PORT 67 - -struct option_data { - int len; - u_int8_t *data; -}; - -struct string_list { - struct string_list *next; - char *string; -}; - -struct iaddr { - int len; - unsigned char iabuf[16]; -}; - -struct iaddrlist { - struct iaddrlist *next; - struct iaddr addr; -}; - -struct packet { - struct dhcp_packet *raw; - int packet_length; - int packet_type; - int options_valid; - int client_port; - struct iaddr client_addr; - struct interface_info *interface; - struct hardware *haddr; - struct option_data options[256]; -}; - -struct hardware { - u_int8_t htype; - u_int8_t hlen; - u_int8_t haddr[16]; -}; - -struct client_lease { - struct client_lease *next; - time_t expiry, renewal, rebind; - struct iaddr address; - char *server_name; -#ifdef __REACTOS__ - time_t obtained; - struct iaddr serveraddress; -#endif - char *filename; - struct string_list *medium; - unsigned int is_static : 1; - unsigned int is_bootp : 1; - struct option_data options[256]; -}; - -/* Possible states in which the client can be. */ -enum dhcp_state { - S_REBOOTING, - S_INIT, - S_SELECTING, - S_REQUESTING, - S_BOUND, - S_RENEWING, - S_REBINDING, - S_STATIC -}; - -struct client_config { - struct option_data defaults[256]; - enum { - ACTION_DEFAULT, - ACTION_SUPERSEDE, - ACTION_PREPEND, - ACTION_APPEND - } default_actions[256]; - - struct option_data send_options[256]; - u_int8_t required_options[256]; - u_int8_t requested_options[256]; - int requested_option_count; - time_t timeout; - time_t initial_interval; - time_t retry_interval; - time_t select_interval; - time_t reboot_timeout; - time_t backoff_cutoff; - struct string_list *media; - char *script_name; - enum { IGNORE, ACCEPT, PREFER } - bootp_policy; - struct string_list *medium; - struct iaddrlist *reject_list; -}; - -struct client_state { - struct client_lease *active; - struct client_lease *new; - struct client_lease *offered_leases; - struct client_lease *leases; - struct client_lease *alias; - enum dhcp_state state; - struct iaddr destination; - u_int32_t xid; - u_int16_t secs; - time_t first_sending; - time_t interval; - struct string_list *medium; - struct dhcp_packet packet; - int packet_length; - struct iaddr requested_address; - struct client_config *config; -}; - -struct interface_info { - struct interface_info *next; - struct hardware hw_address; - struct in_addr primary_address; - char name[IFNAMSIZ]; - int rfdesc; - int wfdesc; - unsigned char *rbuf; - size_t rbuf_max; - size_t rbuf_offset; - size_t rbuf_len; - struct client_state *client; - int noifmedia; - int errors; - int dead; - u_int16_t index; -}; - -struct timeout { - struct timeout *next; - time_t when; - void (*func)(void *); - void *what; -}; - -struct protocol { - struct protocol *next; - int fd; - void (*handler)(struct protocol *); - void *local; -}; - -#define DEFAULT_HASH_SIZE 97 - -struct hash_bucket { - struct hash_bucket *next; - unsigned char *name; - int len; - unsigned char *value; -}; - -struct hash_table { - int hash_count; - struct hash_bucket *buckets[DEFAULT_HASH_SIZE]; -}; - -/* Default path to dhcpd config file. */ -#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" -#define _PATH_DHCLIENT_DB "/var/db/dhclient.leases" -#define DHCPD_LOG_FACILITY LOG_DAEMON - -#define MAX_TIME 0x7fffffff -#define MIN_TIME 0 - -/* External definitions... */ - -/* options.c */ -int cons_options(struct packet *, struct dhcp_packet *, int, - struct tree_cache **, int, int, int, u_int8_t *, int); -char *pretty_print_option(unsigned int, - unsigned char *, int, int, int); -void do_packet(struct interface_info *, struct dhcp_packet *, - int, unsigned int, struct iaddr, struct hardware *); - -/* errwarn.c */ -extern int warnings_occurred; -#ifdef _MSC_VER -void error(char *, ...); -int warning(char *, ...); -int note(char *, ...); -int debug(char *, ...); -int parse_warn(char *, ...); -#else -void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -#endif - -/* conflex.c */ -extern int lexline, lexchar; -extern char *token_line, *tlname; -extern char comments[4096]; -extern int comment_index; -extern int eol_token; -void new_parse(char *); -int next_token(char **, FILE *); -int peek_token(char **, FILE *); - -/* parse.c */ -void skip_to_semi(FILE *); -int parse_semi(FILE *); -char *parse_string(FILE *); -int parse_ip_addr(FILE *, struct iaddr *); -void parse_hardware_param(FILE *, struct hardware *); -void parse_lease_time(FILE *, time_t *); -unsigned char *parse_numeric_aggregate(FILE *, unsigned char *, int *, - int, int, int); -void convert_num(unsigned char *, char *, int, int); -time_t parse_date(FILE *); - -/* tree.c */ -pair cons(caddr_t, pair); - -/* alloc.c */ -struct string_list *new_string_list(size_t size); -struct hash_table *new_hash_table(int); -struct hash_bucket *new_hash_bucket(void); -void dfree(void *, char *); -void free_hash_bucket(struct hash_bucket *, char *); - - -/* bpf.c */ -int if_register_bpf(struct interface_info *); -void if_register_send(struct interface_info *); -void if_register_receive(struct interface_info *); -ssize_t send_packet(struct interface_info *, struct dhcp_packet *, size_t, - struct in_addr, struct sockaddr_in *, struct hardware *); -ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, - struct sockaddr_in *, struct hardware *); - -/* dispatch.c */ -extern void (*bootp_packet_handler)(struct interface_info *, - struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *); -void discover_interfaces(struct interface_info *); -void reinitialize_interfaces(void); -void dispatch(void); -void got_one(struct protocol *); -void add_timeout(time_t, void (*)(void *), void *); -void cancel_timeout(void (*)(void *), void *); -void add_protocol(char *, int, void (*)(struct protocol *), void *); -void remove_protocol(struct protocol *); -struct protocol *find_protocol_by_adapter( struct interface_info * ); -int interface_link_status(char *); - -/* hash.c */ -struct hash_table *new_hash(void); -void add_hash(struct hash_table *, unsigned char *, int, unsigned char *); -unsigned char *hash_lookup(struct hash_table *, unsigned char *, int); - -/* tables.c */ -extern struct dhcp_option dhcp_options[256]; -extern unsigned char dhcp_option_default_priority_list[]; -extern int sizeof_dhcp_option_default_priority_list; -extern struct hash_table universe_hash; -extern struct universe dhcp_universe; -void initialize_universes(void); - -/* convert.c */ -u_int32_t getULong(unsigned char *); -int32_t getLong(unsigned char *); -u_int16_t getUShort(unsigned char *); -int16_t getShort(unsigned char *); -void putULong(unsigned char *, u_int32_t); -void putLong(unsigned char *, int32_t); -void putUShort(unsigned char *, unsigned int); -void putShort(unsigned char *, int); - -/* inet.c */ -struct iaddr subnet_number(struct iaddr, struct iaddr); -struct iaddr broadcast_addr(struct iaddr, struct iaddr); -int addr_eq(struct iaddr, struct iaddr); -char *piaddr(struct iaddr); - -/* dhclient.c */ -extern char *path_dhclient_conf; -extern char *path_dhclient_db; -extern time_t cur_time; -extern int log_priority; -extern int log_perror; - -extern struct client_config top_level_config; - -void dhcpoffer(struct packet *); -void dhcpack(struct packet *); -void dhcpnak(struct packet *); - -void send_discover(void *); -void send_request(void *); -void send_decline(void *); - -void state_reboot(void *); -void state_init(void *); -void state_selecting(void *); -void state_requesting(void *); -void state_bound(void *); -void state_panic(void *); - -void bind_lease(struct interface_info *); - -void make_discover(struct interface_info *, struct client_lease *); -void make_request(struct interface_info *, struct client_lease *); -void make_decline(struct interface_info *, struct client_lease *); - -void free_client_lease(struct client_lease *); -void rewrite_client_leases(struct interface_info *); -void write_client_lease(struct interface_info *, struct client_lease *, int); - -void priv_script_init(struct interface_info *, char *, char *); -void priv_script_write_params(struct interface_info *, char *, struct client_lease *); -int priv_script_go(void); - -void script_init(char *, struct string_list *); -void script_write_params(char *, struct client_lease *); -int script_go(void); -void client_envadd(struct client_state *, - const char *, const char *, const char *, ...); -void script_set_env(struct client_state *, const char *, const char *, - const char *); -void script_flush_env(struct client_state *); -int dhcp_option_ev_name(char *, size_t, struct dhcp_option *); - -struct client_lease *packet_to_lease(struct packet *); -void go_daemon(void); -void client_location_changed(void); - -void bootp(struct packet *); -void dhcp(struct packet *); - -/* packet.c */ -void assemble_hw_header(struct interface_info *, unsigned char *, - int *, struct hardware *); -void assemble_udp_ip_header(unsigned char *, int *, u_int32_t, u_int32_t, - unsigned int, unsigned char *, int); -ssize_t decode_hw_header(unsigned char *, int, struct hardware *); -ssize_t decode_udp_ip_header(unsigned char *, int, struct sockaddr_in *, - unsigned char *, int); - -/* ethernet.c */ -void assemble_ethernet_header(struct interface_info *, unsigned char *, - int *, struct hardware *); -ssize_t decode_ethernet_header(struct interface_info *, unsigned char *, - int, struct hardware *); - -/* clparse.c */ -int read_client_conf(struct interface_info *); -void read_client_leases(void); -void parse_client_statement(FILE *, struct interface_info *, - struct client_config *); -int parse_X(FILE *, u_int8_t *, int); -int parse_option_list(FILE *, u_int8_t *); -void parse_interface_declaration(FILE *, struct client_config *); -struct interface_info *interface_or_dummy(char *); -void make_client_state(struct interface_info *); -void make_client_config(struct interface_info *, struct client_config *); -void parse_client_lease_statement(FILE *, int); -void parse_client_lease_declaration(FILE *, struct client_lease *, - struct interface_info **); -struct dhcp_option *parse_option_decl(FILE *, struct option_data *); -void parse_string_list(FILE *, struct string_list **, int); -void parse_reject_statement(FILE *, struct client_config *); - -/* privsep.c */ -struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); -int buf_close(int, struct buf *); -ssize_t buf_read(int, void *, size_t); -void dispatch_imsg(int); diff --git a/reactos/base/services/dhcp/include/dhctoken.h b/reactos/base/services/dhcp/include/dhctoken.h deleted file mode 100644 index 2aeb5303af1..00000000000 --- a/reactos/base/services/dhcp/include/dhctoken.h +++ /dev/null @@ -1,136 +0,0 @@ -/* dhctoken.h - - Tokens for config file lexer and parser. */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define SEMI ';' -#define DOT '.' -#define COLON ':' -#define COMMA ',' -#define SLASH '/' -#define LBRACE '{' -#define RBRACE '}' - -#define FIRST_TOKEN HOST -#define HOST 256 -#define HARDWARE 257 -#define FILENAME 258 -#define FIXED_ADDR 259 -#define OPTION 260 -#define ETHERNET 261 -#define STRING 262 -#define NUMBER 263 -#define NUMBER_OR_NAME 264 -#define NAME 265 -#define TIMESTAMP 266 -#define STARTS 267 -#define ENDS 268 -#define UID 269 -#define CLASS 270 -#define LEASE 271 -#define RANGE 272 -#define PACKET 273 -#define CIADDR 274 -#define YIADDR 275 -#define SIADDR 276 -#define GIADDR 277 -#define SUBNET 278 -#define NETMASK 279 -#define DEFAULT_LEASE_TIME 280 -#define MAX_LEASE_TIME 281 -#define VENDOR_CLASS 282 -#define USER_CLASS 283 -#define SHARED_NETWORK 284 -#define SERVER_NAME 285 -#define DYNAMIC_BOOTP 286 -#define SERVER_IDENTIFIER 287 -#define DYNAMIC_BOOTP_LEASE_CUTOFF 288 -#define DYNAMIC_BOOTP_LEASE_LENGTH 289 -#define BOOT_UNKNOWN_CLIENTS 290 -#define NEXT_SERVER 291 -#define TOKEN_RING 292 -#define GROUP 293 -#define ONE_LEASE_PER_CLIENT 294 -#define GET_LEASE_HOSTNAMES 295 -#define USE_HOST_DECL_NAMES 296 -#define SEND 297 -#define CLIENT_IDENTIFIER 298 -#define REQUEST 299 -#define REQUIRE 300 -#define TIMEOUT 301 -#define RETRY 302 -#define SELECT_TIMEOUT 303 -#define SCRIPT 304 -#define INTERFACE 305 -#define RENEW 306 -#define REBIND 307 -#define EXPIRE 308 -#define UNKNOWN_CLIENTS 309 -#define ALLOW 310 -#define BOOTP 311 -#define DENY 312 -#define BOOTING 313 -#define DEFAULT 314 -#define MEDIA 315 -#define MEDIUM 316 -#define ALIAS 317 -#define REBOOT 318 -#define ABANDONED 319 -#define BACKOFF_CUTOFF 320 -#define INITIAL_INTERVAL 321 -#define NAMESERVER 322 -#define DOMAIN 323 -#define SEARCH 324 -#define SUPERSEDE 325 -#define APPEND 326 -#define PREPEND 327 -#define HOSTNAME 328 -#define CLIENT_HOSTNAME 329 -#define REJECT 330 -#define FDDI 331 -#define USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 332 -#define AUTHORITATIVE 333 -#define TOKEN_NOT 334 -#define ALWAYS_REPLY_RFC1048 335 - -#define is_identifier(x) ((x) >= FIRST_TOKEN && \ - (x) != STRING && \ - (x) != NUMBER && \ - (x) != EOF) diff --git a/reactos/base/services/dhcp/include/hash.h b/reactos/base/services/dhcp/include/hash.h deleted file mode 100644 index 1bebb3140f8..00000000000 --- a/reactos/base/services/dhcp/include/hash.h +++ /dev/null @@ -1,56 +0,0 @@ -/* hash.h - - Definitions for hashing... */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define DEFAULT_HASH_SIZE 97 - -struct hash_bucket { - struct hash_bucket *next; - unsigned char *name; - int len; - unsigned char *value; -}; - -struct hash_table { - int hash_count; - struct hash_bucket *buckets [DEFAULT_HASH_SIZE]; -}; - diff --git a/reactos/base/services/dhcp/include/inet.h b/reactos/base/services/dhcp/include/inet.h deleted file mode 100644 index a45f92265de..00000000000 --- a/reactos/base/services/dhcp/include/inet.h +++ /dev/null @@ -1,52 +0,0 @@ -/* inet.h - - Portable definitions for internet addresses */ - -/* - * Copyright (c) 1996 The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -/* An internet address of up to 128 bits. */ - -typedef struct _iaddr { - int len; - unsigned char iabuf [16]; -} iaddr; - -typedef struct _iaddrlist { - struct _iaddrlist *next; - iaddr addr; -} iaddrlist; diff --git a/reactos/base/services/dhcp/include/osdep.h b/reactos/base/services/dhcp/include/osdep.h deleted file mode 100644 index 71a985980e1..00000000000 --- a/reactos/base/services/dhcp/include/osdep.h +++ /dev/null @@ -1,294 +0,0 @@ -/* osdep.h - - Operating system dependencies... */ - -/* - * Copyright (c) 1996, 1997, 1998, 1999 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software was written for the Internet Software Consortium by Ted Lemon - * under a contract with Vixie Laboratories. - */ - -#include "site.h" - -/* Porting:: - - If you add a new network API, you must add a check for it below: */ - -#if !defined (USE_SOCKETS) && \ - !defined (USE_SOCKET_SEND) && \ - !defined (USE_SOCKET_RECEIVE) && \ - !defined (USE_RAW_SOCKETS) && \ - !defined (USE_RAW_SEND) && \ - !defined (USE_SOCKET_RECEIVE) && \ - !defined (USE_BPF) && \ - !defined (USE_BPF_SEND) && \ - !defined (USE_BPF_RECEIVE) && \ - !defined (USE_LPF) && \ - !defined (USE_LPF_SEND) && \ - !defined (USE_LPF_RECEIVE) && \ - !defined (USE_NIT) && \ - !defined (USE_NIT_SEND) && \ - !defined (USE_NIT_RECEIVE) && \ - !defined (USR_DLPI_SEND) && \ - !defined (USE_DLPI_RECEIVE) -# define USE_DEFAULT_NETWORK -#endif - - -/* Porting:: - - If you add a new system configuration file, include it here: */ - -#if defined (sun) -# if defined (__svr4__) || defined (__SVR4) -# include "cf/sunos5-5.h" -# else -# include "cf/sunos4.h" -# endif -#endif - -#ifdef aix -# include "cf/aix.h" -#endif - -#ifdef bsdi -# include "cf/bsdos.h" -#endif - -#ifdef __NetBSD__ -# include "cf/netbsd.h" -#endif - -#ifdef __FreeBSD__ -# include "cf/freebsd.h" -#endif - -#if defined (__osf__) && defined (__alpha) -# include "cf/alphaosf.h" -#endif - -#ifdef ultrix -# include "cf/ultrix.h" -#endif - -#ifdef linux -# include "cf/linux.h" -#endif - -#ifdef SCO -# include "cf/sco.h" -#endif - -#if defined (hpux) || defined (__hpux) -# include "cf/hpux.h" -#endif - -#ifdef __QNX__ -# include "cf/qnx.h" -#endif - -#ifdef __CYGWIN32__ -# include "cf/cygwin32.h" -#endif - -#ifdef __APPLE__ -# include "cf/rhapsody.h" -#else -# if defined (NeXT) -# include "cf/nextstep.h" -# endif -#endif - -#if defined(IRIX) || defined(__sgi) -# include "cf/irix.h" -#endif - -#if !defined (TIME_MAX) -# define TIME_MAX 2147483647 -#endif - -/* Porting:: - - If you add a new network API, and have it set up so that it can be - used for sending or receiving, but doesn't have to be used for both, - then set up an ifdef like the ones below: */ - -#ifdef USE_SOCKETS -# define USE_SOCKET_SEND -# define USE_SOCKET_RECEIVE -#endif - -#ifdef USE_RAW_SOCKETS -# define USE_RAW_SEND -# define USE_SOCKET_RECEIVE -#endif - -#ifdef USE_BPF -# define USE_BPF_SEND -# define USE_BPF_RECEIVE -#endif - -#ifdef USE_LPF -# define USE_LPF_SEND -# define USE_LPF_RECEIVE -#endif - -#ifdef USE_NIT -# define USE_NIT_SEND -# define USE_NIT_RECEIVE -#endif - -#ifdef USE_DLPI -# define USE_DLPI_SEND -# define USE_DLPI_RECEIVE -#endif - -#ifdef USE_UPF -# define USE_UPF_SEND -# define USE_UPF_RECEIVE -#endif - -/* Porting:: - - If you add support for sending packets directly out an interface, - and your support does not do ARP or routing, you must use a fallback - mechanism to deal with packets that need to be sent to routers. - Currently, all low-level packet interfaces use BSD sockets as a - fallback. */ - -#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ - defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || defined (USE_LPF_SEND) -# define USE_SOCKET_FALLBACK -# define USE_FALLBACK -#endif - -/* Porting:: - - If you add support for sending packets directly out an interface - and need to be able to assemble packets, add the USE_XXX_SEND - definition for your interface to the list tested below. */ - -#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ - defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ - defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) -# define PACKET_ASSEMBLY -#endif - -/* Porting:: - - If you add support for receiving packets directly from an interface - and need to be able to decode raw packets, add the USE_XXX_RECEIVE - definition for your interface to the list tested below. */ - -#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ - defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ - defined (USE_DLPI_RECEIVE) || \ - defined (USE_LPF_SEND) || \ - (defined (USE_SOCKET_SEND) && defined (SO_BINDTODEVICE)) -# define PACKET_DECODING -#endif - -/* If we don't have a DLPI packet filter, we have to filter in userland. - Probably not worth doing, actually. */ -#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) -# define USERLAND_FILTER -#endif - -/* jmp_buf is assumed to be a struct unless otherwise defined in the - system header. */ -#ifndef jbp_decl -# define jbp_decl(x) jmp_buf *x -#endif -#ifndef jref -# define jref(x) (&(x)) -#endif -#ifndef jdref -# define jdref(x) (*(x)) -#endif -#ifndef jrefproto -# define jrefproto jmp_buf * -#endif - -#ifndef BPF_FORMAT -# define BPF_FORMAT "/dev/bpf%d" -#endif - -#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) -# define HAVE_IFF_POINTOPOINT -#endif - -#if defined (AF_LINK) && !defined (HAVE_AF_LINK) -# define HAVE_AF_LINK -#endif - -#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) -# define HAVE_ARPHRD_TUNNEL -#endif - -#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) -# define HAVE_ARPHRD_LOOPBACK -#endif - -#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) -# define HAVE_ARPHRD_ROSE -#endif - -#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) -# define HAVE_ARPHRD_IEEE802 -#endif - -#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) -# define HAVE_ARPHRD_FDDI -#endif - -#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) -# define HAVE_ARPHRD_AX25 -#endif - -#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) -# define HAVE_ARPHRD_NETROM -#endif - -#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) -# define HAVE_ARPHRD_METRICOM -#endif - -#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) -# define HAVE_SO_BINDTODEVICE -#endif - -#if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR) -# define HAVE_SIOCGIFHWADDR -#endif - -#if defined (AF_LINK) && !defined (HAVE_AF_LINK) -# define HAVE_AF_LINK -#endif diff --git a/reactos/base/services/dhcp/include/predec.h b/reactos/base/services/dhcp/include/predec.h deleted file mode 100644 index 59fb94b003c..00000000000 --- a/reactos/base/services/dhcp/include/predec.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -struct iaddr; -struct interface_info; diff --git a/reactos/base/services/dhcp/include/privsep.h b/reactos/base/services/dhcp/include/privsep.h deleted file mode 100644 index e1fc52d5b69..00000000000 --- a/reactos/base/services/dhcp/include/privsep.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: privsep.h,v 1.2 2004/05/04 18:51:18 henning Exp $ */ - -/* - * Copyright (c) 2004 Henning Brauer - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -//#include -//#include - -struct buf { - u_char *buf; - size_t size; - size_t wpos; - size_t rpos; -}; - -enum imsg_code { - IMSG_NONE, - IMSG_SCRIPT_INIT, - IMSG_SCRIPT_WRITE_PARAMS, - IMSG_SCRIPT_GO, - IMSG_SCRIPT_GO_RET -}; - -struct imsg_hdr { - enum imsg_code code; - size_t len; -}; - -struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); -int buf_close(int, struct buf *); -ssize_t buf_read(int sock, void *, size_t); diff --git a/reactos/base/services/dhcp/include/rosdhcp.h b/reactos/base/services/dhcp/include/rosdhcp.h deleted file mode 100644 index 6b1dab6f0cc..00000000000 --- a/reactos/base/services/dhcp/include/rosdhcp.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef ROSDHCP_H -#define ROSDHCP_H - -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include -#include -#include -#include -#include -#include -#include "stdint.h" -#include "predec.h" -#include -#include "debug.h" -#define IFNAMSIZ MAX_INTERFACE_NAME_LEN -#undef interface /* wine/objbase.h -- Grrr */ - -#undef IGNORE -#undef ACCEPT -#undef PREFER -#define DHCP_DISCOVER_INTERVAL 15 -#define DHCP_REBOOT_TIMEOUT 300 -#define DHCP_PANIC_TIMEOUT DHCP_REBOOT_TIMEOUT * 3 -#define DHCP_BACKOFF_MAX 300 -#define DHCP_DEFAULT_LEASE_TIME 43200 /* 12 hours */ -#define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid" -typedef void *VOIDPTR; - -#ifndef _SSIZE_T_DEFINED -#define _SSIZE_T_DEFINED -#undef ssize_t -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef int ssize_t __attribute__ ((mode (DI))); -#else - typedef __int64 ssize_t; -#endif -#else - typedef int ssize_t; -#endif -#endif - -typedef u_int32_t uintTIME; -#define TIME uintTIME -#include "dhcpd.h" - -#define INLINE inline -#define PROTO(x) x - -typedef void (*handler_t) PROTO ((struct packet *)); - -typedef struct _DHCP_ADAPTER { - LIST_ENTRY ListEntry; - MIB_IFROW IfMib; - MIB_IPFORWARDROW RouterMib; - MIB_IPADDRROW IfAddr; - SOCKADDR Address; - ULONG NteContext,NteInstance; - struct interface_info DhclientInfo; - struct client_state DhclientState; - struct client_config DhclientConfig; - struct sockaddr_in ListenAddr; - unsigned int BindStatus; - unsigned char recv_buf[1]; -} DHCP_ADAPTER, *PDHCP_ADAPTER; - -typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply ); - -#define random rand -#define srandom srand - -void AdapterInit(VOID); -BOOLEAN AdapterDiscover(VOID); -void AdapterStop(VOID); -HANDLE PipeInit(VOID); -extern PDHCP_ADAPTER AdapterGetFirst(); -extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER); -extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); -extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); -extern PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ); -extern VOID ApiInit(); -extern VOID ApiLock(); -extern VOID ApiUnlock(); -extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern int inet_aton(const char *s, struct in_addr *addr); -int warn( char *format, ... ); -#endif/*ROSDHCP_H*/ diff --git a/reactos/base/services/dhcp/include/site.h b/reactos/base/services/dhcp/include/site.h deleted file mode 100644 index 30fdb703005..00000000000 --- a/reactos/base/services/dhcp/include/site.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Site-specific definitions. - - For supported systems, you shouldn't need to make any changes here. - However, you may want to, in order to deal with site-specific - differences. */ - -/* Add any site-specific definitions and inclusions here... */ - -/* #include */ -/* #define SITE_FOOBAR */ - -/* Define this if you don't want dhcpd to run as a daemon and do want - to see all its output printed to stdout instead of being logged via - syslog(). This also makes dhcpd use the dhcpd.conf in its working - directory and write the dhcpd.leases file there. */ - -/* #define DEBUG */ - -/* Define this to see what the parser is parsing. You probably don't - want to see this. */ - -/* #define DEBUG_TOKENS */ - -/* Define this to see dumps of incoming and outgoing packets. This - slows things down quite a bit... */ - -/* #define DEBUG_PACKET */ - -/* Define this if you want to see dumps of tree evaluations. The most - common reason for doing this is to watch what happens with DNS name - lookups. */ - -/* #define DEBUG_EVAL */ - -/* Define this if you want the dhcpd.pid file to go somewhere other than - the default (which varies from system to system, but is usually either - /etc or /var/run. */ - -/* #define _PATH_DHCPD_PID "/var/run/dhcpd.pid" */ - -/* Define this if you want the dhcpd.leases file (the dynamic lease database) - to go somewhere other than the default location, which is normally - /etc/dhcpd.leases. */ - -/* #define _PATH_DHCPD_DB "/etc/dhcpd.leases" */ - -/* Define this if you want the dhcpd.conf file to go somewhere other than - the default location. By default, it goes in /etc/dhcpd.conf. */ - -/* #define _PATH_DHCPD_CONF "/etc/dhcpd.conf" */ - -/* Network API definitions. You do not need to choose one of these - if - you don't choose, one will be chosen for you in your system's config - header. DON'T MESS WITH THIS UNLESS YOU KNOW WHAT YOU'RE DOING!!! */ - -/* Define this to use the standard BSD socket API. - - On many systems, the BSD socket API does not provide the ability to - send packets to the 255.255.255.255 broadcast address, which can - prevent some clients (e.g., Win95) from seeing replies. This is - not a problem on Solaris. - - In addition, the BSD socket API will not work when more than one - network interface is configured on the server. - - However, the BSD socket API is about as efficient as you can get, so if - the aforementioned problems do not matter to you, or if no other - API is supported for your system, you may want to go with it. */ - -/* #define USE_SOCKETS */ - -/* Define this to use the Sun Streams NIT API. - - The Sun Streams NIT API is only supported on SunOS 4.x releases. */ - -/* #define USE_NIT */ - -/* Define this to use the Berkeley Packet Filter API. - - The BPF API is available on all 4.4-BSD derivatives, including - NetBSD, FreeBSD and BSDI's BSD/OS. It's also available on - DEC Alpha OSF/1 in a compatibility mode supported by the Alpha OSF/1 - packetfilter interface. */ - -/* #define USE_BPF */ - -/* Define this to use the raw socket API. - - The raw socket API is provided on many BSD derivatives, and provides - a way to send out raw IP packets. It is only supported for sending - packets - packets must be received with the regular socket API. - This code is experimental - I've never gotten it to actually transmit - a packet to the 255.255.255.255 broadcast address - so use it at your - own risk. */ - -/* #define USE_RAW_SOCKETS */ - -/* Define this to change the logging facility used by dhcpd. */ - -/* #define DHCPD_LOG_FACILITY LOG_DAEMON */ diff --git a/reactos/base/services/dhcp/include/stdint.h b/reactos/base/services/dhcp/include/stdint.h deleted file mode 100644 index a45def0e663..00000000000 --- a/reactos/base/services/dhcp/include/stdint.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -typedef signed char int8_t; -typedef unsigned char u_int8_t; -typedef short int16_t; -typedef unsigned short u_int16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; - -typedef char *caddr_t; diff --git a/reactos/base/services/dhcp/include/sysconf.h b/reactos/base/services/dhcp/include/sysconf.h deleted file mode 100644 index 5feb4c75c70..00000000000 --- a/reactos/base/services/dhcp/include/sysconf.h +++ /dev/null @@ -1,52 +0,0 @@ -/* systat.h - - Definitions for systat protocol... */ - -/* - * Copyright (c) 1997 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define SYSCONF_SOCKET "/var/run/sysconf" - -struct sysconf_header { - u_int32_t type; /* Type of status message... */ - u_int32_t length; /* Length of message. */ -}; - -/* Message types... */ -#define NETWORK_LOCATION_CHANGED 1 - diff --git a/reactos/base/services/dhcp/include/tree.h b/reactos/base/services/dhcp/include/tree.h deleted file mode 100644 index 367ffa7d9a1..00000000000 --- a/reactos/base/services/dhcp/include/tree.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $OpenBSD: tree.h,v 1.5 2004/05/06 22:29:15 deraadt Exp $ */ - -/* Definitions for address trees... */ - -/* - * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -/* A pair of pointers, suitable for making a linked list. */ -typedef struct _pair { - caddr_t car; - struct _pair *cdr; -} *pair; - -struct tree_cache { - unsigned char *value; - int len; - int buf_size; - time_t timeout; -}; - -struct universe { - char *name; - struct hash_table *hash; - struct dhcp_option *options[256]; -}; - -struct dhcp_option { - char *name; - char *format; - struct universe *universe; - unsigned char code; -}; diff --git a/reactos/base/services/dhcp/include/version.h b/reactos/base/services/dhcp/include/version.h deleted file mode 100644 index 303fbfa332b..00000000000 --- a/reactos/base/services/dhcp/include/version.h +++ /dev/null @@ -1,3 +0,0 @@ -/* Current version of ISC DHCP Distribution. */ - -#define DHCP_VERSION "2.0pl5" diff --git a/reactos/base/services/dhcp/memory.c b/reactos/base/services/dhcp/memory.c deleted file mode 100644 index 2752422d2c7..00000000000 --- a/reactos/base/services/dhcp/memory.c +++ /dev/null @@ -1,919 +0,0 @@ -/* memory.c - - Memory-resident database... */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: memory.c,v 1.35.2.4 1999/05/27 17:47:43 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" -#include "dhcpd.h" - -struct subnet *subnets; -struct shared_network *shared_networks; -static struct hash_table *host_hw_addr_hash; -static struct hash_table *host_uid_hash; -static struct hash_table *lease_uid_hash; -static struct hash_table *lease_ip_addr_hash; -static struct hash_table *lease_hw_addr_hash; -struct lease *dangling_leases; - -static struct hash_table *vendor_class_hash; -static struct hash_table *user_class_hash; - -void enter_host (hd) - struct host_decl *hd; -{ - struct host_decl *hp = (struct host_decl *)0; - struct host_decl *np = (struct host_decl *)0; - - hd -> n_ipaddr = (struct host_decl *)0; - - if (hd -> interface.hlen) { - if (!host_hw_addr_hash) - host_hw_addr_hash = new_hash (); - else - hp = (struct host_decl *) - hash_lookup (host_hw_addr_hash, - hd -> interface.haddr, - hd -> interface.hlen); - - /* If there isn't already a host decl matching this - address, add it to the hash table. */ - if (!hp) - add_hash (host_hw_addr_hash, - hd -> interface.haddr, hd -> interface.hlen, - (unsigned char *)hd); - } - - /* If there was already a host declaration for this hardware - address, add this one to the end of the list. */ - - if (hp) { - for (np = hp; np -> n_ipaddr; np = np -> n_ipaddr) - ; - np -> n_ipaddr = hd; - } - - - if (hd -> group -> options [DHO_DHCP_CLIENT_IDENTIFIER]) { - if (!tree_evaluate (hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER])) - return; - - /* If there's no uid hash, make one; otherwise, see if - there's already an entry in the hash for this host. */ - if (!host_uid_hash) { - host_uid_hash = new_hash (); - hp = (struct host_decl *)0; - } else - hp = (struct host_decl *) hash_lookup - (host_uid_hash, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> value, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> len); - - /* If there's already a host declaration for this - client identifier, add this one to the end of the - list. Otherwise, add it to the hash table. */ - if (hp) { - /* Don't link it in twice... */ - if (!np) { - for (np = hp; np -> n_ipaddr; - np = np -> n_ipaddr) - ; - np -> n_ipaddr = hd; - } - } else { - add_hash (host_uid_hash, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> value, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> len, - (unsigned char *)hd); - } - } -} - -struct host_decl *find_hosts_by_haddr (htype, haddr, hlen) - int htype; - unsigned char *haddr; - int hlen; -{ - struct host_decl *foo; - - foo = (struct host_decl *)hash_lookup (host_hw_addr_hash, - haddr, hlen); - return foo; -} - -struct host_decl *find_hosts_by_uid (data, len) - unsigned char *data; - int len; -{ - struct host_decl *foo; - - foo = (struct host_decl *)hash_lookup (host_uid_hash, data, len); - return foo; -} - -/* More than one host_decl can be returned by find_hosts_by_haddr or - find_hosts_by_uid, and each host_decl can have multiple addresses. - Loop through the list of hosts, and then for each host, through the - list of addresses, looking for an address that's in the same shared - network as the one specified. Store the matching address through - the addr pointer, update the host pointer to point at the host_decl - that matched, and return the subnet that matched. */ - -subnet *find_host_for_network (struct host_decl **host, iaddr *addr, - shared_network *share) -{ - int i; - subnet *subnet; - iaddr ip_address; - struct host_decl *hp; - - for (hp = *host; hp; hp = hp -> n_ipaddr) { - if (!hp -> fixed_addr || !tree_evaluate (hp -> fixed_addr)) - continue; - for (i = 0; i < hp -> fixed_addr -> len; i += 4) { - ip_address.len = 4; - memcpy (ip_address.iabuf, - hp -> fixed_addr -> value + i, 4); - subnet = find_grouped_subnet (share, ip_address); - if (subnet) { - *addr = ip_address; - *host = hp; - return subnet; - } - } - } - return (struct _subnet *)0; -} - -void new_address_range (iaddr low, iaddr high, subnet *subnet, int dynamic) -{ - lease *address_range, *lp, *plp; - iaddr net; - int min, max, i; - char lowbuf [16], highbuf [16], netbuf [16]; - shared_network *share = subnet -> shared_network; - struct hostent *h; - struct in_addr ia; - - /* All subnets should have attached shared network structures. */ - if (!share) { - strcpy (netbuf, piaddr (subnet -> net)); - error ("No shared network for network %s (%s)", - netbuf, piaddr (subnet -> netmask)); - } - - /* Initialize the hash table if it hasn't been done yet. */ - if (!lease_uid_hash) - lease_uid_hash = new_hash (); - if (!lease_ip_addr_hash) - lease_ip_addr_hash = new_hash (); - if (!lease_hw_addr_hash) - lease_hw_addr_hash = new_hash (); - - /* Make sure that high and low addresses are in same subnet. */ - net = subnet_number (low, subnet -> netmask); - if (!addr_eq (net, subnet_number (high, subnet -> netmask))) { - strcpy (lowbuf, piaddr (low)); - strcpy (highbuf, piaddr (high)); - strcpy (netbuf, piaddr (subnet -> netmask)); - error ("Address range %s to %s, netmask %s spans %s!", - lowbuf, highbuf, netbuf, "multiple subnets"); - } - - /* Make sure that the addresses are on the correct subnet. */ - if (!addr_eq (net, subnet -> net)) { - strcpy (lowbuf, piaddr (low)); - strcpy (highbuf, piaddr (high)); - strcpy (netbuf, piaddr (subnet -> netmask)); - error ("Address range %s to %s not on net %s/%s!", - lowbuf, highbuf, piaddr (subnet -> net), netbuf); - } - - /* Get the high and low host addresses... */ - max = host_addr (high, subnet -> netmask); - min = host_addr (low, subnet -> netmask); - - /* Allow range to be specified high-to-low as well as low-to-high. */ - if (min > max) { - max = min; - min = host_addr (high, subnet -> netmask); - } - - /* Get a lease structure for each address in the range. */ - address_range = new_leases (max - min + 1, "new_address_range"); - if (!address_range) { - strcpy (lowbuf, piaddr (low)); - strcpy (highbuf, piaddr (high)); - error ("No memory for address range %s-%s.", lowbuf, highbuf); - } - memset (address_range, 0, (sizeof *address_range) * (max - min + 1)); - - /* Fill in the last lease if it hasn't been already... */ - if (!share -> last_lease) { - share -> last_lease = &address_range [0]; - } - - /* Fill out the lease structures with some minimal information. */ - for (i = 0; i < max - min + 1; i++) { - address_range [i].ip_addr = - ip_addr (subnet -> net, subnet -> netmask, i + min); - address_range [i].starts = - address_range [i].timestamp = MIN_TIME; - address_range [i].ends = MIN_TIME; - address_range [i].subnet = subnet; - address_range [i].shared_network = share; - address_range [i].flags = dynamic ? DYNAMIC_BOOTP_OK : 0; - - memcpy (&ia, address_range [i].ip_addr.iabuf, 4); - - if (subnet -> group -> get_lease_hostnames) { - h = gethostbyaddr ((char *)&ia, sizeof ia, AF_INET); - if (!h) - warn ("No hostname for %s", inet_ntoa (ia)); - else { - address_range [i].hostname = - malloc (strlen (h -> h_name) + 1); - if (!address_range [i].hostname) - error ("no memory for hostname %s.", - h -> h_name); - strcpy (address_range [i].hostname, - h -> h_name); - } - } - - /* Link this entry into the list. */ - address_range [i].next = share -> leases; - address_range [i].prev = (struct lease *)0; - share -> leases = &address_range [i]; - if (address_range [i].next) - address_range [i].next -> prev = share -> leases; - add_hash (lease_ip_addr_hash, - address_range [i].ip_addr.iabuf, - address_range [i].ip_addr.len, - (unsigned char *)&address_range [i]); - } - - /* Find out if any dangling leases are in range... */ - plp = (struct lease *)0; - for (lp = dangling_leases; lp; lp = lp -> next) { - iaddr lnet; - int lhost; - - lnet = subnet_number (lp -> ip_addr, subnet -> netmask); - lhost = host_addr (lp -> ip_addr, subnet -> netmask); - - /* If it's in range, fill in the real lease structure with - the dangling lease's values, and remove the lease from - the list of dangling leases. */ - if (addr_eq (lnet, subnet -> net) && - lhost >= i && lhost <= max) { - if (plp) { - plp -> next = lp -> next; - } else { - dangling_leases = lp -> next; - } - lp -> next = (struct lease *)0; - address_range [lhost - i].hostname = lp -> hostname; - address_range [lhost - i].client_hostname = - lp -> client_hostname; - supersede_lease (&address_range [lhost - i], lp, 0); - free_lease (lp, "new_address_range"); - } else - plp = lp; - } -} - -subnet *find_subnet (iaddr addr) -{ - subnet *rv; - - for (rv = subnets; rv; rv = rv -> next_subnet) { - if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) - return rv; - } - return (subnet *)0; -} - -subnet *find_grouped_subnet (shared_network *share, iaddr addr) -{ - subnet *rv; - - for (rv = share -> subnets; rv; rv = rv -> next_sibling) { - if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) - return rv; - } - return (subnet *)0; -} - -int subnet_inner_than (struct _subnet *subnet, struct _subnet *scan, int warnp) -{ - if (addr_eq (subnet_number (subnet -> net, scan -> netmask), - scan -> net) || - addr_eq (subnet_number (scan -> net, subnet -> netmask), - subnet -> net)) { - char n1buf [16]; - int i, j; - for (i = 0; i < 32; i++) - if (subnet -> netmask.iabuf [3 - (i >> 3)] - & (1 << (i & 7))) - break; - for (j = 0; j < 32; j++) - if (scan -> netmask.iabuf [3 - (j >> 3)] & - (1 << (j & 7))) - break; - strcpy (n1buf, piaddr (subnet -> net)); - if (warnp) - warn ("%ssubnet %s/%d conflicts with subnet %s/%d", - "Warning: ", n1buf, 32 - i, - piaddr (scan -> net), 32 - j); - if (i < j) - return 1; - } - return 0; -} - -/* Enter a new subnet into the subnet list. */ - -void enter_subnet (struct _subnet *subnet) -{ - struct _subnet *scan, *prev = (struct _subnet *)0; - - /* Check for duplicates... */ - for (scan = subnets; scan; scan = scan -> next_subnet) { - /* When we find a conflict, make sure that the - subnet with the narrowest subnet mask comes - first. */ - if (subnet_inner_than (subnet, scan, 1)) { - if (prev) { - prev -> next_subnet = subnet; - } else - subnets = subnet; - subnet -> next_subnet = scan; - return; - } - prev = scan; - } - - /* XXX use the BSD radix tree code instead of a linked list. */ - subnet -> next_subnet = subnets; - subnets = subnet; -} - -/* Enter a new shared network into the shared network list. */ - -void enter_shared_network (shared_network *share) -{ - /* XXX Sort the nets into a balanced tree to make searching quicker. */ - share -> next = shared_networks; - shared_networks = share; -} - -/* Enter a lease into the system. This is called by the parser each - time it reads in a new lease. If the subnet for that lease has - already been read in (usually the case), just update that lease; - otherwise, allocate temporary storage for the lease and keep it around - until we're done reading in the config file. */ - -void enter_lease (struct _lease *lease) -{ - struct _lease *comp = find_lease_by_ip_addr (lease -> ip_addr); - - /* If we don't have a place for this lease yet, save it for - later. */ - if (!comp) { - comp = new_lease ("enter_lease"); - if (!comp) { - error ("No memory for lease %s\n", - piaddr (lease -> ip_addr)); - } - *comp = *lease; - comp -> next = dangling_leases; - comp -> prev = (struct lease *)0; - dangling_leases = comp; - } else { - /* Record the hostname information in the lease. */ - comp -> hostname = lease -> hostname; - comp -> client_hostname = lease -> client_hostname; - supersede_lease (comp, lease, 0); - } -} - -/* Replace the data in an existing lease with the data in a new lease; - adjust hash tables to suit, and insertion sort the lease into the - list of leases by expiry time so that we can always find the oldest - lease. */ - -int supersede_lease (struct _lease *comp, struct _lease *lease, int commit) -{ - int enter_uid = 0; - int enter_hwaddr = 0; - struct _lease *lp; - - /* Static leases are not currently kept in the database... */ - if (lease -> flags & STATIC_LEASE) - return 1; - - /* If the existing lease hasn't expired and has a different - unique identifier or, if it doesn't have a unique - identifier, a different hardware address, then the two - leases are in conflict. If the existing lease has a uid - and the new one doesn't, but they both have the same - hardware address, and dynamic bootp is allowed on this - lease, then we allow that, in case a dynamic BOOTP lease is - requested *after* a DHCP lease has been assigned. */ - - if (!(lease -> flags & ABANDONED_LEASE) && - comp -> ends > cur_time && - (((comp -> uid && lease -> uid) && - (comp -> uid_len != lease -> uid_len || - memcmp (comp -> uid, lease -> uid, comp -> uid_len))) || - (!comp -> uid && - ((comp -> hardware_addr.htype != - lease -> hardware_addr.htype) || - (comp -> hardware_addr.hlen != - lease -> hardware_addr.hlen) || - memcmp (comp -> hardware_addr.haddr, - lease -> hardware_addr.haddr, - comp -> hardware_addr.hlen))))) { - warn ("Lease conflict at %s", - piaddr (comp -> ip_addr)); - return 0; - } else { - /* If there's a Unique ID, dissociate it from the hash - table and free it if necessary. */ - if (comp -> uid) { - uid_hash_delete (comp); - enter_uid = 1; - if (comp -> uid != &comp -> uid_buf [0]) { - free (comp -> uid); - comp -> uid_max = 0; - comp -> uid_len = 0; - } - comp -> uid = (unsigned char *)0; - } else - enter_uid = 1; - - if (comp -> hardware_addr.htype && - ((comp -> hardware_addr.hlen != - lease -> hardware_addr.hlen) || - (comp -> hardware_addr.htype != - lease -> hardware_addr.htype) || - memcmp (comp -> hardware_addr.haddr, - lease -> hardware_addr.haddr, - comp -> hardware_addr.hlen))) { - hw_hash_delete (comp); - enter_hwaddr = 1; - } else if (!comp -> hardware_addr.htype) - enter_hwaddr = 1; - - /* Copy the data files, but not the linkages. */ - comp -> starts = lease -> starts; - if (lease -> uid) { - if (lease -> uid_len < sizeof (lease -> uid_buf)) { - memcpy (comp -> uid_buf, - lease -> uid, lease -> uid_len); - comp -> uid = &comp -> uid_buf [0]; - comp -> uid_max = sizeof comp -> uid_buf; - } else if (lease -> uid != &lease -> uid_buf [0]) { - comp -> uid = lease -> uid; - comp -> uid_max = lease -> uid_max; - lease -> uid = (unsigned char *)0; - lease -> uid_max = 0; - } else { - error ("corrupt lease uid."); /* XXX */ - } - } else { - comp -> uid = (unsigned char *)0; - comp -> uid_max = 0; - } - comp -> uid_len = lease -> uid_len; - comp -> host = lease -> host; - comp -> hardware_addr = lease -> hardware_addr; - comp -> flags = ((lease -> flags & ~PERSISTENT_FLAGS) | - (comp -> flags & ~EPHEMERAL_FLAGS)); - - /* Record the lease in the uid hash if necessary. */ - if (enter_uid && lease -> uid) { - uid_hash_add (comp); - } - - /* Record it in the hardware address hash if necessary. */ - if (enter_hwaddr && lease -> hardware_addr.htype) { - hw_hash_add (comp); - } - - /* Remove the lease from its current place in the - timeout sequence. */ - if (comp -> prev) { - comp -> prev -> next = comp -> next; - } else { - comp -> shared_network -> leases = comp -> next; - } - if (comp -> next) { - comp -> next -> prev = comp -> prev; - } - if (comp -> shared_network -> last_lease == comp) { - comp -> shared_network -> last_lease = comp -> prev; - } - - /* Find the last insertion point... */ - if (comp == comp -> shared_network -> insertion_point || - !comp -> shared_network -> insertion_point) { - lp = comp -> shared_network -> leases; - } else { - lp = comp -> shared_network -> insertion_point; - } - - if (!lp) { - /* Nothing on the list yet? Just make comp the - head of the list. */ - comp -> shared_network -> leases = comp; - comp -> shared_network -> last_lease = comp; - } else if (lp -> ends > lease -> ends) { - /* Skip down the list until we run out of list - or find a place for comp. */ - while (lp -> next && lp -> ends > lease -> ends) { - lp = lp -> next; - } - if (lp -> ends > lease -> ends) { - /* If we ran out of list, put comp - at the end. */ - lp -> next = comp; - comp -> prev = lp; - comp -> next = (struct lease *)0; - comp -> shared_network -> last_lease = comp; - } else { - /* If we didn't, put it between lp and - the previous item on the list. */ - if ((comp -> prev = lp -> prev)) - comp -> prev -> next = comp; - comp -> next = lp; - lp -> prev = comp; - } - } else { - /* Skip up the list until we run out of list - or find a place for comp. */ - while (lp -> prev && lp -> ends < lease -> ends) { - lp = lp -> prev; - } - if (lp -> ends < lease -> ends) { - /* If we ran out of list, put comp - at the beginning. */ - lp -> prev = comp; - comp -> next = lp; - comp -> prev = (struct lease *)0; - comp -> shared_network -> leases = comp; - } else { - /* If we didn't, put it between lp and - the next item on the list. */ - if ((comp -> next = lp -> next)) - comp -> next -> prev = comp; - comp -> prev = lp; - lp -> next = comp; - } - } - comp -> shared_network -> insertion_point = comp; - comp -> ends = lease -> ends; - } - - /* Return zero if we didn't commit the lease to permanent storage; - nonzero if we did. */ - return commit && write_lease (comp) && commit_leases (); -} - -/* Release the specified lease and re-hash it as appropriate. */ - -void release_lease (struct _lease *lease) -{ - struct _lease lt; - - lt = *lease; - if (lt.ends > cur_time) { - lt.ends = cur_time; - supersede_lease (lease, <, 1); - } -} - -/* Abandon the specified lease (set its timeout to infinity and its - particulars to zero, and re-hash it as appropriate. */ - -void abandon_lease (struct _lease *lease, char *message) -{ - struct _lease lt; - - lease -> flags |= ABANDONED_LEASE; - lt = *lease; - lt.ends = cur_time; - warn ("Abandoning IP address %s: %s", - piaddr (lease -> ip_addr), message); - lt.hardware_addr.htype = 0; - lt.hardware_addr.hlen = 0; - lt.uid = (unsigned char *)0; - lt.uid_len = 0; - supersede_lease (lease, <, 1); -} - -/* Locate the lease associated with a given IP address... */ - -lease *find_lease_by_ip_addr (iaddr addr) -{ - lease *lease = (struct _lease *)hash_lookup (lease_ip_addr_hash, - addr.iabuf, - addr.len); - return lease; -} - -lease *find_lease_by_uid (unsigned char *uid, int len) -{ - lease *lease = (struct lease *)hash_lookup (lease_uid_hash, - uid, len); - return lease; -} - -lease *find_lease_by_hw_addr (unsigned char *hwaddr, int hwlen) -{ - struct _lease *lease = - (struct _lease *)hash_lookup (lease_hw_addr_hash, - hwaddr, hwlen); - return lease; -} - -/* Add the specified lease to the uid hash. */ - -void uid_hash_add (lease *lease) -{ - struct _lease *head = find_lease_by_uid (lease -> uid, lease -> uid_len); - struct _lease *scan; - -#ifdef DEBUG - if (lease -> n_uid) - abort (); -#endif - - /* If it's not in the hash, just add it. */ - if (!head) - add_hash (lease_uid_hash, lease -> uid, - lease -> uid_len, (unsigned char *)lease); - else { - /* Otherwise, attach it to the end of the list. */ - for (scan = head; scan -> n_uid; scan = scan -> n_uid) -#ifdef DEBUG - if (scan == lease) - abort () -#endif - ; - scan -> n_uid = lease; - } -} - -/* Delete the specified lease from the uid hash. */ - -void uid_hash_delete (lease *lease) -{ - struct _lease *head = - find_lease_by_uid (lease -> uid, lease -> uid_len); - struct _lease *scan; - - /* If it's not in the hash, we have no work to do. */ - if (!head) { - lease -> n_uid = (struct lease *)0; - return; - } - - /* If the lease we're freeing is at the head of the list, - remove the hash table entry and add a new one with the - next lease on the list (if there is one). */ - if (head == lease) { - delete_hash_entry (lease_uid_hash, - lease -> uid, lease -> uid_len); - if (lease -> n_uid) - add_hash (lease_uid_hash, - lease -> n_uid -> uid, - lease -> n_uid -> uid_len, - (unsigned char *)(lease -> n_uid)); - } else { - /* Otherwise, look for the lease in the list of leases - attached to the hash table entry, and remove it if - we find it. */ - for (scan = head; scan -> n_uid; scan = scan -> n_uid) { - if (scan -> n_uid == lease) { - scan -> n_uid = scan -> n_uid -> n_uid; - break; - } - } - } - lease -> n_uid = (struct lease *)0; -} - -/* Add the specified lease to the hardware address hash. */ - -void hw_hash_add (lease *lease) -{ - struct _lease *head = - find_lease_by_hw_addr (lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen); - struct _lease *scan; - - /* If it's not in the hash, just add it. */ - if (!head) - add_hash (lease_hw_addr_hash, - lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen, - (unsigned char *)lease); - else { - /* Otherwise, attach it to the end of the list. */ - for (scan = head; scan -> n_hw; scan = scan -> n_hw) - ; - scan -> n_hw = lease; - } -} - -/* Delete the specified lease from the hardware address hash. */ - -void hw_hash_delete (lease *lease) -{ - struct _lease *head = - find_lease_by_hw_addr (lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen); - struct _lease *scan; - - /* If it's not in the hash, we have no work to do. */ - if (!head) { - lease -> n_hw = (struct lease *)0; - return; - } - - /* If the lease we're freeing is at the head of the list, - remove the hash table entry and add a new one with the - next lease on the list (if there is one). */ - if (head == lease) { - delete_hash_entry (lease_hw_addr_hash, - lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen); - if (lease -> n_hw) - add_hash (lease_hw_addr_hash, - lease -> n_hw -> hardware_addr.haddr, - lease -> n_hw -> hardware_addr.hlen, - (unsigned char *)(lease -> n_hw)); - } else { - /* Otherwise, look for the lease in the list of leases - attached to the hash table entry, and remove it if - we find it. */ - for (scan = head; scan -> n_hw; scan = scan -> n_hw) { - if (scan -> n_hw == lease) { - scan -> n_hw = scan -> n_hw -> n_hw; - break; - } - } - } - lease -> n_hw = (struct lease *)0; -} - - -struct class *add_class (type, name) - int type; - char *name; -{ - struct class *class = new_class ("add_class"); - char *tname = (char *)malloc (strlen (name) + 1); - - if (!vendor_class_hash) - vendor_class_hash = new_hash (); - if (!user_class_hash) - user_class_hash = new_hash (); - - if (!tname || !class || !vendor_class_hash || !user_class_hash) - { - if (tname != NULL) - free(tname); - return (struct class *)0; - } - - memset (class, 0, sizeof *class); - strcpy (tname, name); - class -> name = tname; - - if (type) - add_hash (user_class_hash, - (unsigned char *)tname, strlen (tname), - (unsigned char *)class); - else - add_hash (vendor_class_hash, - (unsigned char *)tname, strlen (tname), - (unsigned char *)class); - return class; -} - -struct class *find_class (type, name, len) - int type; - unsigned char *name; - int len; -{ - struct class *class = - (struct class *)hash_lookup (type - ? user_class_hash - : vendor_class_hash, name, len); - return class; -} - -struct group *clone_group (group, caller) - struct group *group; - char *caller; -{ - struct group *g = new_group (caller); - if (!g) - error ("%s: can't allocate new group", caller); - *g = *group; - return g; -} - -/* Write all interesting leases to permanent storage. */ - -void write_leases () -{ - lease *l; - shared_network *s; - - for (s = shared_networks; s; s = (shared_network *)s -> next) { - for (l = s -> leases; l; l = l -> next) { - if (l -> hardware_addr.hlen || - l -> uid_len || - (l -> flags & ABANDONED_LEASE)) - if (!write_lease (l)) - error ("Can't rewrite lease database"); - } - } - if (!commit_leases ()) - error ("Can't commit leases to new database: %m"); -} - -void dump_subnets () -{ - struct _lease *l; - shared_network *s; - subnet *n; - - note ("Subnets:"); - for (n = subnets; n; n = n -> next_subnet) { - debug (" Subnet %s", piaddr (n -> net)); - debug (" netmask %s", - piaddr (n -> netmask)); - } - note ("Shared networks:"); - for (s = shared_networks; s; s = (shared_network *)s -> next) { - note (" %s", s -> name); - for (l = s -> leases; l; l = l -> next) { - print_lease (l); - } - if (s -> last_lease) { - debug (" Last Lease:"); - print_lease (s -> last_lease); - } - } -} diff --git a/reactos/base/services/dhcp/options.c b/reactos/base/services/dhcp/options.c deleted file mode 100644 index 27be626523a..00000000000 --- a/reactos/base/services/dhcp/options.c +++ /dev/null @@ -1,723 +0,0 @@ -/* $OpenBSD: options.c,v 1.15 2004/12/26 03:17:07 deraadt Exp $ */ - -/* DHCP options parsing and reassembly. */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#include -#include - -#define DHCP_OPTION_DATA -#include "rosdhcp.h" -#include "dhcpd.h" - -int bad_options = 0; -int bad_options_max = 5; - -void parse_options(struct packet *); -void parse_option_buffer(struct packet *, unsigned char *, int); -int store_options(unsigned char *, int, struct tree_cache **, - unsigned char *, int, int, int, int); - - -/* - * Parse all available options out of the specified packet. - */ -void -parse_options(struct packet *packet) -{ - /* Initially, zero all option pointers. */ - memset(packet->options, 0, sizeof(packet->options)); - - /* If we don't see the magic cookie, there's nothing to parse. */ - if (memcmp(packet->raw->options, DHCP_OPTIONS_COOKIE, 4)) { - packet->options_valid = 0; - return; - } - - /* - * Go through the options field, up to the end of the packet or - * the End field. - */ - parse_option_buffer(packet, &packet->raw->options[4], - packet->packet_length - DHCP_FIXED_NON_UDP - 4); - - /* - * If we parsed a DHCP Option Overload option, parse more - * options out of the buffer(s) containing them. - */ - if (packet->options_valid && - packet->options[DHO_DHCP_OPTION_OVERLOAD].data) { - if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1) - parse_option_buffer(packet, - (unsigned char *)packet->raw->file, - sizeof(packet->raw->file)); - if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2) - parse_option_buffer(packet, - (unsigned char *)packet->raw->sname, - sizeof(packet->raw->sname)); - } -} - -/* - * Parse options out of the specified buffer, storing addresses of - * option values in packet->options and setting packet->options_valid if - * no errors are encountered. - */ -void -parse_option_buffer(struct packet *packet, - unsigned char *buffer, int length) -{ - unsigned char *s, *t, *end = buffer + length; - int len, code; - - for (s = buffer; *s != DHO_END && s < end; ) { - code = s[0]; - - /* Pad options don't have a length - just skip them. */ - if (code == DHO_PAD) { - s++; - continue; - } - if (s + 2 > end) { - len = 65536; - goto bogus; - } - - /* - * All other fields (except end, see above) have a - * one-byte length. - */ - len = s[1]; - - /* - * If the length is outrageous, silently skip the rest, - * and mark the packet bad. Unfortunately some crappy - * dhcp servers always seem to give us garbage on the - * end of a packet. so rather than keep refusing, give - * up and try to take one after seeing a few without - * anything good. - */ - if (s + len + 2 > end) { - bogus: - bad_options++; - warning("option %s (%d) %s.", - dhcp_options[code].name, len, - "larger than buffer"); - if (bad_options == bad_options_max) { - packet->options_valid = 1; - bad_options = 0; - warning("Many bogus options seen in offers. " - "Taking this offer in spite of bogus " - "options - hope for the best!"); - } else { - warning("rejecting bogus offer."); - packet->options_valid = 0; - } - return; - } - /* - * If we haven't seen this option before, just make - * space for it and copy it there. - */ - if (!packet->options[code].data) { - if (!(t = calloc(1, len + 1))) - error("Can't allocate storage for option %s.", - dhcp_options[code].name); - /* - * Copy and NUL-terminate the option (in case - * it's an ASCII string. - */ - memcpy(t, &s[2], len); - t[len] = 0; - packet->options[code].len = len; - packet->options[code].data = t; - } else { - /* - * If it's a repeat, concatenate it to whatever - * we last saw. This is really only required - * for clients, but what the heck... - */ - t = calloc(1, len + packet->options[code].len + 1); - if (!t) { - error("Can't expand storage for option %s.", - dhcp_options[code].name); - return; - } - memcpy(t, packet->options[code].data, - packet->options[code].len); - memcpy(t + packet->options[code].len, - &s[2], len); - packet->options[code].len += len; - t[packet->options[code].len] = 0; - free(packet->options[code].data); - packet->options[code].data = t; - } - s += len + 2; - } - packet->options_valid = 1; -} - -/* - * cons options into a big buffer, and then split them out into the - * three separate buffers if needed. This allows us to cons up a set of - * vendor options using the same routine. - */ -int -cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, - int mms, struct tree_cache **options, - int overload, /* Overload flags that may be set. */ - int terminate, int bootpp, u_int8_t *prl, int prl_len) -{ - unsigned char priority_list[300], buffer[4096]; - int priority_len, main_buffer_size, mainbufix, bufix; - int option_size, length; - - /* - * If the client has provided a maximum DHCP message size, use - * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use - * up to the minimum IP MTU size (576 bytes). - * - * XXX if a BOOTP client specifies a max message size, we will - * honor it. - */ - if (!mms && - inpacket && - inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data && - (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >= - sizeof(u_int16_t))) - mms = getUShort( - inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data); - - if (mms) - main_buffer_size = mms - DHCP_FIXED_LEN; - else if (bootpp) - main_buffer_size = 64; - else - main_buffer_size = 576 - DHCP_FIXED_LEN; - - if (main_buffer_size > sizeof(buffer)) - main_buffer_size = sizeof(buffer); - - /* Preload the option priority list with mandatory options. */ - priority_len = 0; - priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE; - priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER; - priority_list[priority_len++] = DHO_DHCP_LEASE_TIME; - priority_list[priority_len++] = DHO_DHCP_MESSAGE; - - /* - * If the client has provided a list of options that it wishes - * returned, use it to prioritize. Otherwise, prioritize based - * on the default priority list. - */ - if (inpacket && - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) { - int prlen = - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len; - if (prlen + priority_len > sizeof(priority_list)) - prlen = sizeof(priority_list) - priority_len; - - memcpy(&priority_list[priority_len], - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data, - prlen); - priority_len += prlen; - prl = priority_list; - } else if (prl) { - if (prl_len + priority_len > sizeof(priority_list)) - prl_len = sizeof(priority_list) - priority_len; - - memcpy(&priority_list[priority_len], prl, prl_len); - priority_len += prl_len; - prl = priority_list; - } else { - memcpy(&priority_list[priority_len], - dhcp_option_default_priority_list, - sizeof_dhcp_option_default_priority_list); - priority_len += sizeof_dhcp_option_default_priority_list; - } - - /* Copy the options into the big buffer... */ - option_size = store_options( - buffer, - (main_buffer_size - 7 + ((overload & 1) ? DHCP_FILE_LEN : 0) + - ((overload & 2) ? DHCP_SNAME_LEN : 0)), - options, priority_list, priority_len, main_buffer_size, - (main_buffer_size + ((overload & 1) ? DHCP_FILE_LEN : 0)), - terminate); - - /* Put the cookie up front... */ - memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4); - mainbufix = 4; - - /* - * If we're going to have to overload, store the overload option - * at the beginning. If we can, though, just store the whole - * thing in the packet's option buffer and leave it at that. - */ - if (option_size <= main_buffer_size - mainbufix) { - memcpy(&outpacket->options[mainbufix], - buffer, option_size); - mainbufix += option_size; - if (mainbufix < main_buffer_size) - outpacket->options[mainbufix++] = DHO_END; - length = DHCP_FIXED_NON_UDP + mainbufix; - } else { - outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD; - outpacket->options[mainbufix++] = 1; - if (option_size > - main_buffer_size - mainbufix + DHCP_FILE_LEN) - outpacket->options[mainbufix++] = 3; - else - outpacket->options[mainbufix++] = 1; - - memcpy(&outpacket->options[mainbufix], - buffer, main_buffer_size - mainbufix); - bufix = main_buffer_size - mainbufix; - length = DHCP_FIXED_NON_UDP + mainbufix; - if (overload & 1) { - if (option_size - bufix <= DHCP_FILE_LEN) { - memcpy(outpacket->file, - &buffer[bufix], option_size - bufix); - mainbufix = option_size - bufix; - if (mainbufix < DHCP_FILE_LEN) - outpacket->file[mainbufix++] = (char)DHO_END; - while (mainbufix < DHCP_FILE_LEN) - outpacket->file[mainbufix++] = (char)DHO_PAD; - } else { - memcpy(outpacket->file, - &buffer[bufix], DHCP_FILE_LEN); - bufix += DHCP_FILE_LEN; - } - } - if ((overload & 2) && option_size < bufix) { - memcpy(outpacket->sname, - &buffer[bufix], option_size - bufix); - - mainbufix = option_size - bufix; - if (mainbufix < DHCP_SNAME_LEN) - outpacket->file[mainbufix++] = (char)DHO_END; - while (mainbufix < DHCP_SNAME_LEN) - outpacket->file[mainbufix++] = (char)DHO_PAD; - } - } - return (length); -} - -/* - * Store all the requested options into the requested buffer. - */ -int -store_options(unsigned char *buffer, int buflen, struct tree_cache **options, - unsigned char *priority_list, int priority_len, int first_cutoff, - int second_cutoff, int terminate) -{ - int bufix = 0, option_stored[256], i, ix, tto; - - /* Zero out the stored-lengths array. */ - memset(option_stored, 0, sizeof(option_stored)); - - /* - * Copy out the options in the order that they appear in the - * priority list... - */ - for (i = 0; i < priority_len; i++) { - /* Code for next option to try to store. */ - int code = priority_list[i]; - int optstart; - - /* - * Number of bytes left to store (some may already have - * been stored by a previous pass). - */ - int length; - - /* If no data is available for this option, skip it. */ - if (!options[code]) { - continue; - } - - /* - * The client could ask for things that are mandatory, - * in which case we should avoid storing them twice... - */ - if (option_stored[code]) - continue; - option_stored[code] = 1; - - /* We should now have a constant length for the option. */ - length = options[code]->len; - - /* Do we add a NUL? */ - if (terminate && dhcp_options[code].format[0] == 't') { - length++; - tto = 1; - } else - tto = 0; - - /* Try to store the option. */ - - /* - * If the option's length is more than 255, we must - * store it in multiple hunks. Store 255-byte hunks - * first. However, in any case, if the option data will - * cross a buffer boundary, split it across that - * boundary. - */ - ix = 0; - - optstart = bufix; - while (length) { - unsigned char incr = length > 255 ? 255 : length; - - /* - * If this hunk of the buffer will cross a - * boundary, only go up to the boundary in this - * pass. - */ - if (bufix < first_cutoff && - bufix + incr > first_cutoff) - incr = first_cutoff - bufix; - else if (bufix < second_cutoff && - bufix + incr > second_cutoff) - incr = second_cutoff - bufix; - - /* - * If this option is going to overflow the - * buffer, skip it. - */ - if (bufix + 2 + incr > buflen) { - bufix = optstart; - break; - } - - /* Everything looks good - copy it in! */ - buffer[bufix] = code; - buffer[bufix + 1] = incr; - if (tto && incr == length) { - memcpy(buffer + bufix + 2, - options[code]->value + ix, incr - 1); - buffer[bufix + 2 + incr - 1] = 0; - } else - memcpy(buffer + bufix + 2, - options[code]->value + ix, incr); - length -= incr; - ix += incr; - bufix += 2 + incr; - } - } - return (bufix); -} - -/* - * Format the specified option so that a human can easily read it. - */ -char * -pretty_print_option(unsigned int code, unsigned char *data, int len, - int emit_commas, int emit_quotes) -{ - static char optbuf[32768]; /* XXX */ - int hunksize = 0, numhunk = -1, numelem = 0; - char fmtbuf[32], *op = optbuf; - int i, j, k, opleft = sizeof(optbuf); - unsigned char *dp = data; - struct in_addr foo; - char comma; - - /* Code should be between 0 and 255. */ - if (code > 255) - error("pretty_print_option: bad code %d", code); - - if (emit_commas) - comma = ','; - else - comma = ' '; - - /* Figure out the size of the data. */ - for (i = 0; dhcp_options[code].format[i]; i++) { - if (!numhunk) { - warning("%s: Excess information in format string: %s", - dhcp_options[code].name, - &(dhcp_options[code].format[i])); - break; - } - numelem++; - fmtbuf[i] = dhcp_options[code].format[i]; - switch (dhcp_options[code].format[i]) { - case 'A': - --numelem; - fmtbuf[i] = 0; - numhunk = 0; - break; - case 'X': - for (k = 0; k < len; k++) - if (!isascii(data[k]) || - !isprint(data[k])) - break; - if (k == len) { - fmtbuf[i] = 't'; - numhunk = -2; - } else { - fmtbuf[i] = 'x'; - hunksize++; - comma = ':'; - numhunk = 0; - } - fmtbuf[i + 1] = 0; - break; - case 't': - fmtbuf[i] = 't'; - fmtbuf[i + 1] = 0; - numhunk = -2; - break; - case 'I': - case 'l': - case 'L': - hunksize += 4; - break; - case 's': - case 'S': - hunksize += 2; - break; - case 'b': - case 'B': - case 'f': - hunksize++; - break; - case 'e': - break; - default: - warning("%s: garbage in format string: %s", - dhcp_options[code].name, - &(dhcp_options[code].format[i])); - break; - } - } - - /* Check for too few bytes... */ - if (hunksize > len) { - warning("%s: expecting at least %d bytes; got %d", - dhcp_options[code].name, hunksize, len); - return (""); - } - /* Check for too many bytes... */ - if (numhunk == -1 && hunksize < len) - warning("%s: %d extra bytes", - dhcp_options[code].name, len - hunksize); - - /* If this is an array, compute its size. */ - if (!numhunk) - numhunk = len / hunksize; - /* See if we got an exact number of hunks. */ - if (numhunk > 0 && numhunk * hunksize < len) - warning("%s: %d extra bytes at end of array", - dhcp_options[code].name, len - numhunk * hunksize); - - /* A one-hunk array prints the same as a single hunk. */ - if (numhunk < 0) - numhunk = 1; - - /* Cycle through the array (or hunk) printing the data. */ - for (i = 0; i < numhunk; i++) { - for (j = 0; j < numelem; j++) { - int opcount; - switch (fmtbuf[j]) { - case 't': - if (emit_quotes) { - *op++ = '"'; - opleft--; - } - for (; dp < data + len; dp++) { - if (!isascii(*dp) || - !isprint(*dp)) { - if (dp + 1 != data + len || - *dp != 0) { - _snprintf(op, opleft, - "\\%03o", *dp); - op += 4; - opleft -= 4; - } - } else if (*dp == '"' || - *dp == '\'' || - *dp == '$' || - *dp == '`' || - *dp == '\\') { - *op++ = '\\'; - *op++ = *dp; - opleft -= 2; - } else { - *op++ = *dp; - opleft--; - } - } - if (emit_quotes) { - *op++ = '"'; - opleft--; - } - - *op = 0; - break; - case 'I': - foo.s_addr = htonl(getULong(dp)); - strncpy(op, inet_ntoa(foo), opleft - 1); - op[opleft - 1] = ANSI_NULL; - opcount = strlen(op); - if (opcount >= opleft) - goto toobig; - opleft -= opcount; - dp += 4; - break; - case 'l': - opcount = _snprintf(op, opleft, "%ld", - (long)getLong(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 4; - break; - case 'L': - opcount = _snprintf(op, opleft, "%ld", - (unsigned long)getULong(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 4; - break; - case 's': - opcount = _snprintf(op, opleft, "%d", - getShort(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 2; - break; - case 'S': - opcount = _snprintf(op, opleft, "%d", - getUShort(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 2; - break; - case 'b': - opcount = _snprintf(op, opleft, "%d", - *(char *)dp++); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - break; - case 'B': - opcount = _snprintf(op, opleft, "%d", *dp++); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - break; - case 'x': - opcount = _snprintf(op, opleft, "%x", *dp++); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - break; - case 'f': - opcount = (size_t) strncpy(op, *dp++ ? "true" : "false", opleft - 1); - op[opleft - 1] = ANSI_NULL; - if (opcount >= opleft) - goto toobig; - opleft -= opcount; - break; - default: - warning("Unexpected format code %c", fmtbuf[j]); - } - op += strlen(op); - opleft -= strlen(op); - if (opleft < 1) - goto toobig; - if (j + 1 < numelem && comma != ':') { - *op++ = ' '; - opleft--; - } - } - if (i + 1 < numhunk) { - *op++ = comma; - opleft--; - } - if (opleft < 1) - goto toobig; - - } - return (optbuf); - toobig: - warning("dhcp option too large"); - return (""); -} - -void -do_packet(struct interface_info *interface, struct dhcp_packet *packet, - int len, unsigned int from_port, struct iaddr from, struct hardware *hfrom) -{ - struct packet tp; - int i; - - if (packet->hlen > sizeof(packet->chaddr)) { - note("Discarding packet with invalid hlen."); - return; - } - - memset(&tp, 0, sizeof(tp)); - tp.raw = packet; - tp.packet_length = len; - tp.client_port = from_port; - tp.client_addr = from; - tp.interface = interface; - tp.haddr = hfrom; - - parse_options(&tp); - if (tp.options_valid && - tp.options[DHO_DHCP_MESSAGE_TYPE].data) - tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0]; - if (tp.packet_type) - dhcp(&tp); - else - bootp(&tp); - - /* Free the data associated with the options. */ - for (i = 0; i < 256; i++) - if (tp.options[i].len && tp.options[i].data) - free(tp.options[i].data); -} diff --git a/reactos/base/services/dhcp/pipe.c b/reactos/base/services/dhcp/pipe.c deleted file mode 100644 index 9ea0402c413..00000000000 --- a/reactos/base/services/dhcp/pipe.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $Id: $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: subsys/system/dhcp/pipe.c - * PURPOSE: DHCP client pipe - * PROGRAMMER: arty - */ - -#include - -#define NDEBUG -#include - -static HANDLE CommPipe = INVALID_HANDLE_VALUE, CommThread; -DWORD CommThrId; - -#define COMM_PIPE_OUTPUT_BUFFER sizeof(COMM_DHCP_REQ) -#define COMM_PIPE_INPUT_BUFFER sizeof(COMM_DHCP_REPLY) -#define COMM_PIPE_DEFAULT_TIMEOUT 1000 - -DWORD PipeSend( COMM_DHCP_REPLY *Reply ) { - DWORD Written = 0; - BOOL Success = - WriteFile( CommPipe, - Reply, - sizeof(*Reply), - &Written, - NULL ); - return Success ? Written : -1; -} - -DWORD WINAPI PipeThreadProc( LPVOID Parameter ) { - DWORD BytesRead, BytesWritten; - COMM_DHCP_REQ Req; - COMM_DHCP_REPLY Reply; - BOOL Result, Connected; - - while( TRUE ) { - Connected = ConnectNamedPipe( CommPipe, NULL ) ? - TRUE : GetLastError() == ERROR_PIPE_CONNECTED; - - if (!Connected) { - DbgPrint("DHCP: Could not connect named pipe\n"); - CloseHandle( CommPipe ); - CommPipe = INVALID_HANDLE_VALUE; - break; - } - - Result = ReadFile( CommPipe, &Req, sizeof(Req), &BytesRead, NULL ); - if( Result ) { - switch( Req.Type ) { - case DhcpReqQueryHWInfo: - BytesWritten = DSQueryHWInfo( PipeSend, &Req ); - break; - - case DhcpReqLeaseIpAddress: - BytesWritten = DSLeaseIpAddress( PipeSend, &Req ); - break; - - case DhcpReqReleaseIpAddress: - BytesWritten = DSReleaseIpAddressLease( PipeSend, &Req ); - break; - - case DhcpReqRenewIpAddress: - BytesWritten = DSRenewIpAddressLease( PipeSend, &Req ); - break; - - case DhcpReqStaticRefreshParams: - BytesWritten = DSStaticRefreshParams( PipeSend, &Req ); - break; - - case DhcpReqGetAdapterInfo: - BytesWritten = DSGetAdapterInfo( PipeSend, &Req ); - break; - - default: - DPRINT1("Unrecognized request type %d\n", Req.Type); - ZeroMemory( &Reply, sizeof( COMM_DHCP_REPLY ) ); - Reply.Reply = 0; - BytesWritten = PipeSend( &Reply ); - break; - } - } - DisconnectNamedPipe( CommPipe ); - } - - return TRUE; -} - -HANDLE PipeInit() { - CommPipe = CreateNamedPipeW - ( DHCP_PIPE_NAME, - PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, - 1, - COMM_PIPE_OUTPUT_BUFFER, - COMM_PIPE_INPUT_BUFFER, - COMM_PIPE_DEFAULT_TIMEOUT, - NULL ); - - if( CommPipe == INVALID_HANDLE_VALUE ) { - DbgPrint("DHCP: Could not create named pipe\n"); - return CommPipe; - } - - CommThread = CreateThread( NULL, 0, PipeThreadProc, NULL, 0, &CommThrId ); - - if( !CommThread ) { - CloseHandle( CommPipe ); - CommPipe = INVALID_HANDLE_VALUE; - } - - return CommPipe; -} - -VOID PipeDestroy() { - CloseHandle( CommPipe ); - CommPipe = INVALID_HANDLE_VALUE; -} diff --git a/reactos/base/services/dhcp/privsep.c b/reactos/base/services/dhcp/privsep.c deleted file mode 100644 index 7a13bfed21b..00000000000 --- a/reactos/base/services/dhcp/privsep.c +++ /dev/null @@ -1,225 +0,0 @@ -/* $OpenBSD: privsep.c,v 1.7 2004/05/10 18:34:42 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Henning Brauer - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "rosdhcp.h" -#include "dhcpd.h" -#include "privsep.h" - -struct buf * -buf_open(size_t len) -{ - struct buf *buf; - - if ((buf = calloc(1, sizeof(struct buf))) == NULL) - return (NULL); - if ((buf->buf = malloc(len)) == NULL) { - free(buf); - return (NULL); - } - buf->size = len; - - return (buf); -} - -int -buf_add(struct buf *buf, void *data, size_t len) -{ - if (buf->wpos + len > buf->size) - return (-1); - - memcpy(buf->buf + buf->wpos, data, len); - buf->wpos += len; - return (0); -} - -int -buf_close(int sock, struct buf *buf) -{ - ssize_t n; - - n = write(sock, buf->buf + buf->rpos, buf->size - buf->rpos); - if (n != -1) - buf->rpos += n; - if (n == 0) { /* connection closed */ - return (-1); - } - - if (buf->rpos < buf->size) - error("short write: wanted %lu got %ld bytes", - (unsigned long)buf->size, (long)buf->rpos); - - free(buf->buf); - free(buf); - return (n); -} - -ssize_t -buf_read(int sock, void *buf, size_t nbytes) -{ - ssize_t n, r = 0; - char *p = buf; - - n = read(sock, p, nbytes); - if (n == 0) - error("connection closed"); - if (n != -1) { - r += n; - p += n; - nbytes -= n; - } - - if (n == -1) - error("buf_read: %d", WSAGetLastError()); - - if (r < nbytes) - error("short read: wanted %lu got %ld bytes", - (unsigned long)nbytes, (long)r); - - return (r); -} - -void -dispatch_imsg(int fd) -{ - struct imsg_hdr hdr; - char *medium, *reason, *filename, - *servername, *prefix; - size_t medium_len, reason_len, filename_len, - servername_len, prefix_len, totlen; - struct client_lease lease; - int ret, i, optlen; - struct buf *buf; - - buf_read(fd, &hdr, sizeof(hdr)); - - switch (hdr.code) { - case IMSG_SCRIPT_INIT: - if (hdr.len < sizeof(hdr) + sizeof(size_t)) - error("corrupted message received"); - buf_read(fd, &medium_len, sizeof(medium_len)); - if (hdr.len < medium_len + sizeof(size_t) + sizeof(hdr) - + sizeof(size_t) || medium_len == SIZE_T_MAX) - error("corrupted message received"); - if (medium_len > 0) { - if ((medium = calloc(1, medium_len + 1)) != NULL) - buf_read(fd, medium, medium_len); - } else - medium = NULL; - - buf_read(fd, &reason_len, sizeof(reason_len)); - if (hdr.len < medium_len + reason_len + sizeof(hdr) || - reason_len == SIZE_T_MAX) - error("corrupted message received"); - if (reason_len > 0) { - if ((reason = calloc(1, reason_len + 1)) != NULL) - buf_read(fd, reason, reason_len); - } else - reason = NULL; - -// priv_script_init(reason, medium); - free(reason); - free(medium); - break; - case IMSG_SCRIPT_WRITE_PARAMS: - //bzero(&lease, sizeof lease); - memset(&lease, 0, sizeof(lease)); - totlen = sizeof(hdr) + sizeof(lease) + sizeof(size_t); - if (hdr.len < totlen) - error("corrupted message received"); - buf_read(fd, &lease, sizeof(lease)); - - buf_read(fd, &filename_len, sizeof(filename_len)); - totlen += filename_len + sizeof(size_t); - if (hdr.len < totlen || filename_len == SIZE_T_MAX) - error("corrupted message received"); - if (filename_len > 0) { - if ((filename = calloc(1, filename_len + 1)) != NULL) - buf_read(fd, filename, filename_len); - } else - filename = NULL; - - buf_read(fd, &servername_len, sizeof(servername_len)); - totlen += servername_len + sizeof(size_t); - if (hdr.len < totlen || servername_len == SIZE_T_MAX) - error("corrupted message received"); - if (servername_len > 0) { - if ((servername = - calloc(1, servername_len + 1)) != NULL) - buf_read(fd, servername, servername_len); - } else - servername = NULL; - - buf_read(fd, &prefix_len, sizeof(prefix_len)); - totlen += prefix_len; - if (hdr.len < totlen || prefix_len == SIZE_T_MAX) - error("corrupted message received"); - if (prefix_len > 0) { - if ((prefix = calloc(1, prefix_len + 1)) != NULL) - buf_read(fd, prefix, prefix_len); - } else - prefix = NULL; - - for (i = 0; i < 256; i++) { - totlen += sizeof(optlen); - if (hdr.len < totlen) - error("corrupted message received"); - buf_read(fd, &optlen, sizeof(optlen)); - lease.options[i].data = NULL; - lease.options[i].len = optlen; - if (optlen > 0) { - totlen += optlen; - if (hdr.len < totlen || optlen == SIZE_T_MAX) - error("corrupted message received"); - lease.options[i].data = - calloc(1, optlen + 1); - if (lease.options[i].data != NULL) - buf_read(fd, lease.options[i].data, optlen); - } - } - lease.server_name = servername; - lease.filename = filename; - -// priv_script_write_params(prefix, &lease); - - free(servername); - free(filename); - free(prefix); - for (i = 0; i < 256; i++) - if (lease.options[i].len > 0) - free(lease.options[i].data); - break; - case IMSG_SCRIPT_GO: - if (hdr.len != sizeof(hdr)) - error("corrupted message received"); - -// ret = priv_script_go(); - - hdr.code = IMSG_SCRIPT_GO_RET; - hdr.len = sizeof(struct imsg_hdr) + sizeof(int); - buf = buf_open(hdr.len); - - if (buf != NULL) { - buf_add(buf, &hdr, sizeof(hdr)); - buf_add(buf, &ret, sizeof(ret)); - buf_close(fd, buf); - } - break; - default: - error("received unknown message, code %d", hdr.code); - } -} diff --git a/reactos/base/services/dhcp/socket.c b/reactos/base/services/dhcp/socket.c deleted file mode 100644 index 849d04943b5..00000000000 --- a/reactos/base/services/dhcp/socket.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "rosdhcp.h" - -SOCKET ServerSocket; - -void SocketInit() { - ServerSocket = socket( AF_INET, SOCK_DGRAM, 0 ); -} - -ssize_t send_packet( struct interface_info *ip, - struct dhcp_packet *p, - size_t size, - struct in_addr addr, - struct sockaddr_in *broadcast, - struct hardware *hardware ) { - int result = - sendto( ip->wfdesc, (char *)p, size, 0, - (struct sockaddr *)broadcast, sizeof(*broadcast) ); - - if (result < 0) { - note ("send_packet: %x", result); - if (result == WSAENETUNREACH) - note ("send_packet: please consult README file%s", - " regarding broadcast address."); - } - - return result; -} - -ssize_t receive_packet(struct interface_info *ip, - unsigned char *packet_data, - size_t packet_len, - struct sockaddr_in *dest, - struct hardware *hardware ) { - int recv_addr_size = sizeof(*dest); - int result = - recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0, - (struct sockaddr *)dest, &recv_addr_size ); - return result; -} diff --git a/reactos/base/services/dhcp/tables.c b/reactos/base/services/dhcp/tables.c deleted file mode 100644 index 3de26b7cef6..00000000000 --- a/reactos/base/services/dhcp/tables.c +++ /dev/null @@ -1,692 +0,0 @@ -/* tables.c - - Tables of information... */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ -#define lint -#ifndef lint -static char copyright[] = -"$Id: tables.c,v 1.13.2.4 1999/04/24 16:46:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" - -/* DHCP Option names, formats and codes, from RFC1533. - - Format codes: - - e - end of data - I - IP address - l - 32-bit signed integer - L - 32-bit unsigned integer - s - 16-bit signed integer - S - 16-bit unsigned integer - b - 8-bit signed integer - B - 8-bit unsigned integer - t - ASCII text - f - flag (true or false) - A - array of whatever precedes (e.g., IA means array of IP addresses) -*/ - -struct universe dhcp_universe; -struct dhcp_option dhcp_options [256] = { - { "pad", "", &dhcp_universe, 0 }, - { "subnet-mask", "I", &dhcp_universe, 1 }, - { "time-offset", "l", &dhcp_universe, 2 }, - { "routers", "IA", &dhcp_universe, 3 }, - { "time-servers", "IA", &dhcp_universe, 4 }, - { "ien116-name-servers", "IA", &dhcp_universe, 5 }, - { "domain-name-servers", "IA", &dhcp_universe, 6 }, - { "log-servers", "IA", &dhcp_universe, 7 }, - { "cookie-servers", "IA", &dhcp_universe, 8 }, - { "lpr-servers", "IA", &dhcp_universe, 9 }, - { "impress-servers", "IA", &dhcp_universe, 10 }, - { "resource-location-servers", "IA", &dhcp_universe, 11 }, - { "host-name", "X", &dhcp_universe, 12 }, - { "boot-size", "S", &dhcp_universe, 13 }, - { "merit-dump", "t", &dhcp_universe, 14 }, - { "domain-name", "t", &dhcp_universe, 15 }, - { "swap-server", "I", &dhcp_universe, 16 }, - { "root-path", "t", &dhcp_universe, 17 }, - { "extensions-path", "t", &dhcp_universe, 18 }, - { "ip-forwarding", "f", &dhcp_universe, 19 }, - { "non-local-source-routing", "f", &dhcp_universe, 20 }, - { "policy-filter", "IIA", &dhcp_universe, 21 }, - { "max-dgram-reassembly", "S", &dhcp_universe, 22 }, - { "default-ip-ttl", "B", &dhcp_universe, 23 }, - { "path-mtu-aging-timeout", "L", &dhcp_universe, 24 }, - { "path-mtu-plateau-table", "SA", &dhcp_universe, 25 }, - { "interface-mtu", "S", &dhcp_universe, 26 }, - { "all-subnets-local", "f", &dhcp_universe, 27 }, - { "broadcast-address", "I", &dhcp_universe, 28 }, - { "perform-mask-discovery", "f", &dhcp_universe, 29 }, - { "mask-supplier", "f", &dhcp_universe, 30 }, - { "router-discovery", "f", &dhcp_universe, 31 }, - { "router-solicitation-address", "I", &dhcp_universe, 32 }, - { "static-routes", "IIA", &dhcp_universe, 33 }, - { "trailer-encapsulation", "f", &dhcp_universe, 34 }, - { "arp-cache-timeout", "L", &dhcp_universe, 35 }, - { "ieee802-3-encapsulation", "f", &dhcp_universe, 36 }, - { "default-tcp-ttl", "B", &dhcp_universe, 37 }, - { "tcp-keepalive-interval", "L", &dhcp_universe, 38 }, - { "tcp-keepalive-garbage", "f", &dhcp_universe, 39 }, - { "nis-domain", "t", &dhcp_universe, 40 }, - { "nis-servers", "IA", &dhcp_universe, 41 }, - { "ntp-servers", "IA", &dhcp_universe, 42 }, - { "vendor-encapsulated-options", "X", &dhcp_universe, 43 }, - { "netbios-name-servers", "IA", &dhcp_universe, 44 }, - { "netbios-dd-server", "IA", &dhcp_universe, 45 }, - { "netbios-node-type", "B", &dhcp_universe, 46 }, - { "netbios-scope", "t", &dhcp_universe, 47 }, - { "font-servers", "IA", &dhcp_universe, 48 }, - { "x-display-manager", "IA", &dhcp_universe, 49 }, - { "dhcp-requested-address", "I", &dhcp_universe, 50 }, - { "dhcp-lease-time", "L", &dhcp_universe, 51 }, - { "dhcp-option-overload", "B", &dhcp_universe, 52 }, - { "dhcp-message-type", "B", &dhcp_universe, 53 }, - { "dhcp-server-identifier", "I", &dhcp_universe, 54 }, - { "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 }, - { "dhcp-message", "t", &dhcp_universe, 56 }, - { "dhcp-max-message-size", "S", &dhcp_universe, 57 }, - { "dhcp-renewal-time", "L", &dhcp_universe, 58 }, - { "dhcp-rebinding-time", "L", &dhcp_universe, 59 }, - { "dhcp-class-identifier", "t", &dhcp_universe, 60 }, - { "dhcp-client-identifier", "X", &dhcp_universe, 61 }, - { "option-62", "X", &dhcp_universe, 62 }, - { "option-63", "X", &dhcp_universe, 63 }, - { "nisplus-domain", "t", &dhcp_universe, 64 }, - { "nisplus-servers", "IA", &dhcp_universe, 65 }, - { "tftp-server-name", "t", &dhcp_universe, 66 }, - { "bootfile-name", "t", &dhcp_universe, 67 }, - { "mobile-ip-home-agent", "IA", &dhcp_universe, 68 }, - { "smtp-server", "IA", &dhcp_universe, 69 }, - { "pop-server", "IA", &dhcp_universe, 70 }, - { "nntp-server", "IA", &dhcp_universe, 71 }, - { "www-server", "IA", &dhcp_universe, 72 }, - { "finger-server", "IA", &dhcp_universe, 73 }, - { "irc-server", "IA", &dhcp_universe, 74 }, - { "streettalk-server", "IA", &dhcp_universe, 75 }, - { "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 }, - { "user-class", "t", &dhcp_universe, 77 }, - { "option-78", "X", &dhcp_universe, 78 }, - { "option-79", "X", &dhcp_universe, 79 }, - { "option-80", "X", &dhcp_universe, 80 }, - { "option-81", "X", &dhcp_universe, 81 }, - { "option-82", "X", &dhcp_universe, 82 }, - { "option-83", "X", &dhcp_universe, 83 }, - { "option-84", "X", &dhcp_universe, 84 }, - { "nds-servers", "IA", &dhcp_universe, 85 }, - { "nds-tree-name", "X", &dhcp_universe, 86 }, - { "nds-context", "X", &dhcp_universe, 87 }, - { "option-88", "X", &dhcp_universe, 88 }, - { "option-89", "X", &dhcp_universe, 89 }, - { "option-90", "X", &dhcp_universe, 90 }, - { "option-91", "X", &dhcp_universe, 91 }, - { "option-92", "X", &dhcp_universe, 92 }, - { "option-93", "X", &dhcp_universe, 93 }, - { "option-94", "X", &dhcp_universe, 94 }, - { "option-95", "X", &dhcp_universe, 95 }, - { "option-96", "X", &dhcp_universe, 96 }, - { "option-97", "X", &dhcp_universe, 97 }, - { "option-98", "X", &dhcp_universe, 98 }, - { "option-99", "X", &dhcp_universe, 99 }, - { "option-100", "X", &dhcp_universe, 100 }, - { "option-101", "X", &dhcp_universe, 101 }, - { "option-102", "X", &dhcp_universe, 102 }, - { "option-103", "X", &dhcp_universe, 103 }, - { "option-104", "X", &dhcp_universe, 104 }, - { "option-105", "X", &dhcp_universe, 105 }, - { "option-106", "X", &dhcp_universe, 106 }, - { "option-107", "X", &dhcp_universe, 107 }, - { "option-108", "X", &dhcp_universe, 108 }, - { "option-109", "X", &dhcp_universe, 109 }, - { "option-110", "X", &dhcp_universe, 110 }, - { "option-111", "X", &dhcp_universe, 111 }, - { "option-112", "X", &dhcp_universe, 112 }, - { "option-113", "X", &dhcp_universe, 113 }, - { "option-114", "X", &dhcp_universe, 114 }, - { "option-115", "X", &dhcp_universe, 115 }, - { "option-116", "X", &dhcp_universe, 116 }, - { "option-117", "X", &dhcp_universe, 117 }, - { "option-118", "X", &dhcp_universe, 118 }, - { "option-119", "X", &dhcp_universe, 119 }, - { "option-120", "X", &dhcp_universe, 120 }, - { "option-121", "X", &dhcp_universe, 121 }, - { "option-122", "X", &dhcp_universe, 122 }, - { "option-123", "X", &dhcp_universe, 123 }, - { "option-124", "X", &dhcp_universe, 124 }, - { "option-125", "X", &dhcp_universe, 125 }, - { "option-126", "X", &dhcp_universe, 126 }, - { "option-127", "X", &dhcp_universe, 127 }, - { "option-128", "X", &dhcp_universe, 128 }, - { "option-129", "X", &dhcp_universe, 129 }, - { "option-130", "X", &dhcp_universe, 130 }, - { "option-131", "X", &dhcp_universe, 131 }, - { "option-132", "X", &dhcp_universe, 132 }, - { "option-133", "X", &dhcp_universe, 133 }, - { "option-134", "X", &dhcp_universe, 134 }, - { "option-135", "X", &dhcp_universe, 135 }, - { "option-136", "X", &dhcp_universe, 136 }, - { "option-137", "X", &dhcp_universe, 137 }, - { "option-138", "X", &dhcp_universe, 138 }, - { "option-139", "X", &dhcp_universe, 139 }, - { "option-140", "X", &dhcp_universe, 140 }, - { "option-141", "X", &dhcp_universe, 141 }, - { "option-142", "X", &dhcp_universe, 142 }, - { "option-143", "X", &dhcp_universe, 143 }, - { "option-144", "X", &dhcp_universe, 144 }, - { "option-145", "X", &dhcp_universe, 145 }, - { "option-146", "X", &dhcp_universe, 146 }, - { "option-147", "X", &dhcp_universe, 147 }, - { "option-148", "X", &dhcp_universe, 148 }, - { "option-149", "X", &dhcp_universe, 149 }, - { "option-150", "X", &dhcp_universe, 150 }, - { "option-151", "X", &dhcp_universe, 151 }, - { "option-152", "X", &dhcp_universe, 152 }, - { "option-153", "X", &dhcp_universe, 153 }, - { "option-154", "X", &dhcp_universe, 154 }, - { "option-155", "X", &dhcp_universe, 155 }, - { "option-156", "X", &dhcp_universe, 156 }, - { "option-157", "X", &dhcp_universe, 157 }, - { "option-158", "X", &dhcp_universe, 158 }, - { "option-159", "X", &dhcp_universe, 159 }, - { "option-160", "X", &dhcp_universe, 160 }, - { "option-161", "X", &dhcp_universe, 161 }, - { "option-162", "X", &dhcp_universe, 162 }, - { "option-163", "X", &dhcp_universe, 163 }, - { "option-164", "X", &dhcp_universe, 164 }, - { "option-165", "X", &dhcp_universe, 165 }, - { "option-166", "X", &dhcp_universe, 166 }, - { "option-167", "X", &dhcp_universe, 167 }, - { "option-168", "X", &dhcp_universe, 168 }, - { "option-169", "X", &dhcp_universe, 169 }, - { "option-170", "X", &dhcp_universe, 170 }, - { "option-171", "X", &dhcp_universe, 171 }, - { "option-172", "X", &dhcp_universe, 172 }, - { "option-173", "X", &dhcp_universe, 173 }, - { "option-174", "X", &dhcp_universe, 174 }, - { "option-175", "X", &dhcp_universe, 175 }, - { "option-176", "X", &dhcp_universe, 176 }, - { "option-177", "X", &dhcp_universe, 177 }, - { "option-178", "X", &dhcp_universe, 178 }, - { "option-179", "X", &dhcp_universe, 179 }, - { "option-180", "X", &dhcp_universe, 180 }, - { "option-181", "X", &dhcp_universe, 181 }, - { "option-182", "X", &dhcp_universe, 182 }, - { "option-183", "X", &dhcp_universe, 183 }, - { "option-184", "X", &dhcp_universe, 184 }, - { "option-185", "X", &dhcp_universe, 185 }, - { "option-186", "X", &dhcp_universe, 186 }, - { "option-187", "X", &dhcp_universe, 187 }, - { "option-188", "X", &dhcp_universe, 188 }, - { "option-189", "X", &dhcp_universe, 189 }, - { "option-190", "X", &dhcp_universe, 190 }, - { "option-191", "X", &dhcp_universe, 191 }, - { "option-192", "X", &dhcp_universe, 192 }, - { "option-193", "X", &dhcp_universe, 193 }, - { "option-194", "X", &dhcp_universe, 194 }, - { "option-195", "X", &dhcp_universe, 195 }, - { "option-196", "X", &dhcp_universe, 196 }, - { "option-197", "X", &dhcp_universe, 197 }, - { "option-198", "X", &dhcp_universe, 198 }, - { "option-199", "X", &dhcp_universe, 199 }, - { "option-200", "X", &dhcp_universe, 200 }, - { "option-201", "X", &dhcp_universe, 201 }, - { "option-202", "X", &dhcp_universe, 202 }, - { "option-203", "X", &dhcp_universe, 203 }, - { "option-204", "X", &dhcp_universe, 204 }, - { "option-205", "X", &dhcp_universe, 205 }, - { "option-206", "X", &dhcp_universe, 206 }, - { "option-207", "X", &dhcp_universe, 207 }, - { "option-208", "X", &dhcp_universe, 208 }, - { "option-209", "X", &dhcp_universe, 209 }, - { "option-210", "X", &dhcp_universe, 210 }, - { "option-211", "X", &dhcp_universe, 211 }, - { "option-212", "X", &dhcp_universe, 212 }, - { "option-213", "X", &dhcp_universe, 213 }, - { "option-214", "X", &dhcp_universe, 214 }, - { "option-215", "X", &dhcp_universe, 215 }, - { "option-216", "X", &dhcp_universe, 216 }, - { "option-217", "X", &dhcp_universe, 217 }, - { "option-218", "X", &dhcp_universe, 218 }, - { "option-219", "X", &dhcp_universe, 219 }, - { "option-220", "X", &dhcp_universe, 220 }, - { "option-221", "X", &dhcp_universe, 221 }, - { "option-222", "X", &dhcp_universe, 222 }, - { "option-223", "X", &dhcp_universe, 223 }, - { "option-224", "X", &dhcp_universe, 224 }, - { "option-225", "X", &dhcp_universe, 225 }, - { "option-226", "X", &dhcp_universe, 226 }, - { "option-227", "X", &dhcp_universe, 227 }, - { "option-228", "X", &dhcp_universe, 228 }, - { "option-229", "X", &dhcp_universe, 229 }, - { "option-230", "X", &dhcp_universe, 230 }, - { "option-231", "X", &dhcp_universe, 231 }, - { "option-232", "X", &dhcp_universe, 232 }, - { "option-233", "X", &dhcp_universe, 233 }, - { "option-234", "X", &dhcp_universe, 234 }, - { "option-235", "X", &dhcp_universe, 235 }, - { "option-236", "X", &dhcp_universe, 236 }, - { "option-237", "X", &dhcp_universe, 237 }, - { "option-238", "X", &dhcp_universe, 238 }, - { "option-239", "X", &dhcp_universe, 239 }, - { "option-240", "X", &dhcp_universe, 240 }, - { "option-241", "X", &dhcp_universe, 241 }, - { "option-242", "X", &dhcp_universe, 242 }, - { "option-243", "X", &dhcp_universe, 243 }, - { "option-244", "X", &dhcp_universe, 244 }, - { "option-245", "X", &dhcp_universe, 245 }, - { "option-246", "X", &dhcp_universe, 246 }, - { "option-247", "X", &dhcp_universe, 247 }, - { "option-248", "X", &dhcp_universe, 248 }, - { "option-249", "X", &dhcp_universe, 249 }, - { "option-250", "X", &dhcp_universe, 250 }, - { "option-251", "X", &dhcp_universe, 251 }, - { "option-252", "X", &dhcp_universe, 252 }, - { "option-253", "X", &dhcp_universe, 253 }, - { "option-254", "X", &dhcp_universe, 254 }, - { "option-end", "e", &dhcp_universe, 255 }, -}; - -/* Default dhcp option priority list (this is ad hoc and should not be - mistaken for a carefully crafted and optimized list). */ -unsigned char dhcp_option_default_priority_list [] = { - DHO_DHCP_REQUESTED_ADDRESS, - DHO_DHCP_OPTION_OVERLOAD, - DHO_DHCP_MAX_MESSAGE_SIZE, - DHO_DHCP_RENEWAL_TIME, - DHO_DHCP_REBINDING_TIME, - DHO_DHCP_CLASS_IDENTIFIER, - DHO_DHCP_CLIENT_IDENTIFIER, - DHO_SUBNET_MASK, - DHO_TIME_OFFSET, - DHO_ROUTERS, - DHO_TIME_SERVERS, - DHO_NAME_SERVERS, - DHO_DOMAIN_NAME_SERVERS, - DHO_HOST_NAME, - DHO_LOG_SERVERS, - DHO_COOKIE_SERVERS, - DHO_LPR_SERVERS, - DHO_IMPRESS_SERVERS, - DHO_RESOURCE_LOCATION_SERVERS, - DHO_HOST_NAME, - DHO_BOOT_SIZE, - DHO_MERIT_DUMP, - DHO_DOMAIN_NAME, - DHO_SWAP_SERVER, - DHO_ROOT_PATH, - DHO_EXTENSIONS_PATH, - DHO_IP_FORWARDING, - DHO_NON_LOCAL_SOURCE_ROUTING, - DHO_POLICY_FILTER, - DHO_MAX_DGRAM_REASSEMBLY, - DHO_DEFAULT_IP_TTL, - DHO_PATH_MTU_AGING_TIMEOUT, - DHO_PATH_MTU_PLATEAU_TABLE, - DHO_INTERFACE_MTU, - DHO_ALL_SUBNETS_LOCAL, - DHO_BROADCAST_ADDRESS, - DHO_PERFORM_MASK_DISCOVERY, - DHO_MASK_SUPPLIER, - DHO_ROUTER_DISCOVERY, - DHO_ROUTER_SOLICITATION_ADDRESS, - DHO_STATIC_ROUTES, - DHO_TRAILER_ENCAPSULATION, - DHO_ARP_CACHE_TIMEOUT, - DHO_IEEE802_3_ENCAPSULATION, - DHO_DEFAULT_TCP_TTL, - DHO_TCP_KEEPALIVE_INTERVAL, - DHO_TCP_KEEPALIVE_GARBAGE, - DHO_NIS_DOMAIN, - DHO_NIS_SERVERS, - DHO_NTP_SERVERS, - DHO_VENDOR_ENCAPSULATED_OPTIONS, - DHO_NETBIOS_NAME_SERVERS, - DHO_NETBIOS_DD_SERVER, - DHO_NETBIOS_NODE_TYPE, - DHO_NETBIOS_SCOPE, - DHO_FONT_SERVERS, - DHO_X_DISPLAY_MANAGER, - DHO_DHCP_PARAMETER_REQUEST_LIST, - - /* Presently-undefined options... */ - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, -}; - -int sizeof_dhcp_option_default_priority_list = - sizeof dhcp_option_default_priority_list; - - -char *hardware_types [] = { - "unknown-0", - "ethernet", - "unknown-2", - "unknown-3", - "unknown-4", - "unknown-5", - "token-ring", - "unknown-7", - "fddi", - "unknown-9", - "unknown-10", - "unknown-11", - "unknown-12", - "unknown-13", - "unknown-14", - "unknown-15", - "unknown-16", - "unknown-17", - "unknown-18", - "unknown-19", - "unknown-20", - "unknown-21", - "unknown-22", - "unknown-23", - "unknown-24", - "unknown-25", - "unknown-26", - "unknown-27", - "unknown-28", - "unknown-29", - "unknown-30", - "unknown-31", - "unknown-32", - "unknown-33", - "unknown-34", - "unknown-35", - "unknown-36", - "unknown-37", - "unknown-38", - "unknown-39", - "unknown-40", - "unknown-41", - "unknown-42", - "unknown-43", - "unknown-44", - "unknown-45", - "unknown-46", - "unknown-47", - "unknown-48", - "unknown-49", - "unknown-50", - "unknown-51", - "unknown-52", - "unknown-53", - "unknown-54", - "unknown-55", - "unknown-56", - "unknown-57", - "unknown-58", - "unknown-59", - "unknown-60", - "unknown-61", - "unknown-62", - "unknown-63", - "unknown-64", - "unknown-65", - "unknown-66", - "unknown-67", - "unknown-68", - "unknown-69", - "unknown-70", - "unknown-71", - "unknown-72", - "unknown-73", - "unknown-74", - "unknown-75", - "unknown-76", - "unknown-77", - "unknown-78", - "unknown-79", - "unknown-80", - "unknown-81", - "unknown-82", - "unknown-83", - "unknown-84", - "unknown-85", - "unknown-86", - "unknown-87", - "unknown-88", - "unknown-89", - "unknown-90", - "unknown-91", - "unknown-92", - "unknown-93", - "unknown-94", - "unknown-95", - "unknown-96", - "unknown-97", - "unknown-98", - "unknown-99", - "unknown-100", - "unknown-101", - "unknown-102", - "unknown-103", - "unknown-104", - "unknown-105", - "unknown-106", - "unknown-107", - "unknown-108", - "unknown-109", - "unknown-110", - "unknown-111", - "unknown-112", - "unknown-113", - "unknown-114", - "unknown-115", - "unknown-116", - "unknown-117", - "unknown-118", - "unknown-119", - "unknown-120", - "unknown-121", - "unknown-122", - "unknown-123", - "unknown-124", - "unknown-125", - "unknown-126", - "unknown-127", - "unknown-128", - "unknown-129", - "unknown-130", - "unknown-131", - "unknown-132", - "unknown-133", - "unknown-134", - "unknown-135", - "unknown-136", - "unknown-137", - "unknown-138", - "unknown-139", - "unknown-140", - "unknown-141", - "unknown-142", - "unknown-143", - "unknown-144", - "unknown-145", - "unknown-146", - "unknown-147", - "unknown-148", - "unknown-149", - "unknown-150", - "unknown-151", - "unknown-152", - "unknown-153", - "unknown-154", - "unknown-155", - "unknown-156", - "unknown-157", - "unknown-158", - "unknown-159", - "unknown-160", - "unknown-161", - "unknown-162", - "unknown-163", - "unknown-164", - "unknown-165", - "unknown-166", - "unknown-167", - "unknown-168", - "unknown-169", - "unknown-170", - "unknown-171", - "unknown-172", - "unknown-173", - "unknown-174", - "unknown-175", - "unknown-176", - "unknown-177", - "unknown-178", - "unknown-179", - "unknown-180", - "unknown-181", - "unknown-182", - "unknown-183", - "unknown-184", - "unknown-185", - "unknown-186", - "unknown-187", - "unknown-188", - "unknown-189", - "unknown-190", - "unknown-191", - "unknown-192", - "unknown-193", - "unknown-194", - "unknown-195", - "unknown-196", - "unknown-197", - "unknown-198", - "unknown-199", - "unknown-200", - "unknown-201", - "unknown-202", - "unknown-203", - "unknown-204", - "unknown-205", - "unknown-206", - "unknown-207", - "unknown-208", - "unknown-209", - "unknown-210", - "unknown-211", - "unknown-212", - "unknown-213", - "unknown-214", - "unknown-215", - "unknown-216", - "unknown-217", - "unknown-218", - "unknown-219", - "unknown-220", - "unknown-221", - "unknown-222", - "unknown-223", - "unknown-224", - "unknown-225", - "unknown-226", - "unknown-227", - "unknown-228", - "unknown-229", - "unknown-230", - "unknown-231", - "unknown-232", - "unknown-233", - "unknown-234", - "unknown-235", - "unknown-236", - "unknown-237", - "unknown-238", - "unknown-239", - "unknown-240", - "unknown-241", - "unknown-242", - "unknown-243", - "unknown-244", - "unknown-245", - "unknown-246", - "unknown-247", - "unknown-248", - "unknown-249", - "unknown-250", - "unknown-251", - "unknown-252", - "unknown-253", - "unknown-254", - "unknown-255" }; - - - -struct hash_table universe_hash; - -void initialize_universes() -{ - int i; - - dhcp_universe.name = "dhcp"; - dhcp_universe.hash = new_hash (); - if (!dhcp_universe.hash) - error ("Can't allocate dhcp option hash table."); - for (i = 0; i < 256; i++) { - dhcp_universe.options [i] = &dhcp_options [i]; - add_hash (dhcp_universe.hash, - (unsigned char *)dhcp_options [i].name, 0, - (unsigned char *)&dhcp_options [i]); - } - universe_hash.hash_count = DEFAULT_HASH_SIZE; - add_hash (&universe_hash, - (unsigned char *)dhcp_universe.name, 0, - (unsigned char *)&dhcp_universe); -} diff --git a/reactos/base/services/dhcp/timer.c b/reactos/base/services/dhcp/timer.c deleted file mode 100644 index ccd817188ec..00000000000 --- a/reactos/base/services/dhcp/timer.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "rosdhcp.h" - diff --git a/reactos/base/services/dhcp/tree.c b/reactos/base/services/dhcp/tree.c deleted file mode 100644 index f721d08f897..00000000000 --- a/reactos/base/services/dhcp/tree.c +++ /dev/null @@ -1,412 +0,0 @@ -/* tree.c - - Routines for manipulating parse trees... */ - -/* - * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: tree.c,v 1.10 1997/05/09 08:14:57 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" - -static TIME tree_evaluate_recurse PROTO ((int *, unsigned char **, int *, - struct tree *)); -static TIME do_host_lookup PROTO ((int *, unsigned char **, int *, - struct dns_host_entry *)); -static void do_data_copy PROTO ((int *, unsigned char **, int *, - unsigned char *, int)); - -pair cons (car, cdr) - caddr_t car; - pair cdr; -{ - pair foo = (pair)dmalloc (sizeof *foo, "cons"); - if (!foo) - error ("no memory for cons."); - foo -> car = car; - foo -> cdr = cdr; - return foo; -} - -struct tree_cache *tree_cache (tree) - struct tree *tree; -{ - struct tree_cache *tc; - - tc = new_tree_cache ("tree_cache"); - if (!tc) - return 0; - tc -> value = (unsigned char *)0; - tc -> len = tc -> buf_size = 0; - tc -> timeout = 0; - tc -> tree = tree; - return tc; -} - -struct tree *tree_host_lookup (name) - char *name; -{ - struct tree *nt; - nt = new_tree ("tree_host_lookup"); - if (!nt) - error ("No memory for host lookup tree node."); - nt -> op = TREE_HOST_LOOKUP; - nt -> data.host_lookup.host = enter_dns_host (name); - return nt; -} - -struct dns_host_entry *enter_dns_host (name) - char *name; -{ - struct dns_host_entry *dh; - - if (!(dh = (struct dns_host_entry *)dmalloc - (sizeof (struct dns_host_entry), "enter_dns_host")) - || !(dh -> hostname = dmalloc (strlen (name) + 1, - "enter_dns_host"))) - error ("Can't allocate space for new host."); - strcpy (dh -> hostname, name); - dh -> data = (unsigned char *)0; - dh -> data_len = 0; - dh -> buf_len = 0; - dh -> timeout = 0; - return dh; -} - -struct tree *tree_const (data, len) - unsigned char *data; - int len; -{ - struct tree *nt; - if (!(nt = new_tree ("tree_const")) - || !(nt -> data.const_val.data = - (unsigned char *)dmalloc (len, "tree_const"))) - error ("No memory for constant data tree node."); - nt -> op = TREE_CONST; - memcpy (nt -> data.const_val.data, data, len); - nt -> data.const_val.len = len; - return nt; -} - -struct tree *tree_concat (left, right) - struct tree *left, *right; -{ - struct tree *nt; - - /* If we're concatenating a null tree to a non-null tree, just - return the non-null tree; if both trees are null, return - a null tree. */ - if (!left) - return right; - if (!right) - return left; - - /* If both trees are constant, combine them. */ - if (left -> op == TREE_CONST && right -> op == TREE_CONST) { - unsigned char *buf = dmalloc (left -> data.const_val.len - + right -> data.const_val.len, - "tree_concat"); - if (!buf) - error ("No memory to concatenate constants."); - memcpy (buf, left -> data.const_val.data, - left -> data.const_val.len); - memcpy (buf + left -> data.const_val.len, - right -> data.const_val.data, - right -> data.const_val.len); - dfree (left -> data.const_val.data, "tree_concat"); - dfree (right -> data.const_val.data, "tree_concat"); - left -> data.const_val.data = buf; - left -> data.const_val.len += right -> data.const_val.len; - free_tree (right, "tree_concat"); - return left; - } - - /* Otherwise, allocate a new node to concatenate the two. */ - if (!(nt = new_tree ("tree_concat"))) - error ("No memory for data tree concatenation node."); - nt -> op = TREE_CONCAT; - nt -> data.concat.left = left; - nt -> data.concat.right = right; - return nt; -} - -struct tree *tree_limit (tree, limit) - struct tree *tree; - int limit; -{ - struct tree *rv; - - /* If the tree we're limiting is constant, limit it now. */ - if (tree -> op == TREE_CONST) { - if (tree -> data.const_val.len > limit) - tree -> data.const_val.len = limit; - return tree; - } - - /* Otherwise, put in a node which enforces the limit on evaluation. */ - rv = new_tree ("tree_limit"); - if (!rv) - return (struct tree *)0; - rv -> op = TREE_LIMIT; - rv -> data.limit.tree = tree; - rv -> data.limit.limit = limit; - return rv; -} - -int tree_evaluate (tree_cache) - struct tree_cache *tree_cache; -{ - unsigned char *bp = tree_cache -> value; - int bc = tree_cache -> buf_size; - int bufix = 0; - - /* If there's no tree associated with this cache, it evaluates - to a constant and that was detected at startup. */ - if (!tree_cache -> tree) - return 1; - - /* Try to evaluate the tree without allocating more memory... */ - tree_cache -> timeout = tree_evaluate_recurse (&bufix, &bp, &bc, - tree_cache -> tree); - - /* No additional allocation needed? */ - if (bufix <= bc) { - tree_cache -> len = bufix; - return 1; - } - - /* If we can't allocate more memory, return with what we - have (maybe nothing). */ - if (!(bp = (unsigned char *)dmalloc (bufix, "tree_evaluate"))) - return 0; - - /* Record the change in conditions... */ - bc = bufix; - bufix = 0; - - /* Note that the size of the result shouldn't change on the - second call to tree_evaluate_recurse, since we haven't - changed the ``current'' time. */ - tree_evaluate_recurse (&bufix, &bp, &bc, tree_cache -> tree); - - /* Free the old buffer if needed, then store the new buffer - location and size and return. */ - if (tree_cache -> value) - dfree (tree_cache -> value, "tree_evaluate"); - tree_cache -> value = bp; - tree_cache -> len = bufix; - tree_cache -> buf_size = bc; - return 1; -} - -static TIME tree_evaluate_recurse (bufix, bufp, bufcount, tree) - int *bufix; - unsigned char **bufp; - int *bufcount; - struct tree *tree; -{ - int limit; - TIME t1, t2; - - switch (tree -> op) { - case TREE_CONCAT: - t1 = tree_evaluate_recurse (bufix, bufp, bufcount, - tree -> data.concat.left); - t2 = tree_evaluate_recurse (bufix, bufp, bufcount, - tree -> data.concat.right); - if (t1 > t2) - return t2; - return t1; - - case TREE_HOST_LOOKUP: - return do_host_lookup (bufix, bufp, bufcount, - tree -> data.host_lookup.host); - - case TREE_CONST: - do_data_copy (bufix, bufp, bufcount, - tree -> data.const_val.data, - tree -> data.const_val.len); - t1 = MAX_TIME; - return t1; - - case TREE_LIMIT: - limit = *bufix + tree -> data.limit.limit; - t1 = tree_evaluate_recurse (bufix, bufp, bufcount, - tree -> data.limit.tree); - *bufix = limit; - return t1; - - default: - warn ("Bad node id in tree: %d."); - t1 = MAX_TIME; - return t1; - } -} - -static TIME do_host_lookup (bufix, bufp, bufcount, dns) - int *bufix; - unsigned char **bufp; - int *bufcount; - struct dns_host_entry *dns; -{ - struct hostent *h; - int i; - int new_len; - -#ifdef DEBUG_EVAL - debug ("time: now = %d dns = %d %d diff = %d", - cur_time, dns -> timeout, cur_time - dns -> timeout); -#endif - - /* If the record hasn't timed out, just copy the data and return. */ - if (cur_time <= dns -> timeout) { -#ifdef DEBUG_EVAL - debug ("easy copy: %x %d %x", - dns -> data, dns -> data_len, - dns -> data ? *(int *)(dns -> data) : 0); -#endif - do_data_copy (bufix, bufp, bufcount, - dns -> data, dns -> data_len); - return dns -> timeout; - } -#ifdef DEBUG_EVAL - debug ("Looking up %s", dns -> hostname); -#endif - - /* Otherwise, look it up... */ - h = gethostbyname (dns -> hostname); - if (!h) { -#ifndef NO_H_ERRNO - switch (h_errno) { - case HOST_NOT_FOUND: -#endif - warn ("%s: host unknown.", dns -> hostname); -#ifndef NO_H_ERRNO - break; - case TRY_AGAIN: - warn ("%s: temporary name server failure", - dns -> hostname); - break; - case NO_RECOVERY: - warn ("%s: name server failed", dns -> hostname); - break; - case NO_DATA: - warn ("%s: no A record associated with address", - dns -> hostname); - } -#endif /* !NO_H_ERRNO */ - - /* Okay to try again after a minute. */ - return cur_time + 60; - } - -#ifdef DEBUG_EVAL - debug ("Lookup succeeded; first address is %x", - h -> h_addr_list [0]); -#endif - - /* Count the number of addresses we got... */ - for (i = 0; h -> h_addr_list [i]; i++) - ; - - /* Do we need to allocate more memory? */ - new_len = i * h -> h_length; - if (dns -> buf_len < i) { - unsigned char *buf = - (unsigned char *)dmalloc (new_len, "do_host_lookup"); - /* If we didn't get more memory, use what we have. */ - if (!buf) { - new_len = dns -> buf_len; - if (!dns -> buf_len) { - dns -> timeout = cur_time + 60; - return dns -> timeout; - } - } else { - if (dns -> data) - dfree (dns -> data, "do_host_lookup"); - dns -> data = buf; - dns -> buf_len = new_len; - } - } - - /* Addresses are conveniently stored one to the buffer, so we - have to copy them out one at a time... :'( */ - for (i = 0; i < new_len / h -> h_length; i++) { - memcpy (dns -> data + h -> h_length * i, - h -> h_addr_list [i], h -> h_length); - } -#ifdef DEBUG_EVAL - debug ("dns -> data: %x h -> h_addr_list [0]: %x", - *(int *)(dns -> data), h -> h_addr_list [0]); -#endif - dns -> data_len = new_len; - - /* Set the timeout for an hour from now. - XXX This should really use the time on the DNS reply. */ - dns -> timeout = cur_time + 3600; - -#ifdef DEBUG_EVAL - debug ("hard copy: %x %d %x", - dns -> data, dns -> data_len, *(int *)(dns -> data)); -#endif - do_data_copy (bufix, bufp, bufcount, dns -> data, dns -> data_len); - return dns -> timeout; -} - -static void do_data_copy (bufix, bufp, bufcount, data, len) - int *bufix; - unsigned char **bufp; - int *bufcount; - unsigned char *data; - int len; -{ - int space = *bufcount - *bufix; - - /* If there's more space than we need, use only what we need. */ - if (space > len) - space = len; - - /* Copy as much data as will fit, then increment the buffer index - by the amount we actually had to copy, which could be more. */ - if (space > 0) - memcpy (*bufp + *bufix, data, space); - *bufix += len; -} diff --git a/reactos/base/services/dhcp/util.c b/reactos/base/services/dhcp/util.c deleted file mode 100644 index 238a788e283..00000000000 --- a/reactos/base/services/dhcp/util.c +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include "rosdhcp.h" - -#define NDEBUG -#include - -char *piaddr( struct iaddr addr ) { - struct sockaddr_in sa; - memcpy(&sa.sin_addr,addr.iabuf,sizeof(sa.sin_addr)); - return inet_ntoa( sa.sin_addr ); -} - -int note( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("NOTE: %s\n", buf); - - return ret; -} - -int debug( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("DEBUG: %s\n", buf); - - return ret; -} - -int warn( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("WARN: %s\n", buf); - - return ret; -} - -int warning( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("WARNING: %s\n", buf); - - return ret; -} - -void error( char *format, ... ) { - char buf[0x100]; - va_list arg_begin; - va_start( arg_begin, format ); - - _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT1("ERROR: %s\n", buf); -} - -int16_t getShort( unsigned char *data ) { - return (int16_t) ntohs(*(int16_t*) data); -} - -u_int16_t getUShort( unsigned char *data ) { - return (u_int16_t) ntohs(*(u_int16_t*) data); -} - -int32_t getLong( unsigned char *data ) { - return (int32_t) ntohl(*(u_int32_t*) data); -} - -u_int32_t getULong( unsigned char *data ) { - return ntohl(*(u_int32_t*)data); -} - -int addr_eq( struct iaddr a, struct iaddr b ) { - return a.len == b.len && !memcmp( a.iabuf, b.iabuf, a.len ); -} - -void *dmalloc( int size, char *name ) { return malloc( size ); } - -int read_client_conf(struct interface_info *ifi) { - /* What a strange dance */ - struct client_config *config; - char ComputerName [MAX_COMPUTERNAME_LENGTH + 1]; - LPSTR lpCompName; - DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0]; - - if ((ifi!= NULL) && (ifi->client->config != NULL)) - config = ifi->client->config; - else - { - warn("util.c read_client_conf poorly implemented!"); - return 0; - } - - - GetComputerName(ComputerName, & ComputerNameSize); - debug("Hostname: %s, length: %lu", - ComputerName, ComputerNameSize); - /* This never gets freed since it's only called once */ - lpCompName = - HeapAlloc(GetProcessHeap(), 0, ComputerNameSize + 1); - if (lpCompName !=NULL) { - memcpy(lpCompName, ComputerName, ComputerNameSize + 1); - /* Send our hostname, some dhcpds use this to update DNS */ - config->send_options[DHO_HOST_NAME].data = (u_int8_t*)lpCompName; - config->send_options[DHO_HOST_NAME].len = ComputerNameSize; - debug("Hostname: %s, length: %d", - config->send_options[DHO_HOST_NAME].data, - config->send_options[DHO_HOST_NAME].len); - } else { - error("Failed to allocate heap for hostname"); - } - /* Both Linux and Windows send this */ - config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].data = - ifi->hw_address.haddr; - config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].len = - ifi->hw_address.hlen; - - /* Setup the requested option list */ - config->requested_options - [config->requested_option_count++] = DHO_SUBNET_MASK; - config->requested_options - [config->requested_option_count++] = DHO_BROADCAST_ADDRESS; - config->requested_options - [config->requested_option_count++] = DHO_TIME_OFFSET; - config->requested_options - [config->requested_option_count++] = DHO_ROUTERS; - config->requested_options - [config->requested_option_count++] = DHO_DOMAIN_NAME; - config->requested_options - [config->requested_option_count++] = DHO_DOMAIN_NAME_SERVERS; - config->requested_options - [config->requested_option_count++] = DHO_HOST_NAME; - config->requested_options - [config->requested_option_count++] = DHO_NTP_SERVERS; - - warn("util.c read_client_conf poorly implemented!"); - return 0; -} - -struct iaddr broadcast_addr( struct iaddr addr, struct iaddr mask ) { - struct iaddr bcast = { 0 }; - return bcast; -} - -struct iaddr subnet_number( struct iaddr addr, struct iaddr mask ) { - struct iaddr bcast = { 0 }; - return bcast; -} From 2b3f32398db126dc0e6a7b78749c17dcaffffebe Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 21 May 2010 06:08:15 +0000 Subject: [PATCH 141/151] DHCPCSVC] - Move code from dhcp to dhcpcsvc - Export ServiceMain from dhcpcsvc - Now our DHCP service is compatible with the Windows architecture [DHCP] - Remove dhcp from build [IPHLPAPI] - Use dhcpcsvc APIs to control the DHCP service - Add a missing DhcpCApiInitialize - Fix include path in the rbuild file [BOOTDATA] - Add DHCP to the service list to be loaded by svchost in the netsvcs group - Add the correct registry keys in the DHCP service key for loading by svchost - Remove dhcp.exe from bootcd - Part 3 of 3 svn path=/trunk/; revision=47288 --- reactos/base/services/services.rbuild | 3 - reactos/boot/bootdata/hivesft_arm.inf | 2 +- reactos/boot/bootdata/hivesft_i386.inf | 2 +- reactos/boot/bootdata/hivesys_i386.inf | 9 +- reactos/boot/bootdata/packages/reactos.dff | 1 - reactos/dll/win32/dhcpcsvc/adapter.c | 446 ++++ reactos/dll/win32/dhcpcsvc/alloc.c | 93 + reactos/dll/win32/dhcpcsvc/api.c | 201 ++ reactos/dll/win32/dhcpcsvc/compat.c | 67 + reactos/dll/win32/dhcpcsvc/dhclient.c | 1996 ++++++++++++++++++ reactos/dll/win32/dhcpcsvc/dhcpcsvc.c | 136 +- reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild | 18 + reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec | 3 +- reactos/dll/win32/dhcpcsvc/dispatch.c | 354 ++++ reactos/dll/win32/dhcpcsvc/hash.c | 165 ++ reactos/dll/win32/dhcpcsvc/include/debug.h | 51 + reactos/dll/win32/dhcpcsvc/include/dhcp.h | 169 ++ reactos/dll/win32/dhcpcsvc/include/dhcpd.h | 485 +++++ reactos/dll/win32/dhcpcsvc/include/hash.h | 56 + reactos/dll/win32/dhcpcsvc/include/rosdhcp.h | 100 + reactos/dll/win32/dhcpcsvc/include/tree.h | 66 + reactos/dll/win32/dhcpcsvc/options.c | 723 +++++++ reactos/dll/win32/dhcpcsvc/pipe.c | 120 ++ reactos/dll/win32/dhcpcsvc/socket.c | 39 + reactos/dll/win32/dhcpcsvc/tables.c | 692 ++++++ reactos/dll/win32/dhcpcsvc/tree.c | 412 ++++ reactos/dll/win32/dhcpcsvc/util.c | 166 ++ reactos/dll/win32/iphlpapi/dhcp_reactos.c | 27 +- reactos/dll/win32/iphlpapi/iphlpapi.rbuild | 2 +- reactos/dll/win32/iphlpapi/iphlpapi_main.c | 73 +- reactos/include/psdk/dhcpcapi.h | 30 +- 31 files changed, 6616 insertions(+), 91 deletions(-) create mode 100644 reactos/dll/win32/dhcpcsvc/adapter.c create mode 100644 reactos/dll/win32/dhcpcsvc/alloc.c create mode 100644 reactos/dll/win32/dhcpcsvc/api.c create mode 100644 reactos/dll/win32/dhcpcsvc/compat.c create mode 100644 reactos/dll/win32/dhcpcsvc/dhclient.c create mode 100644 reactos/dll/win32/dhcpcsvc/dispatch.c create mode 100644 reactos/dll/win32/dhcpcsvc/hash.c create mode 100644 reactos/dll/win32/dhcpcsvc/include/debug.h create mode 100644 reactos/dll/win32/dhcpcsvc/include/dhcp.h create mode 100644 reactos/dll/win32/dhcpcsvc/include/dhcpd.h create mode 100644 reactos/dll/win32/dhcpcsvc/include/hash.h create mode 100644 reactos/dll/win32/dhcpcsvc/include/rosdhcp.h create mode 100644 reactos/dll/win32/dhcpcsvc/include/tree.h create mode 100644 reactos/dll/win32/dhcpcsvc/options.c create mode 100644 reactos/dll/win32/dhcpcsvc/pipe.c create mode 100644 reactos/dll/win32/dhcpcsvc/socket.c create mode 100644 reactos/dll/win32/dhcpcsvc/tables.c create mode 100644 reactos/dll/win32/dhcpcsvc/tree.c create mode 100644 reactos/dll/win32/dhcpcsvc/util.c diff --git a/reactos/base/services/services.rbuild b/reactos/base/services/services.rbuild index 993f7d01ad9..5125d9b2f79 100644 --- a/reactos/base/services/services.rbuild +++ b/reactos/base/services/services.rbuild @@ -4,9 +4,6 @@ - - - diff --git a/reactos/boot/bootdata/hivesft_arm.inf b/reactos/boot/bootdata/hivesft_arm.inf index aabd6e10a34..6a63e499ae1 100644 --- a/reactos/boot/bootdata/hivesft_arm.inf +++ b/reactos/boot/bootdata/hivesft_arm.inf @@ -1128,6 +1128,6 @@ HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\Device\shellex\P ; SvcHost services HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"DHCP" ; EOF diff --git a/reactos/boot/bootdata/hivesft_i386.inf b/reactos/boot/bootdata/hivesft_i386.inf index b65d55aa471..5acea1c1687 100644 --- a/reactos/boot/bootdata/hivesft_i386.inf +++ b/reactos/boot/bootdata/hivesft_i386.inf @@ -1264,6 +1264,6 @@ HKLM,"SOFTWARE\Microsoft\Ole","EnableRemoteConnect",0x00000000,"N" ; SvcHost services HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost",,0x00000012 -HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"" +HKLM,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost", "netsvcs",0x00010000,"DHCP" ; EOF diff --git a/reactos/boot/bootdata/hivesys_i386.inf b/reactos/boot/bootdata/hivesys_i386.inf index 988fed4fc6b..3ca06176457 100644 --- a/reactos/boot/bootdata/hivesys_i386.inf +++ b/reactos/boot/bootdata/hivesys_i386.inf @@ -1037,12 +1037,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Disk","Type",0x00010001,0x00000001 ; DHCP client service HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","DisplayName",0x00000000,"DHCP Client" HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Description",0x00000000,"Attempts to obtain network settings automatically from an available DHCP server" -HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ErrorControl",0x00010001,0x00000000 -HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Group",0x00000000,"Network" -HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ImagePath",0x00020000,"%SystemRoot%\system32\dhcp.exe" +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ErrorControl",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Group",0x00000000,"TDI" +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k netsvcs" HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","ObjectName",0x00000000,"LocalSystem" HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Start",0x00010001,0x00000002 -HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Type",0x00010001,0x00000010 +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP","Type",0x00010001,0x00000020 +HKLM,"SYSTEM\CurrentControlSet\Services\DHCP\Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\dhcpcsvc.dll" ; Event logging service HKLM,"SYSTEM\CurrentControlSet\Services\EventLog",,0x00000010 diff --git a/reactos/boot/bootdata/packages/reactos.dff b/reactos/boot/bootdata/packages/reactos.dff index d87de7d4bf7..c76e469d7f2 100644 --- a/reactos/boot/bootdata/packages/reactos.dff +++ b/reactos/boot/bootdata/packages/reactos.dff @@ -90,7 +90,6 @@ base\applications\wordpad\wordpad.exe 1 base\applications\write\write.exe 1 base\services\audiosrv\audiosrv.exe 1 -base\services\dhcp\dhcp.exe 1 base\services\eventlog\eventlog.exe 1 base\services\rpcss\rpcss.exe 1 base\services\spoolsv\spoolsv.exe 1 diff --git a/reactos/dll/win32/dhcpcsvc/adapter.c b/reactos/dll/win32/dhcpcsvc/adapter.c new file mode 100644 index 00000000000..ea848bc8bcc --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/adapter.c @@ -0,0 +1,446 @@ +#include "rosdhcp.h" + +static SOCKET DhcpSocket = INVALID_SOCKET; +static LIST_ENTRY AdapterList; +static WSADATA wsd; + +PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { + int i = 0; + DWORD Error; + HKEY MainKey; + PCHAR *Out, OutKeyName; + DWORD CharTotal = 0, AppendLen = 1 + strlen(Append); + DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; + + Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); + + if( Error ) return NULL; + + Error = RegQueryInfoKey + ( MainKey, + NULL, NULL, NULL, + &MaxSubKeys, &MaxSubKeyLen, + NULL, NULL, NULL, NULL, NULL, NULL ); + + DH_DbgPrint(MID_TRACE,("MaxSubKeys: %d, MaxSubKeyLen %d\n", + MaxSubKeys, MaxSubKeyLen)); + + CharTotal = (sizeof(PCHAR) + MaxSubKeyLen + AppendLen) * (MaxSubKeys + 1); + + DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n", + AppendLen, CharTotal)); + + Out = (CHAR**) malloc( CharTotal ); + OutKeyName = ((PCHAR)&Out[MaxSubKeys+1]); + + if( !Out ) { RegCloseKey( MainKey ); return NULL; } + + i = 0; + do { + Out[i] = OutKeyName; + Error = RegEnumKey( MainKey, i, OutKeyName, MaxSubKeyLen ); + if( !Error ) { + strcat( OutKeyName, Append ); + DH_DbgPrint(MID_TRACE,("[%d]: %s\n", i, OutKeyName)); + OutKeyName += strlen(OutKeyName) + 1; + i++; + } else Out[i] = 0; + } while( Error == ERROR_SUCCESS ); + + RegCloseKey( MainKey ); + + return Out; +} + +PCHAR RegReadString( HKEY Root, PCHAR Subkey, PCHAR Value ) { + PCHAR SubOut = NULL; + DWORD SubOutLen = 0, Error = 0; + HKEY ValueKey = NULL; + + DH_DbgPrint(MID_TRACE,("Looking in %x:%s:%s\n", Root, Subkey, Value )); + + if( Subkey && strlen(Subkey) ) { + if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS ) + goto regerror; + } else ValueKey = Root; + + DH_DbgPrint(MID_TRACE,("Got Key %x\n", ValueKey)); + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s has size %d\n", Value, SubOutLen)); + + if( !(SubOut = (CHAR*) malloc(SubOutLen)) ) + goto regerror; + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s is %s\n", Value, SubOut)); + + goto cleanup; + +regerror: + if( SubOut ) { free( SubOut ); SubOut = NULL; } +cleanup: + if( ValueKey && ValueKey != Root ) { + DH_DbgPrint(MID_TRACE,("Closing key %x\n", ValueKey)); + RegCloseKey( ValueKey ); + } + + DH_DbgPrint(MID_TRACE,("Returning %x with error %d\n", SubOut, Error)); + + return SubOut; +} + +HKEY FindAdapterKey( PDHCP_ADAPTER Adapter ) { + int i = 0; + PCHAR EnumKeyName = + "SYSTEM\\CurrentControlSet\\Control\\Class\\" + "{4D36E972-E325-11CE-BFC1-08002BE10318}"; + PCHAR TargetKeyNameStart = + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; + PCHAR TargetKeyName = NULL; + PCHAR *EnumKeysLinkage = GetSubkeyNames( EnumKeyName, "\\Linkage" ); + PCHAR *EnumKeysTop = GetSubkeyNames( EnumKeyName, "" ); + PCHAR RootDevice = NULL; + HKEY EnumKey, OutKey = NULL; + DWORD Error = ERROR_SUCCESS; + + if( !EnumKeysLinkage || !EnumKeysTop ) goto cleanup; + + Error = RegOpenKey( HKEY_LOCAL_MACHINE, EnumKeyName, &EnumKey ); + + if( Error ) goto cleanup; + + for( i = 0; EnumKeysLinkage[i]; i++ ) { + RootDevice = RegReadString + ( EnumKey, EnumKeysLinkage[i], "RootDevice" ); + + if( RootDevice && + !strcmp( RootDevice, Adapter->DhclientInfo.name ) ) { + TargetKeyName = + (CHAR*) malloc( strlen( TargetKeyNameStart ) + + strlen( RootDevice ) + 1); + if( !TargetKeyName ) goto cleanup; + sprintf( TargetKeyName, "%s%s", + TargetKeyNameStart, RootDevice ); + Error = RegCreateKeyExA( HKEY_LOCAL_MACHINE, TargetKeyName, 0, NULL, 0, KEY_READ, NULL, &OutKey, NULL ); + break; + } else { + free( RootDevice ); RootDevice = 0; + } + } + +cleanup: + if( RootDevice ) free( RootDevice ); + if( EnumKeysLinkage ) free( EnumKeysLinkage ); + if( EnumKeysTop ) free( EnumKeysTop ); + if( TargetKeyName ) free( TargetKeyName ); + + return OutKey; +} + +BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) { + HKEY AdapterKey = NULL; + PCHAR IPAddress = NULL, Netmask = NULL, DefaultGateway = NULL; + NTSTATUS Status = STATUS_SUCCESS; + DWORD Error = ERROR_SUCCESS; + + Adapter->DhclientState.config = &Adapter->DhclientConfig; + strncpy(Adapter->DhclientInfo.name, (char*)Adapter->IfMib.bDescr, + sizeof(Adapter->DhclientInfo.name)); + + AdapterKey = FindAdapterKey( Adapter ); + if( AdapterKey ) + IPAddress = RegReadString( AdapterKey, NULL, "IPAddress" ); + + if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) { + /* Non-automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus, + IPAddress)); + + Adapter->DhclientState.state = S_STATIC; + + Netmask = RegReadString( AdapterKey, NULL, "Subnetmask" ); + + Status = AddIPAddress( inet_addr( IPAddress ), + inet_addr( Netmask ? Netmask : "255.255.255.0" ), + Adapter->IfMib.dwIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + + DefaultGateway = RegReadString( AdapterKey, NULL, "DefaultGateway" ); + + if( DefaultGateway ) { + Adapter->RouterMib.dwForwardDest = 0; + Adapter->RouterMib.dwForwardMask = 0; + Adapter->RouterMib.dwForwardMetric1 = 1; + Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; + Adapter->RouterMib.dwForwardNextHop = inet_addr(DefaultGateway); + Error = CreateIpForwardEntry( &Adapter->RouterMib ); + if( Error ) + warning("Failed to set default gateway %s: %ld\n", + DefaultGateway, Error); + } + + if( DefaultGateway ) free( DefaultGateway ); + if( Netmask ) free( Netmask ); + } else { + /* Automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (dynamic)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus)); + + Adapter->DhclientInfo.client->state = S_INIT; + } + + if( IPAddress ) free( IPAddress ); + + return TRUE; +} + +void AdapterInit() { + WSAStartup(0x0101,&wsd); + + InitializeListHead( &AdapterList ); +} + +int +InterfaceConnected(MIB_IFROW IfEntry) +{ + if (IfEntry.dwOperStatus == IF_OPER_STATUS_CONNECTED || + IfEntry.dwOperStatus == IF_OPER_STATUS_OPERATIONAL) + return 1; + + DH_DbgPrint(MID_TRACE,("Interface %d is down\n", IfEntry.dwIndex)); + return 0; +} + +/* + * XXX Figure out the way to bind a specific adapter to a socket. + */ +BOOLEAN AdapterDiscover() { + PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE)); + DWORD Error, Size = sizeof(MIB_IFTABLE); + PDHCP_ADAPTER Adapter = NULL; + struct interface_info *ifi = NULL; + int i; + BOOLEAN ret = TRUE; + + DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n")); + + while( (Error = GetIfTable(Table, &Size, 0 )) == + ERROR_INSUFFICIENT_BUFFER ) { + DH_DbgPrint(MID_TRACE,("Error %d, New Buffer Size: %d\n", Error, Size)); + free( Table ); + Table = (PMIB_IFTABLE) malloc( Size ); + } + + if( Error != NO_ERROR ) { + ret = FALSE; + goto term; + } + + DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries)); + + for( i = Table->dwNumEntries - 1; i >= 0; i-- ) { + DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n", + Table->table[i].dwIndex)); + + if ((Adapter = AdapterFindByHardwareAddress(Table->table[i].bPhysAddr, Table->table[i].dwPhysAddrLen))) + { + /* This is an existing adapter */ + if (InterfaceConnected(Table->table[i])) { + /* We're still active so we stay in the list */ + ifi = &Adapter->DhclientInfo; + } else { + /* We've lost our link so out we go */ + RemoveEntryList(&Adapter->ListEntry); + free(Adapter); + } + + continue; + } + + Adapter = (DHCP_ADAPTER*) calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 ); + + if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET && InterfaceConnected(Table->table[i])) { + memcpy( &Adapter->IfMib, &Table->table[i], + sizeof(Adapter->IfMib) ); + Adapter->DhclientInfo.client = &Adapter->DhclientState; + Adapter->DhclientInfo.rbuf = Adapter->recv_buf; + Adapter->DhclientInfo.rbuf_max = Table->table[i].dwMtu; + Adapter->DhclientInfo.rbuf_len = + Adapter->DhclientInfo.rbuf_offset = 0; + memcpy(Adapter->DhclientInfo.hw_address.haddr, + Adapter->IfMib.bPhysAddr, + Adapter->IfMib.dwPhysAddrLen); + Adapter->DhclientInfo.hw_address.hlen = + Adapter->IfMib.dwPhysAddrLen; + /* I'm not sure where else to set this, but + some DHCP servers won't take a zero. + We checked the hardware type earlier in + the if statement. */ + Adapter->DhclientInfo.hw_address.htype = + HTYPE_ETHER; + + if( DhcpSocket == INVALID_SOCKET ) { + DhcpSocket = + Adapter->DhclientInfo.rfdesc = + Adapter->DhclientInfo.wfdesc = + socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); + + if (DhcpSocket != INVALID_SOCKET) { + Adapter->ListenAddr.sin_family = AF_INET; + Adapter->ListenAddr.sin_port = htons(LOCAL_PORT); + Adapter->BindStatus = + (bind( Adapter->DhclientInfo.rfdesc, + (struct sockaddr *)&Adapter->ListenAddr, + sizeof(Adapter->ListenAddr) ) == 0) ? + 0 : WSAGetLastError(); + } else { + error("socket() failed: %d\n", WSAGetLastError()); + } + } else { + Adapter->DhclientInfo.rfdesc = + Adapter->DhclientInfo.wfdesc = DhcpSocket; + } + + Adapter->DhclientConfig.timeout = DHCP_PANIC_TIMEOUT; + Adapter->DhclientConfig.initial_interval = DHCP_DISCOVER_INTERVAL; + Adapter->DhclientConfig.retry_interval = DHCP_DISCOVER_INTERVAL; + Adapter->DhclientConfig.select_interval = 1; + Adapter->DhclientConfig.reboot_timeout = DHCP_REBOOT_TIMEOUT; + Adapter->DhclientConfig.backoff_cutoff = DHCP_BACKOFF_MAX; + Adapter->DhclientState.interval = + Adapter->DhclientConfig.retry_interval; + + if( PrepareAdapterForService( Adapter ) ) { + Adapter->DhclientInfo.next = ifi; + ifi = &Adapter->DhclientInfo; + + read_client_conf(&Adapter->DhclientInfo); + + if (Adapter->DhclientInfo.client->state == S_INIT) + { + add_protocol(Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, + got_one, &Adapter->DhclientInfo); + + state_init(&Adapter->DhclientInfo); + } + + InsertTailList( &AdapterList, &Adapter->ListEntry ); + } else { free( Adapter ); Adapter = 0; } + } else { free( Adapter ); Adapter = 0; } + + if( !Adapter ) + DH_DbgPrint(MID_TRACE,("Adapter %d was rejected\n", + Table->table[i].dwIndex)); + } + + DH_DbgPrint(MID_TRACE,("done with AdapterInit\n")); + +term: + if( Table ) free( Table ); + return ret; +} + +void AdapterStop() { + PLIST_ENTRY ListEntry; + PDHCP_ADAPTER Adapter; + while( !IsListEmpty( &AdapterList ) ) { + ListEntry = (PLIST_ENTRY)RemoveHeadList( &AdapterList ); + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + free( Adapter ); + } + WSACleanup(); +} + +PDHCP_ADAPTER AdapterFindIndex( unsigned int indx ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for( ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink ) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if( Adapter->IfMib.dwIndex == indx ) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterFindName( const WCHAR *name ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for( ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink ) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if( !wcsicmp( Adapter->IfMib.wszName, name ) ) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterFindInfo( struct interface_info *ip ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for( ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink ) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if( ip == &Adapter->DhclientInfo ) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for(ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if (Adapter->DhclientInfo.hw_address.hlen == hlen && + !memcmp(Adapter->DhclientInfo.hw_address.haddr, + haddr, + hlen)) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterGetFirst() { + if( IsListEmpty( &AdapterList ) ) return NULL; else { + return CONTAINING_RECORD + ( AdapterList.Flink, DHCP_ADAPTER, ListEntry ); + } +} + +PDHCP_ADAPTER AdapterGetNext( PDHCP_ADAPTER This ) +{ + if( This->ListEntry.Flink == &AdapterList ) return NULL; + return CONTAINING_RECORD + ( This->ListEntry.Flink, DHCP_ADAPTER, ListEntry ); +} + +void if_register_send(struct interface_info *ip) { + +} + +void if_register_receive(struct interface_info *ip) { +} diff --git a/reactos/dll/win32/dhcpcsvc/alloc.c b/reactos/dll/win32/dhcpcsvc/alloc.c new file mode 100644 index 00000000000..97027fa4445 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/alloc.c @@ -0,0 +1,93 @@ +/* $OpenBSD: alloc.c,v 1.9 2004/05/04 20:28:40 deraadt Exp $ */ + +/* Memory allocation... */ + +/* + * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#include "rosdhcp.h" +#include "dhcpd.h" + +struct string_list * +new_string_list(size_t size) +{ + struct string_list *rval; + + rval = calloc(1, sizeof(struct string_list) + size); + if (rval != NULL) + rval->string = ((char *)rval) + sizeof(struct string_list); + return (rval); +} + +struct hash_table * +new_hash_table(int count) +{ + struct hash_table *rval; + + rval = calloc(1, sizeof(struct hash_table) - + (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *)) + + (count * sizeof(struct hash_bucket *))); + if (rval == NULL) + return (NULL); + rval->hash_count = count; + return (rval); +} + +struct hash_bucket * +new_hash_bucket(void) +{ + struct hash_bucket *rval = calloc(1, sizeof(struct hash_bucket)); + + return (rval); +} + +void +dfree(void *ptr, char *name) +{ + if (!ptr) { + warning("dfree %s: free on null pointer.", name); + return; + } + free(ptr); +} + +void +free_hash_bucket(struct hash_bucket *ptr, char *name) +{ + dfree(ptr, name); +} diff --git a/reactos/dll/win32/dhcpcsvc/api.c b/reactos/dll/win32/dhcpcsvc/api.c new file mode 100644 index 00000000000..efa07a80a54 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/api.c @@ -0,0 +1,201 @@ +/* $Id: $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: subsys/system/dhcp/api.c + * PURPOSE: DHCP client api handlers + * PROGRAMMER: arty + */ + +#include "rosdhcp.h" +#include +#include + +#define NDEBUG +#include + +static CRITICAL_SECTION ApiCriticalSection; + +VOID ApiInit() { + InitializeCriticalSection( &ApiCriticalSection ); +} + +VOID ApiLock() { + EnterCriticalSection( &ApiCriticalSection ); +} + +VOID ApiUnlock() { + LeaveCriticalSection( &ApiCriticalSection ); +} + +VOID ApiFree() { + DeleteCriticalSection( &ApiCriticalSection ); +} + +/* This represents the service portion of the DHCP client API */ + +DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + add_protocol( Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, got_one, + &Adapter->DhclientInfo ); + Adapter->DhclientInfo.client->state = S_INIT; + state_reboot(&Adapter->DhclientInfo); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if (Adapter) { + Reply.QueryHWInfo.AdapterIndex = Req->AdapterIndex; + Reply.QueryHWInfo.MediaType = Adapter->IfMib.dwType; + Reply.QueryHWInfo.Mtu = Adapter->IfMib.dwMtu; + Reply.QueryHWInfo.Speed = Adapter->IfMib.dwSpeed; + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + struct protocol* proto; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + if (Adapter->NteContext) + DeleteIPAddress( Adapter->NteContext ); + + proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); + if (proto) + remove_protocol(proto); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + if( !Adapter || Adapter->DhclientState.state == S_STATIC ) { + Reply.Reply = 0; + ApiUnlock(); + return Send( &Reply ); + } + + Reply.Reply = 1; + + add_protocol( Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, got_one, + &Adapter->DhclientInfo ); + Adapter->DhclientInfo.client->state = S_INIT; + state_reboot(&Adapter->DhclientInfo); + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + NTSTATUS Status; + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + struct protocol* proto; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + if (Adapter->NteContext) + DeleteIPAddress( Adapter->NteContext ); + Adapter->DhclientState.state = S_STATIC; + proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); + if (proto) + remove_protocol(proto); + Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress, + Req->Body.StaticRefreshParams.Netmask, + Req->AdapterIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + Reply.Reply = NT_SUCCESS(Status); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + Reply.GetAdapterInfo.DhcpEnabled = (S_STATIC != Adapter->DhclientState.state); + if (S_BOUND == Adapter->DhclientState.state) { + if (sizeof(Reply.GetAdapterInfo.DhcpServer) == + Adapter->DhclientState.active->serveraddress.len) { + memcpy(&Reply.GetAdapterInfo.DhcpServer, + Adapter->DhclientState.active->serveraddress.iabuf, + Adapter->DhclientState.active->serveraddress.len); + } else { + DPRINT1("Unexpected server address len %d\n", + Adapter->DhclientState.active->serveraddress.len); + Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); + } + Reply.GetAdapterInfo.LeaseObtained = Adapter->DhclientState.active->obtained; + Reply.GetAdapterInfo.LeaseExpires = Adapter->DhclientState.active->expiry; + } else { + Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); + Reply.GetAdapterInfo.LeaseObtained = 0; + Reply.GetAdapterInfo.LeaseExpires = 0; + } + } + + ApiUnlock(); + + return Send( &Reply ); +} diff --git a/reactos/dll/win32/dhcpcsvc/compat.c b/reactos/dll/win32/dhcpcsvc/compat.c new file mode 100644 index 00000000000..83c9c12ea8c --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/compat.c @@ -0,0 +1,67 @@ +#include "rosdhcp.h" +#include "dhcpd.h" +#include "stdint.h" + +size_t strlcpy(char *d, const char *s, size_t bufsize) +{ + size_t len = strlen(s); + size_t ret = len; + if (bufsize > 0) { + if (len >= bufsize) + len = bufsize-1; + memcpy(d, s, len); + d[len] = 0; + } + return ret; +} + +// not really random :( +u_int32_t arc4random() +{ + static int did_srand = 0; + u_int32_t ret; + + if (!did_srand) { + srand(0); + did_srand = 1; + } + + ret = rand() << 10 ^ rand(); + return ret; +} + + +int inet_aton(const char *cp, struct in_addr *inp) +/* inet_addr code from ROS, slightly modified. */ +{ + ULONG Octets[4] = {0,0,0,0}; + ULONG i = 0; + + if(!cp) + return 0; + + while(*cp) + { + CHAR c = *cp; + cp++; + + if(c == '.') + { + i++; + continue; + } + + if(c < '0' || c > '9') + return 0; + + Octets[i] *= 10; + Octets[i] += (c - '0'); + + if(Octets[i] > 255) + return 0; + } + + inp->S_un.S_addr = (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0]; + return 1; +} + diff --git a/reactos/dll/win32/dhcpcsvc/dhclient.c b/reactos/dll/win32/dhcpcsvc/dhclient.c new file mode 100644 index 00000000000..a27c7b667ad --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/dhclient.c @@ -0,0 +1,1996 @@ +/* $OpenBSD: dhclient.c,v 1.62 2004/12/05 18:35:51 deraadt Exp $ */ + +/* + * Copyright 2004 Henning Brauer + * Copyright (c) 1995, 1996, 1997, 1998, 1999 + * The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + * + * This client was substantially modified and enhanced by Elliot Poger + * for use on Linux while he was working on the MosquitoNet project at + * Stanford. + * + * The current version owes much to Elliot's Linux enhancements, but + * was substantially reorganized and partially rewritten by Ted Lemon + * so as to use the same networking framework that the Internet Software + * Consortium DHCP server uses. Much system-specific configuration code + * was moved into a shell script so that as support for more operating + * systems is added, it will not be necessary to port and maintain + * system-specific configuration code to these operating systems - instead, + * the shell script can invoke the native tools to accomplish the same + * purpose. + */ + +#include "rosdhcp.h" +#include "dhcpd.h" + +#define PERIOD 0x2e +#define hyphenchar(c) ((c) == 0x2d) +#define bslashchar(c) ((c) == 0x5c) +#define periodchar(c) ((c) == PERIOD) +#define asterchar(c) ((c) == 0x2a) +#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) || \ + ((c) >= 0x61 && (c) <= 0x7a)) +#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) + +#define borderchar(c) (alphachar(c) || digitchar(c)) +#define middlechar(c) (borderchar(c) || hyphenchar(c)) +#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) + +unsigned long debug_trace_level = 0; /* DEBUG_ULTRA */ + +char *path_dhclient_conf = _PATH_DHCLIENT_CONF; +char *path_dhclient_db = NULL; + +int log_perror = 1; +int privfd; +//int nullfd = -1; + +struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; +struct in_addr inaddr_any; +struct sockaddr_in sockaddr_broadcast; + +/* + * ASSERT_STATE() does nothing now; it used to be + * assert (state_is == state_shouldbe). + */ +#define ASSERT_STATE(state_is, state_shouldbe) {} + +#define TIME_MAX 2147483647 + +int log_priority; +int no_daemon; +int unknown_ok = 1; +int routefd; + +void usage(void); +int check_option(struct client_lease *l, int option); +int ipv4addrs(char * buf); +int res_hnok(const char *dn); +char *option_as_string(unsigned int code, unsigned char *data, int len); +int fork_privchld(int, int); +int check_arp( struct interface_info *ip, struct client_lease *lp ); + +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) + +time_t scripttime; + +static WCHAR ServiceName[] = L"DHCP"; + +SERVICE_STATUS_HANDLE ServiceStatusHandle = 0; +SERVICE_STATUS ServiceStatus; + + +/* XXX Implement me */ +int check_arp( struct interface_info *ip, struct client_lease *lp ) { + return 1; +} + + +static VOID +UpdateServiceStatus(DWORD dwState) +{ + ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + ServiceStatus.dwCurrentState = dwState; + + ServiceStatus.dwControlsAccepted = 0; + + ServiceStatus.dwWin32ExitCode = 0; + ServiceStatus.dwServiceSpecificExitCode = 0; + ServiceStatus.dwCheckPoint = 0; + + if (dwState == SERVICE_START_PENDING || + dwState == SERVICE_STOP_PENDING || + dwState == SERVICE_PAUSE_PENDING || + dwState == SERVICE_CONTINUE_PENDING) + ServiceStatus.dwWaitHint = 10000; + else + ServiceStatus.dwWaitHint = 0; + + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); +} + + +static DWORD WINAPI +ServiceControlHandler(DWORD dwControl, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext) +{ + switch (dwControl) + { + case SERVICE_CONTROL_STOP: + UpdateServiceStatus(SERVICE_STOP_PENDING); + UpdateServiceStatus(SERVICE_STOPPED); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_PAUSE: + UpdateServiceStatus(SERVICE_PAUSED); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_CONTINUE: + UpdateServiceStatus(SERVICE_START_PENDING); + UpdateServiceStatus(SERVICE_RUNNING); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_INTERROGATE: + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_SHUTDOWN: + UpdateServiceStatus(SERVICE_STOP_PENDING); + UpdateServiceStatus(SERVICE_STOPPED); + return ERROR_SUCCESS; + + default : + return ERROR_CALL_NOT_IMPLEMENTED; + } +} + + +VOID NTAPI +ServiceMain(DWORD argc, LPWSTR *argv) +{ + ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, + ServiceControlHandler, + NULL); + if (!ServiceStatusHandle) + { + DbgPrint("DHCPCSVC: Unable to register service control handler (%x)\n", GetLastError); + return; + } + + UpdateServiceStatus(SERVICE_START_PENDING); + + ApiInit(); + AdapterInit(); + + tzset(); + + memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); + sockaddr_broadcast.sin_family = AF_INET; + sockaddr_broadcast.sin_port = htons(REMOTE_PORT); + sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; + inaddr_any.s_addr = INADDR_ANY; + bootp_packet_handler = do_packet; + + if (PipeInit() == INVALID_HANDLE_VALUE) + { + DbgPrint("DHCPCSVC: PipeInit() failed!\n"); + AdapterStop(); + ApiFree(); + UpdateServiceStatus(SERVICE_STOPPED); + } + + DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); + + UpdateServiceStatus(SERVICE_RUNNING); + + DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); + + DbgPrint("DHCPCSVC: DHCP service is starting up\n"); + + dispatch(); + + DbgPrint("DHCPCSVC: DHCP service is shutting down\n"); + + //AdapterStop(); + //ApiFree(); + /* FIXME: Close pipe and kill pipe thread */ + + UpdateServiceStatus(SERVICE_STOPPED); +} + +/* + * Individual States: + * + * Each routine is called from the dhclient_state_machine() in one of + * these conditions: + * -> entering INIT state + * -> recvpacket_flag == 0: timeout in this state + * -> otherwise: received a packet in this state + * + * Return conditions as handled by dhclient_state_machine(): + * Returns 1, sendpacket_flag = 1: send packet, reset timer. + * Returns 1, sendpacket_flag = 0: just reset the timer (wait for a milestone). + * Returns 0: finish the nap which was interrupted for no good reason. + * + * Several per-interface variables are used to keep track of the process: + * active_lease: the lease that is being used on the interface + * (null pointer if not configured yet). + * offered_leases: leases corresponding to DHCPOFFER messages that have + * been sent to us by DHCP servers. + * acked_leases: leases corresponding to DHCPACK messages that have been + * sent to us by DHCP servers. + * sendpacket: DHCP packet we're trying to send. + * destination: IP address to send sendpacket to + * In addition, there are several relevant per-lease variables. + * T1_expiry, T2_expiry, lease_expiry: lease milestones + * In the active lease, these control the process of renewing the lease; + * In leases on the acked_leases list, this simply determines when we + * can no longer legitimately use the lease. + */ + +void +state_reboot(void *ipp) +{ + struct interface_info *ip = ipp; + ULONG foo = (ULONG) GetTickCount(); + + /* If we don't remember an active lease, go straight to INIT. */ + if (!ip->client->active || ip->client->active->is_bootp) { + state_init(ip); + return; + } + + /* We are in the rebooting state. */ + ip->client->state = S_REBOOTING; + + /* make_request doesn't initialize xid because it normally comes + from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER, + so pick an xid now. */ + ip->client->xid = RtlRandom(&foo); + + /* Make a DHCPREQUEST packet, and set appropriate per-interface + flags. */ + make_request(ip, ip->client->active); + ip->client->destination = iaddr_broadcast; + time(&ip->client->first_sending); + ip->client->interval = ip->client->config->initial_interval; + + /* Zap the medium list... */ + ip->client->medium = NULL; + + /* Send out the first DHCPREQUEST packet. */ + send_request(ip); +} + +/* + * Called when a lease has completely expired and we've + * been unable to renew it. + */ +void +state_init(void *ipp) +{ + struct interface_info *ip = ipp; + + ASSERT_STATE(state, S_INIT); + + /* Make a DHCPDISCOVER packet, and set appropriate per-interface + flags. */ + make_discover(ip, ip->client->active); + ip->client->xid = ip->client->packet.xid; + ip->client->destination = iaddr_broadcast; + ip->client->state = S_SELECTING; + time(&ip->client->first_sending); + ip->client->interval = ip->client->config->initial_interval; + + /* Add an immediate timeout to cause the first DHCPDISCOVER packet + to go out. */ + send_discover(ip); +} + +/* + * state_selecting is called when one or more DHCPOFFER packets + * have been received and a configurable period of time has passed. + */ +void +state_selecting(void *ipp) +{ + struct interface_info *ip = ipp; + struct client_lease *lp, *next, *picked; + time_t cur_time; + + ASSERT_STATE(state, S_SELECTING); + + time(&cur_time); + + /* Cancel state_selecting and send_discover timeouts, since either + one could have got us here. */ + cancel_timeout(state_selecting, ip); + cancel_timeout(send_discover, ip); + + /* We have received one or more DHCPOFFER packets. Currently, + the only criterion by which we judge leases is whether or + not we get a response when we arp for them. */ + picked = NULL; + for (lp = ip->client->offered_leases; lp; lp = next) { + next = lp->next; + + /* Check to see if we got an ARPREPLY for the address + in this particular lease. */ + if (!picked) { + if( !check_arp(ip,lp) ) goto freeit; + picked = lp; + picked->next = NULL; + } else { +freeit: + free_client_lease(lp); + } + } + ip->client->offered_leases = NULL; + + /* If we just tossed all the leases we were offered, go back + to square one. */ + if (!picked) { + ip->client->state = S_INIT; + state_init(ip); + return; + } + + /* If it was a BOOTREPLY, we can just take the address right now. */ + if (!picked->options[DHO_DHCP_MESSAGE_TYPE].len) { + ip->client->new = picked; + + /* Make up some lease expiry times + XXX these should be configurable. */ + ip->client->new->expiry = cur_time + 12000; + ip->client->new->renewal += cur_time + 8000; + ip->client->new->rebind += cur_time + 10000; + + ip->client->state = S_REQUESTING; + + /* Bind to the address we received. */ + bind_lease(ip); + return; + } + + /* Go to the REQUESTING state. */ + ip->client->destination = iaddr_broadcast; + ip->client->state = S_REQUESTING; + ip->client->first_sending = cur_time; + ip->client->interval = ip->client->config->initial_interval; + + /* Make a DHCPREQUEST packet from the lease we picked. */ + make_request(ip, picked); + ip->client->xid = ip->client->packet.xid; + + /* Toss the lease we picked - we'll get it back in a DHCPACK. */ + free_client_lease(picked); + + /* Add an immediate timeout to send the first DHCPREQUEST packet. */ + send_request(ip); +} + +/* state_requesting is called when we receive a DHCPACK message after + having sent out one or more DHCPREQUEST packets. */ + +void +dhcpack(struct packet *packet) +{ + struct interface_info *ip = packet->interface; + struct client_lease *lease; + time_t cur_time; + + time(&cur_time); + + /* If we're not receptive to an offer right now, or if the offer + has an unrecognizable transaction id, then just drop it. */ + if (packet->interface->client->xid != packet->raw->xid || + (packet->interface->hw_address.hlen != packet->raw->hlen) || + (memcmp(packet->interface->hw_address.haddr, + packet->raw->chaddr, packet->raw->hlen))) + return; + + if (ip->client->state != S_REBOOTING && + ip->client->state != S_REQUESTING && + ip->client->state != S_RENEWING && + ip->client->state != S_REBINDING) + return; + + note("DHCPACK from %s", piaddr(packet->client_addr)); + + lease = packet_to_lease(packet); + if (!lease) { + note("packet_to_lease failed."); + return; + } + + ip->client->new = lease; + + /* Stop resending DHCPREQUEST. */ + cancel_timeout(send_request, ip); + + /* Figure out the lease time. */ + if (ip->client->new->options[DHO_DHCP_LEASE_TIME].data) + ip->client->new->expiry = getULong( + ip->client->new->options[DHO_DHCP_LEASE_TIME].data); + else + ip->client->new->expiry = DHCP_DEFAULT_LEASE_TIME; + /* A number that looks negative here is really just very large, + because the lease expiry offset is unsigned. */ + if (ip->client->new->expiry < 0) + ip->client->new->expiry = TIME_MAX; + /* XXX should be fixed by resetting the client state */ + if (ip->client->new->expiry < 60) + ip->client->new->expiry = 60; + + /* Take the server-provided renewal time if there is one; + otherwise figure it out according to the spec. */ + if (ip->client->new->options[DHO_DHCP_RENEWAL_TIME].len) + ip->client->new->renewal = getULong( + ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data); + else + ip->client->new->renewal = ip->client->new->expiry / 2; + + /* Same deal with the rebind time. */ + if (ip->client->new->options[DHO_DHCP_REBINDING_TIME].len) + ip->client->new->rebind = getULong( + ip->client->new->options[DHO_DHCP_REBINDING_TIME].data); + else + ip->client->new->rebind = ip->client->new->renewal + + ip->client->new->renewal / 2 + ip->client->new->renewal / 4; + +#ifdef __REACTOS__ + ip->client->new->obtained = cur_time; +#endif + ip->client->new->expiry += cur_time; + /* Lease lengths can never be negative. */ + if (ip->client->new->expiry < cur_time) + ip->client->new->expiry = TIME_MAX; + ip->client->new->renewal += cur_time; + if (ip->client->new->renewal < cur_time) + ip->client->new->renewal = TIME_MAX; + ip->client->new->rebind += cur_time; + if (ip->client->new->rebind < cur_time) + ip->client->new->rebind = TIME_MAX; + + bind_lease(ip); +} + +void set_name_servers( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { + CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; + HKEY RegKey; + + strcat(Buffer, Adapter->DhclientInfo.name); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &RegKey ) != ERROR_SUCCESS) + return; + + + if( new_lease->options[DHO_DOMAIN_NAME_SERVERS].len ) { + + struct iaddr nameserver; + char *nsbuf; + int i, addrs = + new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG); + + nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) ); + + if( nsbuf) { + nsbuf[0] = 0; + for( i = 0; i < addrs; i++ ) { + nameserver.len = sizeof(ULONG); + memcpy( nameserver.iabuf, + new_lease->options[DHO_DOMAIN_NAME_SERVERS].data + + (i * sizeof(ULONG)), sizeof(ULONG) ); + strcat( nsbuf, piaddr(nameserver) ); + if( i != addrs-1 ) strcat( nsbuf, "," ); + } + + DH_DbgPrint(MID_TRACE,("Setting DhcpNameserver: %s\n", nsbuf)); + + RegSetValueExA( RegKey, "DhcpNameServer", 0, REG_SZ, + (LPBYTE)nsbuf, strlen(nsbuf) + 1 ); + free( nsbuf ); + } + + } else { + RegDeleteValueW( RegKey, L"DhcpNameServer" ); + } + + RegCloseKey( RegKey ); + +} + +void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { + CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; + struct iaddr netmask; + HKEY hkey; + int i; + DWORD dwEnableDHCP; + + strcat(Buffer, Adapter->DhclientInfo.name); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &hkey) != ERROR_SUCCESS) + hkey = NULL; + + + if( Adapter->NteContext ) + DeleteIPAddress( Adapter->NteContext ); + + /* Set up our default router if we got one from the DHCP server */ + if( new_lease->options[DHO_SUBNET_MASK].len ) { + NTSTATUS Status; + + memcpy( netmask.iabuf, + new_lease->options[DHO_SUBNET_MASK].data, + new_lease->options[DHO_SUBNET_MASK].len ); + Status = AddIPAddress + ( *((ULONG*)new_lease->address.iabuf), + *((ULONG*)netmask.iabuf), + Adapter->IfMib.dwIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + if (hkey) { + RegSetValueExA(hkey, "DhcpIPAddress", 0, REG_SZ, (LPBYTE)piaddr(new_lease->address), strlen(piaddr(new_lease->address))+1); + Buffer[0] = '\0'; + for(i = 0; i < new_lease->options[DHO_SUBNET_MASK].len; i++) + { + sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_SUBNET_MASK].data[i]); + if (i + 1 < new_lease->options[DHO_SUBNET_MASK].len) + strcat(Buffer, "."); + } + RegSetValueExA(hkey, "DhcpSubnetMask", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); + RegSetValueExA(hkey, "IPAddress", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); + RegSetValueExA(hkey, "SubnetMask", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); + dwEnableDHCP = 1; + RegSetValueExA(hkey, "EnableDHCP", 0, REG_DWORD, (LPBYTE)&dwEnableDHCP, sizeof(DWORD)); + } + + if( !NT_SUCCESS(Status) ) + warning("AddIPAddress: %lx\n", Status); + } + + if( new_lease->options[DHO_ROUTERS].len ) { + NTSTATUS Status; + + Adapter->RouterMib.dwForwardDest = 0; /* Default route */ + Adapter->RouterMib.dwForwardMask = 0; + Adapter->RouterMib.dwForwardMetric1 = 1; + Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; + + if( Adapter->RouterMib.dwForwardNextHop ) { + /* If we set a default route before, delete it before continuing */ + DeleteIpForwardEntry( &Adapter->RouterMib ); + } + + Adapter->RouterMib.dwForwardNextHop = + *((ULONG*)new_lease->options[DHO_ROUTERS].data); + + Status = CreateIpForwardEntry( &Adapter->RouterMib ); + + if( !NT_SUCCESS(Status) ) + warning("CreateIpForwardEntry: %lx\n", Status); + + if (hkey) { + Buffer[0] = '\0'; + for(i = 0; i < new_lease->options[DHO_ROUTERS].len; i++) + { + sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_ROUTERS].data[i]); + if (i + 1 < new_lease->options[DHO_ROUTERS].len) + strcat(Buffer, "."); + } + RegSetValueExA(hkey, "DhcpDefaultGateway", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); + RegSetValueExA(hkey, "DefaultGateway", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); + } + } + + if (hkey) + RegCloseKey(hkey); +} + + +void +bind_lease(struct interface_info *ip) +{ + PDHCP_ADAPTER Adapter; + struct client_lease *new_lease = ip->client->new; + time_t cur_time; + + time(&cur_time); + + /* Remember the medium. */ + ip->client->new->medium = ip->client->medium; + ip->client->active = ip->client->new; + ip->client->new = NULL; + + /* Set up a timeout to start the renewal process. */ + /* Timeout of zero means no timeout (some implementations seem to use + * one day). + */ + if( ip->client->active->renewal - cur_time ) + add_timeout(ip->client->active->renewal, state_bound, ip); + + note("bound to %s -- renewal in %ld seconds.", + piaddr(ip->client->active->address), + (long int)(ip->client->active->renewal - cur_time)); + + ip->client->state = S_BOUND; + + Adapter = AdapterFindInfo( ip ); + + if( Adapter ) setup_adapter( Adapter, new_lease ); + else { + warning("Could not find adapter for info %p\n", ip); + return; + } + set_name_servers( Adapter, new_lease ); +} + +/* + * state_bound is called when we've successfully bound to a particular + * lease, but the renewal time on that lease has expired. We are + * expected to unicast a DHCPREQUEST to the server that gave us our + * original lease. + */ +void +state_bound(void *ipp) +{ + struct interface_info *ip = ipp; + + ASSERT_STATE(state, S_BOUND); + + /* T1 has expired. */ + make_request(ip, ip->client->active); + ip->client->xid = ip->client->packet.xid; + + if (ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) { + memcpy(ip->client->destination.iabuf, ip->client->active-> + options[DHO_DHCP_SERVER_IDENTIFIER].data, 4); + ip->client->destination.len = 4; + } else + ip->client->destination = iaddr_broadcast; + + time(&ip->client->first_sending); + ip->client->interval = ip->client->config->initial_interval; + ip->client->state = S_RENEWING; + + /* Send the first packet immediately. */ + send_request(ip); +} + +void +bootp(struct packet *packet) +{ + struct iaddrlist *ap; + + if (packet->raw->op != BOOTREPLY) + return; + + /* If there's a reject list, make sure this packet's sender isn't + on it. */ + for (ap = packet->interface->client->config->reject_list; + ap; ap = ap->next) { + if (addr_eq(packet->client_addr, ap->addr)) { + note("BOOTREPLY from %s rejected.", piaddr(ap->addr)); + return; + } + } + dhcpoffer(packet); +} + +void +dhcp(struct packet *packet) +{ + struct iaddrlist *ap; + void (*handler)(struct packet *); + char *type; + + switch (packet->packet_type) { + case DHCPOFFER: + handler = dhcpoffer; + type = "DHCPOFFER"; + break; + case DHCPNAK: + handler = dhcpnak; + type = "DHCPNACK"; + break; + case DHCPACK: + handler = dhcpack; + type = "DHCPACK"; + break; + default: + return; + } + + /* If there's a reject list, make sure this packet's sender isn't + on it. */ + for (ap = packet->interface->client->config->reject_list; + ap; ap = ap->next) { + if (addr_eq(packet->client_addr, ap->addr)) { + note("%s from %s rejected.", type, piaddr(ap->addr)); + return; + } + } + (*handler)(packet); +} + +void +dhcpoffer(struct packet *packet) +{ + struct interface_info *ip = packet->interface; + struct client_lease *lease, *lp; + int i; + int arp_timeout_needed = 0, stop_selecting; + char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? + "DHCPOFFER" : "BOOTREPLY"; + time_t cur_time; + + time(&cur_time); + + /* If we're not receptive to an offer right now, or if the offer + has an unrecognizable transaction id, then just drop it. */ + if (ip->client->state != S_SELECTING || + packet->interface->client->xid != packet->raw->xid || + (packet->interface->hw_address.hlen != packet->raw->hlen) || + (memcmp(packet->interface->hw_address.haddr, + packet->raw->chaddr, packet->raw->hlen))) + return; + + note("%s from %s", name, piaddr(packet->client_addr)); + + + /* If this lease doesn't supply the minimum required parameters, + blow it off. */ + for (i = 0; ip->client->config->required_options[i]; i++) { + if (!packet->options[ip->client->config-> + required_options[i]].len) { + note("%s isn't satisfactory.", name); + return; + } + } + + /* If we've already seen this lease, don't record it again. */ + for (lease = ip->client->offered_leases; + lease; lease = lease->next) { + if (lease->address.len == sizeof(packet->raw->yiaddr) && + !memcmp(lease->address.iabuf, + &packet->raw->yiaddr, lease->address.len)) { + debug("%s already seen.", name); + return; + } + } + + lease = packet_to_lease(packet); + if (!lease) { + note("packet_to_lease failed."); + return; + } + + /* If this lease was acquired through a BOOTREPLY, record that + fact. */ + if (!packet->options[DHO_DHCP_MESSAGE_TYPE].len) + lease->is_bootp = 1; + + /* Record the medium under which this lease was offered. */ + lease->medium = ip->client->medium; + + /* Send out an ARP Request for the offered IP address. */ + if( !check_arp( ip, lease ) ) { + note("Arp check failed\n"); + return; + } + + /* Figure out when we're supposed to stop selecting. */ + stop_selecting = + ip->client->first_sending + ip->client->config->select_interval; + + /* If this is the lease we asked for, put it at the head of the + list, and don't mess with the arp request timeout. */ + if (lease->address.len == ip->client->requested_address.len && + !memcmp(lease->address.iabuf, + ip->client->requested_address.iabuf, + ip->client->requested_address.len)) { + lease->next = ip->client->offered_leases; + ip->client->offered_leases = lease; + } else { + /* If we already have an offer, and arping for this + offer would take us past the selection timeout, + then don't extend the timeout - just hope for the + best. */ + if (ip->client->offered_leases && + (cur_time + arp_timeout_needed) > stop_selecting) + arp_timeout_needed = 0; + + /* Put the lease at the end of the list. */ + lease->next = NULL; + if (!ip->client->offered_leases) + ip->client->offered_leases = lease; + else { + for (lp = ip->client->offered_leases; lp->next; + lp = lp->next) + ; /* nothing */ + lp->next = lease; + } + } + + /* If we're supposed to stop selecting before we've had time + to wait for the ARPREPLY, add some delay to wait for + the ARPREPLY. */ + if (stop_selecting - cur_time < arp_timeout_needed) + stop_selecting = cur_time + arp_timeout_needed; + + /* If the selecting interval has expired, go immediately to + state_selecting(). Otherwise, time out into + state_selecting at the select interval. */ + if (stop_selecting <= 0) + state_selecting(ip); + else { + add_timeout(stop_selecting, state_selecting, ip); + cancel_timeout(send_discover, ip); + } +} + +/* Allocate a client_lease structure and initialize it from the parameters + in the specified packet. */ + +struct client_lease * +packet_to_lease(struct packet *packet) +{ + struct client_lease *lease; + int i; + + lease = malloc(sizeof(struct client_lease)); + + if (!lease) { + warning("dhcpoffer: no memory to record lease."); + return (NULL); + } + + memset(lease, 0, sizeof(*lease)); + + /* Copy the lease options. */ + for (i = 0; i < 256; i++) { + if (packet->options[i].len) { + lease->options[i].data = + malloc(packet->options[i].len + 1); + if (!lease->options[i].data) { + warning("dhcpoffer: no memory for option %d", i); + free_client_lease(lease); + return (NULL); + } else { + memcpy(lease->options[i].data, + packet->options[i].data, + packet->options[i].len); + lease->options[i].len = + packet->options[i].len; + lease->options[i].data[lease->options[i].len] = + 0; + } + if (!check_option(lease,i)) { + /* ignore a bogus lease offer */ + warning("Invalid lease option - ignoring offer"); + free_client_lease(lease); + return (NULL); + } + } + } + + lease->address.len = sizeof(packet->raw->yiaddr); + memcpy(lease->address.iabuf, &packet->raw->yiaddr, lease->address.len); +#ifdef __REACTOS__ + lease->serveraddress.len = sizeof(packet->raw->siaddr); + memcpy(lease->serveraddress.iabuf, &packet->raw->siaddr, lease->address.len); +#endif + + /* If the server name was filled out, copy it. */ + if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || + !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) && + packet->raw->sname[0]) { + lease->server_name = malloc(DHCP_SNAME_LEN + 1); + if (!lease->server_name) { + warning("dhcpoffer: no memory for server name."); + free_client_lease(lease); + return (NULL); + } + memcpy(lease->server_name, packet->raw->sname, DHCP_SNAME_LEN); + lease->server_name[DHCP_SNAME_LEN]='\0'; + if (!res_hnok(lease->server_name) ) { + warning("Bogus server name %s", lease->server_name ); + free_client_lease(lease); + return (NULL); + } + + } + + /* Ditto for the filename. */ + if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || + !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)) && + packet->raw->file[0]) { + /* Don't count on the NUL terminator. */ + lease->filename = malloc(DHCP_FILE_LEN + 1); + if (!lease->filename) { + warning("dhcpoffer: no memory for filename."); + free_client_lease(lease); + return (NULL); + } + memcpy(lease->filename, packet->raw->file, DHCP_FILE_LEN); + lease->filename[DHCP_FILE_LEN]='\0'; + } + return lease; +} + +void +dhcpnak(struct packet *packet) +{ + struct interface_info *ip = packet->interface; + + /* If we're not receptive to an offer right now, or if the offer + has an unrecognizable transaction id, then just drop it. */ + if (packet->interface->client->xid != packet->raw->xid || + (packet->interface->hw_address.hlen != packet->raw->hlen) || + (memcmp(packet->interface->hw_address.haddr, + packet->raw->chaddr, packet->raw->hlen))) + return; + + if (ip->client->state != S_REBOOTING && + ip->client->state != S_REQUESTING && + ip->client->state != S_RENEWING && + ip->client->state != S_REBINDING) + return; + + note("DHCPNAK from %s", piaddr(packet->client_addr)); + + if (!ip->client->active) { + note("DHCPNAK with no active lease.\n"); + return; + } + + free_client_lease(ip->client->active); + ip->client->active = NULL; + + /* Stop sending DHCPREQUEST packets... */ + cancel_timeout(send_request, ip); + + ip->client->state = S_INIT; + state_init(ip); +} + +/* Send out a DHCPDISCOVER packet, and set a timeout to send out another + one after the right interval has expired. If we don't get an offer by + the time we reach the panic interval, call the panic function. */ + +void +send_discover(void *ipp) +{ + struct interface_info *ip = ipp; + int interval, increase = 1; + time_t cur_time; + + DH_DbgPrint(MID_TRACE,("Doing discover on interface %p\n",ip)); + + time(&cur_time); + + /* Figure out how long it's been since we started transmitting. */ + interval = cur_time - ip->client->first_sending; + + /* If we're past the panic timeout, call the script and tell it + we haven't found anything for this interface yet. */ + if (interval > ip->client->config->timeout) { + state_panic(ip); + return; + } + + /* If we're selecting media, try the whole list before doing + the exponential backoff, but if we've already received an + offer, stop looping, because we obviously have it right. */ + if (!ip->client->offered_leases && + ip->client->config->media) { + int fail = 0; + + if (ip->client->medium) { + ip->client->medium = ip->client->medium->next; + increase = 0; + } + if (!ip->client->medium) { + if (fail) + error("No valid media types for %s!", ip->name); + ip->client->medium = ip->client->config->media; + increase = 1; + } + + note("Trying medium \"%s\" %d", ip->client->medium->string, + increase); + /* XXX Support other media types eventually */ + } + + /* + * If we're supposed to increase the interval, do so. If it's + * currently zero (i.e., we haven't sent any packets yet), set + * it to one; otherwise, add to it a random number between zero + * and two times itself. On average, this means that it will + * double with every transmission. + */ + if (increase) { + if (!ip->client->interval) + ip->client->interval = + ip->client->config->initial_interval; + else { + ip->client->interval += (rand() >> 2) % + (2 * ip->client->interval); + } + + /* Don't backoff past cutoff. */ + if (ip->client->interval > + ip->client->config->backoff_cutoff) + ip->client->interval = + ((ip->client->config->backoff_cutoff / 2) + + ((rand() >> 2) % + ip->client->config->backoff_cutoff)); + } else if (!ip->client->interval) + ip->client->interval = + ip->client->config->initial_interval; + + /* If the backoff would take us to the panic timeout, just use that + as the interval. */ + if (cur_time + ip->client->interval > + ip->client->first_sending + ip->client->config->timeout) + ip->client->interval = + (ip->client->first_sending + + ip->client->config->timeout) - cur_time + 1; + + /* Record the number of seconds since we started sending. */ + if (interval < 65536) + ip->client->packet.secs = htons(interval); + else + ip->client->packet.secs = htons(65535); + ip->client->secs = ip->client->packet.secs; + + note("DHCPDISCOVER on %s to %s port %d interval %ld", + ip->name, inet_ntoa(sockaddr_broadcast.sin_addr), + ntohs(sockaddr_broadcast.sin_port), (long int)ip->client->interval); + + /* Send out a packet. */ + (void)send_packet(ip, &ip->client->packet, ip->client->packet_length, + inaddr_any, &sockaddr_broadcast, NULL); + + DH_DbgPrint(MID_TRACE,("discover timeout: now %x -> then %x\n", + cur_time, cur_time + ip->client->interval)); + + add_timeout(cur_time + ip->client->interval, send_discover, ip); +} + +/* + * state_panic gets called if we haven't received any offers in a preset + * amount of time. When this happens, we try to use existing leases + * that haven't yet expired, and failing that, we call the client script + * and hope it can do something. + */ +void +state_panic(void *ipp) +{ + struct interface_info *ip = ipp; + time_t cur_time; + + time(&cur_time); + + note("No DHCPOFFERS received."); + + note("No working leases in persistent database - sleeping.\n"); + ip->client->state = S_INIT; + add_timeout(cur_time + ip->client->config->retry_interval, state_init, + ip); + /* XXX Take any failure actions necessary */ +} + +void +send_request(void *ipp) +{ + struct interface_info *ip = ipp; + struct sockaddr_in destination; + struct in_addr from; + int interval; + time_t cur_time; + + time(&cur_time); + + /* Figure out how long it's been since we started transmitting. */ + interval = cur_time - ip->client->first_sending; + + /* If we're in the INIT-REBOOT or REQUESTING state and we're + past the reboot timeout, go to INIT and see if we can + DISCOVER an address... */ + /* XXX In the INIT-REBOOT state, if we don't get an ACK, it + means either that we're on a network with no DHCP server, + or that our server is down. In the latter case, assuming + that there is a backup DHCP server, DHCPDISCOVER will get + us a new address, but we could also have successfully + reused our old address. In the former case, we're hosed + anyway. This is not a win-prone situation. */ + if ((ip->client->state == S_REBOOTING || + ip->client->state == S_REQUESTING) && + interval > ip->client->config->reboot_timeout) { + ip->client->state = S_INIT; + cancel_timeout(send_request, ip); + state_init(ip); + return; + } + + /* If we're in the reboot state, make sure the media is set up + correctly. */ + if (ip->client->state == S_REBOOTING && + !ip->client->medium && + ip->client->active->medium ) { + /* If the medium we chose won't fly, go to INIT state. */ + /* XXX Nothing for now */ + + /* Record the medium. */ + ip->client->medium = ip->client->active->medium; + } + + /* If the lease has expired, relinquish the address and go back + to the INIT state. */ + if (ip->client->state != S_REQUESTING && + cur_time > ip->client->active->expiry) { + PDHCP_ADAPTER Adapter = AdapterFindInfo( ip ); + /* Run the client script with the new parameters. */ + /* No script actions necessary in the expiry case */ + /* Now do a preinit on the interface so that we can + discover a new address. */ + + if( Adapter ) + DeleteIPAddress( Adapter->NteContext ); + + ip->client->state = S_INIT; + state_init(ip); + return; + } + + /* Do the exponential backoff... */ + if (!ip->client->interval) + ip->client->interval = ip->client->config->initial_interval; + else + ip->client->interval += ((rand() >> 2) % + (2 * ip->client->interval)); + + /* Don't backoff past cutoff. */ + if (ip->client->interval > + ip->client->config->backoff_cutoff) + ip->client->interval = + ((ip->client->config->backoff_cutoff / 2) + + ((rand() >> 2) % ip->client->interval)); + + /* If the backoff would take us to the expiry time, just set the + timeout to the expiry time. */ + if (ip->client->state != S_REQUESTING && + cur_time + ip->client->interval > + ip->client->active->expiry) + ip->client->interval = + ip->client->active->expiry - cur_time + 1; + + /* If the lease T2 time has elapsed, or if we're not yet bound, + broadcast the DHCPREQUEST rather than unicasting. */ + memset(&destination, 0, sizeof(destination)); + if (ip->client->state == S_REQUESTING || + ip->client->state == S_REBOOTING || + cur_time > ip->client->active->rebind) + destination.sin_addr.s_addr = INADDR_BROADCAST; + else + memcpy(&destination.sin_addr.s_addr, + ip->client->destination.iabuf, + sizeof(destination.sin_addr.s_addr)); + destination.sin_port = htons(REMOTE_PORT); + destination.sin_family = AF_INET; +// destination.sin_len = sizeof(destination); + + if (ip->client->state != S_REQUESTING) + memcpy(&from, ip->client->active->address.iabuf, + sizeof(from)); + else + from.s_addr = INADDR_ANY; + + /* Record the number of seconds since we started sending. */ + if (ip->client->state == S_REQUESTING) + ip->client->packet.secs = ip->client->secs; + else { + if (interval < 65536) + ip->client->packet.secs = htons(interval); + else + ip->client->packet.secs = htons(65535); + } + + note("DHCPREQUEST on %s to %s port %d", ip->name, + inet_ntoa(destination.sin_addr), ntohs(destination.sin_port)); + + /* Send out a packet. */ + (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, + from, &destination, NULL); + + add_timeout(cur_time + ip->client->interval, send_request, ip); +} + +void +send_decline(void *ipp) +{ + struct interface_info *ip = ipp; + + note("DHCPDECLINE on %s to %s port %d", ip->name, + inet_ntoa(sockaddr_broadcast.sin_addr), + ntohs(sockaddr_broadcast.sin_port)); + + /* Send out a packet. */ + (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, + inaddr_any, &sockaddr_broadcast, NULL); +} + +void +make_discover(struct interface_info *ip, struct client_lease *lease) +{ + unsigned char discover = DHCPDISCOVER; + struct tree_cache *options[256]; + struct tree_cache option_elements[256]; + int i; + ULONG foo = (ULONG) GetTickCount(); + + memset(option_elements, 0, sizeof(option_elements)); + memset(options, 0, sizeof(options)); + memset(&ip->client->packet, 0, sizeof(ip->client->packet)); + + /* Set DHCP_MESSAGE_TYPE to DHCPDISCOVER */ + i = DHO_DHCP_MESSAGE_TYPE; + options[i] = &option_elements[i]; + options[i]->value = &discover; + options[i]->len = sizeof(discover); + options[i]->buf_size = sizeof(discover); + options[i]->timeout = 0xFFFFFFFF; + + /* Request the options we want */ + i = DHO_DHCP_PARAMETER_REQUEST_LIST; + options[i] = &option_elements[i]; + options[i]->value = ip->client->config->requested_options; + options[i]->len = ip->client->config->requested_option_count; + options[i]->buf_size = + ip->client->config->requested_option_count; + options[i]->timeout = 0xFFFFFFFF; + + /* If we had an address, try to get it again. */ + if (lease) { + ip->client->requested_address = lease->address; + i = DHO_DHCP_REQUESTED_ADDRESS; + options[i] = &option_elements[i]; + options[i]->value = lease->address.iabuf; + options[i]->len = lease->address.len; + options[i]->buf_size = lease->address.len; + options[i]->timeout = 0xFFFFFFFF; + } else + ip->client->requested_address.len = 0; + + /* Send any options requested in the config file. */ + for (i = 0; i < 256; i++) + if (!options[i] && + ip->client->config->send_options[i].data) { + options[i] = &option_elements[i]; + options[i]->value = + ip->client->config->send_options[i].data; + options[i]->len = + ip->client->config->send_options[i].len; + options[i]->buf_size = + ip->client->config->send_options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + + /* Set up the option buffer... */ + ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + options, 0, 0, 0, NULL, 0); + if (ip->client->packet_length < BOOTP_MIN_LEN) + ip->client->packet_length = BOOTP_MIN_LEN; + + ip->client->packet.op = BOOTREQUEST; + ip->client->packet.htype = ip->hw_address.htype; + ip->client->packet.hlen = ip->hw_address.hlen; + ip->client->packet.hops = 0; + ip->client->packet.xid = RtlRandom(&foo); + ip->client->packet.secs = 0; /* filled in by send_discover. */ + ip->client->packet.flags = 0; + + memset(&(ip->client->packet.ciaddr), + 0, sizeof(ip->client->packet.ciaddr)); + memset(&(ip->client->packet.yiaddr), + 0, sizeof(ip->client->packet.yiaddr)); + memset(&(ip->client->packet.siaddr), + 0, sizeof(ip->client->packet.siaddr)); + memset(&(ip->client->packet.giaddr), + 0, sizeof(ip->client->packet.giaddr)); + memcpy(ip->client->packet.chaddr, + ip->hw_address.haddr, ip->hw_address.hlen); +} + + +void +make_request(struct interface_info *ip, struct client_lease * lease) +{ + unsigned char request = DHCPREQUEST; + struct tree_cache *options[256]; + struct tree_cache option_elements[256]; + int i; + + memset(options, 0, sizeof(options)); + memset(&ip->client->packet, 0, sizeof(ip->client->packet)); + + /* Set DHCP_MESSAGE_TYPE to DHCPREQUEST */ + i = DHO_DHCP_MESSAGE_TYPE; + options[i] = &option_elements[i]; + options[i]->value = &request; + options[i]->len = sizeof(request); + options[i]->buf_size = sizeof(request); + options[i]->timeout = 0xFFFFFFFF; + + /* Request the options we want */ + i = DHO_DHCP_PARAMETER_REQUEST_LIST; + options[i] = &option_elements[i]; + options[i]->value = ip->client->config->requested_options; + options[i]->len = ip->client->config->requested_option_count; + options[i]->buf_size = + ip->client->config->requested_option_count; + options[i]->timeout = 0xFFFFFFFF; + + /* If we are requesting an address that hasn't yet been assigned + to us, use the DHCP Requested Address option. */ + if (ip->client->state == S_REQUESTING) { + /* Send back the server identifier... */ + i = DHO_DHCP_SERVER_IDENTIFIER; + options[i] = &option_elements[i]; + options[i]->value = lease->options[i].data; + options[i]->len = lease->options[i].len; + options[i]->buf_size = lease->options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + if (ip->client->state == S_REQUESTING || + ip->client->state == S_REBOOTING) { + ip->client->requested_address = lease->address; + i = DHO_DHCP_REQUESTED_ADDRESS; + options[i] = &option_elements[i]; + options[i]->value = lease->address.iabuf; + options[i]->len = lease->address.len; + options[i]->buf_size = lease->address.len; + options[i]->timeout = 0xFFFFFFFF; + } else + ip->client->requested_address.len = 0; + + /* Send any options requested in the config file. */ + for (i = 0; i < 256; i++) + if (!options[i] && + ip->client->config->send_options[i].data) { + options[i] = &option_elements[i]; + options[i]->value = + ip->client->config->send_options[i].data; + options[i]->len = + ip->client->config->send_options[i].len; + options[i]->buf_size = + ip->client->config->send_options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + + /* Set up the option buffer... */ + ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + options, 0, 0, 0, NULL, 0); + if (ip->client->packet_length < BOOTP_MIN_LEN) + ip->client->packet_length = BOOTP_MIN_LEN; + + ip->client->packet.op = BOOTREQUEST; + ip->client->packet.htype = ip->hw_address.htype; + ip->client->packet.hlen = ip->hw_address.hlen; + ip->client->packet.hops = 0; + ip->client->packet.xid = ip->client->xid; + ip->client->packet.secs = 0; /* Filled in by send_request. */ + + /* If we own the address we're requesting, put it in ciaddr; + otherwise set ciaddr to zero. */ + if (ip->client->state == S_BOUND || + ip->client->state == S_RENEWING || + ip->client->state == S_REBINDING) { + memcpy(&ip->client->packet.ciaddr, + lease->address.iabuf, lease->address.len); + ip->client->packet.flags = 0; + } else { + memset(&ip->client->packet.ciaddr, 0, + sizeof(ip->client->packet.ciaddr)); + ip->client->packet.flags = 0; + } + + memset(&ip->client->packet.yiaddr, 0, + sizeof(ip->client->packet.yiaddr)); + memset(&ip->client->packet.siaddr, 0, + sizeof(ip->client->packet.siaddr)); + memset(&ip->client->packet.giaddr, 0, + sizeof(ip->client->packet.giaddr)); + memcpy(ip->client->packet.chaddr, + ip->hw_address.haddr, ip->hw_address.hlen); +} + +void +make_decline(struct interface_info *ip, struct client_lease *lease) +{ + struct tree_cache *options[256], message_type_tree; + struct tree_cache requested_address_tree; + struct tree_cache server_id_tree, client_id_tree; + unsigned char decline = DHCPDECLINE; + int i; + + memset(options, 0, sizeof(options)); + memset(&ip->client->packet, 0, sizeof(ip->client->packet)); + + /* Set DHCP_MESSAGE_TYPE to DHCPDECLINE */ + i = DHO_DHCP_MESSAGE_TYPE; + options[i] = &message_type_tree; + options[i]->value = &decline; + options[i]->len = sizeof(decline); + options[i]->buf_size = sizeof(decline); + options[i]->timeout = 0xFFFFFFFF; + + /* Send back the server identifier... */ + i = DHO_DHCP_SERVER_IDENTIFIER; + options[i] = &server_id_tree; + options[i]->value = lease->options[i].data; + options[i]->len = lease->options[i].len; + options[i]->buf_size = lease->options[i].len; + options[i]->timeout = 0xFFFFFFFF; + + /* Send back the address we're declining. */ + i = DHO_DHCP_REQUESTED_ADDRESS; + options[i] = &requested_address_tree; + options[i]->value = lease->address.iabuf; + options[i]->len = lease->address.len; + options[i]->buf_size = lease->address.len; + options[i]->timeout = 0xFFFFFFFF; + + /* Send the uid if the user supplied one. */ + i = DHO_DHCP_CLIENT_IDENTIFIER; + if (ip->client->config->send_options[i].len) { + options[i] = &client_id_tree; + options[i]->value = ip->client->config->send_options[i].data; + options[i]->len = ip->client->config->send_options[i].len; + options[i]->buf_size = ip->client->config->send_options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + + + /* Set up the option buffer... */ + ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + options, 0, 0, 0, NULL, 0); + if (ip->client->packet_length < BOOTP_MIN_LEN) + ip->client->packet_length = BOOTP_MIN_LEN; + + ip->client->packet.op = BOOTREQUEST; + ip->client->packet.htype = ip->hw_address.htype; + ip->client->packet.hlen = ip->hw_address.hlen; + ip->client->packet.hops = 0; + ip->client->packet.xid = ip->client->xid; + ip->client->packet.secs = 0; /* Filled in by send_request. */ + ip->client->packet.flags = 0; + + /* ciaddr must always be zero. */ + memset(&ip->client->packet.ciaddr, 0, + sizeof(ip->client->packet.ciaddr)); + memset(&ip->client->packet.yiaddr, 0, + sizeof(ip->client->packet.yiaddr)); + memset(&ip->client->packet.siaddr, 0, + sizeof(ip->client->packet.siaddr)); + memset(&ip->client->packet.giaddr, 0, + sizeof(ip->client->packet.giaddr)); + memcpy(ip->client->packet.chaddr, + ip->hw_address.haddr, ip->hw_address.hlen); +} + +void +free_client_lease(struct client_lease *lease) +{ + int i; + + if (lease->server_name) + free(lease->server_name); + if (lease->filename) + free(lease->filename); + for (i = 0; i < 256; i++) { + if (lease->options[i].len) + free(lease->options[i].data); + } + free(lease); +} + +FILE *leaseFile; + +void +rewrite_client_leases(struct interface_info *ifi) +{ + struct client_lease *lp; + + if (!leaseFile) { + leaseFile = fopen(path_dhclient_db, "w"); + if (!leaseFile) + error("can't create %s", path_dhclient_db); + } else { + fflush(leaseFile); + rewind(leaseFile); + } + + for (lp = ifi->client->leases; lp; lp = lp->next) + write_client_lease(ifi, lp, 1); + if (ifi->client->active) + write_client_lease(ifi, ifi->client->active, 1); + + fflush(leaseFile); +} + +void +write_client_lease(struct interface_info *ip, struct client_lease *lease, + int rewrite) +{ + static int leases_written; + struct tm *t; + int i; + + if (!rewrite) { + if (leases_written++ > 20) { + rewrite_client_leases(ip); + leases_written = 0; + } + } + + /* If the lease came from the config file, we don't need to stash + a copy in the lease database. */ + if (lease->is_static) + return; + + if (!leaseFile) { /* XXX */ + leaseFile = fopen(path_dhclient_db, "w"); + if (!leaseFile) { + error("can't create %s", path_dhclient_db); + return; + } + } + + fprintf(leaseFile, "lease {\n"); + if (lease->is_bootp) + fprintf(leaseFile, " bootp;\n"); + fprintf(leaseFile, " interface \"%s\";\n", ip->name); + fprintf(leaseFile, " fixed-address %s;\n", piaddr(lease->address)); + if (lease->filename) + fprintf(leaseFile, " filename \"%s\";\n", lease->filename); + if (lease->server_name) + fprintf(leaseFile, " server-name \"%s\";\n", + lease->server_name); + if (lease->medium) + fprintf(leaseFile, " medium \"%s\";\n", lease->medium->string); + for (i = 0; i < 256; i++) + if (lease->options[i].len) + fprintf(leaseFile, " option %s %s;\n", + dhcp_options[i].name, + pretty_print_option(i, lease->options[i].data, + lease->options[i].len, 1, 1)); + + t = gmtime(&lease->renewal); + if (t) + fprintf(leaseFile, " renew %d %d/%d/%d %02d:%02d:%02d;\n", + t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + t = gmtime(&lease->rebind); + if (t) + fprintf(leaseFile, " rebind %d %d/%d/%d %02d:%02d:%02d;\n", + t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + t = gmtime(&lease->expiry); + if (t) + fprintf(leaseFile, " expire %d %d/%d/%d %02d:%02d:%02d;\n", + t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + fprintf(leaseFile, "}\n"); + fflush(leaseFile); +} + +void +priv_script_init(struct interface_info *ip, char *reason, char *medium) +{ + if (ip) { + // XXX Do we need to do anything? + } +} + +void +priv_script_write_params(struct interface_info *ip, char *prefix, struct client_lease *lease) +{ + u_int8_t dbuf[1500]; + int i, len = 0; + +#if 0 + script_set_env(ip->client, prefix, "ip_address", + piaddr(lease->address)); +#endif + + if (lease->options[DHO_SUBNET_MASK].len && + (lease->options[DHO_SUBNET_MASK].len < + sizeof(lease->address.iabuf))) { + struct iaddr netmask, subnet, broadcast; + + memcpy(netmask.iabuf, lease->options[DHO_SUBNET_MASK].data, + lease->options[DHO_SUBNET_MASK].len); + netmask.len = lease->options[DHO_SUBNET_MASK].len; + + subnet = subnet_number(lease->address, netmask); + if (subnet.len) { +#if 0 + script_set_env(ip->client, prefix, "network_number", + piaddr(subnet)); +#endif + if (!lease->options[DHO_BROADCAST_ADDRESS].len) { + broadcast = broadcast_addr(subnet, netmask); + if (broadcast.len) +#if 0 + script_set_env(ip->client, prefix, + "broadcast_address", + piaddr(broadcast)); +#else + ; +#endif + } + } + } + +#if 0 + if (lease->filename) + script_set_env(ip->client, prefix, "filename", lease->filename); + if (lease->server_name) + script_set_env(ip->client, prefix, "server_name", + lease->server_name); +#endif + + for (i = 0; i < 256; i++) { + u_int8_t *dp = NULL; + + if (ip->client->config->defaults[i].len) { + if (lease->options[i].len) { + switch ( + ip->client->config->default_actions[i]) { + case ACTION_DEFAULT: + dp = lease->options[i].data; + len = lease->options[i].len; + break; + case ACTION_SUPERSEDE: +supersede: + dp = ip->client-> + config->defaults[i].data; + len = ip->client-> + config->defaults[i].len; + break; + case ACTION_PREPEND: + len = ip->client-> + config->defaults[i].len + + lease->options[i].len; + if (len >= sizeof(dbuf)) { + warning("no space to %s %s", + "prepend option", + dhcp_options[i].name); + goto supersede; + } + dp = dbuf; + memcpy(dp, + ip->client-> + config->defaults[i].data, + ip->client-> + config->defaults[i].len); + memcpy(dp + ip->client-> + config->defaults[i].len, + lease->options[i].data, + lease->options[i].len); + dp[len] = '\0'; + break; + case ACTION_APPEND: + len = ip->client-> + config->defaults[i].len + + lease->options[i].len + 1; + if (len > sizeof(dbuf)) { + warning("no space to %s %s", + "append option", + dhcp_options[i].name); + goto supersede; + } + dp = dbuf; + memcpy(dp, + lease->options[i].data, + lease->options[i].len); + memcpy(dp + lease->options[i].len, + ip->client-> + config->defaults[i].data, + ip->client-> + config->defaults[i].len); + dp[len-1] = '\0'; + } + } else { + dp = ip->client-> + config->defaults[i].data; + len = ip->client-> + config->defaults[i].len; + } + } else if (lease->options[i].len) { + len = lease->options[i].len; + dp = lease->options[i].data; + } else { + len = 0; + } +#if 0 + if (len) { + char name[256]; + + if (dhcp_option_ev_name(name, sizeof(name), + &dhcp_options[i])) + script_set_env(ip->client, prefix, name, + pretty_print_option(i, dp, len, 0, 0)); + } +#endif + } +#if 0 + snprintf(tbuf, sizeof(tbuf), "%d", (int)lease->expiry); + script_set_env(ip->client, prefix, "expiry", tbuf); +#endif +} + +int +dhcp_option_ev_name(char *buf, size_t buflen, struct dhcp_option *option) +{ + int i; + + for (i = 0; option->name[i]; i++) { + if (i + 1 == buflen) + return 0; + if (option->name[i] == '-') + buf[i] = '_'; + else + buf[i] = option->name[i]; + } + + buf[i] = 0; + return 1; +} + +#if 0 +void +go_daemon(void) +{ + static int state = 0; + + if (no_daemon || state) + return; + + state = 1; + + /* Stop logging to stderr... */ + log_perror = 0; + + if (daemon(1, 0) == -1) + error("daemon"); + + /* we are chrooted, daemon(3) fails to open /dev/null */ + if (nullfd != -1) { + dup2(nullfd, STDIN_FILENO); + dup2(nullfd, STDOUT_FILENO); + dup2(nullfd, STDERR_FILENO); + close(nullfd); + nullfd = -1; + } +} +#endif + +int +check_option(struct client_lease *l, int option) +{ + char *opbuf; + char *sbuf; + + /* we use this, since this is what gets passed to dhclient-script */ + + opbuf = pretty_print_option(option, l->options[option].data, + l->options[option].len, 0, 0); + + sbuf = option_as_string(option, l->options[option].data, + l->options[option].len); + + switch (option) { + case DHO_SUBNET_MASK: + case DHO_TIME_SERVERS: + case DHO_NAME_SERVERS: + case DHO_ROUTERS: + case DHO_DOMAIN_NAME_SERVERS: + case DHO_LOG_SERVERS: + case DHO_COOKIE_SERVERS: + case DHO_LPR_SERVERS: + case DHO_IMPRESS_SERVERS: + case DHO_RESOURCE_LOCATION_SERVERS: + case DHO_SWAP_SERVER: + case DHO_BROADCAST_ADDRESS: + case DHO_NIS_SERVERS: + case DHO_NTP_SERVERS: + case DHO_NETBIOS_NAME_SERVERS: + case DHO_NETBIOS_DD_SERVER: + case DHO_FONT_SERVERS: + case DHO_DHCP_SERVER_IDENTIFIER: + if (!ipv4addrs(opbuf)) { + warning("Invalid IP address in option(%d): %s", option, opbuf); + return (0); + } + return (1) ; + case DHO_HOST_NAME: + case DHO_DOMAIN_NAME: + case DHO_NIS_DOMAIN: + if (!res_hnok(sbuf)) + warning("Bogus Host Name option %d: %s (%s)", option, + sbuf, opbuf); + return (1); + case DHO_PAD: + case DHO_TIME_OFFSET: + case DHO_BOOT_SIZE: + case DHO_MERIT_DUMP: + case DHO_ROOT_PATH: + case DHO_EXTENSIONS_PATH: + case DHO_IP_FORWARDING: + case DHO_NON_LOCAL_SOURCE_ROUTING: + case DHO_POLICY_FILTER: + case DHO_MAX_DGRAM_REASSEMBLY: + case DHO_DEFAULT_IP_TTL: + case DHO_PATH_MTU_AGING_TIMEOUT: + case DHO_PATH_MTU_PLATEAU_TABLE: + case DHO_INTERFACE_MTU: + case DHO_ALL_SUBNETS_LOCAL: + case DHO_PERFORM_MASK_DISCOVERY: + case DHO_MASK_SUPPLIER: + case DHO_ROUTER_DISCOVERY: + case DHO_ROUTER_SOLICITATION_ADDRESS: + case DHO_STATIC_ROUTES: + case DHO_TRAILER_ENCAPSULATION: + case DHO_ARP_CACHE_TIMEOUT: + case DHO_IEEE802_3_ENCAPSULATION: + case DHO_DEFAULT_TCP_TTL: + case DHO_TCP_KEEPALIVE_INTERVAL: + case DHO_TCP_KEEPALIVE_GARBAGE: + case DHO_VENDOR_ENCAPSULATED_OPTIONS: + case DHO_NETBIOS_NODE_TYPE: + case DHO_NETBIOS_SCOPE: + case DHO_X_DISPLAY_MANAGER: + case DHO_DHCP_REQUESTED_ADDRESS: + case DHO_DHCP_LEASE_TIME: + case DHO_DHCP_OPTION_OVERLOAD: + case DHO_DHCP_MESSAGE_TYPE: + case DHO_DHCP_PARAMETER_REQUEST_LIST: + case DHO_DHCP_MESSAGE: + case DHO_DHCP_MAX_MESSAGE_SIZE: + case DHO_DHCP_RENEWAL_TIME: + case DHO_DHCP_REBINDING_TIME: + case DHO_DHCP_CLASS_IDENTIFIER: + case DHO_DHCP_CLIENT_IDENTIFIER: + case DHO_DHCP_USER_CLASS_ID: + case DHO_END: + return (1); + default: + warning("unknown dhcp option value 0x%x", option); + return (unknown_ok); + } +} + +int +res_hnok(const char *dn) +{ + int pch = PERIOD, ch = *dn++; + + while (ch != '\0') { + int nch = *dn++; + + if (periodchar(ch)) { + ; + } else if (periodchar(pch)) { + if (!borderchar(ch)) + return (0); + } else if (periodchar(nch) || nch == '\0') { + if (!borderchar(ch)) + return (0); + } else { + if (!middlechar(ch)) + return (0); + } + pch = ch, ch = nch; + } + return (1); +} + +/* Does buf consist only of dotted decimal ipv4 addrs? + * return how many if so, + * otherwise, return 0 + */ +int +ipv4addrs(char * buf) +{ + char *tmp; + struct in_addr jnk; + int i = 0; + + note("Input: %s", buf); + + do { + tmp = strtok(buf, " "); + note("got %s", tmp); + if( tmp && inet_aton(tmp, &jnk) ) i++; + buf = NULL; + } while( tmp ); + + return (i); +} + + +char * +option_as_string(unsigned int code, unsigned char *data, int len) +{ + static char optbuf[32768]; /* XXX */ + char *op = optbuf; + int opleft = sizeof(optbuf); + unsigned char *dp = data; + + if (code > 255) + error("option_as_string: bad code %d", code); + + for (; dp < data + len; dp++) { + if (!isascii(*dp) || !isprint(*dp)) { + if (dp + 1 != data + len || *dp != 0) { + _snprintf(op, opleft, "\\%03o", *dp); + op += 4; + opleft -= 4; + } + } else if (*dp == '"' || *dp == '\'' || *dp == '$' || + *dp == '`' || *dp == '\\') { + *op++ = '\\'; + *op++ = *dp; + opleft -= 2; + } else { + *op++ = *dp; + opleft--; + } + } + if (opleft < 1) + goto toobig; + *op = 0; + return optbuf; +toobig: + warning("dhcp option too large"); + return ""; +} + diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c index 0c59fb7df90..07910684993 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c @@ -6,22 +6,63 @@ * COPYRIGHT: Copyright 2005 Art Yerkes */ -#include -#include -#include -#include +#include #define NDEBUG #include -#define DHCP_TIMEOUT 1000 +static HANDLE PipeHandle = INVALID_HANDLE_VALUE; DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version) { - *Version = 2; - return 0; + DWORD PipeMode; + + /* Wait for the pipe to be available */ + if (WaitNamedPipeW(DHCP_PIPE_NAME, NMPWAIT_USE_DEFAULT_WAIT)) + { + /* It's available, let's try to open it */ + PipeHandle = CreateFileW(DHCP_PIPE_NAME, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, + NULL); + + /* Check if we succeeded in opening the pipe */ + if (PipeHandle == INVALID_HANDLE_VALUE) + { + /* We didn't */ + return GetLastError(); + } + else + { + /* Change the pipe into message mode */ + PipeMode = PIPE_READMODE_MESSAGE; + if (!SetNamedPipeHandleState(PipeHandle, &PipeMode, NULL, NULL)) + { + /* Mode change failed */ + CloseHandle(PipeHandle); + PipeHandle = INVALID_HANDLE_VALUE; + return GetLastError(); + } + else + { + /* We're good to go */ + *Version = 2; + return NO_ERROR; + } + } + } + else + { + /* No good, we failed */ + return GetLastError(); + } } VOID APIENTRY DhcpCApiCleanup() { + CloseHandle(PipeHandle); + PipeHandle = INVALID_HANDLE_VALUE; } DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, @@ -33,12 +74,20 @@ DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqQueryHWInfo; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } if( !Reply.Reply ) return 0; else { @@ -55,12 +104,20 @@ DWORD APIENTRY DhcpLeaseIpAddress( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqLeaseIpAddress; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -71,12 +128,20 @@ DWORD APIENTRY DhcpReleaseIpAddressLease( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqReleaseIpAddress; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -87,12 +152,20 @@ DWORD APIENTRY DhcpRenewIpAddressLease( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqRenewIpAddress; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -105,14 +178,22 @@ DWORD APIENTRY DhcpStaticRefreshParams( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqStaticRefreshParams; Req.AdapterIndex = AdapterIndex; Req.Body.StaticRefreshParams.IPAddress = Address; Req.Body.StaticRefreshParams.Netmask = Netmask; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -153,7 +234,7 @@ DhcpNotifyConfigChange(LPWSTR ServerName, DWORD SubnetMask, int DhcpAction) { - DPRINT1("DhcpNotifyConfigChange not implemented yet\n"); + DbgPrint("DHCPCSVC: DhcpNotifyConfigChange not implemented yet\n"); return 0; } @@ -192,12 +273,15 @@ DWORD APIENTRY DhcpRosGetAdapterInfo( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqGetAdapterInfo; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); if ( 0 != Result && 0 != Reply.Reply ) { *DhcpEnabled = Reply.GetAdapterInfo.DhcpEnabled; diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild index c2cc0a1e112..99ea9326dce 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild @@ -2,8 +2,26 @@ include ntdll + msvcrt ws2_32 iphlpapi + advapi32 + oldnames + adapter.c + alloc.c + api.c + compat.c + dhclient.c dhcpcsvc.c dhcpcsvc.rc + dispatch.c + hash.c + options.c + pipe.c + socket.c + tables.c + util.c + + rosdhcp.h + diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec index d97b6e7f2ac..b9f95712bb4 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec @@ -43,5 +43,4 @@ @ stub McastRenewAddress @ stub McastRequestAddress @ stdcall DhcpRosGetAdapterInfo(long ptr ptr ptr ptr) -# The Windows DHCP client service is implemented in the DLL too -#@ stub ServiceMain +@ stdcall ServiceMain(long ptr) diff --git a/reactos/dll/win32/dhcpcsvc/dispatch.c b/reactos/dll/win32/dhcpcsvc/dispatch.c new file mode 100644 index 00000000000..b429f9517e7 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/dispatch.c @@ -0,0 +1,354 @@ +/* $OpenBSD: dispatch.c,v 1.31 2004/09/21 04:07:03 david Exp $ */ + +/* + * Copyright 2004 Henning Brauer + * Copyright (c) 1995, 1996, 1997, 1998, 1999 + * The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#include "rosdhcp.h" +#include "dhcpd.h" +//#include + +//#include +//#include +//#include + +struct protocol *protocols = NULL; +struct timeout *timeouts = NULL; +static struct timeout *free_timeouts = NULL; +void (*bootp_packet_handler)(struct interface_info *, + struct dhcp_packet *, int, unsigned int, + struct iaddr, struct hardware *); + +/* + * Wait for packets to come in using poll(). When a packet comes in, + * call receive_packet to receive the packet and possibly strip hardware + * addressing information from it, and then call through the + * bootp_packet_handler hook to try to do something with it. + */ +void +dispatch(void) +{ + int count, to_msec, err; + struct protocol *l; + fd_set fds; + time_t howlong, cur_time; + struct timeval timeval; + + if (!AdapterDiscover()) + return; + + ApiLock(); + + do { + /* + * Call any expired timeouts, and then if there's still + * a timeout registered, time out the select call then. + */ + time(&cur_time); + + if (timeouts) { + struct timeout *t; + + if (timeouts->when <= cur_time) { + t = timeouts; + timeouts = timeouts->next; + (*(t->func))(t->what); + t->next = free_timeouts; + free_timeouts = t; + continue; + } + + /* + * Figure timeout in milliseconds, and check for + * potential overflow, so we can cram into an + * int for poll, while not polling with a + * negative timeout and blocking indefinitely. + */ + howlong = timeouts->when - cur_time; + if (howlong > INT_MAX / 1000) + howlong = INT_MAX / 1000; + to_msec = howlong * 1000; + } else + to_msec = 5000; + + /* Set up the descriptors to be polled. */ + FD_ZERO(&fds); + + for (l = protocols; l; l = l->next) + FD_SET(l->fd, &fds); + + /* Wait for a packet or a timeout... XXX */ + timeval.tv_sec = to_msec / 1000; + timeval.tv_usec = to_msec % 1000; + + ApiUnlock(); + + if (protocols) + count = select(0, &fds, NULL, NULL, &timeval); + else { + Sleep(to_msec); + count = 0; + } + + ApiLock(); + + DH_DbgPrint(MID_TRACE,("Select: %d\n", count)); + + /* Not likely to be transitory... */ + if (count == SOCKET_ERROR) { + err = WSAGetLastError(); + error("poll: %d", err); + break; + } + + for (l = protocols; l; l = l->next) { + struct interface_info *ip; + ip = l->local; + if (FD_ISSET(l->fd, &fds)) { + if (ip && (l->handler != got_one || + !ip->dead)) { + DH_DbgPrint(MID_TRACE,("Handling %x\n", l)); + (*(l->handler))(l); + } + } + } + } while (1); + + ApiUnlock(); +} + +void +got_one(struct protocol *l) +{ + struct sockaddr_in from; + struct hardware hfrom; + struct iaddr ifrom; + ssize_t result; + union { + /* + * Packet input buffer. Must be as large as largest + * possible MTU. + */ + unsigned char packbuf[4095]; + struct dhcp_packet packet; + } u; + struct interface_info *ip = l->local; + PDHCP_ADAPTER adapter; + + if ((result = receive_packet(ip, u.packbuf, sizeof(u), &from, + &hfrom)) == -1) { + warning("receive_packet failed on %s: %d", ip->name, + WSAGetLastError()); + ip->errors++; + if (ip->errors > 20) { + /* our interface has gone away. */ + warning("Interface %s no longer appears valid.", + ip->name); + ip->dead = 1; + closesocket(l->fd); + remove_protocol(l); + adapter = AdapterFindInfo(ip); + if (adapter) { + RemoveEntryList(&adapter->ListEntry); + free(adapter); + } + } + return; + } + if (result == 0) + return; + + if (bootp_packet_handler) { + ifrom.len = 4; + memcpy(ifrom.iabuf, &from.sin_addr, ifrom.len); + + + adapter = AdapterFindByHardwareAddress(u.packet.chaddr, + u.packet.hlen); + + if (!adapter) { + warning("Discarding packet with a non-matching target physical address\n"); + return; + } + + (*bootp_packet_handler)(&adapter->DhclientInfo, &u.packet, result, + from.sin_port, ifrom, &hfrom); + } +} + +void +add_timeout(time_t when, void (*where)(void *), void *what) +{ + struct timeout *t, *q; + + DH_DbgPrint(MID_TRACE,("Adding timeout %x %p %x\n", when, where, what)); + /* See if this timeout supersedes an existing timeout. */ + t = NULL; + for (q = timeouts; q; q = q->next) { + if (q->func == where && q->what == what) { + if (t) + t->next = q->next; + else + timeouts = q->next; + break; + } + t = q; + } + + /* If we didn't supersede a timeout, allocate a timeout + structure now. */ + if (!q) { + if (free_timeouts) { + q = free_timeouts; + free_timeouts = q->next; + q->func = where; + q->what = what; + } else { + q = malloc(sizeof(struct timeout)); + if (!q) { + error("Can't allocate timeout structure!"); + return; + } + q->func = where; + q->what = what; + } + } + + q->when = when; + + /* Now sort this timeout into the timeout list. */ + + /* Beginning of list? */ + if (!timeouts || timeouts->when > q->when) { + q->next = timeouts; + timeouts = q; + return; + } + + /* Middle of list? */ + for (t = timeouts; t->next; t = t->next) { + if (t->next->when > q->when) { + q->next = t->next; + t->next = q; + return; + } + } + + /* End of list. */ + t->next = q; + q->next = NULL; +} + +void +cancel_timeout(void (*where)(void *), void *what) +{ + struct timeout *t, *q; + + /* Look for this timeout on the list, and unlink it if we find it. */ + t = NULL; + for (q = timeouts; q; q = q->next) { + if (q->func == where && q->what == what) { + if (t) + t->next = q->next; + else + timeouts = q->next; + break; + } + t = q; + } + + /* If we found the timeout, put it on the free list. */ + if (q) { + q->next = free_timeouts; + free_timeouts = q; + } +} + +/* Add a protocol to the list of protocols... */ +void +add_protocol(char *name, int fd, void (*handler)(struct protocol *), + void *local) +{ + struct protocol *p; + + p = malloc(sizeof(*p)); + if (!p) + error("can't allocate protocol struct for %s", name); + + p->fd = fd; + p->handler = handler; + p->local = local; + p->next = protocols; + protocols = p; +} + +void +remove_protocol(struct protocol *proto) +{ + struct protocol *p, *next, *prev; + + prev = NULL; + for (p = protocols; p; p = next) { + next = p->next; + if (p == proto) { + if (prev) + prev->next = p->next; + else + protocols = p->next; + free(p); + } + } +} + +struct protocol * +find_protocol_by_adapter(struct interface_info *info) +{ + struct protocol *p; + + for( p = protocols; p; p = p->next ) { + if( p->local == (void *)info ) return p; + } + + return NULL; +} + +int +interface_link_status(char *ifname) +{ + return (1); +} diff --git a/reactos/dll/win32/dhcpcsvc/hash.c b/reactos/dll/win32/dhcpcsvc/hash.c new file mode 100644 index 00000000000..84c8c6a7ade --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/hash.c @@ -0,0 +1,165 @@ +/* hash.c + + Routines for manipulating hash tables... */ + +/* + * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define lint +#ifndef lint +static char copyright[] = +"$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "rosdhcp.h" + +static __inline int do_hash PROTO ((unsigned char *, int, int)); + +struct hash_table *new_hash () +{ + struct hash_table *rv = new_hash_table (DEFAULT_HASH_SIZE); + if (!rv) + return rv; + memset (&rv -> buckets [0], 0, + DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *)); + return rv; +} + +static __inline int do_hash (name, len, size) + unsigned char *name; + int len; + int size; +{ + register int accum = 0; + register unsigned char *s = name; + int i = len; + while (i--) { + /* Add the character in... */ + accum += *s++; + /* Add carry back in... */ + while (accum > 255) { + accum = (accum & 255) + (accum >> 8); + } + } + return accum % size; +} + +void add_hash (table, name, len, pointer) + struct hash_table *table; + int len; + unsigned char *name; + unsigned char *pointer; +{ + int hashno; + struct hash_bucket *bp; + + if (!table) + return; + if (!len) + len = strlen ((char *)name); + + hashno = do_hash (name, len, table -> hash_count); + bp = new_hash_bucket (); + + if (!bp) { + warn ("Can't add %s to hash table.", name); + return; + } + bp -> name = name; + bp -> value = pointer; + bp -> next = table -> buckets [hashno]; + bp -> len = len; + table -> buckets [hashno] = bp; +} + +void delete_hash_entry (table, name, len) + struct hash_table *table; + int len; + unsigned char *name; +{ + int hashno; + struct hash_bucket *bp, *pbp = (struct hash_bucket *)0; + + if (!table) + return; + if (!len) + len = strlen ((char *)name); + + hashno = do_hash (name, len, table -> hash_count); + + /* Go through the list looking for an entry that matches; + if we find it, delete it. */ + for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { + if ((!bp -> len && + !strcmp ((char *)bp -> name, (char *)name)) || + (bp -> len == len && + !memcmp (bp -> name, name, len))) { + if (pbp) { + pbp -> next = bp -> next; + } else { + table -> buckets [hashno] = bp -> next; + } + free_hash_bucket (bp, "delete_hash_entry"); + break; + } + pbp = bp; /* jwg, 9/6/96 - nice catch! */ + } +} + +unsigned char *hash_lookup (table, name, len) + struct hash_table *table; + unsigned char *name; + int len; +{ + int hashno; + struct hash_bucket *bp; + + if (!table) + return (unsigned char *)0; + + if (!len) + len = strlen ((char *)name); + + hashno = do_hash (name, len, table -> hash_count); + + for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { + if (len == bp -> len && !memcmp (bp -> name, name, len)) + return bp -> value; + } + return (unsigned char *)0; +} diff --git a/reactos/dll/win32/dhcpcsvc/include/debug.h b/reactos/dll/win32/dhcpcsvc/include/debug.h new file mode 100644 index 00000000000..de374aaba45 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/include/debug.h @@ -0,0 +1,51 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS TCP/IP protocol driver + * FILE: include/debug.h + * PURPOSE: Debugging support macros + * DEFINES: DBG - Enable debug output + * NASSERT - Disable assertions + */ + +#pragma once + +#define NORMAL_MASK 0x000000FF +#define SPECIAL_MASK 0xFFFFFF00 +#define MIN_TRACE 0x00000001 +#define MID_TRACE 0x00000002 +#define MAX_TRACE 0x00000003 + +#define DEBUG_ADAPTER 0x00000100 +#define DEBUG_ULTRA 0xFFFFFFFF + +#if DBG + +extern unsigned long debug_trace_level; + +#ifdef _MSC_VER + +#define DH_DbgPrint(_t_, _x_) \ + if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ + ((debug_trace_level & _t_) > NORMAL_MASK)) { \ + DbgPrint("(%s:%d) ", __FILE__, __LINE__); \ + DbgPrint _x_ ; \ + } + +#else /* _MSC_VER */ + +#define DH_DbgPrint(_t_, _x_) \ + if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ + ((debug_trace_level & _t_) > NORMAL_MASK)) { \ + DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \ + DbgPrint _x_ ; \ + } + +#endif /* _MSC_VER */ + +#else /* DBG */ + +#define DH_DbgPrint(_t_, _x_) + +#endif /* DBG */ + +/* EOF */ diff --git a/reactos/dll/win32/dhcpcsvc/include/dhcp.h b/reactos/dll/win32/dhcpcsvc/include/dhcp.h new file mode 100644 index 00000000000..8ac8ed3a9e6 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/include/dhcp.h @@ -0,0 +1,169 @@ +/* $OpenBSD: dhcp.h,v 1.5 2004/05/04 15:49:49 deraadt Exp $ */ + +/* Protocol structures... */ + +/* + * Copyright (c) 1995, 1996 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ + 20 + /* IP header */ \ + 8) /* UDP header */ +#define DHCP_SNAME_LEN 64 +#define DHCP_FILE_LEN 128 +#define DHCP_FIXED_NON_UDP 236 +#define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) + /* Everything but options. */ +#define DHCP_MTU_MAX 1500 +#define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) + +#define BOOTP_MIN_LEN 300 +#define DHCP_MIN_LEN 548 + +struct dhcp_packet { + u_int8_t op; /* Message opcode/type */ + u_int8_t htype; /* Hardware addr type (see net/if_types.h) */ + u_int8_t hlen; /* Hardware addr length */ + u_int8_t hops; /* Number of relay agent hops from client */ + u_int32_t xid; /* Transaction ID */ + u_int16_t secs; /* Seconds since client started looking */ + u_int16_t flags; /* Flag bits */ + struct in_addr ciaddr; /* Client IP address (if already in use) */ + struct in_addr yiaddr; /* Client IP address */ + struct in_addr siaddr; /* IP address of next server to talk to */ + struct in_addr giaddr; /* DHCP relay agent IP address */ + unsigned char chaddr[16]; /* Client hardware address */ + char sname[DHCP_SNAME_LEN]; /* Server name */ + char file[DHCP_FILE_LEN]; /* Boot filename */ + unsigned char options[DHCP_OPTION_LEN]; + /* Optional parameters + (actual length dependent on MTU). */ +}; + +/* BOOTP (rfc951) message types */ +#define BOOTREQUEST 1 +#define BOOTREPLY 2 + +/* Possible values for flags field... */ +#define BOOTP_BROADCAST 32768L + +/* Possible values for hardware type (htype) field... */ +#define HTYPE_ETHER 1 /* Ethernet */ +#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ +#define HTYPE_FDDI 8 /* FDDI... */ + +/* Magic cookie validating dhcp options field (and bootp vendor + extensions field). */ +#define DHCP_OPTIONS_COOKIE "\143\202\123\143" + + +/* DHCP Option codes: */ + +#define DHO_PAD 0 +#define DHO_SUBNET_MASK 1 +#define DHO_TIME_OFFSET 2 +#define DHO_ROUTERS 3 +#define DHO_TIME_SERVERS 4 +#define DHO_NAME_SERVERS 5 +#define DHO_DOMAIN_NAME_SERVERS 6 +#define DHO_LOG_SERVERS 7 +#define DHO_COOKIE_SERVERS 8 +#define DHO_LPR_SERVERS 9 +#define DHO_IMPRESS_SERVERS 10 +#define DHO_RESOURCE_LOCATION_SERVERS 11 +#define DHO_HOST_NAME 12 +#define DHO_BOOT_SIZE 13 +#define DHO_MERIT_DUMP 14 +#define DHO_DOMAIN_NAME 15 +#define DHO_SWAP_SERVER 16 +#define DHO_ROOT_PATH 17 +#define DHO_EXTENSIONS_PATH 18 +#define DHO_IP_FORWARDING 19 +#define DHO_NON_LOCAL_SOURCE_ROUTING 20 +#define DHO_POLICY_FILTER 21 +#define DHO_MAX_DGRAM_REASSEMBLY 22 +#define DHO_DEFAULT_IP_TTL 23 +#define DHO_PATH_MTU_AGING_TIMEOUT 24 +#define DHO_PATH_MTU_PLATEAU_TABLE 25 +#define DHO_INTERFACE_MTU 26 +#define DHO_ALL_SUBNETS_LOCAL 27 +#define DHO_BROADCAST_ADDRESS 28 +#define DHO_PERFORM_MASK_DISCOVERY 29 +#define DHO_MASK_SUPPLIER 30 +#define DHO_ROUTER_DISCOVERY 31 +#define DHO_ROUTER_SOLICITATION_ADDRESS 32 +#define DHO_STATIC_ROUTES 33 +#define DHO_TRAILER_ENCAPSULATION 34 +#define DHO_ARP_CACHE_TIMEOUT 35 +#define DHO_IEEE802_3_ENCAPSULATION 36 +#define DHO_DEFAULT_TCP_TTL 37 +#define DHO_TCP_KEEPALIVE_INTERVAL 38 +#define DHO_TCP_KEEPALIVE_GARBAGE 39 +#define DHO_NIS_DOMAIN 40 +#define DHO_NIS_SERVERS 41 +#define DHO_NTP_SERVERS 42 +#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43 +#define DHO_NETBIOS_NAME_SERVERS 44 +#define DHO_NETBIOS_DD_SERVER 45 +#define DHO_NETBIOS_NODE_TYPE 46 +#define DHO_NETBIOS_SCOPE 47 +#define DHO_FONT_SERVERS 48 +#define DHO_X_DISPLAY_MANAGER 49 +#define DHO_DHCP_REQUESTED_ADDRESS 50 +#define DHO_DHCP_LEASE_TIME 51 +#define DHO_DHCP_OPTION_OVERLOAD 52 +#define DHO_DHCP_MESSAGE_TYPE 53 +#define DHO_DHCP_SERVER_IDENTIFIER 54 +#define DHO_DHCP_PARAMETER_REQUEST_LIST 55 +#define DHO_DHCP_MESSAGE 56 +#define DHO_DHCP_MAX_MESSAGE_SIZE 57 +#define DHO_DHCP_RENEWAL_TIME 58 +#define DHO_DHCP_REBINDING_TIME 59 +#define DHO_DHCP_CLASS_IDENTIFIER 60 +#define DHO_DHCP_CLIENT_IDENTIFIER 61 +#define DHO_DHCP_USER_CLASS_ID 77 +#define DHO_END 255 + +/* DHCP message types. */ +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST 3 +#define DHCPDECLINE 4 +#define DHCPACK 5 +#define DHCPNAK 6 +#define DHCPRELEASE 7 +#define DHCPINFORM 8 diff --git a/reactos/dll/win32/dhcpcsvc/include/dhcpd.h b/reactos/dll/win32/dhcpcsvc/include/dhcpd.h new file mode 100644 index 00000000000..d6a2fa405b8 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/include/dhcpd.h @@ -0,0 +1,485 @@ +/* $OpenBSD: dhcpd.h,v 1.33 2004/05/06 22:29:15 deraadt Exp $ */ + +/* + * Copyright (c) 2004 Henning Brauer + * Copyright (c) 1995, 1996, 1997, 1998, 1999 + * The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#pragma once + +#include +#include +#include "stdint.h" + +#define IFNAMSIZ MAX_INTERFACE_NAME_LEN + +#define ETH_ALEN 6 +#define ETHER_ADDR_LEN ETH_ALEN +#include +struct ether_header +{ + u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ + u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */ + u_int16_t ether_type; /* packet type ID field */ +}; +#include + +struct ip + { + unsigned int ip_hl:4; /* header length */ + unsigned int ip_v:4; /* version */ + u_int8_t ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_int8_t ip_ttl; /* time to live */ + u_int8_t ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ + }; + +struct udphdr { + u_int16_t uh_sport; /* source port */ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* udp length */ + u_int16_t uh_sum; /* udp checksum */ +}; + +#define ETHERTYPE_IP 0x0800 +#define IPTOS_LOWDELAY 0x10 +#define ARPHRD_ETHER 1 + +// FIXME: I have no idea what this should be! +#define SIZE_T_MAX 1600 + +#define USE_SOCKET_RECEIVE +#define USE_SOCKET_SEND + +#include +#include +//#include +#include +#include +#include +//#include +#include +#include +#include +#include +//#include + +#include "dhcp.h" +#include "tree.h" + +#define LOCAL_PORT 68 +#define REMOTE_PORT 67 + +struct option_data { + int len; + u_int8_t *data; +}; + +struct string_list { + struct string_list *next; + char *string; +}; + +struct iaddr { + int len; + unsigned char iabuf[16]; +}; + +struct iaddrlist { + struct iaddrlist *next; + struct iaddr addr; +}; + +struct packet { + struct dhcp_packet *raw; + int packet_length; + int packet_type; + int options_valid; + int client_port; + struct iaddr client_addr; + struct interface_info *interface; + struct hardware *haddr; + struct option_data options[256]; +}; + +struct hardware { + u_int8_t htype; + u_int8_t hlen; + u_int8_t haddr[16]; +}; + +struct client_lease { + struct client_lease *next; + time_t expiry, renewal, rebind; + struct iaddr address; + char *server_name; +#ifdef __REACTOS__ + time_t obtained; + struct iaddr serveraddress; +#endif + char *filename; + struct string_list *medium; + unsigned int is_static : 1; + unsigned int is_bootp : 1; + struct option_data options[256]; +}; + +/* Possible states in which the client can be. */ +enum dhcp_state { + S_REBOOTING, + S_INIT, + S_SELECTING, + S_REQUESTING, + S_BOUND, + S_RENEWING, + S_REBINDING, + S_STATIC +}; + +struct client_config { + struct option_data defaults[256]; + enum { + ACTION_DEFAULT, + ACTION_SUPERSEDE, + ACTION_PREPEND, + ACTION_APPEND + } default_actions[256]; + + struct option_data send_options[256]; + u_int8_t required_options[256]; + u_int8_t requested_options[256]; + int requested_option_count; + time_t timeout; + time_t initial_interval; + time_t retry_interval; + time_t select_interval; + time_t reboot_timeout; + time_t backoff_cutoff; + struct string_list *media; + char *script_name; + enum { IGNORE, ACCEPT, PREFER } + bootp_policy; + struct string_list *medium; + struct iaddrlist *reject_list; +}; + +struct client_state { + struct client_lease *active; + struct client_lease *new; + struct client_lease *offered_leases; + struct client_lease *leases; + struct client_lease *alias; + enum dhcp_state state; + struct iaddr destination; + u_int32_t xid; + u_int16_t secs; + time_t first_sending; + time_t interval; + struct string_list *medium; + struct dhcp_packet packet; + int packet_length; + struct iaddr requested_address; + struct client_config *config; +}; + +struct interface_info { + struct interface_info *next; + struct hardware hw_address; + struct in_addr primary_address; + char name[IFNAMSIZ]; + int rfdesc; + int wfdesc; + unsigned char *rbuf; + size_t rbuf_max; + size_t rbuf_offset; + size_t rbuf_len; + struct client_state *client; + int noifmedia; + int errors; + int dead; + u_int16_t index; +}; + +struct timeout { + struct timeout *next; + time_t when; + void (*func)(void *); + void *what; +}; + +struct protocol { + struct protocol *next; + int fd; + void (*handler)(struct protocol *); + void *local; +}; + +#define DEFAULT_HASH_SIZE 97 + +struct hash_bucket { + struct hash_bucket *next; + unsigned char *name; + int len; + unsigned char *value; +}; + +struct hash_table { + int hash_count; + struct hash_bucket *buckets[DEFAULT_HASH_SIZE]; +}; + +/* Default path to dhcpd config file. */ +#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" +#define _PATH_DHCLIENT_DB "/var/db/dhclient.leases" +#define DHCPD_LOG_FACILITY LOG_DAEMON + +#define MAX_TIME 0x7fffffff +#define MIN_TIME 0 + +/* External definitions... */ + +/* options.c */ +int cons_options(struct packet *, struct dhcp_packet *, int, + struct tree_cache **, int, int, int, u_int8_t *, int); +char *pretty_print_option(unsigned int, + unsigned char *, int, int, int); +void do_packet(struct interface_info *, struct dhcp_packet *, + int, unsigned int, struct iaddr, struct hardware *); + +/* errwarn.c */ +extern int warnings_occurred; +#ifdef _MSC_VER +void error(char *, ...); +int warning(char *, ...); +int note(char *, ...); +int debug(char *, ...); +int parse_warn(char *, ...); +#else +void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +#endif + +/* conflex.c */ +extern int lexline, lexchar; +extern char *token_line, *tlname; +extern char comments[4096]; +extern int comment_index; +extern int eol_token; +void new_parse(char *); +int next_token(char **, FILE *); +int peek_token(char **, FILE *); + +/* parse.c */ +void skip_to_semi(FILE *); +int parse_semi(FILE *); +char *parse_string(FILE *); +int parse_ip_addr(FILE *, struct iaddr *); +void parse_hardware_param(FILE *, struct hardware *); +void parse_lease_time(FILE *, time_t *); +unsigned char *parse_numeric_aggregate(FILE *, unsigned char *, int *, + int, int, int); +void convert_num(unsigned char *, char *, int, int); +time_t parse_date(FILE *); + +/* tree.c */ +pair cons(caddr_t, pair); + +/* alloc.c */ +struct string_list *new_string_list(size_t size); +struct hash_table *new_hash_table(int); +struct hash_bucket *new_hash_bucket(void); +void dfree(void *, char *); +void free_hash_bucket(struct hash_bucket *, char *); + + +/* bpf.c */ +int if_register_bpf(struct interface_info *); +void if_register_send(struct interface_info *); +void if_register_receive(struct interface_info *); +ssize_t send_packet(struct interface_info *, struct dhcp_packet *, size_t, + struct in_addr, struct sockaddr_in *, struct hardware *); +ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, + struct sockaddr_in *, struct hardware *); + +/* dispatch.c */ +extern void (*bootp_packet_handler)(struct interface_info *, + struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *); +void discover_interfaces(struct interface_info *); +void reinitialize_interfaces(void); +void dispatch(void); +void got_one(struct protocol *); +void add_timeout(time_t, void (*)(void *), void *); +void cancel_timeout(void (*)(void *), void *); +void add_protocol(char *, int, void (*)(struct protocol *), void *); +void remove_protocol(struct protocol *); +struct protocol *find_protocol_by_adapter( struct interface_info * ); +int interface_link_status(char *); + +/* hash.c */ +struct hash_table *new_hash(void); +void add_hash(struct hash_table *, unsigned char *, int, unsigned char *); +unsigned char *hash_lookup(struct hash_table *, unsigned char *, int); + +/* tables.c */ +extern struct dhcp_option dhcp_options[256]; +extern unsigned char dhcp_option_default_priority_list[]; +extern int sizeof_dhcp_option_default_priority_list; +extern struct hash_table universe_hash; +extern struct universe dhcp_universe; +void initialize_universes(void); + +/* convert.c */ +u_int32_t getULong(unsigned char *); +int32_t getLong(unsigned char *); +u_int16_t getUShort(unsigned char *); +int16_t getShort(unsigned char *); +void putULong(unsigned char *, u_int32_t); +void putLong(unsigned char *, int32_t); +void putUShort(unsigned char *, unsigned int); +void putShort(unsigned char *, int); + +/* inet.c */ +struct iaddr subnet_number(struct iaddr, struct iaddr); +struct iaddr broadcast_addr(struct iaddr, struct iaddr); +int addr_eq(struct iaddr, struct iaddr); +char *piaddr(struct iaddr); + +/* dhclient.c */ +extern char *path_dhclient_conf; +extern char *path_dhclient_db; +extern time_t cur_time; +extern int log_priority; +extern int log_perror; + +extern struct client_config top_level_config; + +void dhcpoffer(struct packet *); +void dhcpack(struct packet *); +void dhcpnak(struct packet *); + +void send_discover(void *); +void send_request(void *); +void send_decline(void *); + +void state_reboot(void *); +void state_init(void *); +void state_selecting(void *); +void state_requesting(void *); +void state_bound(void *); +void state_panic(void *); + +void bind_lease(struct interface_info *); + +void make_discover(struct interface_info *, struct client_lease *); +void make_request(struct interface_info *, struct client_lease *); +void make_decline(struct interface_info *, struct client_lease *); + +void free_client_lease(struct client_lease *); +void rewrite_client_leases(struct interface_info *); +void write_client_lease(struct interface_info *, struct client_lease *, int); + +void priv_script_init(struct interface_info *, char *, char *); +void priv_script_write_params(struct interface_info *, char *, struct client_lease *); +int priv_script_go(void); + +void script_init(char *, struct string_list *); +void script_write_params(char *, struct client_lease *); +int script_go(void); +void client_envadd(struct client_state *, + const char *, const char *, const char *, ...); +void script_set_env(struct client_state *, const char *, const char *, + const char *); +void script_flush_env(struct client_state *); +int dhcp_option_ev_name(char *, size_t, struct dhcp_option *); + +struct client_lease *packet_to_lease(struct packet *); +void go_daemon(void); +void client_location_changed(void); + +void bootp(struct packet *); +void dhcp(struct packet *); + +/* packet.c */ +void assemble_hw_header(struct interface_info *, unsigned char *, + int *, struct hardware *); +void assemble_udp_ip_header(unsigned char *, int *, u_int32_t, u_int32_t, + unsigned int, unsigned char *, int); +ssize_t decode_hw_header(unsigned char *, int, struct hardware *); +ssize_t decode_udp_ip_header(unsigned char *, int, struct sockaddr_in *, + unsigned char *, int); + +/* ethernet.c */ +void assemble_ethernet_header(struct interface_info *, unsigned char *, + int *, struct hardware *); +ssize_t decode_ethernet_header(struct interface_info *, unsigned char *, + int, struct hardware *); + +/* clparse.c */ +int read_client_conf(struct interface_info *); +void read_client_leases(void); +void parse_client_statement(FILE *, struct interface_info *, + struct client_config *); +int parse_X(FILE *, u_int8_t *, int); +int parse_option_list(FILE *, u_int8_t *); +void parse_interface_declaration(FILE *, struct client_config *); +struct interface_info *interface_or_dummy(char *); +void make_client_state(struct interface_info *); +void make_client_config(struct interface_info *, struct client_config *); +void parse_client_lease_statement(FILE *, int); +void parse_client_lease_declaration(FILE *, struct client_lease *, + struct interface_info **); +struct dhcp_option *parse_option_decl(FILE *, struct option_data *); +void parse_string_list(FILE *, struct string_list **, int); +void parse_reject_statement(FILE *, struct client_config *); + +/* privsep.c */ +struct buf *buf_open(size_t); +int buf_add(struct buf *, void *, size_t); +int buf_close(int, struct buf *); +ssize_t buf_read(int, void *, size_t); +void dispatch_imsg(int); diff --git a/reactos/dll/win32/dhcpcsvc/include/hash.h b/reactos/dll/win32/dhcpcsvc/include/hash.h new file mode 100644 index 00000000000..1bebb3140f8 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/include/hash.h @@ -0,0 +1,56 @@ +/* hash.h + + Definitions for hashing... */ + +/* + * Copyright (c) 1995, 1996 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define DEFAULT_HASH_SIZE 97 + +struct hash_bucket { + struct hash_bucket *next; + unsigned char *name; + int len; + unsigned char *value; +}; + +struct hash_table { + int hash_count; + struct hash_bucket *buckets [DEFAULT_HASH_SIZE]; +}; + diff --git a/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h b/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h new file mode 100644 index 00000000000..48c67167f3e --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h @@ -0,0 +1,100 @@ +#ifndef ROSDHCP_H +#define ROSDHCP_H + +#define WIN32_NO_STATUS +#include +#define NTOS_MODE_USER +#include +#include +#include +#include +#include +#include +#include +#include "debug.h" +#define IFNAMSIZ MAX_INTERFACE_NAME_LEN +#undef interface /* wine/objbase.h -- Grrr */ + +#undef IGNORE +#undef ACCEPT +#undef PREFER +#define DHCP_DISCOVER_INTERVAL 15 +#define DHCP_REBOOT_TIMEOUT 300 +#define DHCP_PANIC_TIMEOUT DHCP_REBOOT_TIMEOUT * 3 +#define DHCP_BACKOFF_MAX 300 +#define DHCP_DEFAULT_LEASE_TIME 43200 /* 12 hours */ +#define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid" +typedef void *VOIDPTR; +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned int u_int32_t; +typedef char *caddr_t; + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif + +typedef u_int32_t uintTIME; +#define TIME uintTIME +#include "dhcpd.h" + +#define INLINE inline +#define PROTO(x) x + +typedef void (*handler_t) PROTO ((struct packet *)); + +struct iaddr; +struct interface_info; + +typedef struct _DHCP_ADAPTER { + LIST_ENTRY ListEntry; + MIB_IFROW IfMib; + MIB_IPFORWARDROW RouterMib; + MIB_IPADDRROW IfAddr; + SOCKADDR Address; + ULONG NteContext,NteInstance; + struct interface_info DhclientInfo; + struct client_state DhclientState; + struct client_config DhclientConfig; + struct sockaddr_in ListenAddr; + unsigned int BindStatus; + unsigned char recv_buf[1]; +} DHCP_ADAPTER, *PDHCP_ADAPTER; + +typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply ); + +#define random rand +#define srandom srand + +void AdapterInit(VOID); +BOOLEAN AdapterDiscover(VOID); +void AdapterStop(VOID); +extern PDHCP_ADAPTER AdapterGetFirst(); +extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER); +extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); +extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); +extern PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ); +extern HANDLE PipeInit(); +extern VOID ApiInit(); +extern VOID ApiFree(); +extern VOID ApiLock(); +extern VOID ApiUnlock(); +extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern int inet_aton(const char *s, struct in_addr *addr); +int warn( char *format, ... ); +#endif/*ROSDHCP_H*/ diff --git a/reactos/dll/win32/dhcpcsvc/include/tree.h b/reactos/dll/win32/dhcpcsvc/include/tree.h new file mode 100644 index 00000000000..367ffa7d9a1 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/include/tree.h @@ -0,0 +1,66 @@ +/* $OpenBSD: tree.h,v 1.5 2004/05/06 22:29:15 deraadt Exp $ */ + +/* Definitions for address trees... */ + +/* + * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +/* A pair of pointers, suitable for making a linked list. */ +typedef struct _pair { + caddr_t car; + struct _pair *cdr; +} *pair; + +struct tree_cache { + unsigned char *value; + int len; + int buf_size; + time_t timeout; +}; + +struct universe { + char *name; + struct hash_table *hash; + struct dhcp_option *options[256]; +}; + +struct dhcp_option { + char *name; + char *format; + struct universe *universe; + unsigned char code; +}; diff --git a/reactos/dll/win32/dhcpcsvc/options.c b/reactos/dll/win32/dhcpcsvc/options.c new file mode 100644 index 00000000000..27be626523a --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/options.c @@ -0,0 +1,723 @@ +/* $OpenBSD: options.c,v 1.15 2004/12/26 03:17:07 deraadt Exp $ */ + +/* DHCP options parsing and reassembly. */ + +/* + * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#include +#include + +#define DHCP_OPTION_DATA +#include "rosdhcp.h" +#include "dhcpd.h" + +int bad_options = 0; +int bad_options_max = 5; + +void parse_options(struct packet *); +void parse_option_buffer(struct packet *, unsigned char *, int); +int store_options(unsigned char *, int, struct tree_cache **, + unsigned char *, int, int, int, int); + + +/* + * Parse all available options out of the specified packet. + */ +void +parse_options(struct packet *packet) +{ + /* Initially, zero all option pointers. */ + memset(packet->options, 0, sizeof(packet->options)); + + /* If we don't see the magic cookie, there's nothing to parse. */ + if (memcmp(packet->raw->options, DHCP_OPTIONS_COOKIE, 4)) { + packet->options_valid = 0; + return; + } + + /* + * Go through the options field, up to the end of the packet or + * the End field. + */ + parse_option_buffer(packet, &packet->raw->options[4], + packet->packet_length - DHCP_FIXED_NON_UDP - 4); + + /* + * If we parsed a DHCP Option Overload option, parse more + * options out of the buffer(s) containing them. + */ + if (packet->options_valid && + packet->options[DHO_DHCP_OPTION_OVERLOAD].data) { + if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1) + parse_option_buffer(packet, + (unsigned char *)packet->raw->file, + sizeof(packet->raw->file)); + if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2) + parse_option_buffer(packet, + (unsigned char *)packet->raw->sname, + sizeof(packet->raw->sname)); + } +} + +/* + * Parse options out of the specified buffer, storing addresses of + * option values in packet->options and setting packet->options_valid if + * no errors are encountered. + */ +void +parse_option_buffer(struct packet *packet, + unsigned char *buffer, int length) +{ + unsigned char *s, *t, *end = buffer + length; + int len, code; + + for (s = buffer; *s != DHO_END && s < end; ) { + code = s[0]; + + /* Pad options don't have a length - just skip them. */ + if (code == DHO_PAD) { + s++; + continue; + } + if (s + 2 > end) { + len = 65536; + goto bogus; + } + + /* + * All other fields (except end, see above) have a + * one-byte length. + */ + len = s[1]; + + /* + * If the length is outrageous, silently skip the rest, + * and mark the packet bad. Unfortunately some crappy + * dhcp servers always seem to give us garbage on the + * end of a packet. so rather than keep refusing, give + * up and try to take one after seeing a few without + * anything good. + */ + if (s + len + 2 > end) { + bogus: + bad_options++; + warning("option %s (%d) %s.", + dhcp_options[code].name, len, + "larger than buffer"); + if (bad_options == bad_options_max) { + packet->options_valid = 1; + bad_options = 0; + warning("Many bogus options seen in offers. " + "Taking this offer in spite of bogus " + "options - hope for the best!"); + } else { + warning("rejecting bogus offer."); + packet->options_valid = 0; + } + return; + } + /* + * If we haven't seen this option before, just make + * space for it and copy it there. + */ + if (!packet->options[code].data) { + if (!(t = calloc(1, len + 1))) + error("Can't allocate storage for option %s.", + dhcp_options[code].name); + /* + * Copy and NUL-terminate the option (in case + * it's an ASCII string. + */ + memcpy(t, &s[2], len); + t[len] = 0; + packet->options[code].len = len; + packet->options[code].data = t; + } else { + /* + * If it's a repeat, concatenate it to whatever + * we last saw. This is really only required + * for clients, but what the heck... + */ + t = calloc(1, len + packet->options[code].len + 1); + if (!t) { + error("Can't expand storage for option %s.", + dhcp_options[code].name); + return; + } + memcpy(t, packet->options[code].data, + packet->options[code].len); + memcpy(t + packet->options[code].len, + &s[2], len); + packet->options[code].len += len; + t[packet->options[code].len] = 0; + free(packet->options[code].data); + packet->options[code].data = t; + } + s += len + 2; + } + packet->options_valid = 1; +} + +/* + * cons options into a big buffer, and then split them out into the + * three separate buffers if needed. This allows us to cons up a set of + * vendor options using the same routine. + */ +int +cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, + int mms, struct tree_cache **options, + int overload, /* Overload flags that may be set. */ + int terminate, int bootpp, u_int8_t *prl, int prl_len) +{ + unsigned char priority_list[300], buffer[4096]; + int priority_len, main_buffer_size, mainbufix, bufix; + int option_size, length; + + /* + * If the client has provided a maximum DHCP message size, use + * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use + * up to the minimum IP MTU size (576 bytes). + * + * XXX if a BOOTP client specifies a max message size, we will + * honor it. + */ + if (!mms && + inpacket && + inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data && + (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >= + sizeof(u_int16_t))) + mms = getUShort( + inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data); + + if (mms) + main_buffer_size = mms - DHCP_FIXED_LEN; + else if (bootpp) + main_buffer_size = 64; + else + main_buffer_size = 576 - DHCP_FIXED_LEN; + + if (main_buffer_size > sizeof(buffer)) + main_buffer_size = sizeof(buffer); + + /* Preload the option priority list with mandatory options. */ + priority_len = 0; + priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE; + priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER; + priority_list[priority_len++] = DHO_DHCP_LEASE_TIME; + priority_list[priority_len++] = DHO_DHCP_MESSAGE; + + /* + * If the client has provided a list of options that it wishes + * returned, use it to prioritize. Otherwise, prioritize based + * on the default priority list. + */ + if (inpacket && + inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) { + int prlen = + inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len; + if (prlen + priority_len > sizeof(priority_list)) + prlen = sizeof(priority_list) - priority_len; + + memcpy(&priority_list[priority_len], + inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data, + prlen); + priority_len += prlen; + prl = priority_list; + } else if (prl) { + if (prl_len + priority_len > sizeof(priority_list)) + prl_len = sizeof(priority_list) - priority_len; + + memcpy(&priority_list[priority_len], prl, prl_len); + priority_len += prl_len; + prl = priority_list; + } else { + memcpy(&priority_list[priority_len], + dhcp_option_default_priority_list, + sizeof_dhcp_option_default_priority_list); + priority_len += sizeof_dhcp_option_default_priority_list; + } + + /* Copy the options into the big buffer... */ + option_size = store_options( + buffer, + (main_buffer_size - 7 + ((overload & 1) ? DHCP_FILE_LEN : 0) + + ((overload & 2) ? DHCP_SNAME_LEN : 0)), + options, priority_list, priority_len, main_buffer_size, + (main_buffer_size + ((overload & 1) ? DHCP_FILE_LEN : 0)), + terminate); + + /* Put the cookie up front... */ + memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4); + mainbufix = 4; + + /* + * If we're going to have to overload, store the overload option + * at the beginning. If we can, though, just store the whole + * thing in the packet's option buffer and leave it at that. + */ + if (option_size <= main_buffer_size - mainbufix) { + memcpy(&outpacket->options[mainbufix], + buffer, option_size); + mainbufix += option_size; + if (mainbufix < main_buffer_size) + outpacket->options[mainbufix++] = DHO_END; + length = DHCP_FIXED_NON_UDP + mainbufix; + } else { + outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD; + outpacket->options[mainbufix++] = 1; + if (option_size > + main_buffer_size - mainbufix + DHCP_FILE_LEN) + outpacket->options[mainbufix++] = 3; + else + outpacket->options[mainbufix++] = 1; + + memcpy(&outpacket->options[mainbufix], + buffer, main_buffer_size - mainbufix); + bufix = main_buffer_size - mainbufix; + length = DHCP_FIXED_NON_UDP + mainbufix; + if (overload & 1) { + if (option_size - bufix <= DHCP_FILE_LEN) { + memcpy(outpacket->file, + &buffer[bufix], option_size - bufix); + mainbufix = option_size - bufix; + if (mainbufix < DHCP_FILE_LEN) + outpacket->file[mainbufix++] = (char)DHO_END; + while (mainbufix < DHCP_FILE_LEN) + outpacket->file[mainbufix++] = (char)DHO_PAD; + } else { + memcpy(outpacket->file, + &buffer[bufix], DHCP_FILE_LEN); + bufix += DHCP_FILE_LEN; + } + } + if ((overload & 2) && option_size < bufix) { + memcpy(outpacket->sname, + &buffer[bufix], option_size - bufix); + + mainbufix = option_size - bufix; + if (mainbufix < DHCP_SNAME_LEN) + outpacket->file[mainbufix++] = (char)DHO_END; + while (mainbufix < DHCP_SNAME_LEN) + outpacket->file[mainbufix++] = (char)DHO_PAD; + } + } + return (length); +} + +/* + * Store all the requested options into the requested buffer. + */ +int +store_options(unsigned char *buffer, int buflen, struct tree_cache **options, + unsigned char *priority_list, int priority_len, int first_cutoff, + int second_cutoff, int terminate) +{ + int bufix = 0, option_stored[256], i, ix, tto; + + /* Zero out the stored-lengths array. */ + memset(option_stored, 0, sizeof(option_stored)); + + /* + * Copy out the options in the order that they appear in the + * priority list... + */ + for (i = 0; i < priority_len; i++) { + /* Code for next option to try to store. */ + int code = priority_list[i]; + int optstart; + + /* + * Number of bytes left to store (some may already have + * been stored by a previous pass). + */ + int length; + + /* If no data is available for this option, skip it. */ + if (!options[code]) { + continue; + } + + /* + * The client could ask for things that are mandatory, + * in which case we should avoid storing them twice... + */ + if (option_stored[code]) + continue; + option_stored[code] = 1; + + /* We should now have a constant length for the option. */ + length = options[code]->len; + + /* Do we add a NUL? */ + if (terminate && dhcp_options[code].format[0] == 't') { + length++; + tto = 1; + } else + tto = 0; + + /* Try to store the option. */ + + /* + * If the option's length is more than 255, we must + * store it in multiple hunks. Store 255-byte hunks + * first. However, in any case, if the option data will + * cross a buffer boundary, split it across that + * boundary. + */ + ix = 0; + + optstart = bufix; + while (length) { + unsigned char incr = length > 255 ? 255 : length; + + /* + * If this hunk of the buffer will cross a + * boundary, only go up to the boundary in this + * pass. + */ + if (bufix < first_cutoff && + bufix + incr > first_cutoff) + incr = first_cutoff - bufix; + else if (bufix < second_cutoff && + bufix + incr > second_cutoff) + incr = second_cutoff - bufix; + + /* + * If this option is going to overflow the + * buffer, skip it. + */ + if (bufix + 2 + incr > buflen) { + bufix = optstart; + break; + } + + /* Everything looks good - copy it in! */ + buffer[bufix] = code; + buffer[bufix + 1] = incr; + if (tto && incr == length) { + memcpy(buffer + bufix + 2, + options[code]->value + ix, incr - 1); + buffer[bufix + 2 + incr - 1] = 0; + } else + memcpy(buffer + bufix + 2, + options[code]->value + ix, incr); + length -= incr; + ix += incr; + bufix += 2 + incr; + } + } + return (bufix); +} + +/* + * Format the specified option so that a human can easily read it. + */ +char * +pretty_print_option(unsigned int code, unsigned char *data, int len, + int emit_commas, int emit_quotes) +{ + static char optbuf[32768]; /* XXX */ + int hunksize = 0, numhunk = -1, numelem = 0; + char fmtbuf[32], *op = optbuf; + int i, j, k, opleft = sizeof(optbuf); + unsigned char *dp = data; + struct in_addr foo; + char comma; + + /* Code should be between 0 and 255. */ + if (code > 255) + error("pretty_print_option: bad code %d", code); + + if (emit_commas) + comma = ','; + else + comma = ' '; + + /* Figure out the size of the data. */ + for (i = 0; dhcp_options[code].format[i]; i++) { + if (!numhunk) { + warning("%s: Excess information in format string: %s", + dhcp_options[code].name, + &(dhcp_options[code].format[i])); + break; + } + numelem++; + fmtbuf[i] = dhcp_options[code].format[i]; + switch (dhcp_options[code].format[i]) { + case 'A': + --numelem; + fmtbuf[i] = 0; + numhunk = 0; + break; + case 'X': + for (k = 0; k < len; k++) + if (!isascii(data[k]) || + !isprint(data[k])) + break; + if (k == len) { + fmtbuf[i] = 't'; + numhunk = -2; + } else { + fmtbuf[i] = 'x'; + hunksize++; + comma = ':'; + numhunk = 0; + } + fmtbuf[i + 1] = 0; + break; + case 't': + fmtbuf[i] = 't'; + fmtbuf[i + 1] = 0; + numhunk = -2; + break; + case 'I': + case 'l': + case 'L': + hunksize += 4; + break; + case 's': + case 'S': + hunksize += 2; + break; + case 'b': + case 'B': + case 'f': + hunksize++; + break; + case 'e': + break; + default: + warning("%s: garbage in format string: %s", + dhcp_options[code].name, + &(dhcp_options[code].format[i])); + break; + } + } + + /* Check for too few bytes... */ + if (hunksize > len) { + warning("%s: expecting at least %d bytes; got %d", + dhcp_options[code].name, hunksize, len); + return (""); + } + /* Check for too many bytes... */ + if (numhunk == -1 && hunksize < len) + warning("%s: %d extra bytes", + dhcp_options[code].name, len - hunksize); + + /* If this is an array, compute its size. */ + if (!numhunk) + numhunk = len / hunksize; + /* See if we got an exact number of hunks. */ + if (numhunk > 0 && numhunk * hunksize < len) + warning("%s: %d extra bytes at end of array", + dhcp_options[code].name, len - numhunk * hunksize); + + /* A one-hunk array prints the same as a single hunk. */ + if (numhunk < 0) + numhunk = 1; + + /* Cycle through the array (or hunk) printing the data. */ + for (i = 0; i < numhunk; i++) { + for (j = 0; j < numelem; j++) { + int opcount; + switch (fmtbuf[j]) { + case 't': + if (emit_quotes) { + *op++ = '"'; + opleft--; + } + for (; dp < data + len; dp++) { + if (!isascii(*dp) || + !isprint(*dp)) { + if (dp + 1 != data + len || + *dp != 0) { + _snprintf(op, opleft, + "\\%03o", *dp); + op += 4; + opleft -= 4; + } + } else if (*dp == '"' || + *dp == '\'' || + *dp == '$' || + *dp == '`' || + *dp == '\\') { + *op++ = '\\'; + *op++ = *dp; + opleft -= 2; + } else { + *op++ = *dp; + opleft--; + } + } + if (emit_quotes) { + *op++ = '"'; + opleft--; + } + + *op = 0; + break; + case 'I': + foo.s_addr = htonl(getULong(dp)); + strncpy(op, inet_ntoa(foo), opleft - 1); + op[opleft - 1] = ANSI_NULL; + opcount = strlen(op); + if (opcount >= opleft) + goto toobig; + opleft -= opcount; + dp += 4; + break; + case 'l': + opcount = _snprintf(op, opleft, "%ld", + (long)getLong(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 4; + break; + case 'L': + opcount = _snprintf(op, opleft, "%ld", + (unsigned long)getULong(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 4; + break; + case 's': + opcount = _snprintf(op, opleft, "%d", + getShort(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 2; + break; + case 'S': + opcount = _snprintf(op, opleft, "%d", + getUShort(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 2; + break; + case 'b': + opcount = _snprintf(op, opleft, "%d", + *(char *)dp++); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + break; + case 'B': + opcount = _snprintf(op, opleft, "%d", *dp++); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + break; + case 'x': + opcount = _snprintf(op, opleft, "%x", *dp++); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + break; + case 'f': + opcount = (size_t) strncpy(op, *dp++ ? "true" : "false", opleft - 1); + op[opleft - 1] = ANSI_NULL; + if (opcount >= opleft) + goto toobig; + opleft -= opcount; + break; + default: + warning("Unexpected format code %c", fmtbuf[j]); + } + op += strlen(op); + opleft -= strlen(op); + if (opleft < 1) + goto toobig; + if (j + 1 < numelem && comma != ':') { + *op++ = ' '; + opleft--; + } + } + if (i + 1 < numhunk) { + *op++ = comma; + opleft--; + } + if (opleft < 1) + goto toobig; + + } + return (optbuf); + toobig: + warning("dhcp option too large"); + return (""); +} + +void +do_packet(struct interface_info *interface, struct dhcp_packet *packet, + int len, unsigned int from_port, struct iaddr from, struct hardware *hfrom) +{ + struct packet tp; + int i; + + if (packet->hlen > sizeof(packet->chaddr)) { + note("Discarding packet with invalid hlen."); + return; + } + + memset(&tp, 0, sizeof(tp)); + tp.raw = packet; + tp.packet_length = len; + tp.client_port = from_port; + tp.client_addr = from; + tp.interface = interface; + tp.haddr = hfrom; + + parse_options(&tp); + if (tp.options_valid && + tp.options[DHO_DHCP_MESSAGE_TYPE].data) + tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0]; + if (tp.packet_type) + dhcp(&tp); + else + bootp(&tp); + + /* Free the data associated with the options. */ + for (i = 0; i < 256; i++) + if (tp.options[i].len && tp.options[i].data) + free(tp.options[i].data); +} diff --git a/reactos/dll/win32/dhcpcsvc/pipe.c b/reactos/dll/win32/dhcpcsvc/pipe.c new file mode 100644 index 00000000000..9ea0402c413 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/pipe.c @@ -0,0 +1,120 @@ +/* $Id: $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: subsys/system/dhcp/pipe.c + * PURPOSE: DHCP client pipe + * PROGRAMMER: arty + */ + +#include + +#define NDEBUG +#include + +static HANDLE CommPipe = INVALID_HANDLE_VALUE, CommThread; +DWORD CommThrId; + +#define COMM_PIPE_OUTPUT_BUFFER sizeof(COMM_DHCP_REQ) +#define COMM_PIPE_INPUT_BUFFER sizeof(COMM_DHCP_REPLY) +#define COMM_PIPE_DEFAULT_TIMEOUT 1000 + +DWORD PipeSend( COMM_DHCP_REPLY *Reply ) { + DWORD Written = 0; + BOOL Success = + WriteFile( CommPipe, + Reply, + sizeof(*Reply), + &Written, + NULL ); + return Success ? Written : -1; +} + +DWORD WINAPI PipeThreadProc( LPVOID Parameter ) { + DWORD BytesRead, BytesWritten; + COMM_DHCP_REQ Req; + COMM_DHCP_REPLY Reply; + BOOL Result, Connected; + + while( TRUE ) { + Connected = ConnectNamedPipe( CommPipe, NULL ) ? + TRUE : GetLastError() == ERROR_PIPE_CONNECTED; + + if (!Connected) { + DbgPrint("DHCP: Could not connect named pipe\n"); + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; + break; + } + + Result = ReadFile( CommPipe, &Req, sizeof(Req), &BytesRead, NULL ); + if( Result ) { + switch( Req.Type ) { + case DhcpReqQueryHWInfo: + BytesWritten = DSQueryHWInfo( PipeSend, &Req ); + break; + + case DhcpReqLeaseIpAddress: + BytesWritten = DSLeaseIpAddress( PipeSend, &Req ); + break; + + case DhcpReqReleaseIpAddress: + BytesWritten = DSReleaseIpAddressLease( PipeSend, &Req ); + break; + + case DhcpReqRenewIpAddress: + BytesWritten = DSRenewIpAddressLease( PipeSend, &Req ); + break; + + case DhcpReqStaticRefreshParams: + BytesWritten = DSStaticRefreshParams( PipeSend, &Req ); + break; + + case DhcpReqGetAdapterInfo: + BytesWritten = DSGetAdapterInfo( PipeSend, &Req ); + break; + + default: + DPRINT1("Unrecognized request type %d\n", Req.Type); + ZeroMemory( &Reply, sizeof( COMM_DHCP_REPLY ) ); + Reply.Reply = 0; + BytesWritten = PipeSend( &Reply ); + break; + } + } + DisconnectNamedPipe( CommPipe ); + } + + return TRUE; +} + +HANDLE PipeInit() { + CommPipe = CreateNamedPipeW + ( DHCP_PIPE_NAME, + PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + 1, + COMM_PIPE_OUTPUT_BUFFER, + COMM_PIPE_INPUT_BUFFER, + COMM_PIPE_DEFAULT_TIMEOUT, + NULL ); + + if( CommPipe == INVALID_HANDLE_VALUE ) { + DbgPrint("DHCP: Could not create named pipe\n"); + return CommPipe; + } + + CommThread = CreateThread( NULL, 0, PipeThreadProc, NULL, 0, &CommThrId ); + + if( !CommThread ) { + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; + } + + return CommPipe; +} + +VOID PipeDestroy() { + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; +} diff --git a/reactos/dll/win32/dhcpcsvc/socket.c b/reactos/dll/win32/dhcpcsvc/socket.c new file mode 100644 index 00000000000..849d04943b5 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/socket.c @@ -0,0 +1,39 @@ +#include "rosdhcp.h" + +SOCKET ServerSocket; + +void SocketInit() { + ServerSocket = socket( AF_INET, SOCK_DGRAM, 0 ); +} + +ssize_t send_packet( struct interface_info *ip, + struct dhcp_packet *p, + size_t size, + struct in_addr addr, + struct sockaddr_in *broadcast, + struct hardware *hardware ) { + int result = + sendto( ip->wfdesc, (char *)p, size, 0, + (struct sockaddr *)broadcast, sizeof(*broadcast) ); + + if (result < 0) { + note ("send_packet: %x", result); + if (result == WSAENETUNREACH) + note ("send_packet: please consult README file%s", + " regarding broadcast address."); + } + + return result; +} + +ssize_t receive_packet(struct interface_info *ip, + unsigned char *packet_data, + size_t packet_len, + struct sockaddr_in *dest, + struct hardware *hardware ) { + int recv_addr_size = sizeof(*dest); + int result = + recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0, + (struct sockaddr *)dest, &recv_addr_size ); + return result; +} diff --git a/reactos/dll/win32/dhcpcsvc/tables.c b/reactos/dll/win32/dhcpcsvc/tables.c new file mode 100644 index 00000000000..3de26b7cef6 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/tables.c @@ -0,0 +1,692 @@ +/* tables.c + + Tables of information... */ + +/* + * Copyright (c) 1995, 1996 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ +#define lint +#ifndef lint +static char copyright[] = +"$Id: tables.c,v 1.13.2.4 1999/04/24 16:46:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "rosdhcp.h" + +/* DHCP Option names, formats and codes, from RFC1533. + + Format codes: + + e - end of data + I - IP address + l - 32-bit signed integer + L - 32-bit unsigned integer + s - 16-bit signed integer + S - 16-bit unsigned integer + b - 8-bit signed integer + B - 8-bit unsigned integer + t - ASCII text + f - flag (true or false) + A - array of whatever precedes (e.g., IA means array of IP addresses) +*/ + +struct universe dhcp_universe; +struct dhcp_option dhcp_options [256] = { + { "pad", "", &dhcp_universe, 0 }, + { "subnet-mask", "I", &dhcp_universe, 1 }, + { "time-offset", "l", &dhcp_universe, 2 }, + { "routers", "IA", &dhcp_universe, 3 }, + { "time-servers", "IA", &dhcp_universe, 4 }, + { "ien116-name-servers", "IA", &dhcp_universe, 5 }, + { "domain-name-servers", "IA", &dhcp_universe, 6 }, + { "log-servers", "IA", &dhcp_universe, 7 }, + { "cookie-servers", "IA", &dhcp_universe, 8 }, + { "lpr-servers", "IA", &dhcp_universe, 9 }, + { "impress-servers", "IA", &dhcp_universe, 10 }, + { "resource-location-servers", "IA", &dhcp_universe, 11 }, + { "host-name", "X", &dhcp_universe, 12 }, + { "boot-size", "S", &dhcp_universe, 13 }, + { "merit-dump", "t", &dhcp_universe, 14 }, + { "domain-name", "t", &dhcp_universe, 15 }, + { "swap-server", "I", &dhcp_universe, 16 }, + { "root-path", "t", &dhcp_universe, 17 }, + { "extensions-path", "t", &dhcp_universe, 18 }, + { "ip-forwarding", "f", &dhcp_universe, 19 }, + { "non-local-source-routing", "f", &dhcp_universe, 20 }, + { "policy-filter", "IIA", &dhcp_universe, 21 }, + { "max-dgram-reassembly", "S", &dhcp_universe, 22 }, + { "default-ip-ttl", "B", &dhcp_universe, 23 }, + { "path-mtu-aging-timeout", "L", &dhcp_universe, 24 }, + { "path-mtu-plateau-table", "SA", &dhcp_universe, 25 }, + { "interface-mtu", "S", &dhcp_universe, 26 }, + { "all-subnets-local", "f", &dhcp_universe, 27 }, + { "broadcast-address", "I", &dhcp_universe, 28 }, + { "perform-mask-discovery", "f", &dhcp_universe, 29 }, + { "mask-supplier", "f", &dhcp_universe, 30 }, + { "router-discovery", "f", &dhcp_universe, 31 }, + { "router-solicitation-address", "I", &dhcp_universe, 32 }, + { "static-routes", "IIA", &dhcp_universe, 33 }, + { "trailer-encapsulation", "f", &dhcp_universe, 34 }, + { "arp-cache-timeout", "L", &dhcp_universe, 35 }, + { "ieee802-3-encapsulation", "f", &dhcp_universe, 36 }, + { "default-tcp-ttl", "B", &dhcp_universe, 37 }, + { "tcp-keepalive-interval", "L", &dhcp_universe, 38 }, + { "tcp-keepalive-garbage", "f", &dhcp_universe, 39 }, + { "nis-domain", "t", &dhcp_universe, 40 }, + { "nis-servers", "IA", &dhcp_universe, 41 }, + { "ntp-servers", "IA", &dhcp_universe, 42 }, + { "vendor-encapsulated-options", "X", &dhcp_universe, 43 }, + { "netbios-name-servers", "IA", &dhcp_universe, 44 }, + { "netbios-dd-server", "IA", &dhcp_universe, 45 }, + { "netbios-node-type", "B", &dhcp_universe, 46 }, + { "netbios-scope", "t", &dhcp_universe, 47 }, + { "font-servers", "IA", &dhcp_universe, 48 }, + { "x-display-manager", "IA", &dhcp_universe, 49 }, + { "dhcp-requested-address", "I", &dhcp_universe, 50 }, + { "dhcp-lease-time", "L", &dhcp_universe, 51 }, + { "dhcp-option-overload", "B", &dhcp_universe, 52 }, + { "dhcp-message-type", "B", &dhcp_universe, 53 }, + { "dhcp-server-identifier", "I", &dhcp_universe, 54 }, + { "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 }, + { "dhcp-message", "t", &dhcp_universe, 56 }, + { "dhcp-max-message-size", "S", &dhcp_universe, 57 }, + { "dhcp-renewal-time", "L", &dhcp_universe, 58 }, + { "dhcp-rebinding-time", "L", &dhcp_universe, 59 }, + { "dhcp-class-identifier", "t", &dhcp_universe, 60 }, + { "dhcp-client-identifier", "X", &dhcp_universe, 61 }, + { "option-62", "X", &dhcp_universe, 62 }, + { "option-63", "X", &dhcp_universe, 63 }, + { "nisplus-domain", "t", &dhcp_universe, 64 }, + { "nisplus-servers", "IA", &dhcp_universe, 65 }, + { "tftp-server-name", "t", &dhcp_universe, 66 }, + { "bootfile-name", "t", &dhcp_universe, 67 }, + { "mobile-ip-home-agent", "IA", &dhcp_universe, 68 }, + { "smtp-server", "IA", &dhcp_universe, 69 }, + { "pop-server", "IA", &dhcp_universe, 70 }, + { "nntp-server", "IA", &dhcp_universe, 71 }, + { "www-server", "IA", &dhcp_universe, 72 }, + { "finger-server", "IA", &dhcp_universe, 73 }, + { "irc-server", "IA", &dhcp_universe, 74 }, + { "streettalk-server", "IA", &dhcp_universe, 75 }, + { "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 }, + { "user-class", "t", &dhcp_universe, 77 }, + { "option-78", "X", &dhcp_universe, 78 }, + { "option-79", "X", &dhcp_universe, 79 }, + { "option-80", "X", &dhcp_universe, 80 }, + { "option-81", "X", &dhcp_universe, 81 }, + { "option-82", "X", &dhcp_universe, 82 }, + { "option-83", "X", &dhcp_universe, 83 }, + { "option-84", "X", &dhcp_universe, 84 }, + { "nds-servers", "IA", &dhcp_universe, 85 }, + { "nds-tree-name", "X", &dhcp_universe, 86 }, + { "nds-context", "X", &dhcp_universe, 87 }, + { "option-88", "X", &dhcp_universe, 88 }, + { "option-89", "X", &dhcp_universe, 89 }, + { "option-90", "X", &dhcp_universe, 90 }, + { "option-91", "X", &dhcp_universe, 91 }, + { "option-92", "X", &dhcp_universe, 92 }, + { "option-93", "X", &dhcp_universe, 93 }, + { "option-94", "X", &dhcp_universe, 94 }, + { "option-95", "X", &dhcp_universe, 95 }, + { "option-96", "X", &dhcp_universe, 96 }, + { "option-97", "X", &dhcp_universe, 97 }, + { "option-98", "X", &dhcp_universe, 98 }, + { "option-99", "X", &dhcp_universe, 99 }, + { "option-100", "X", &dhcp_universe, 100 }, + { "option-101", "X", &dhcp_universe, 101 }, + { "option-102", "X", &dhcp_universe, 102 }, + { "option-103", "X", &dhcp_universe, 103 }, + { "option-104", "X", &dhcp_universe, 104 }, + { "option-105", "X", &dhcp_universe, 105 }, + { "option-106", "X", &dhcp_universe, 106 }, + { "option-107", "X", &dhcp_universe, 107 }, + { "option-108", "X", &dhcp_universe, 108 }, + { "option-109", "X", &dhcp_universe, 109 }, + { "option-110", "X", &dhcp_universe, 110 }, + { "option-111", "X", &dhcp_universe, 111 }, + { "option-112", "X", &dhcp_universe, 112 }, + { "option-113", "X", &dhcp_universe, 113 }, + { "option-114", "X", &dhcp_universe, 114 }, + { "option-115", "X", &dhcp_universe, 115 }, + { "option-116", "X", &dhcp_universe, 116 }, + { "option-117", "X", &dhcp_universe, 117 }, + { "option-118", "X", &dhcp_universe, 118 }, + { "option-119", "X", &dhcp_universe, 119 }, + { "option-120", "X", &dhcp_universe, 120 }, + { "option-121", "X", &dhcp_universe, 121 }, + { "option-122", "X", &dhcp_universe, 122 }, + { "option-123", "X", &dhcp_universe, 123 }, + { "option-124", "X", &dhcp_universe, 124 }, + { "option-125", "X", &dhcp_universe, 125 }, + { "option-126", "X", &dhcp_universe, 126 }, + { "option-127", "X", &dhcp_universe, 127 }, + { "option-128", "X", &dhcp_universe, 128 }, + { "option-129", "X", &dhcp_universe, 129 }, + { "option-130", "X", &dhcp_universe, 130 }, + { "option-131", "X", &dhcp_universe, 131 }, + { "option-132", "X", &dhcp_universe, 132 }, + { "option-133", "X", &dhcp_universe, 133 }, + { "option-134", "X", &dhcp_universe, 134 }, + { "option-135", "X", &dhcp_universe, 135 }, + { "option-136", "X", &dhcp_universe, 136 }, + { "option-137", "X", &dhcp_universe, 137 }, + { "option-138", "X", &dhcp_universe, 138 }, + { "option-139", "X", &dhcp_universe, 139 }, + { "option-140", "X", &dhcp_universe, 140 }, + { "option-141", "X", &dhcp_universe, 141 }, + { "option-142", "X", &dhcp_universe, 142 }, + { "option-143", "X", &dhcp_universe, 143 }, + { "option-144", "X", &dhcp_universe, 144 }, + { "option-145", "X", &dhcp_universe, 145 }, + { "option-146", "X", &dhcp_universe, 146 }, + { "option-147", "X", &dhcp_universe, 147 }, + { "option-148", "X", &dhcp_universe, 148 }, + { "option-149", "X", &dhcp_universe, 149 }, + { "option-150", "X", &dhcp_universe, 150 }, + { "option-151", "X", &dhcp_universe, 151 }, + { "option-152", "X", &dhcp_universe, 152 }, + { "option-153", "X", &dhcp_universe, 153 }, + { "option-154", "X", &dhcp_universe, 154 }, + { "option-155", "X", &dhcp_universe, 155 }, + { "option-156", "X", &dhcp_universe, 156 }, + { "option-157", "X", &dhcp_universe, 157 }, + { "option-158", "X", &dhcp_universe, 158 }, + { "option-159", "X", &dhcp_universe, 159 }, + { "option-160", "X", &dhcp_universe, 160 }, + { "option-161", "X", &dhcp_universe, 161 }, + { "option-162", "X", &dhcp_universe, 162 }, + { "option-163", "X", &dhcp_universe, 163 }, + { "option-164", "X", &dhcp_universe, 164 }, + { "option-165", "X", &dhcp_universe, 165 }, + { "option-166", "X", &dhcp_universe, 166 }, + { "option-167", "X", &dhcp_universe, 167 }, + { "option-168", "X", &dhcp_universe, 168 }, + { "option-169", "X", &dhcp_universe, 169 }, + { "option-170", "X", &dhcp_universe, 170 }, + { "option-171", "X", &dhcp_universe, 171 }, + { "option-172", "X", &dhcp_universe, 172 }, + { "option-173", "X", &dhcp_universe, 173 }, + { "option-174", "X", &dhcp_universe, 174 }, + { "option-175", "X", &dhcp_universe, 175 }, + { "option-176", "X", &dhcp_universe, 176 }, + { "option-177", "X", &dhcp_universe, 177 }, + { "option-178", "X", &dhcp_universe, 178 }, + { "option-179", "X", &dhcp_universe, 179 }, + { "option-180", "X", &dhcp_universe, 180 }, + { "option-181", "X", &dhcp_universe, 181 }, + { "option-182", "X", &dhcp_universe, 182 }, + { "option-183", "X", &dhcp_universe, 183 }, + { "option-184", "X", &dhcp_universe, 184 }, + { "option-185", "X", &dhcp_universe, 185 }, + { "option-186", "X", &dhcp_universe, 186 }, + { "option-187", "X", &dhcp_universe, 187 }, + { "option-188", "X", &dhcp_universe, 188 }, + { "option-189", "X", &dhcp_universe, 189 }, + { "option-190", "X", &dhcp_universe, 190 }, + { "option-191", "X", &dhcp_universe, 191 }, + { "option-192", "X", &dhcp_universe, 192 }, + { "option-193", "X", &dhcp_universe, 193 }, + { "option-194", "X", &dhcp_universe, 194 }, + { "option-195", "X", &dhcp_universe, 195 }, + { "option-196", "X", &dhcp_universe, 196 }, + { "option-197", "X", &dhcp_universe, 197 }, + { "option-198", "X", &dhcp_universe, 198 }, + { "option-199", "X", &dhcp_universe, 199 }, + { "option-200", "X", &dhcp_universe, 200 }, + { "option-201", "X", &dhcp_universe, 201 }, + { "option-202", "X", &dhcp_universe, 202 }, + { "option-203", "X", &dhcp_universe, 203 }, + { "option-204", "X", &dhcp_universe, 204 }, + { "option-205", "X", &dhcp_universe, 205 }, + { "option-206", "X", &dhcp_universe, 206 }, + { "option-207", "X", &dhcp_universe, 207 }, + { "option-208", "X", &dhcp_universe, 208 }, + { "option-209", "X", &dhcp_universe, 209 }, + { "option-210", "X", &dhcp_universe, 210 }, + { "option-211", "X", &dhcp_universe, 211 }, + { "option-212", "X", &dhcp_universe, 212 }, + { "option-213", "X", &dhcp_universe, 213 }, + { "option-214", "X", &dhcp_universe, 214 }, + { "option-215", "X", &dhcp_universe, 215 }, + { "option-216", "X", &dhcp_universe, 216 }, + { "option-217", "X", &dhcp_universe, 217 }, + { "option-218", "X", &dhcp_universe, 218 }, + { "option-219", "X", &dhcp_universe, 219 }, + { "option-220", "X", &dhcp_universe, 220 }, + { "option-221", "X", &dhcp_universe, 221 }, + { "option-222", "X", &dhcp_universe, 222 }, + { "option-223", "X", &dhcp_universe, 223 }, + { "option-224", "X", &dhcp_universe, 224 }, + { "option-225", "X", &dhcp_universe, 225 }, + { "option-226", "X", &dhcp_universe, 226 }, + { "option-227", "X", &dhcp_universe, 227 }, + { "option-228", "X", &dhcp_universe, 228 }, + { "option-229", "X", &dhcp_universe, 229 }, + { "option-230", "X", &dhcp_universe, 230 }, + { "option-231", "X", &dhcp_universe, 231 }, + { "option-232", "X", &dhcp_universe, 232 }, + { "option-233", "X", &dhcp_universe, 233 }, + { "option-234", "X", &dhcp_universe, 234 }, + { "option-235", "X", &dhcp_universe, 235 }, + { "option-236", "X", &dhcp_universe, 236 }, + { "option-237", "X", &dhcp_universe, 237 }, + { "option-238", "X", &dhcp_universe, 238 }, + { "option-239", "X", &dhcp_universe, 239 }, + { "option-240", "X", &dhcp_universe, 240 }, + { "option-241", "X", &dhcp_universe, 241 }, + { "option-242", "X", &dhcp_universe, 242 }, + { "option-243", "X", &dhcp_universe, 243 }, + { "option-244", "X", &dhcp_universe, 244 }, + { "option-245", "X", &dhcp_universe, 245 }, + { "option-246", "X", &dhcp_universe, 246 }, + { "option-247", "X", &dhcp_universe, 247 }, + { "option-248", "X", &dhcp_universe, 248 }, + { "option-249", "X", &dhcp_universe, 249 }, + { "option-250", "X", &dhcp_universe, 250 }, + { "option-251", "X", &dhcp_universe, 251 }, + { "option-252", "X", &dhcp_universe, 252 }, + { "option-253", "X", &dhcp_universe, 253 }, + { "option-254", "X", &dhcp_universe, 254 }, + { "option-end", "e", &dhcp_universe, 255 }, +}; + +/* Default dhcp option priority list (this is ad hoc and should not be + mistaken for a carefully crafted and optimized list). */ +unsigned char dhcp_option_default_priority_list [] = { + DHO_DHCP_REQUESTED_ADDRESS, + DHO_DHCP_OPTION_OVERLOAD, + DHO_DHCP_MAX_MESSAGE_SIZE, + DHO_DHCP_RENEWAL_TIME, + DHO_DHCP_REBINDING_TIME, + DHO_DHCP_CLASS_IDENTIFIER, + DHO_DHCP_CLIENT_IDENTIFIER, + DHO_SUBNET_MASK, + DHO_TIME_OFFSET, + DHO_ROUTERS, + DHO_TIME_SERVERS, + DHO_NAME_SERVERS, + DHO_DOMAIN_NAME_SERVERS, + DHO_HOST_NAME, + DHO_LOG_SERVERS, + DHO_COOKIE_SERVERS, + DHO_LPR_SERVERS, + DHO_IMPRESS_SERVERS, + DHO_RESOURCE_LOCATION_SERVERS, + DHO_HOST_NAME, + DHO_BOOT_SIZE, + DHO_MERIT_DUMP, + DHO_DOMAIN_NAME, + DHO_SWAP_SERVER, + DHO_ROOT_PATH, + DHO_EXTENSIONS_PATH, + DHO_IP_FORWARDING, + DHO_NON_LOCAL_SOURCE_ROUTING, + DHO_POLICY_FILTER, + DHO_MAX_DGRAM_REASSEMBLY, + DHO_DEFAULT_IP_TTL, + DHO_PATH_MTU_AGING_TIMEOUT, + DHO_PATH_MTU_PLATEAU_TABLE, + DHO_INTERFACE_MTU, + DHO_ALL_SUBNETS_LOCAL, + DHO_BROADCAST_ADDRESS, + DHO_PERFORM_MASK_DISCOVERY, + DHO_MASK_SUPPLIER, + DHO_ROUTER_DISCOVERY, + DHO_ROUTER_SOLICITATION_ADDRESS, + DHO_STATIC_ROUTES, + DHO_TRAILER_ENCAPSULATION, + DHO_ARP_CACHE_TIMEOUT, + DHO_IEEE802_3_ENCAPSULATION, + DHO_DEFAULT_TCP_TTL, + DHO_TCP_KEEPALIVE_INTERVAL, + DHO_TCP_KEEPALIVE_GARBAGE, + DHO_NIS_DOMAIN, + DHO_NIS_SERVERS, + DHO_NTP_SERVERS, + DHO_VENDOR_ENCAPSULATED_OPTIONS, + DHO_NETBIOS_NAME_SERVERS, + DHO_NETBIOS_DD_SERVER, + DHO_NETBIOS_NODE_TYPE, + DHO_NETBIOS_SCOPE, + DHO_FONT_SERVERS, + DHO_X_DISPLAY_MANAGER, + DHO_DHCP_PARAMETER_REQUEST_LIST, + + /* Presently-undefined options... */ + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, +}; + +int sizeof_dhcp_option_default_priority_list = + sizeof dhcp_option_default_priority_list; + + +char *hardware_types [] = { + "unknown-0", + "ethernet", + "unknown-2", + "unknown-3", + "unknown-4", + "unknown-5", + "token-ring", + "unknown-7", + "fddi", + "unknown-9", + "unknown-10", + "unknown-11", + "unknown-12", + "unknown-13", + "unknown-14", + "unknown-15", + "unknown-16", + "unknown-17", + "unknown-18", + "unknown-19", + "unknown-20", + "unknown-21", + "unknown-22", + "unknown-23", + "unknown-24", + "unknown-25", + "unknown-26", + "unknown-27", + "unknown-28", + "unknown-29", + "unknown-30", + "unknown-31", + "unknown-32", + "unknown-33", + "unknown-34", + "unknown-35", + "unknown-36", + "unknown-37", + "unknown-38", + "unknown-39", + "unknown-40", + "unknown-41", + "unknown-42", + "unknown-43", + "unknown-44", + "unknown-45", + "unknown-46", + "unknown-47", + "unknown-48", + "unknown-49", + "unknown-50", + "unknown-51", + "unknown-52", + "unknown-53", + "unknown-54", + "unknown-55", + "unknown-56", + "unknown-57", + "unknown-58", + "unknown-59", + "unknown-60", + "unknown-61", + "unknown-62", + "unknown-63", + "unknown-64", + "unknown-65", + "unknown-66", + "unknown-67", + "unknown-68", + "unknown-69", + "unknown-70", + "unknown-71", + "unknown-72", + "unknown-73", + "unknown-74", + "unknown-75", + "unknown-76", + "unknown-77", + "unknown-78", + "unknown-79", + "unknown-80", + "unknown-81", + "unknown-82", + "unknown-83", + "unknown-84", + "unknown-85", + "unknown-86", + "unknown-87", + "unknown-88", + "unknown-89", + "unknown-90", + "unknown-91", + "unknown-92", + "unknown-93", + "unknown-94", + "unknown-95", + "unknown-96", + "unknown-97", + "unknown-98", + "unknown-99", + "unknown-100", + "unknown-101", + "unknown-102", + "unknown-103", + "unknown-104", + "unknown-105", + "unknown-106", + "unknown-107", + "unknown-108", + "unknown-109", + "unknown-110", + "unknown-111", + "unknown-112", + "unknown-113", + "unknown-114", + "unknown-115", + "unknown-116", + "unknown-117", + "unknown-118", + "unknown-119", + "unknown-120", + "unknown-121", + "unknown-122", + "unknown-123", + "unknown-124", + "unknown-125", + "unknown-126", + "unknown-127", + "unknown-128", + "unknown-129", + "unknown-130", + "unknown-131", + "unknown-132", + "unknown-133", + "unknown-134", + "unknown-135", + "unknown-136", + "unknown-137", + "unknown-138", + "unknown-139", + "unknown-140", + "unknown-141", + "unknown-142", + "unknown-143", + "unknown-144", + "unknown-145", + "unknown-146", + "unknown-147", + "unknown-148", + "unknown-149", + "unknown-150", + "unknown-151", + "unknown-152", + "unknown-153", + "unknown-154", + "unknown-155", + "unknown-156", + "unknown-157", + "unknown-158", + "unknown-159", + "unknown-160", + "unknown-161", + "unknown-162", + "unknown-163", + "unknown-164", + "unknown-165", + "unknown-166", + "unknown-167", + "unknown-168", + "unknown-169", + "unknown-170", + "unknown-171", + "unknown-172", + "unknown-173", + "unknown-174", + "unknown-175", + "unknown-176", + "unknown-177", + "unknown-178", + "unknown-179", + "unknown-180", + "unknown-181", + "unknown-182", + "unknown-183", + "unknown-184", + "unknown-185", + "unknown-186", + "unknown-187", + "unknown-188", + "unknown-189", + "unknown-190", + "unknown-191", + "unknown-192", + "unknown-193", + "unknown-194", + "unknown-195", + "unknown-196", + "unknown-197", + "unknown-198", + "unknown-199", + "unknown-200", + "unknown-201", + "unknown-202", + "unknown-203", + "unknown-204", + "unknown-205", + "unknown-206", + "unknown-207", + "unknown-208", + "unknown-209", + "unknown-210", + "unknown-211", + "unknown-212", + "unknown-213", + "unknown-214", + "unknown-215", + "unknown-216", + "unknown-217", + "unknown-218", + "unknown-219", + "unknown-220", + "unknown-221", + "unknown-222", + "unknown-223", + "unknown-224", + "unknown-225", + "unknown-226", + "unknown-227", + "unknown-228", + "unknown-229", + "unknown-230", + "unknown-231", + "unknown-232", + "unknown-233", + "unknown-234", + "unknown-235", + "unknown-236", + "unknown-237", + "unknown-238", + "unknown-239", + "unknown-240", + "unknown-241", + "unknown-242", + "unknown-243", + "unknown-244", + "unknown-245", + "unknown-246", + "unknown-247", + "unknown-248", + "unknown-249", + "unknown-250", + "unknown-251", + "unknown-252", + "unknown-253", + "unknown-254", + "unknown-255" }; + + + +struct hash_table universe_hash; + +void initialize_universes() +{ + int i; + + dhcp_universe.name = "dhcp"; + dhcp_universe.hash = new_hash (); + if (!dhcp_universe.hash) + error ("Can't allocate dhcp option hash table."); + for (i = 0; i < 256; i++) { + dhcp_universe.options [i] = &dhcp_options [i]; + add_hash (dhcp_universe.hash, + (unsigned char *)dhcp_options [i].name, 0, + (unsigned char *)&dhcp_options [i]); + } + universe_hash.hash_count = DEFAULT_HASH_SIZE; + add_hash (&universe_hash, + (unsigned char *)dhcp_universe.name, 0, + (unsigned char *)&dhcp_universe); +} diff --git a/reactos/dll/win32/dhcpcsvc/tree.c b/reactos/dll/win32/dhcpcsvc/tree.c new file mode 100644 index 00000000000..f721d08f897 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/tree.c @@ -0,0 +1,412 @@ +/* tree.c + + Routines for manipulating parse trees... */ + +/* + * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#ifndef lint +static char copyright[] = +"$Id: tree.c,v 1.10 1997/05/09 08:14:57 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "rosdhcp.h" + +static TIME tree_evaluate_recurse PROTO ((int *, unsigned char **, int *, + struct tree *)); +static TIME do_host_lookup PROTO ((int *, unsigned char **, int *, + struct dns_host_entry *)); +static void do_data_copy PROTO ((int *, unsigned char **, int *, + unsigned char *, int)); + +pair cons (car, cdr) + caddr_t car; + pair cdr; +{ + pair foo = (pair)dmalloc (sizeof *foo, "cons"); + if (!foo) + error ("no memory for cons."); + foo -> car = car; + foo -> cdr = cdr; + return foo; +} + +struct tree_cache *tree_cache (tree) + struct tree *tree; +{ + struct tree_cache *tc; + + tc = new_tree_cache ("tree_cache"); + if (!tc) + return 0; + tc -> value = (unsigned char *)0; + tc -> len = tc -> buf_size = 0; + tc -> timeout = 0; + tc -> tree = tree; + return tc; +} + +struct tree *tree_host_lookup (name) + char *name; +{ + struct tree *nt; + nt = new_tree ("tree_host_lookup"); + if (!nt) + error ("No memory for host lookup tree node."); + nt -> op = TREE_HOST_LOOKUP; + nt -> data.host_lookup.host = enter_dns_host (name); + return nt; +} + +struct dns_host_entry *enter_dns_host (name) + char *name; +{ + struct dns_host_entry *dh; + + if (!(dh = (struct dns_host_entry *)dmalloc + (sizeof (struct dns_host_entry), "enter_dns_host")) + || !(dh -> hostname = dmalloc (strlen (name) + 1, + "enter_dns_host"))) + error ("Can't allocate space for new host."); + strcpy (dh -> hostname, name); + dh -> data = (unsigned char *)0; + dh -> data_len = 0; + dh -> buf_len = 0; + dh -> timeout = 0; + return dh; +} + +struct tree *tree_const (data, len) + unsigned char *data; + int len; +{ + struct tree *nt; + if (!(nt = new_tree ("tree_const")) + || !(nt -> data.const_val.data = + (unsigned char *)dmalloc (len, "tree_const"))) + error ("No memory for constant data tree node."); + nt -> op = TREE_CONST; + memcpy (nt -> data.const_val.data, data, len); + nt -> data.const_val.len = len; + return nt; +} + +struct tree *tree_concat (left, right) + struct tree *left, *right; +{ + struct tree *nt; + + /* If we're concatenating a null tree to a non-null tree, just + return the non-null tree; if both trees are null, return + a null tree. */ + if (!left) + return right; + if (!right) + return left; + + /* If both trees are constant, combine them. */ + if (left -> op == TREE_CONST && right -> op == TREE_CONST) { + unsigned char *buf = dmalloc (left -> data.const_val.len + + right -> data.const_val.len, + "tree_concat"); + if (!buf) + error ("No memory to concatenate constants."); + memcpy (buf, left -> data.const_val.data, + left -> data.const_val.len); + memcpy (buf + left -> data.const_val.len, + right -> data.const_val.data, + right -> data.const_val.len); + dfree (left -> data.const_val.data, "tree_concat"); + dfree (right -> data.const_val.data, "tree_concat"); + left -> data.const_val.data = buf; + left -> data.const_val.len += right -> data.const_val.len; + free_tree (right, "tree_concat"); + return left; + } + + /* Otherwise, allocate a new node to concatenate the two. */ + if (!(nt = new_tree ("tree_concat"))) + error ("No memory for data tree concatenation node."); + nt -> op = TREE_CONCAT; + nt -> data.concat.left = left; + nt -> data.concat.right = right; + return nt; +} + +struct tree *tree_limit (tree, limit) + struct tree *tree; + int limit; +{ + struct tree *rv; + + /* If the tree we're limiting is constant, limit it now. */ + if (tree -> op == TREE_CONST) { + if (tree -> data.const_val.len > limit) + tree -> data.const_val.len = limit; + return tree; + } + + /* Otherwise, put in a node which enforces the limit on evaluation. */ + rv = new_tree ("tree_limit"); + if (!rv) + return (struct tree *)0; + rv -> op = TREE_LIMIT; + rv -> data.limit.tree = tree; + rv -> data.limit.limit = limit; + return rv; +} + +int tree_evaluate (tree_cache) + struct tree_cache *tree_cache; +{ + unsigned char *bp = tree_cache -> value; + int bc = tree_cache -> buf_size; + int bufix = 0; + + /* If there's no tree associated with this cache, it evaluates + to a constant and that was detected at startup. */ + if (!tree_cache -> tree) + return 1; + + /* Try to evaluate the tree without allocating more memory... */ + tree_cache -> timeout = tree_evaluate_recurse (&bufix, &bp, &bc, + tree_cache -> tree); + + /* No additional allocation needed? */ + if (bufix <= bc) { + tree_cache -> len = bufix; + return 1; + } + + /* If we can't allocate more memory, return with what we + have (maybe nothing). */ + if (!(bp = (unsigned char *)dmalloc (bufix, "tree_evaluate"))) + return 0; + + /* Record the change in conditions... */ + bc = bufix; + bufix = 0; + + /* Note that the size of the result shouldn't change on the + second call to tree_evaluate_recurse, since we haven't + changed the ``current'' time. */ + tree_evaluate_recurse (&bufix, &bp, &bc, tree_cache -> tree); + + /* Free the old buffer if needed, then store the new buffer + location and size and return. */ + if (tree_cache -> value) + dfree (tree_cache -> value, "tree_evaluate"); + tree_cache -> value = bp; + tree_cache -> len = bufix; + tree_cache -> buf_size = bc; + return 1; +} + +static TIME tree_evaluate_recurse (bufix, bufp, bufcount, tree) + int *bufix; + unsigned char **bufp; + int *bufcount; + struct tree *tree; +{ + int limit; + TIME t1, t2; + + switch (tree -> op) { + case TREE_CONCAT: + t1 = tree_evaluate_recurse (bufix, bufp, bufcount, + tree -> data.concat.left); + t2 = tree_evaluate_recurse (bufix, bufp, bufcount, + tree -> data.concat.right); + if (t1 > t2) + return t2; + return t1; + + case TREE_HOST_LOOKUP: + return do_host_lookup (bufix, bufp, bufcount, + tree -> data.host_lookup.host); + + case TREE_CONST: + do_data_copy (bufix, bufp, bufcount, + tree -> data.const_val.data, + tree -> data.const_val.len); + t1 = MAX_TIME; + return t1; + + case TREE_LIMIT: + limit = *bufix + tree -> data.limit.limit; + t1 = tree_evaluate_recurse (bufix, bufp, bufcount, + tree -> data.limit.tree); + *bufix = limit; + return t1; + + default: + warn ("Bad node id in tree: %d."); + t1 = MAX_TIME; + return t1; + } +} + +static TIME do_host_lookup (bufix, bufp, bufcount, dns) + int *bufix; + unsigned char **bufp; + int *bufcount; + struct dns_host_entry *dns; +{ + struct hostent *h; + int i; + int new_len; + +#ifdef DEBUG_EVAL + debug ("time: now = %d dns = %d %d diff = %d", + cur_time, dns -> timeout, cur_time - dns -> timeout); +#endif + + /* If the record hasn't timed out, just copy the data and return. */ + if (cur_time <= dns -> timeout) { +#ifdef DEBUG_EVAL + debug ("easy copy: %x %d %x", + dns -> data, dns -> data_len, + dns -> data ? *(int *)(dns -> data) : 0); +#endif + do_data_copy (bufix, bufp, bufcount, + dns -> data, dns -> data_len); + return dns -> timeout; + } +#ifdef DEBUG_EVAL + debug ("Looking up %s", dns -> hostname); +#endif + + /* Otherwise, look it up... */ + h = gethostbyname (dns -> hostname); + if (!h) { +#ifndef NO_H_ERRNO + switch (h_errno) { + case HOST_NOT_FOUND: +#endif + warn ("%s: host unknown.", dns -> hostname); +#ifndef NO_H_ERRNO + break; + case TRY_AGAIN: + warn ("%s: temporary name server failure", + dns -> hostname); + break; + case NO_RECOVERY: + warn ("%s: name server failed", dns -> hostname); + break; + case NO_DATA: + warn ("%s: no A record associated with address", + dns -> hostname); + } +#endif /* !NO_H_ERRNO */ + + /* Okay to try again after a minute. */ + return cur_time + 60; + } + +#ifdef DEBUG_EVAL + debug ("Lookup succeeded; first address is %x", + h -> h_addr_list [0]); +#endif + + /* Count the number of addresses we got... */ + for (i = 0; h -> h_addr_list [i]; i++) + ; + + /* Do we need to allocate more memory? */ + new_len = i * h -> h_length; + if (dns -> buf_len < i) { + unsigned char *buf = + (unsigned char *)dmalloc (new_len, "do_host_lookup"); + /* If we didn't get more memory, use what we have. */ + if (!buf) { + new_len = dns -> buf_len; + if (!dns -> buf_len) { + dns -> timeout = cur_time + 60; + return dns -> timeout; + } + } else { + if (dns -> data) + dfree (dns -> data, "do_host_lookup"); + dns -> data = buf; + dns -> buf_len = new_len; + } + } + + /* Addresses are conveniently stored one to the buffer, so we + have to copy them out one at a time... :'( */ + for (i = 0; i < new_len / h -> h_length; i++) { + memcpy (dns -> data + h -> h_length * i, + h -> h_addr_list [i], h -> h_length); + } +#ifdef DEBUG_EVAL + debug ("dns -> data: %x h -> h_addr_list [0]: %x", + *(int *)(dns -> data), h -> h_addr_list [0]); +#endif + dns -> data_len = new_len; + + /* Set the timeout for an hour from now. + XXX This should really use the time on the DNS reply. */ + dns -> timeout = cur_time + 3600; + +#ifdef DEBUG_EVAL + debug ("hard copy: %x %d %x", + dns -> data, dns -> data_len, *(int *)(dns -> data)); +#endif + do_data_copy (bufix, bufp, bufcount, dns -> data, dns -> data_len); + return dns -> timeout; +} + +static void do_data_copy (bufix, bufp, bufcount, data, len) + int *bufix; + unsigned char **bufp; + int *bufcount; + unsigned char *data; + int len; +{ + int space = *bufcount - *bufix; + + /* If there's more space than we need, use only what we need. */ + if (space > len) + space = len; + + /* Copy as much data as will fit, then increment the buffer index + by the amount we actually had to copy, which could be more. */ + if (space > 0) + memcpy (*bufp + *bufix, data, space); + *bufix += len; +} diff --git a/reactos/dll/win32/dhcpcsvc/util.c b/reactos/dll/win32/dhcpcsvc/util.c new file mode 100644 index 00000000000..238a788e283 --- /dev/null +++ b/reactos/dll/win32/dhcpcsvc/util.c @@ -0,0 +1,166 @@ +#include +#include "rosdhcp.h" + +#define NDEBUG +#include + +char *piaddr( struct iaddr addr ) { + struct sockaddr_in sa; + memcpy(&sa.sin_addr,addr.iabuf,sizeof(sa.sin_addr)); + return inet_ntoa( sa.sin_addr ); +} + +int note( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("NOTE: %s\n", buf); + + return ret; +} + +int debug( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("DEBUG: %s\n", buf); + + return ret; +} + +int warn( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("WARN: %s\n", buf); + + return ret; +} + +int warning( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("WARNING: %s\n", buf); + + return ret; +} + +void error( char *format, ... ) { + char buf[0x100]; + va_list arg_begin; + va_start( arg_begin, format ); + + _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT1("ERROR: %s\n", buf); +} + +int16_t getShort( unsigned char *data ) { + return (int16_t) ntohs(*(int16_t*) data); +} + +u_int16_t getUShort( unsigned char *data ) { + return (u_int16_t) ntohs(*(u_int16_t*) data); +} + +int32_t getLong( unsigned char *data ) { + return (int32_t) ntohl(*(u_int32_t*) data); +} + +u_int32_t getULong( unsigned char *data ) { + return ntohl(*(u_int32_t*)data); +} + +int addr_eq( struct iaddr a, struct iaddr b ) { + return a.len == b.len && !memcmp( a.iabuf, b.iabuf, a.len ); +} + +void *dmalloc( int size, char *name ) { return malloc( size ); } + +int read_client_conf(struct interface_info *ifi) { + /* What a strange dance */ + struct client_config *config; + char ComputerName [MAX_COMPUTERNAME_LENGTH + 1]; + LPSTR lpCompName; + DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0]; + + if ((ifi!= NULL) && (ifi->client->config != NULL)) + config = ifi->client->config; + else + { + warn("util.c read_client_conf poorly implemented!"); + return 0; + } + + + GetComputerName(ComputerName, & ComputerNameSize); + debug("Hostname: %s, length: %lu", + ComputerName, ComputerNameSize); + /* This never gets freed since it's only called once */ + lpCompName = + HeapAlloc(GetProcessHeap(), 0, ComputerNameSize + 1); + if (lpCompName !=NULL) { + memcpy(lpCompName, ComputerName, ComputerNameSize + 1); + /* Send our hostname, some dhcpds use this to update DNS */ + config->send_options[DHO_HOST_NAME].data = (u_int8_t*)lpCompName; + config->send_options[DHO_HOST_NAME].len = ComputerNameSize; + debug("Hostname: %s, length: %d", + config->send_options[DHO_HOST_NAME].data, + config->send_options[DHO_HOST_NAME].len); + } else { + error("Failed to allocate heap for hostname"); + } + /* Both Linux and Windows send this */ + config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].data = + ifi->hw_address.haddr; + config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].len = + ifi->hw_address.hlen; + + /* Setup the requested option list */ + config->requested_options + [config->requested_option_count++] = DHO_SUBNET_MASK; + config->requested_options + [config->requested_option_count++] = DHO_BROADCAST_ADDRESS; + config->requested_options + [config->requested_option_count++] = DHO_TIME_OFFSET; + config->requested_options + [config->requested_option_count++] = DHO_ROUTERS; + config->requested_options + [config->requested_option_count++] = DHO_DOMAIN_NAME; + config->requested_options + [config->requested_option_count++] = DHO_DOMAIN_NAME_SERVERS; + config->requested_options + [config->requested_option_count++] = DHO_HOST_NAME; + config->requested_options + [config->requested_option_count++] = DHO_NTP_SERVERS; + + warn("util.c read_client_conf poorly implemented!"); + return 0; +} + +struct iaddr broadcast_addr( struct iaddr addr, struct iaddr mask ) { + struct iaddr bcast = { 0 }; + return bcast; +} + +struct iaddr subnet_number( struct iaddr addr, struct iaddr mask ) { + struct iaddr bcast = { 0 }; + return bcast; +} diff --git a/reactos/dll/win32/iphlpapi/dhcp_reactos.c b/reactos/dll/win32/iphlpapi/dhcp_reactos.c index 1dd4b87eee9..9e8086f3cfb 100644 --- a/reactos/dll/win32/iphlpapi/dhcp_reactos.c +++ b/reactos/dll/win32/iphlpapi/dhcp_reactos.c @@ -8,6 +8,8 @@ #include "iphlpapi_private.h" #include "dhcp.h" +#include "dhcpcsdk.h" +#include "dhcpcapi.h" #include #define NDEBUG @@ -25,6 +27,27 @@ DWORD getDhcpInfoForAdapter(DWORD AdapterIndex, time_t *LeaseObtained, time_t *LeaseExpires) { - return DhcpRosGetAdapterInfo(AdapterIndex, DhcpEnabled, DhcpServer, - LeaseObtained, LeaseExpires); + DWORD Status, Version = 0; + + Status = DhcpCApiInitialize(&Version); + if (Status == ERROR_NOT_READY) + { + /* The DHCP server isn't running yet */ + *DhcpEnabled = FALSE; + *DhcpServer = htonl(INADDR_NONE); + *LeaseObtained = 0; + *LeaseExpires = 0; + return ERROR_SUCCESS; + } + else if (Status != ERROR_SUCCESS) + { + return Status; + } + + Status = DhcpRosGetAdapterInfo(AdapterIndex, DhcpEnabled, DhcpServer, + LeaseObtained, LeaseExpires); + + DhcpCApiCleanup(); + + return Status; } diff --git a/reactos/dll/win32/iphlpapi/iphlpapi.rbuild b/reactos/dll/win32/iphlpapi/iphlpapi.rbuild index 207a9f565b2..ed1fe25218e 100644 --- a/reactos/dll/win32/iphlpapi/iphlpapi.rbuild +++ b/reactos/dll/win32/iphlpapi/iphlpapi.rbuild @@ -2,7 +2,7 @@ . include/reactos/wine - include + include . wine ntdll diff --git a/reactos/dll/win32/iphlpapi/iphlpapi_main.c b/reactos/dll/win32/iphlpapi/iphlpapi_main.c index d945dadf836..3fd68560c17 100644 --- a/reactos/dll/win32/iphlpapi/iphlpapi_main.c +++ b/reactos/dll/win32/iphlpapi/iphlpapi_main.c @@ -49,7 +49,7 @@ #include "route.h" #include "wine/debug.h" #include "dhcpcsdk.h" -#include "dhcp/rosdhcp_public.h" +#include "dhcpcapi.h" WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); @@ -63,6 +63,7 @@ typedef struct _NAME_SERVER_LIST_CONTEXT { BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { + DWORD Version; switch (fdwReason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL ); @@ -1944,30 +1945,23 @@ DWORD WINAPI GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIP */ DWORD WINAPI IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo) { - COMM_DHCP_REPLY Reply; - COMM_DHCP_REQ Request; - DWORD BytesRead; - - Request.AdapterIndex = AdapterInfo->Index; - Request.Type = DhcpReqReleaseIpAddress; - - TRACE("AdapterInfo %p\n", AdapterInfo); - - if (CallNamedPipe(DHCP_PIPE_NAME, - &Request, - sizeof(Request), - &Reply, - sizeof(Reply), - &BytesRead, - NMPWAIT_USE_DEFAULT_WAIT)) - { - if (Reply.Reply) - return NO_ERROR; + DWORD Status, Version = 0; + if (!AdapterInfo || !AdapterInfo->Name) return ERROR_INVALID_PARAMETER; - } - return ERROR_PROC_NOT_FOUND; + /* Maybe we should do this in DllMain */ + if (DhcpCApiInitialize(&Version) != ERROR_SUCCESS) + return ERROR_PROC_NOT_FOUND; + + if (DhcpReleaseIpAddressLease(AdapterInfo->Index)) + Status = ERROR_SUCCESS; + else + Status = ERROR_PROC_NOT_FOUND; + + DhcpCApiCleanup(); + + return Status; } @@ -1985,30 +1979,23 @@ DWORD WINAPI IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo) */ DWORD WINAPI IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo) { - COMM_DHCP_REPLY Reply; - COMM_DHCP_REQ Request; - DWORD BytesRead; - - Request.AdapterIndex = AdapterInfo->Index; - Request.Type = DhcpReqRenewIpAddress; - - TRACE("AdapterInfo %p\n", AdapterInfo); - - if (CallNamedPipe(DHCP_PIPE_NAME, - &Request, - sizeof(Request), - &Reply, - sizeof(Reply), - &BytesRead, - NMPWAIT_USE_DEFAULT_WAIT)) - { - if (Reply.Reply) - return NO_ERROR; + DWORD Status, Version = 0; + if (!AdapterInfo || !AdapterInfo->Name) return ERROR_INVALID_PARAMETER; - } - return ERROR_PROC_NOT_FOUND; + /* Maybe we should do this in DllMain */ + if (DhcpCApiInitialize(&Version) != ERROR_SUCCESS) + return ERROR_PROC_NOT_FOUND; + + if (DhcpRenewIpAddressLease(AdapterInfo->Index)) + Status = ERROR_SUCCESS; + else + Status = ERROR_PROC_NOT_FOUND; + + DhcpCApiCleanup(); + + return Status; } diff --git a/reactos/include/psdk/dhcpcapi.h b/reactos/include/psdk/dhcpcapi.h index a6f93d13e35..9b7416c773f 100644 --- a/reactos/include/psdk/dhcpcapi.h +++ b/reactos/include/psdk/dhcpcapi.h @@ -1,17 +1,33 @@ #ifndef _DHCPCAPI_H #define _DHCPCAPI_H -#include -#include - #ifdef __cplusplus extern "C" { #endif - VOID WINAPI DhcpLeaseIpAddress( ULONG AdapterIndex ); - VOID WINAPI DhcpReleaseIpAddressLease( ULONG AdapterIndex ); - VOID WINAPI DhcpStaticRefreshParams - ( ULONG AdapterIndex, ULONG IpAddress, ULONG NetMask ); +DWORD APIENTRY DhcpLeaseIpAddress( DWORD AdapterIndex ); +DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, + PDWORD MediaType, + PDWORD Mtu, + PDWORD Speed ); +DWORD APIENTRY DhcpReleaseIpAddressLease( DWORD AdapterIndex ); +DWORD APIENTRY DhcpRenewIpAddressLease( DWORD AdapterIndex ); +DWORD APIENTRY DhcpStaticRefreshParams( DWORD AdapterIndex, + DWORD Address, + DWORD Netmask ); +DWORD APIENTRY +DhcpNotifyConfigChange(LPWSTR ServerName, + LPWSTR AdapterName, + BOOL NewIpAddress, + DWORD IpIndex, + DWORD IpAddress, + DWORD SubnetMask, + int DhcpAction); +DWORD APIENTRY DhcpRosGetAdapterInfo( DWORD AdapterIndex, + PBOOL DhcpEnabled, + PDWORD DhcpServer, + time_t *LeaseObtained, + time_t *LeaseExpires ); #ifdef __cplusplus } From 623631273434243ff9b63402c3df92ae3d70be60 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 21 May 2010 19:22:09 +0000 Subject: [PATCH 142/151] [DHCPCSVC] - Restore SVN history - Part 1 of x svn path=/trunk/; revision=47290 --- reactos/dll/win32/dhcpcsvc/adapter.c | 446 ---- reactos/dll/win32/dhcpcsvc/alloc.c | 93 - reactos/dll/win32/dhcpcsvc/api.c | 201 -- reactos/dll/win32/dhcpcsvc/compat.c | 67 - reactos/dll/win32/dhcpcsvc/dhclient.c | 1996 ------------------ reactos/dll/win32/dhcpcsvc/dhcpcsvc.c | 136 +- reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild | 18 - reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec | 3 +- reactos/dll/win32/dhcpcsvc/dispatch.c | 354 ---- reactos/dll/win32/dhcpcsvc/hash.c | 165 -- reactos/dll/win32/dhcpcsvc/include/debug.h | 51 - reactos/dll/win32/dhcpcsvc/include/dhcp.h | 169 -- reactos/dll/win32/dhcpcsvc/include/dhcpd.h | 485 ----- reactos/dll/win32/dhcpcsvc/include/hash.h | 56 - reactos/dll/win32/dhcpcsvc/include/rosdhcp.h | 100 - reactos/dll/win32/dhcpcsvc/include/tree.h | 66 - reactos/dll/win32/dhcpcsvc/options.c | 723 ------- reactos/dll/win32/dhcpcsvc/pipe.c | 120 -- reactos/dll/win32/dhcpcsvc/socket.c | 39 - reactos/dll/win32/dhcpcsvc/tables.c | 692 ------ reactos/dll/win32/dhcpcsvc/tree.c | 412 ---- reactos/dll/win32/dhcpcsvc/util.c | 166 -- 22 files changed, 28 insertions(+), 6530 deletions(-) delete mode 100644 reactos/dll/win32/dhcpcsvc/adapter.c delete mode 100644 reactos/dll/win32/dhcpcsvc/alloc.c delete mode 100644 reactos/dll/win32/dhcpcsvc/api.c delete mode 100644 reactos/dll/win32/dhcpcsvc/compat.c delete mode 100644 reactos/dll/win32/dhcpcsvc/dhclient.c delete mode 100644 reactos/dll/win32/dhcpcsvc/dispatch.c delete mode 100644 reactos/dll/win32/dhcpcsvc/hash.c delete mode 100644 reactos/dll/win32/dhcpcsvc/include/debug.h delete mode 100644 reactos/dll/win32/dhcpcsvc/include/dhcp.h delete mode 100644 reactos/dll/win32/dhcpcsvc/include/dhcpd.h delete mode 100644 reactos/dll/win32/dhcpcsvc/include/hash.h delete mode 100644 reactos/dll/win32/dhcpcsvc/include/rosdhcp.h delete mode 100644 reactos/dll/win32/dhcpcsvc/include/tree.h delete mode 100644 reactos/dll/win32/dhcpcsvc/options.c delete mode 100644 reactos/dll/win32/dhcpcsvc/pipe.c delete mode 100644 reactos/dll/win32/dhcpcsvc/socket.c delete mode 100644 reactos/dll/win32/dhcpcsvc/tables.c delete mode 100644 reactos/dll/win32/dhcpcsvc/tree.c delete mode 100644 reactos/dll/win32/dhcpcsvc/util.c diff --git a/reactos/dll/win32/dhcpcsvc/adapter.c b/reactos/dll/win32/dhcpcsvc/adapter.c deleted file mode 100644 index ea848bc8bcc..00000000000 --- a/reactos/dll/win32/dhcpcsvc/adapter.c +++ /dev/null @@ -1,446 +0,0 @@ -#include "rosdhcp.h" - -static SOCKET DhcpSocket = INVALID_SOCKET; -static LIST_ENTRY AdapterList; -static WSADATA wsd; - -PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { - int i = 0; - DWORD Error; - HKEY MainKey; - PCHAR *Out, OutKeyName; - DWORD CharTotal = 0, AppendLen = 1 + strlen(Append); - DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; - - Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); - - if( Error ) return NULL; - - Error = RegQueryInfoKey - ( MainKey, - NULL, NULL, NULL, - &MaxSubKeys, &MaxSubKeyLen, - NULL, NULL, NULL, NULL, NULL, NULL ); - - DH_DbgPrint(MID_TRACE,("MaxSubKeys: %d, MaxSubKeyLen %d\n", - MaxSubKeys, MaxSubKeyLen)); - - CharTotal = (sizeof(PCHAR) + MaxSubKeyLen + AppendLen) * (MaxSubKeys + 1); - - DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n", - AppendLen, CharTotal)); - - Out = (CHAR**) malloc( CharTotal ); - OutKeyName = ((PCHAR)&Out[MaxSubKeys+1]); - - if( !Out ) { RegCloseKey( MainKey ); return NULL; } - - i = 0; - do { - Out[i] = OutKeyName; - Error = RegEnumKey( MainKey, i, OutKeyName, MaxSubKeyLen ); - if( !Error ) { - strcat( OutKeyName, Append ); - DH_DbgPrint(MID_TRACE,("[%d]: %s\n", i, OutKeyName)); - OutKeyName += strlen(OutKeyName) + 1; - i++; - } else Out[i] = 0; - } while( Error == ERROR_SUCCESS ); - - RegCloseKey( MainKey ); - - return Out; -} - -PCHAR RegReadString( HKEY Root, PCHAR Subkey, PCHAR Value ) { - PCHAR SubOut = NULL; - DWORD SubOutLen = 0, Error = 0; - HKEY ValueKey = NULL; - - DH_DbgPrint(MID_TRACE,("Looking in %x:%s:%s\n", Root, Subkey, Value )); - - if( Subkey && strlen(Subkey) ) { - if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS ) - goto regerror; - } else ValueKey = Root; - - DH_DbgPrint(MID_TRACE,("Got Key %x\n", ValueKey)); - - if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, - (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) - goto regerror; - - DH_DbgPrint(MID_TRACE,("Value %s has size %d\n", Value, SubOutLen)); - - if( !(SubOut = (CHAR*) malloc(SubOutLen)) ) - goto regerror; - - if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, - (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) - goto regerror; - - DH_DbgPrint(MID_TRACE,("Value %s is %s\n", Value, SubOut)); - - goto cleanup; - -regerror: - if( SubOut ) { free( SubOut ); SubOut = NULL; } -cleanup: - if( ValueKey && ValueKey != Root ) { - DH_DbgPrint(MID_TRACE,("Closing key %x\n", ValueKey)); - RegCloseKey( ValueKey ); - } - - DH_DbgPrint(MID_TRACE,("Returning %x with error %d\n", SubOut, Error)); - - return SubOut; -} - -HKEY FindAdapterKey( PDHCP_ADAPTER Adapter ) { - int i = 0; - PCHAR EnumKeyName = - "SYSTEM\\CurrentControlSet\\Control\\Class\\" - "{4D36E972-E325-11CE-BFC1-08002BE10318}"; - PCHAR TargetKeyNameStart = - "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; - PCHAR TargetKeyName = NULL; - PCHAR *EnumKeysLinkage = GetSubkeyNames( EnumKeyName, "\\Linkage" ); - PCHAR *EnumKeysTop = GetSubkeyNames( EnumKeyName, "" ); - PCHAR RootDevice = NULL; - HKEY EnumKey, OutKey = NULL; - DWORD Error = ERROR_SUCCESS; - - if( !EnumKeysLinkage || !EnumKeysTop ) goto cleanup; - - Error = RegOpenKey( HKEY_LOCAL_MACHINE, EnumKeyName, &EnumKey ); - - if( Error ) goto cleanup; - - for( i = 0; EnumKeysLinkage[i]; i++ ) { - RootDevice = RegReadString - ( EnumKey, EnumKeysLinkage[i], "RootDevice" ); - - if( RootDevice && - !strcmp( RootDevice, Adapter->DhclientInfo.name ) ) { - TargetKeyName = - (CHAR*) malloc( strlen( TargetKeyNameStart ) + - strlen( RootDevice ) + 1); - if( !TargetKeyName ) goto cleanup; - sprintf( TargetKeyName, "%s%s", - TargetKeyNameStart, RootDevice ); - Error = RegCreateKeyExA( HKEY_LOCAL_MACHINE, TargetKeyName, 0, NULL, 0, KEY_READ, NULL, &OutKey, NULL ); - break; - } else { - free( RootDevice ); RootDevice = 0; - } - } - -cleanup: - if( RootDevice ) free( RootDevice ); - if( EnumKeysLinkage ) free( EnumKeysLinkage ); - if( EnumKeysTop ) free( EnumKeysTop ); - if( TargetKeyName ) free( TargetKeyName ); - - return OutKey; -} - -BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) { - HKEY AdapterKey = NULL; - PCHAR IPAddress = NULL, Netmask = NULL, DefaultGateway = NULL; - NTSTATUS Status = STATUS_SUCCESS; - DWORD Error = ERROR_SUCCESS; - - Adapter->DhclientState.config = &Adapter->DhclientConfig; - strncpy(Adapter->DhclientInfo.name, (char*)Adapter->IfMib.bDescr, - sizeof(Adapter->DhclientInfo.name)); - - AdapterKey = FindAdapterKey( Adapter ); - if( AdapterKey ) - IPAddress = RegReadString( AdapterKey, NULL, "IPAddress" ); - - if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) { - /* Non-automatic case */ - DH_DbgPrint - (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n", - Adapter->DhclientInfo.name, - Adapter->BindStatus, - IPAddress)); - - Adapter->DhclientState.state = S_STATIC; - - Netmask = RegReadString( AdapterKey, NULL, "Subnetmask" ); - - Status = AddIPAddress( inet_addr( IPAddress ), - inet_addr( Netmask ? Netmask : "255.255.255.0" ), - Adapter->IfMib.dwIndex, - &Adapter->NteContext, - &Adapter->NteInstance ); - - DefaultGateway = RegReadString( AdapterKey, NULL, "DefaultGateway" ); - - if( DefaultGateway ) { - Adapter->RouterMib.dwForwardDest = 0; - Adapter->RouterMib.dwForwardMask = 0; - Adapter->RouterMib.dwForwardMetric1 = 1; - Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; - Adapter->RouterMib.dwForwardNextHop = inet_addr(DefaultGateway); - Error = CreateIpForwardEntry( &Adapter->RouterMib ); - if( Error ) - warning("Failed to set default gateway %s: %ld\n", - DefaultGateway, Error); - } - - if( DefaultGateway ) free( DefaultGateway ); - if( Netmask ) free( Netmask ); - } else { - /* Automatic case */ - DH_DbgPrint - (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (dynamic)\n", - Adapter->DhclientInfo.name, - Adapter->BindStatus)); - - Adapter->DhclientInfo.client->state = S_INIT; - } - - if( IPAddress ) free( IPAddress ); - - return TRUE; -} - -void AdapterInit() { - WSAStartup(0x0101,&wsd); - - InitializeListHead( &AdapterList ); -} - -int -InterfaceConnected(MIB_IFROW IfEntry) -{ - if (IfEntry.dwOperStatus == IF_OPER_STATUS_CONNECTED || - IfEntry.dwOperStatus == IF_OPER_STATUS_OPERATIONAL) - return 1; - - DH_DbgPrint(MID_TRACE,("Interface %d is down\n", IfEntry.dwIndex)); - return 0; -} - -/* - * XXX Figure out the way to bind a specific adapter to a socket. - */ -BOOLEAN AdapterDiscover() { - PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE)); - DWORD Error, Size = sizeof(MIB_IFTABLE); - PDHCP_ADAPTER Adapter = NULL; - struct interface_info *ifi = NULL; - int i; - BOOLEAN ret = TRUE; - - DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n")); - - while( (Error = GetIfTable(Table, &Size, 0 )) == - ERROR_INSUFFICIENT_BUFFER ) { - DH_DbgPrint(MID_TRACE,("Error %d, New Buffer Size: %d\n", Error, Size)); - free( Table ); - Table = (PMIB_IFTABLE) malloc( Size ); - } - - if( Error != NO_ERROR ) { - ret = FALSE; - goto term; - } - - DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries)); - - for( i = Table->dwNumEntries - 1; i >= 0; i-- ) { - DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n", - Table->table[i].dwIndex)); - - if ((Adapter = AdapterFindByHardwareAddress(Table->table[i].bPhysAddr, Table->table[i].dwPhysAddrLen))) - { - /* This is an existing adapter */ - if (InterfaceConnected(Table->table[i])) { - /* We're still active so we stay in the list */ - ifi = &Adapter->DhclientInfo; - } else { - /* We've lost our link so out we go */ - RemoveEntryList(&Adapter->ListEntry); - free(Adapter); - } - - continue; - } - - Adapter = (DHCP_ADAPTER*) calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 ); - - if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET && InterfaceConnected(Table->table[i])) { - memcpy( &Adapter->IfMib, &Table->table[i], - sizeof(Adapter->IfMib) ); - Adapter->DhclientInfo.client = &Adapter->DhclientState; - Adapter->DhclientInfo.rbuf = Adapter->recv_buf; - Adapter->DhclientInfo.rbuf_max = Table->table[i].dwMtu; - Adapter->DhclientInfo.rbuf_len = - Adapter->DhclientInfo.rbuf_offset = 0; - memcpy(Adapter->DhclientInfo.hw_address.haddr, - Adapter->IfMib.bPhysAddr, - Adapter->IfMib.dwPhysAddrLen); - Adapter->DhclientInfo.hw_address.hlen = - Adapter->IfMib.dwPhysAddrLen; - /* I'm not sure where else to set this, but - some DHCP servers won't take a zero. - We checked the hardware type earlier in - the if statement. */ - Adapter->DhclientInfo.hw_address.htype = - HTYPE_ETHER; - - if( DhcpSocket == INVALID_SOCKET ) { - DhcpSocket = - Adapter->DhclientInfo.rfdesc = - Adapter->DhclientInfo.wfdesc = - socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); - - if (DhcpSocket != INVALID_SOCKET) { - Adapter->ListenAddr.sin_family = AF_INET; - Adapter->ListenAddr.sin_port = htons(LOCAL_PORT); - Adapter->BindStatus = - (bind( Adapter->DhclientInfo.rfdesc, - (struct sockaddr *)&Adapter->ListenAddr, - sizeof(Adapter->ListenAddr) ) == 0) ? - 0 : WSAGetLastError(); - } else { - error("socket() failed: %d\n", WSAGetLastError()); - } - } else { - Adapter->DhclientInfo.rfdesc = - Adapter->DhclientInfo.wfdesc = DhcpSocket; - } - - Adapter->DhclientConfig.timeout = DHCP_PANIC_TIMEOUT; - Adapter->DhclientConfig.initial_interval = DHCP_DISCOVER_INTERVAL; - Adapter->DhclientConfig.retry_interval = DHCP_DISCOVER_INTERVAL; - Adapter->DhclientConfig.select_interval = 1; - Adapter->DhclientConfig.reboot_timeout = DHCP_REBOOT_TIMEOUT; - Adapter->DhclientConfig.backoff_cutoff = DHCP_BACKOFF_MAX; - Adapter->DhclientState.interval = - Adapter->DhclientConfig.retry_interval; - - if( PrepareAdapterForService( Adapter ) ) { - Adapter->DhclientInfo.next = ifi; - ifi = &Adapter->DhclientInfo; - - read_client_conf(&Adapter->DhclientInfo); - - if (Adapter->DhclientInfo.client->state == S_INIT) - { - add_protocol(Adapter->DhclientInfo.name, - Adapter->DhclientInfo.rfdesc, - got_one, &Adapter->DhclientInfo); - - state_init(&Adapter->DhclientInfo); - } - - InsertTailList( &AdapterList, &Adapter->ListEntry ); - } else { free( Adapter ); Adapter = 0; } - } else { free( Adapter ); Adapter = 0; } - - if( !Adapter ) - DH_DbgPrint(MID_TRACE,("Adapter %d was rejected\n", - Table->table[i].dwIndex)); - } - - DH_DbgPrint(MID_TRACE,("done with AdapterInit\n")); - -term: - if( Table ) free( Table ); - return ret; -} - -void AdapterStop() { - PLIST_ENTRY ListEntry; - PDHCP_ADAPTER Adapter; - while( !IsListEmpty( &AdapterList ) ) { - ListEntry = (PLIST_ENTRY)RemoveHeadList( &AdapterList ); - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - free( Adapter ); - } - WSACleanup(); -} - -PDHCP_ADAPTER AdapterFindIndex( unsigned int indx ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for( ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink ) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if( Adapter->IfMib.dwIndex == indx ) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterFindName( const WCHAR *name ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for( ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink ) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if( !wcsicmp( Adapter->IfMib.wszName, name ) ) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterFindInfo( struct interface_info *ip ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for( ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink ) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if( ip == &Adapter->DhclientInfo ) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ) { - PDHCP_ADAPTER Adapter; - PLIST_ENTRY ListEntry; - - for(ListEntry = AdapterList.Flink; - ListEntry != &AdapterList; - ListEntry = ListEntry->Flink) { - Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); - if (Adapter->DhclientInfo.hw_address.hlen == hlen && - !memcmp(Adapter->DhclientInfo.hw_address.haddr, - haddr, - hlen)) return Adapter; - } - - return NULL; -} - -PDHCP_ADAPTER AdapterGetFirst() { - if( IsListEmpty( &AdapterList ) ) return NULL; else { - return CONTAINING_RECORD - ( AdapterList.Flink, DHCP_ADAPTER, ListEntry ); - } -} - -PDHCP_ADAPTER AdapterGetNext( PDHCP_ADAPTER This ) -{ - if( This->ListEntry.Flink == &AdapterList ) return NULL; - return CONTAINING_RECORD - ( This->ListEntry.Flink, DHCP_ADAPTER, ListEntry ); -} - -void if_register_send(struct interface_info *ip) { - -} - -void if_register_receive(struct interface_info *ip) { -} diff --git a/reactos/dll/win32/dhcpcsvc/alloc.c b/reactos/dll/win32/dhcpcsvc/alloc.c deleted file mode 100644 index 97027fa4445..00000000000 --- a/reactos/dll/win32/dhcpcsvc/alloc.c +++ /dev/null @@ -1,93 +0,0 @@ -/* $OpenBSD: alloc.c,v 1.9 2004/05/04 20:28:40 deraadt Exp $ */ - -/* Memory allocation... */ - -/* - * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#include "rosdhcp.h" -#include "dhcpd.h" - -struct string_list * -new_string_list(size_t size) -{ - struct string_list *rval; - - rval = calloc(1, sizeof(struct string_list) + size); - if (rval != NULL) - rval->string = ((char *)rval) + sizeof(struct string_list); - return (rval); -} - -struct hash_table * -new_hash_table(int count) -{ - struct hash_table *rval; - - rval = calloc(1, sizeof(struct hash_table) - - (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *)) + - (count * sizeof(struct hash_bucket *))); - if (rval == NULL) - return (NULL); - rval->hash_count = count; - return (rval); -} - -struct hash_bucket * -new_hash_bucket(void) -{ - struct hash_bucket *rval = calloc(1, sizeof(struct hash_bucket)); - - return (rval); -} - -void -dfree(void *ptr, char *name) -{ - if (!ptr) { - warning("dfree %s: free on null pointer.", name); - return; - } - free(ptr); -} - -void -free_hash_bucket(struct hash_bucket *ptr, char *name) -{ - dfree(ptr, name); -} diff --git a/reactos/dll/win32/dhcpcsvc/api.c b/reactos/dll/win32/dhcpcsvc/api.c deleted file mode 100644 index efa07a80a54..00000000000 --- a/reactos/dll/win32/dhcpcsvc/api.c +++ /dev/null @@ -1,201 +0,0 @@ -/* $Id: $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: subsys/system/dhcp/api.c - * PURPOSE: DHCP client api handlers - * PROGRAMMER: arty - */ - -#include "rosdhcp.h" -#include -#include - -#define NDEBUG -#include - -static CRITICAL_SECTION ApiCriticalSection; - -VOID ApiInit() { - InitializeCriticalSection( &ApiCriticalSection ); -} - -VOID ApiLock() { - EnterCriticalSection( &ApiCriticalSection ); -} - -VOID ApiUnlock() { - LeaveCriticalSection( &ApiCriticalSection ); -} - -VOID ApiFree() { - DeleteCriticalSection( &ApiCriticalSection ); -} - -/* This represents the service portion of the DHCP client API */ - -DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - add_protocol( Adapter->DhclientInfo.name, - Adapter->DhclientInfo.rfdesc, got_one, - &Adapter->DhclientInfo ); - Adapter->DhclientInfo.client->state = S_INIT; - state_reboot(&Adapter->DhclientInfo); - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if (Adapter) { - Reply.QueryHWInfo.AdapterIndex = Req->AdapterIndex; - Reply.QueryHWInfo.MediaType = Adapter->IfMib.dwType; - Reply.QueryHWInfo.Mtu = Adapter->IfMib.dwMtu; - Reply.QueryHWInfo.Speed = Adapter->IfMib.dwSpeed; - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - struct protocol* proto; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - if (Adapter->NteContext) - DeleteIPAddress( Adapter->NteContext ); - - proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); - if (proto) - remove_protocol(proto); - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - if( !Adapter || Adapter->DhclientState.state == S_STATIC ) { - Reply.Reply = 0; - ApiUnlock(); - return Send( &Reply ); - } - - Reply.Reply = 1; - - add_protocol( Adapter->DhclientInfo.name, - Adapter->DhclientInfo.rfdesc, got_one, - &Adapter->DhclientInfo ); - Adapter->DhclientInfo.client->state = S_INIT; - state_reboot(&Adapter->DhclientInfo); - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - NTSTATUS Status; - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - struct protocol* proto; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - if (Adapter->NteContext) - DeleteIPAddress( Adapter->NteContext ); - Adapter->DhclientState.state = S_STATIC; - proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); - if (proto) - remove_protocol(proto); - Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress, - Req->Body.StaticRefreshParams.Netmask, - Req->AdapterIndex, - &Adapter->NteContext, - &Adapter->NteInstance ); - Reply.Reply = NT_SUCCESS(Status); - } - - ApiUnlock(); - - return Send( &Reply ); -} - -DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { - COMM_DHCP_REPLY Reply; - PDHCP_ADAPTER Adapter; - - ApiLock(); - - Adapter = AdapterFindIndex( Req->AdapterIndex ); - - Reply.Reply = Adapter ? 1 : 0; - - if( Adapter ) { - Reply.GetAdapterInfo.DhcpEnabled = (S_STATIC != Adapter->DhclientState.state); - if (S_BOUND == Adapter->DhclientState.state) { - if (sizeof(Reply.GetAdapterInfo.DhcpServer) == - Adapter->DhclientState.active->serveraddress.len) { - memcpy(&Reply.GetAdapterInfo.DhcpServer, - Adapter->DhclientState.active->serveraddress.iabuf, - Adapter->DhclientState.active->serveraddress.len); - } else { - DPRINT1("Unexpected server address len %d\n", - Adapter->DhclientState.active->serveraddress.len); - Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); - } - Reply.GetAdapterInfo.LeaseObtained = Adapter->DhclientState.active->obtained; - Reply.GetAdapterInfo.LeaseExpires = Adapter->DhclientState.active->expiry; - } else { - Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); - Reply.GetAdapterInfo.LeaseObtained = 0; - Reply.GetAdapterInfo.LeaseExpires = 0; - } - } - - ApiUnlock(); - - return Send( &Reply ); -} diff --git a/reactos/dll/win32/dhcpcsvc/compat.c b/reactos/dll/win32/dhcpcsvc/compat.c deleted file mode 100644 index 83c9c12ea8c..00000000000 --- a/reactos/dll/win32/dhcpcsvc/compat.c +++ /dev/null @@ -1,67 +0,0 @@ -#include "rosdhcp.h" -#include "dhcpd.h" -#include "stdint.h" - -size_t strlcpy(char *d, const char *s, size_t bufsize) -{ - size_t len = strlen(s); - size_t ret = len; - if (bufsize > 0) { - if (len >= bufsize) - len = bufsize-1; - memcpy(d, s, len); - d[len] = 0; - } - return ret; -} - -// not really random :( -u_int32_t arc4random() -{ - static int did_srand = 0; - u_int32_t ret; - - if (!did_srand) { - srand(0); - did_srand = 1; - } - - ret = rand() << 10 ^ rand(); - return ret; -} - - -int inet_aton(const char *cp, struct in_addr *inp) -/* inet_addr code from ROS, slightly modified. */ -{ - ULONG Octets[4] = {0,0,0,0}; - ULONG i = 0; - - if(!cp) - return 0; - - while(*cp) - { - CHAR c = *cp; - cp++; - - if(c == '.') - { - i++; - continue; - } - - if(c < '0' || c > '9') - return 0; - - Octets[i] *= 10; - Octets[i] += (c - '0'); - - if(Octets[i] > 255) - return 0; - } - - inp->S_un.S_addr = (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0]; - return 1; -} - diff --git a/reactos/dll/win32/dhcpcsvc/dhclient.c b/reactos/dll/win32/dhcpcsvc/dhclient.c deleted file mode 100644 index a27c7b667ad..00000000000 --- a/reactos/dll/win32/dhcpcsvc/dhclient.c +++ /dev/null @@ -1,1996 +0,0 @@ -/* $OpenBSD: dhclient.c,v 1.62 2004/12/05 18:35:51 deraadt Exp $ */ - -/* - * Copyright 2004 Henning Brauer - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - * - * This client was substantially modified and enhanced by Elliot Poger - * for use on Linux while he was working on the MosquitoNet project at - * Stanford. - * - * The current version owes much to Elliot's Linux enhancements, but - * was substantially reorganized and partially rewritten by Ted Lemon - * so as to use the same networking framework that the Internet Software - * Consortium DHCP server uses. Much system-specific configuration code - * was moved into a shell script so that as support for more operating - * systems is added, it will not be necessary to port and maintain - * system-specific configuration code to these operating systems - instead, - * the shell script can invoke the native tools to accomplish the same - * purpose. - */ - -#include "rosdhcp.h" -#include "dhcpd.h" - -#define PERIOD 0x2e -#define hyphenchar(c) ((c) == 0x2d) -#define bslashchar(c) ((c) == 0x5c) -#define periodchar(c) ((c) == PERIOD) -#define asterchar(c) ((c) == 0x2a) -#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) || \ - ((c) >= 0x61 && (c) <= 0x7a)) -#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) - -#define borderchar(c) (alphachar(c) || digitchar(c)) -#define middlechar(c) (borderchar(c) || hyphenchar(c)) -#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) - -unsigned long debug_trace_level = 0; /* DEBUG_ULTRA */ - -char *path_dhclient_conf = _PATH_DHCLIENT_CONF; -char *path_dhclient_db = NULL; - -int log_perror = 1; -int privfd; -//int nullfd = -1; - -struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; -struct in_addr inaddr_any; -struct sockaddr_in sockaddr_broadcast; - -/* - * ASSERT_STATE() does nothing now; it used to be - * assert (state_is == state_shouldbe). - */ -#define ASSERT_STATE(state_is, state_shouldbe) {} - -#define TIME_MAX 2147483647 - -int log_priority; -int no_daemon; -int unknown_ok = 1; -int routefd; - -void usage(void); -int check_option(struct client_lease *l, int option); -int ipv4addrs(char * buf); -int res_hnok(const char *dn); -char *option_as_string(unsigned int code, unsigned char *data, int len); -int fork_privchld(int, int); -int check_arp( struct interface_info *ip, struct client_lease *lp ); - -#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) - -time_t scripttime; - -static WCHAR ServiceName[] = L"DHCP"; - -SERVICE_STATUS_HANDLE ServiceStatusHandle = 0; -SERVICE_STATUS ServiceStatus; - - -/* XXX Implement me */ -int check_arp( struct interface_info *ip, struct client_lease *lp ) { - return 1; -} - - -static VOID -UpdateServiceStatus(DWORD dwState) -{ - ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; - ServiceStatus.dwCurrentState = dwState; - - ServiceStatus.dwControlsAccepted = 0; - - ServiceStatus.dwWin32ExitCode = 0; - ServiceStatus.dwServiceSpecificExitCode = 0; - ServiceStatus.dwCheckPoint = 0; - - if (dwState == SERVICE_START_PENDING || - dwState == SERVICE_STOP_PENDING || - dwState == SERVICE_PAUSE_PENDING || - dwState == SERVICE_CONTINUE_PENDING) - ServiceStatus.dwWaitHint = 10000; - else - ServiceStatus.dwWaitHint = 0; - - SetServiceStatus(ServiceStatusHandle, - &ServiceStatus); -} - - -static DWORD WINAPI -ServiceControlHandler(DWORD dwControl, - DWORD dwEventType, - LPVOID lpEventData, - LPVOID lpContext) -{ - switch (dwControl) - { - case SERVICE_CONTROL_STOP: - UpdateServiceStatus(SERVICE_STOP_PENDING); - UpdateServiceStatus(SERVICE_STOPPED); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_PAUSE: - UpdateServiceStatus(SERVICE_PAUSED); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_CONTINUE: - UpdateServiceStatus(SERVICE_START_PENDING); - UpdateServiceStatus(SERVICE_RUNNING); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_INTERROGATE: - SetServiceStatus(ServiceStatusHandle, - &ServiceStatus); - return ERROR_SUCCESS; - - case SERVICE_CONTROL_SHUTDOWN: - UpdateServiceStatus(SERVICE_STOP_PENDING); - UpdateServiceStatus(SERVICE_STOPPED); - return ERROR_SUCCESS; - - default : - return ERROR_CALL_NOT_IMPLEMENTED; - } -} - - -VOID NTAPI -ServiceMain(DWORD argc, LPWSTR *argv) -{ - ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, - ServiceControlHandler, - NULL); - if (!ServiceStatusHandle) - { - DbgPrint("DHCPCSVC: Unable to register service control handler (%x)\n", GetLastError); - return; - } - - UpdateServiceStatus(SERVICE_START_PENDING); - - ApiInit(); - AdapterInit(); - - tzset(); - - memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); - sockaddr_broadcast.sin_family = AF_INET; - sockaddr_broadcast.sin_port = htons(REMOTE_PORT); - sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; - inaddr_any.s_addr = INADDR_ANY; - bootp_packet_handler = do_packet; - - if (PipeInit() == INVALID_HANDLE_VALUE) - { - DbgPrint("DHCPCSVC: PipeInit() failed!\n"); - AdapterStop(); - ApiFree(); - UpdateServiceStatus(SERVICE_STOPPED); - } - - DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); - - UpdateServiceStatus(SERVICE_RUNNING); - - DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); - - DbgPrint("DHCPCSVC: DHCP service is starting up\n"); - - dispatch(); - - DbgPrint("DHCPCSVC: DHCP service is shutting down\n"); - - //AdapterStop(); - //ApiFree(); - /* FIXME: Close pipe and kill pipe thread */ - - UpdateServiceStatus(SERVICE_STOPPED); -} - -/* - * Individual States: - * - * Each routine is called from the dhclient_state_machine() in one of - * these conditions: - * -> entering INIT state - * -> recvpacket_flag == 0: timeout in this state - * -> otherwise: received a packet in this state - * - * Return conditions as handled by dhclient_state_machine(): - * Returns 1, sendpacket_flag = 1: send packet, reset timer. - * Returns 1, sendpacket_flag = 0: just reset the timer (wait for a milestone). - * Returns 0: finish the nap which was interrupted for no good reason. - * - * Several per-interface variables are used to keep track of the process: - * active_lease: the lease that is being used on the interface - * (null pointer if not configured yet). - * offered_leases: leases corresponding to DHCPOFFER messages that have - * been sent to us by DHCP servers. - * acked_leases: leases corresponding to DHCPACK messages that have been - * sent to us by DHCP servers. - * sendpacket: DHCP packet we're trying to send. - * destination: IP address to send sendpacket to - * In addition, there are several relevant per-lease variables. - * T1_expiry, T2_expiry, lease_expiry: lease milestones - * In the active lease, these control the process of renewing the lease; - * In leases on the acked_leases list, this simply determines when we - * can no longer legitimately use the lease. - */ - -void -state_reboot(void *ipp) -{ - struct interface_info *ip = ipp; - ULONG foo = (ULONG) GetTickCount(); - - /* If we don't remember an active lease, go straight to INIT. */ - if (!ip->client->active || ip->client->active->is_bootp) { - state_init(ip); - return; - } - - /* We are in the rebooting state. */ - ip->client->state = S_REBOOTING; - - /* make_request doesn't initialize xid because it normally comes - from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER, - so pick an xid now. */ - ip->client->xid = RtlRandom(&foo); - - /* Make a DHCPREQUEST packet, and set appropriate per-interface - flags. */ - make_request(ip, ip->client->active); - ip->client->destination = iaddr_broadcast; - time(&ip->client->first_sending); - ip->client->interval = ip->client->config->initial_interval; - - /* Zap the medium list... */ - ip->client->medium = NULL; - - /* Send out the first DHCPREQUEST packet. */ - send_request(ip); -} - -/* - * Called when a lease has completely expired and we've - * been unable to renew it. - */ -void -state_init(void *ipp) -{ - struct interface_info *ip = ipp; - - ASSERT_STATE(state, S_INIT); - - /* Make a DHCPDISCOVER packet, and set appropriate per-interface - flags. */ - make_discover(ip, ip->client->active); - ip->client->xid = ip->client->packet.xid; - ip->client->destination = iaddr_broadcast; - ip->client->state = S_SELECTING; - time(&ip->client->first_sending); - ip->client->interval = ip->client->config->initial_interval; - - /* Add an immediate timeout to cause the first DHCPDISCOVER packet - to go out. */ - send_discover(ip); -} - -/* - * state_selecting is called when one or more DHCPOFFER packets - * have been received and a configurable period of time has passed. - */ -void -state_selecting(void *ipp) -{ - struct interface_info *ip = ipp; - struct client_lease *lp, *next, *picked; - time_t cur_time; - - ASSERT_STATE(state, S_SELECTING); - - time(&cur_time); - - /* Cancel state_selecting and send_discover timeouts, since either - one could have got us here. */ - cancel_timeout(state_selecting, ip); - cancel_timeout(send_discover, ip); - - /* We have received one or more DHCPOFFER packets. Currently, - the only criterion by which we judge leases is whether or - not we get a response when we arp for them. */ - picked = NULL; - for (lp = ip->client->offered_leases; lp; lp = next) { - next = lp->next; - - /* Check to see if we got an ARPREPLY for the address - in this particular lease. */ - if (!picked) { - if( !check_arp(ip,lp) ) goto freeit; - picked = lp; - picked->next = NULL; - } else { -freeit: - free_client_lease(lp); - } - } - ip->client->offered_leases = NULL; - - /* If we just tossed all the leases we were offered, go back - to square one. */ - if (!picked) { - ip->client->state = S_INIT; - state_init(ip); - return; - } - - /* If it was a BOOTREPLY, we can just take the address right now. */ - if (!picked->options[DHO_DHCP_MESSAGE_TYPE].len) { - ip->client->new = picked; - - /* Make up some lease expiry times - XXX these should be configurable. */ - ip->client->new->expiry = cur_time + 12000; - ip->client->new->renewal += cur_time + 8000; - ip->client->new->rebind += cur_time + 10000; - - ip->client->state = S_REQUESTING; - - /* Bind to the address we received. */ - bind_lease(ip); - return; - } - - /* Go to the REQUESTING state. */ - ip->client->destination = iaddr_broadcast; - ip->client->state = S_REQUESTING; - ip->client->first_sending = cur_time; - ip->client->interval = ip->client->config->initial_interval; - - /* Make a DHCPREQUEST packet from the lease we picked. */ - make_request(ip, picked); - ip->client->xid = ip->client->packet.xid; - - /* Toss the lease we picked - we'll get it back in a DHCPACK. */ - free_client_lease(picked); - - /* Add an immediate timeout to send the first DHCPREQUEST packet. */ - send_request(ip); -} - -/* state_requesting is called when we receive a DHCPACK message after - having sent out one or more DHCPREQUEST packets. */ - -void -dhcpack(struct packet *packet) -{ - struct interface_info *ip = packet->interface; - struct client_lease *lease; - time_t cur_time; - - time(&cur_time); - - /* If we're not receptive to an offer right now, or if the offer - has an unrecognizable transaction id, then just drop it. */ - if (packet->interface->client->xid != packet->raw->xid || - (packet->interface->hw_address.hlen != packet->raw->hlen) || - (memcmp(packet->interface->hw_address.haddr, - packet->raw->chaddr, packet->raw->hlen))) - return; - - if (ip->client->state != S_REBOOTING && - ip->client->state != S_REQUESTING && - ip->client->state != S_RENEWING && - ip->client->state != S_REBINDING) - return; - - note("DHCPACK from %s", piaddr(packet->client_addr)); - - lease = packet_to_lease(packet); - if (!lease) { - note("packet_to_lease failed."); - return; - } - - ip->client->new = lease; - - /* Stop resending DHCPREQUEST. */ - cancel_timeout(send_request, ip); - - /* Figure out the lease time. */ - if (ip->client->new->options[DHO_DHCP_LEASE_TIME].data) - ip->client->new->expiry = getULong( - ip->client->new->options[DHO_DHCP_LEASE_TIME].data); - else - ip->client->new->expiry = DHCP_DEFAULT_LEASE_TIME; - /* A number that looks negative here is really just very large, - because the lease expiry offset is unsigned. */ - if (ip->client->new->expiry < 0) - ip->client->new->expiry = TIME_MAX; - /* XXX should be fixed by resetting the client state */ - if (ip->client->new->expiry < 60) - ip->client->new->expiry = 60; - - /* Take the server-provided renewal time if there is one; - otherwise figure it out according to the spec. */ - if (ip->client->new->options[DHO_DHCP_RENEWAL_TIME].len) - ip->client->new->renewal = getULong( - ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data); - else - ip->client->new->renewal = ip->client->new->expiry / 2; - - /* Same deal with the rebind time. */ - if (ip->client->new->options[DHO_DHCP_REBINDING_TIME].len) - ip->client->new->rebind = getULong( - ip->client->new->options[DHO_DHCP_REBINDING_TIME].data); - else - ip->client->new->rebind = ip->client->new->renewal + - ip->client->new->renewal / 2 + ip->client->new->renewal / 4; - -#ifdef __REACTOS__ - ip->client->new->obtained = cur_time; -#endif - ip->client->new->expiry += cur_time; - /* Lease lengths can never be negative. */ - if (ip->client->new->expiry < cur_time) - ip->client->new->expiry = TIME_MAX; - ip->client->new->renewal += cur_time; - if (ip->client->new->renewal < cur_time) - ip->client->new->renewal = TIME_MAX; - ip->client->new->rebind += cur_time; - if (ip->client->new->rebind < cur_time) - ip->client->new->rebind = TIME_MAX; - - bind_lease(ip); -} - -void set_name_servers( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { - CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; - HKEY RegKey; - - strcat(Buffer, Adapter->DhclientInfo.name); - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &RegKey ) != ERROR_SUCCESS) - return; - - - if( new_lease->options[DHO_DOMAIN_NAME_SERVERS].len ) { - - struct iaddr nameserver; - char *nsbuf; - int i, addrs = - new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG); - - nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) ); - - if( nsbuf) { - nsbuf[0] = 0; - for( i = 0; i < addrs; i++ ) { - nameserver.len = sizeof(ULONG); - memcpy( nameserver.iabuf, - new_lease->options[DHO_DOMAIN_NAME_SERVERS].data + - (i * sizeof(ULONG)), sizeof(ULONG) ); - strcat( nsbuf, piaddr(nameserver) ); - if( i != addrs-1 ) strcat( nsbuf, "," ); - } - - DH_DbgPrint(MID_TRACE,("Setting DhcpNameserver: %s\n", nsbuf)); - - RegSetValueExA( RegKey, "DhcpNameServer", 0, REG_SZ, - (LPBYTE)nsbuf, strlen(nsbuf) + 1 ); - free( nsbuf ); - } - - } else { - RegDeleteValueW( RegKey, L"DhcpNameServer" ); - } - - RegCloseKey( RegKey ); - -} - -void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { - CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; - struct iaddr netmask; - HKEY hkey; - int i; - DWORD dwEnableDHCP; - - strcat(Buffer, Adapter->DhclientInfo.name); - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &hkey) != ERROR_SUCCESS) - hkey = NULL; - - - if( Adapter->NteContext ) - DeleteIPAddress( Adapter->NteContext ); - - /* Set up our default router if we got one from the DHCP server */ - if( new_lease->options[DHO_SUBNET_MASK].len ) { - NTSTATUS Status; - - memcpy( netmask.iabuf, - new_lease->options[DHO_SUBNET_MASK].data, - new_lease->options[DHO_SUBNET_MASK].len ); - Status = AddIPAddress - ( *((ULONG*)new_lease->address.iabuf), - *((ULONG*)netmask.iabuf), - Adapter->IfMib.dwIndex, - &Adapter->NteContext, - &Adapter->NteInstance ); - if (hkey) { - RegSetValueExA(hkey, "DhcpIPAddress", 0, REG_SZ, (LPBYTE)piaddr(new_lease->address), strlen(piaddr(new_lease->address))+1); - Buffer[0] = '\0'; - for(i = 0; i < new_lease->options[DHO_SUBNET_MASK].len; i++) - { - sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_SUBNET_MASK].data[i]); - if (i + 1 < new_lease->options[DHO_SUBNET_MASK].len) - strcat(Buffer, "."); - } - RegSetValueExA(hkey, "DhcpSubnetMask", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); - RegSetValueExA(hkey, "IPAddress", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); - RegSetValueExA(hkey, "SubnetMask", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); - dwEnableDHCP = 1; - RegSetValueExA(hkey, "EnableDHCP", 0, REG_DWORD, (LPBYTE)&dwEnableDHCP, sizeof(DWORD)); - } - - if( !NT_SUCCESS(Status) ) - warning("AddIPAddress: %lx\n", Status); - } - - if( new_lease->options[DHO_ROUTERS].len ) { - NTSTATUS Status; - - Adapter->RouterMib.dwForwardDest = 0; /* Default route */ - Adapter->RouterMib.dwForwardMask = 0; - Adapter->RouterMib.dwForwardMetric1 = 1; - Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; - - if( Adapter->RouterMib.dwForwardNextHop ) { - /* If we set a default route before, delete it before continuing */ - DeleteIpForwardEntry( &Adapter->RouterMib ); - } - - Adapter->RouterMib.dwForwardNextHop = - *((ULONG*)new_lease->options[DHO_ROUTERS].data); - - Status = CreateIpForwardEntry( &Adapter->RouterMib ); - - if( !NT_SUCCESS(Status) ) - warning("CreateIpForwardEntry: %lx\n", Status); - - if (hkey) { - Buffer[0] = '\0'; - for(i = 0; i < new_lease->options[DHO_ROUTERS].len; i++) - { - sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_ROUTERS].data[i]); - if (i + 1 < new_lease->options[DHO_ROUTERS].len) - strcat(Buffer, "."); - } - RegSetValueExA(hkey, "DhcpDefaultGateway", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); - RegSetValueExA(hkey, "DefaultGateway", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); - } - } - - if (hkey) - RegCloseKey(hkey); -} - - -void -bind_lease(struct interface_info *ip) -{ - PDHCP_ADAPTER Adapter; - struct client_lease *new_lease = ip->client->new; - time_t cur_time; - - time(&cur_time); - - /* Remember the medium. */ - ip->client->new->medium = ip->client->medium; - ip->client->active = ip->client->new; - ip->client->new = NULL; - - /* Set up a timeout to start the renewal process. */ - /* Timeout of zero means no timeout (some implementations seem to use - * one day). - */ - if( ip->client->active->renewal - cur_time ) - add_timeout(ip->client->active->renewal, state_bound, ip); - - note("bound to %s -- renewal in %ld seconds.", - piaddr(ip->client->active->address), - (long int)(ip->client->active->renewal - cur_time)); - - ip->client->state = S_BOUND; - - Adapter = AdapterFindInfo( ip ); - - if( Adapter ) setup_adapter( Adapter, new_lease ); - else { - warning("Could not find adapter for info %p\n", ip); - return; - } - set_name_servers( Adapter, new_lease ); -} - -/* - * state_bound is called when we've successfully bound to a particular - * lease, but the renewal time on that lease has expired. We are - * expected to unicast a DHCPREQUEST to the server that gave us our - * original lease. - */ -void -state_bound(void *ipp) -{ - struct interface_info *ip = ipp; - - ASSERT_STATE(state, S_BOUND); - - /* T1 has expired. */ - make_request(ip, ip->client->active); - ip->client->xid = ip->client->packet.xid; - - if (ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) { - memcpy(ip->client->destination.iabuf, ip->client->active-> - options[DHO_DHCP_SERVER_IDENTIFIER].data, 4); - ip->client->destination.len = 4; - } else - ip->client->destination = iaddr_broadcast; - - time(&ip->client->first_sending); - ip->client->interval = ip->client->config->initial_interval; - ip->client->state = S_RENEWING; - - /* Send the first packet immediately. */ - send_request(ip); -} - -void -bootp(struct packet *packet) -{ - struct iaddrlist *ap; - - if (packet->raw->op != BOOTREPLY) - return; - - /* If there's a reject list, make sure this packet's sender isn't - on it. */ - for (ap = packet->interface->client->config->reject_list; - ap; ap = ap->next) { - if (addr_eq(packet->client_addr, ap->addr)) { - note("BOOTREPLY from %s rejected.", piaddr(ap->addr)); - return; - } - } - dhcpoffer(packet); -} - -void -dhcp(struct packet *packet) -{ - struct iaddrlist *ap; - void (*handler)(struct packet *); - char *type; - - switch (packet->packet_type) { - case DHCPOFFER: - handler = dhcpoffer; - type = "DHCPOFFER"; - break; - case DHCPNAK: - handler = dhcpnak; - type = "DHCPNACK"; - break; - case DHCPACK: - handler = dhcpack; - type = "DHCPACK"; - break; - default: - return; - } - - /* If there's a reject list, make sure this packet's sender isn't - on it. */ - for (ap = packet->interface->client->config->reject_list; - ap; ap = ap->next) { - if (addr_eq(packet->client_addr, ap->addr)) { - note("%s from %s rejected.", type, piaddr(ap->addr)); - return; - } - } - (*handler)(packet); -} - -void -dhcpoffer(struct packet *packet) -{ - struct interface_info *ip = packet->interface; - struct client_lease *lease, *lp; - int i; - int arp_timeout_needed = 0, stop_selecting; - char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? - "DHCPOFFER" : "BOOTREPLY"; - time_t cur_time; - - time(&cur_time); - - /* If we're not receptive to an offer right now, or if the offer - has an unrecognizable transaction id, then just drop it. */ - if (ip->client->state != S_SELECTING || - packet->interface->client->xid != packet->raw->xid || - (packet->interface->hw_address.hlen != packet->raw->hlen) || - (memcmp(packet->interface->hw_address.haddr, - packet->raw->chaddr, packet->raw->hlen))) - return; - - note("%s from %s", name, piaddr(packet->client_addr)); - - - /* If this lease doesn't supply the minimum required parameters, - blow it off. */ - for (i = 0; ip->client->config->required_options[i]; i++) { - if (!packet->options[ip->client->config-> - required_options[i]].len) { - note("%s isn't satisfactory.", name); - return; - } - } - - /* If we've already seen this lease, don't record it again. */ - for (lease = ip->client->offered_leases; - lease; lease = lease->next) { - if (lease->address.len == sizeof(packet->raw->yiaddr) && - !memcmp(lease->address.iabuf, - &packet->raw->yiaddr, lease->address.len)) { - debug("%s already seen.", name); - return; - } - } - - lease = packet_to_lease(packet); - if (!lease) { - note("packet_to_lease failed."); - return; - } - - /* If this lease was acquired through a BOOTREPLY, record that - fact. */ - if (!packet->options[DHO_DHCP_MESSAGE_TYPE].len) - lease->is_bootp = 1; - - /* Record the medium under which this lease was offered. */ - lease->medium = ip->client->medium; - - /* Send out an ARP Request for the offered IP address. */ - if( !check_arp( ip, lease ) ) { - note("Arp check failed\n"); - return; - } - - /* Figure out when we're supposed to stop selecting. */ - stop_selecting = - ip->client->first_sending + ip->client->config->select_interval; - - /* If this is the lease we asked for, put it at the head of the - list, and don't mess with the arp request timeout. */ - if (lease->address.len == ip->client->requested_address.len && - !memcmp(lease->address.iabuf, - ip->client->requested_address.iabuf, - ip->client->requested_address.len)) { - lease->next = ip->client->offered_leases; - ip->client->offered_leases = lease; - } else { - /* If we already have an offer, and arping for this - offer would take us past the selection timeout, - then don't extend the timeout - just hope for the - best. */ - if (ip->client->offered_leases && - (cur_time + arp_timeout_needed) > stop_selecting) - arp_timeout_needed = 0; - - /* Put the lease at the end of the list. */ - lease->next = NULL; - if (!ip->client->offered_leases) - ip->client->offered_leases = lease; - else { - for (lp = ip->client->offered_leases; lp->next; - lp = lp->next) - ; /* nothing */ - lp->next = lease; - } - } - - /* If we're supposed to stop selecting before we've had time - to wait for the ARPREPLY, add some delay to wait for - the ARPREPLY. */ - if (stop_selecting - cur_time < arp_timeout_needed) - stop_selecting = cur_time + arp_timeout_needed; - - /* If the selecting interval has expired, go immediately to - state_selecting(). Otherwise, time out into - state_selecting at the select interval. */ - if (stop_selecting <= 0) - state_selecting(ip); - else { - add_timeout(stop_selecting, state_selecting, ip); - cancel_timeout(send_discover, ip); - } -} - -/* Allocate a client_lease structure and initialize it from the parameters - in the specified packet. */ - -struct client_lease * -packet_to_lease(struct packet *packet) -{ - struct client_lease *lease; - int i; - - lease = malloc(sizeof(struct client_lease)); - - if (!lease) { - warning("dhcpoffer: no memory to record lease."); - return (NULL); - } - - memset(lease, 0, sizeof(*lease)); - - /* Copy the lease options. */ - for (i = 0; i < 256; i++) { - if (packet->options[i].len) { - lease->options[i].data = - malloc(packet->options[i].len + 1); - if (!lease->options[i].data) { - warning("dhcpoffer: no memory for option %d", i); - free_client_lease(lease); - return (NULL); - } else { - memcpy(lease->options[i].data, - packet->options[i].data, - packet->options[i].len); - lease->options[i].len = - packet->options[i].len; - lease->options[i].data[lease->options[i].len] = - 0; - } - if (!check_option(lease,i)) { - /* ignore a bogus lease offer */ - warning("Invalid lease option - ignoring offer"); - free_client_lease(lease); - return (NULL); - } - } - } - - lease->address.len = sizeof(packet->raw->yiaddr); - memcpy(lease->address.iabuf, &packet->raw->yiaddr, lease->address.len); -#ifdef __REACTOS__ - lease->serveraddress.len = sizeof(packet->raw->siaddr); - memcpy(lease->serveraddress.iabuf, &packet->raw->siaddr, lease->address.len); -#endif - - /* If the server name was filled out, copy it. */ - if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || - !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) && - packet->raw->sname[0]) { - lease->server_name = malloc(DHCP_SNAME_LEN + 1); - if (!lease->server_name) { - warning("dhcpoffer: no memory for server name."); - free_client_lease(lease); - return (NULL); - } - memcpy(lease->server_name, packet->raw->sname, DHCP_SNAME_LEN); - lease->server_name[DHCP_SNAME_LEN]='\0'; - if (!res_hnok(lease->server_name) ) { - warning("Bogus server name %s", lease->server_name ); - free_client_lease(lease); - return (NULL); - } - - } - - /* Ditto for the filename. */ - if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || - !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)) && - packet->raw->file[0]) { - /* Don't count on the NUL terminator. */ - lease->filename = malloc(DHCP_FILE_LEN + 1); - if (!lease->filename) { - warning("dhcpoffer: no memory for filename."); - free_client_lease(lease); - return (NULL); - } - memcpy(lease->filename, packet->raw->file, DHCP_FILE_LEN); - lease->filename[DHCP_FILE_LEN]='\0'; - } - return lease; -} - -void -dhcpnak(struct packet *packet) -{ - struct interface_info *ip = packet->interface; - - /* If we're not receptive to an offer right now, or if the offer - has an unrecognizable transaction id, then just drop it. */ - if (packet->interface->client->xid != packet->raw->xid || - (packet->interface->hw_address.hlen != packet->raw->hlen) || - (memcmp(packet->interface->hw_address.haddr, - packet->raw->chaddr, packet->raw->hlen))) - return; - - if (ip->client->state != S_REBOOTING && - ip->client->state != S_REQUESTING && - ip->client->state != S_RENEWING && - ip->client->state != S_REBINDING) - return; - - note("DHCPNAK from %s", piaddr(packet->client_addr)); - - if (!ip->client->active) { - note("DHCPNAK with no active lease.\n"); - return; - } - - free_client_lease(ip->client->active); - ip->client->active = NULL; - - /* Stop sending DHCPREQUEST packets... */ - cancel_timeout(send_request, ip); - - ip->client->state = S_INIT; - state_init(ip); -} - -/* Send out a DHCPDISCOVER packet, and set a timeout to send out another - one after the right interval has expired. If we don't get an offer by - the time we reach the panic interval, call the panic function. */ - -void -send_discover(void *ipp) -{ - struct interface_info *ip = ipp; - int interval, increase = 1; - time_t cur_time; - - DH_DbgPrint(MID_TRACE,("Doing discover on interface %p\n",ip)); - - time(&cur_time); - - /* Figure out how long it's been since we started transmitting. */ - interval = cur_time - ip->client->first_sending; - - /* If we're past the panic timeout, call the script and tell it - we haven't found anything for this interface yet. */ - if (interval > ip->client->config->timeout) { - state_panic(ip); - return; - } - - /* If we're selecting media, try the whole list before doing - the exponential backoff, but if we've already received an - offer, stop looping, because we obviously have it right. */ - if (!ip->client->offered_leases && - ip->client->config->media) { - int fail = 0; - - if (ip->client->medium) { - ip->client->medium = ip->client->medium->next; - increase = 0; - } - if (!ip->client->medium) { - if (fail) - error("No valid media types for %s!", ip->name); - ip->client->medium = ip->client->config->media; - increase = 1; - } - - note("Trying medium \"%s\" %d", ip->client->medium->string, - increase); - /* XXX Support other media types eventually */ - } - - /* - * If we're supposed to increase the interval, do so. If it's - * currently zero (i.e., we haven't sent any packets yet), set - * it to one; otherwise, add to it a random number between zero - * and two times itself. On average, this means that it will - * double with every transmission. - */ - if (increase) { - if (!ip->client->interval) - ip->client->interval = - ip->client->config->initial_interval; - else { - ip->client->interval += (rand() >> 2) % - (2 * ip->client->interval); - } - - /* Don't backoff past cutoff. */ - if (ip->client->interval > - ip->client->config->backoff_cutoff) - ip->client->interval = - ((ip->client->config->backoff_cutoff / 2) - + ((rand() >> 2) % - ip->client->config->backoff_cutoff)); - } else if (!ip->client->interval) - ip->client->interval = - ip->client->config->initial_interval; - - /* If the backoff would take us to the panic timeout, just use that - as the interval. */ - if (cur_time + ip->client->interval > - ip->client->first_sending + ip->client->config->timeout) - ip->client->interval = - (ip->client->first_sending + - ip->client->config->timeout) - cur_time + 1; - - /* Record the number of seconds since we started sending. */ - if (interval < 65536) - ip->client->packet.secs = htons(interval); - else - ip->client->packet.secs = htons(65535); - ip->client->secs = ip->client->packet.secs; - - note("DHCPDISCOVER on %s to %s port %d interval %ld", - ip->name, inet_ntoa(sockaddr_broadcast.sin_addr), - ntohs(sockaddr_broadcast.sin_port), (long int)ip->client->interval); - - /* Send out a packet. */ - (void)send_packet(ip, &ip->client->packet, ip->client->packet_length, - inaddr_any, &sockaddr_broadcast, NULL); - - DH_DbgPrint(MID_TRACE,("discover timeout: now %x -> then %x\n", - cur_time, cur_time + ip->client->interval)); - - add_timeout(cur_time + ip->client->interval, send_discover, ip); -} - -/* - * state_panic gets called if we haven't received any offers in a preset - * amount of time. When this happens, we try to use existing leases - * that haven't yet expired, and failing that, we call the client script - * and hope it can do something. - */ -void -state_panic(void *ipp) -{ - struct interface_info *ip = ipp; - time_t cur_time; - - time(&cur_time); - - note("No DHCPOFFERS received."); - - note("No working leases in persistent database - sleeping.\n"); - ip->client->state = S_INIT; - add_timeout(cur_time + ip->client->config->retry_interval, state_init, - ip); - /* XXX Take any failure actions necessary */ -} - -void -send_request(void *ipp) -{ - struct interface_info *ip = ipp; - struct sockaddr_in destination; - struct in_addr from; - int interval; - time_t cur_time; - - time(&cur_time); - - /* Figure out how long it's been since we started transmitting. */ - interval = cur_time - ip->client->first_sending; - - /* If we're in the INIT-REBOOT or REQUESTING state and we're - past the reboot timeout, go to INIT and see if we can - DISCOVER an address... */ - /* XXX In the INIT-REBOOT state, if we don't get an ACK, it - means either that we're on a network with no DHCP server, - or that our server is down. In the latter case, assuming - that there is a backup DHCP server, DHCPDISCOVER will get - us a new address, but we could also have successfully - reused our old address. In the former case, we're hosed - anyway. This is not a win-prone situation. */ - if ((ip->client->state == S_REBOOTING || - ip->client->state == S_REQUESTING) && - interval > ip->client->config->reboot_timeout) { - ip->client->state = S_INIT; - cancel_timeout(send_request, ip); - state_init(ip); - return; - } - - /* If we're in the reboot state, make sure the media is set up - correctly. */ - if (ip->client->state == S_REBOOTING && - !ip->client->medium && - ip->client->active->medium ) { - /* If the medium we chose won't fly, go to INIT state. */ - /* XXX Nothing for now */ - - /* Record the medium. */ - ip->client->medium = ip->client->active->medium; - } - - /* If the lease has expired, relinquish the address and go back - to the INIT state. */ - if (ip->client->state != S_REQUESTING && - cur_time > ip->client->active->expiry) { - PDHCP_ADAPTER Adapter = AdapterFindInfo( ip ); - /* Run the client script with the new parameters. */ - /* No script actions necessary in the expiry case */ - /* Now do a preinit on the interface so that we can - discover a new address. */ - - if( Adapter ) - DeleteIPAddress( Adapter->NteContext ); - - ip->client->state = S_INIT; - state_init(ip); - return; - } - - /* Do the exponential backoff... */ - if (!ip->client->interval) - ip->client->interval = ip->client->config->initial_interval; - else - ip->client->interval += ((rand() >> 2) % - (2 * ip->client->interval)); - - /* Don't backoff past cutoff. */ - if (ip->client->interval > - ip->client->config->backoff_cutoff) - ip->client->interval = - ((ip->client->config->backoff_cutoff / 2) + - ((rand() >> 2) % ip->client->interval)); - - /* If the backoff would take us to the expiry time, just set the - timeout to the expiry time. */ - if (ip->client->state != S_REQUESTING && - cur_time + ip->client->interval > - ip->client->active->expiry) - ip->client->interval = - ip->client->active->expiry - cur_time + 1; - - /* If the lease T2 time has elapsed, or if we're not yet bound, - broadcast the DHCPREQUEST rather than unicasting. */ - memset(&destination, 0, sizeof(destination)); - if (ip->client->state == S_REQUESTING || - ip->client->state == S_REBOOTING || - cur_time > ip->client->active->rebind) - destination.sin_addr.s_addr = INADDR_BROADCAST; - else - memcpy(&destination.sin_addr.s_addr, - ip->client->destination.iabuf, - sizeof(destination.sin_addr.s_addr)); - destination.sin_port = htons(REMOTE_PORT); - destination.sin_family = AF_INET; -// destination.sin_len = sizeof(destination); - - if (ip->client->state != S_REQUESTING) - memcpy(&from, ip->client->active->address.iabuf, - sizeof(from)); - else - from.s_addr = INADDR_ANY; - - /* Record the number of seconds since we started sending. */ - if (ip->client->state == S_REQUESTING) - ip->client->packet.secs = ip->client->secs; - else { - if (interval < 65536) - ip->client->packet.secs = htons(interval); - else - ip->client->packet.secs = htons(65535); - } - - note("DHCPREQUEST on %s to %s port %d", ip->name, - inet_ntoa(destination.sin_addr), ntohs(destination.sin_port)); - - /* Send out a packet. */ - (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, - from, &destination, NULL); - - add_timeout(cur_time + ip->client->interval, send_request, ip); -} - -void -send_decline(void *ipp) -{ - struct interface_info *ip = ipp; - - note("DHCPDECLINE on %s to %s port %d", ip->name, - inet_ntoa(sockaddr_broadcast.sin_addr), - ntohs(sockaddr_broadcast.sin_port)); - - /* Send out a packet. */ - (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, - inaddr_any, &sockaddr_broadcast, NULL); -} - -void -make_discover(struct interface_info *ip, struct client_lease *lease) -{ - unsigned char discover = DHCPDISCOVER; - struct tree_cache *options[256]; - struct tree_cache option_elements[256]; - int i; - ULONG foo = (ULONG) GetTickCount(); - - memset(option_elements, 0, sizeof(option_elements)); - memset(options, 0, sizeof(options)); - memset(&ip->client->packet, 0, sizeof(ip->client->packet)); - - /* Set DHCP_MESSAGE_TYPE to DHCPDISCOVER */ - i = DHO_DHCP_MESSAGE_TYPE; - options[i] = &option_elements[i]; - options[i]->value = &discover; - options[i]->len = sizeof(discover); - options[i]->buf_size = sizeof(discover); - options[i]->timeout = 0xFFFFFFFF; - - /* Request the options we want */ - i = DHO_DHCP_PARAMETER_REQUEST_LIST; - options[i] = &option_elements[i]; - options[i]->value = ip->client->config->requested_options; - options[i]->len = ip->client->config->requested_option_count; - options[i]->buf_size = - ip->client->config->requested_option_count; - options[i]->timeout = 0xFFFFFFFF; - - /* If we had an address, try to get it again. */ - if (lease) { - ip->client->requested_address = lease->address; - i = DHO_DHCP_REQUESTED_ADDRESS; - options[i] = &option_elements[i]; - options[i]->value = lease->address.iabuf; - options[i]->len = lease->address.len; - options[i]->buf_size = lease->address.len; - options[i]->timeout = 0xFFFFFFFF; - } else - ip->client->requested_address.len = 0; - - /* Send any options requested in the config file. */ - for (i = 0; i < 256; i++) - if (!options[i] && - ip->client->config->send_options[i].data) { - options[i] = &option_elements[i]; - options[i]->value = - ip->client->config->send_options[i].data; - options[i]->len = - ip->client->config->send_options[i].len; - options[i]->buf_size = - ip->client->config->send_options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - - /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, - options, 0, 0, 0, NULL, 0); - if (ip->client->packet_length < BOOTP_MIN_LEN) - ip->client->packet_length = BOOTP_MIN_LEN; - - ip->client->packet.op = BOOTREQUEST; - ip->client->packet.htype = ip->hw_address.htype; - ip->client->packet.hlen = ip->hw_address.hlen; - ip->client->packet.hops = 0; - ip->client->packet.xid = RtlRandom(&foo); - ip->client->packet.secs = 0; /* filled in by send_discover. */ - ip->client->packet.flags = 0; - - memset(&(ip->client->packet.ciaddr), - 0, sizeof(ip->client->packet.ciaddr)); - memset(&(ip->client->packet.yiaddr), - 0, sizeof(ip->client->packet.yiaddr)); - memset(&(ip->client->packet.siaddr), - 0, sizeof(ip->client->packet.siaddr)); - memset(&(ip->client->packet.giaddr), - 0, sizeof(ip->client->packet.giaddr)); - memcpy(ip->client->packet.chaddr, - ip->hw_address.haddr, ip->hw_address.hlen); -} - - -void -make_request(struct interface_info *ip, struct client_lease * lease) -{ - unsigned char request = DHCPREQUEST; - struct tree_cache *options[256]; - struct tree_cache option_elements[256]; - int i; - - memset(options, 0, sizeof(options)); - memset(&ip->client->packet, 0, sizeof(ip->client->packet)); - - /* Set DHCP_MESSAGE_TYPE to DHCPREQUEST */ - i = DHO_DHCP_MESSAGE_TYPE; - options[i] = &option_elements[i]; - options[i]->value = &request; - options[i]->len = sizeof(request); - options[i]->buf_size = sizeof(request); - options[i]->timeout = 0xFFFFFFFF; - - /* Request the options we want */ - i = DHO_DHCP_PARAMETER_REQUEST_LIST; - options[i] = &option_elements[i]; - options[i]->value = ip->client->config->requested_options; - options[i]->len = ip->client->config->requested_option_count; - options[i]->buf_size = - ip->client->config->requested_option_count; - options[i]->timeout = 0xFFFFFFFF; - - /* If we are requesting an address that hasn't yet been assigned - to us, use the DHCP Requested Address option. */ - if (ip->client->state == S_REQUESTING) { - /* Send back the server identifier... */ - i = DHO_DHCP_SERVER_IDENTIFIER; - options[i] = &option_elements[i]; - options[i]->value = lease->options[i].data; - options[i]->len = lease->options[i].len; - options[i]->buf_size = lease->options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - if (ip->client->state == S_REQUESTING || - ip->client->state == S_REBOOTING) { - ip->client->requested_address = lease->address; - i = DHO_DHCP_REQUESTED_ADDRESS; - options[i] = &option_elements[i]; - options[i]->value = lease->address.iabuf; - options[i]->len = lease->address.len; - options[i]->buf_size = lease->address.len; - options[i]->timeout = 0xFFFFFFFF; - } else - ip->client->requested_address.len = 0; - - /* Send any options requested in the config file. */ - for (i = 0; i < 256; i++) - if (!options[i] && - ip->client->config->send_options[i].data) { - options[i] = &option_elements[i]; - options[i]->value = - ip->client->config->send_options[i].data; - options[i]->len = - ip->client->config->send_options[i].len; - options[i]->buf_size = - ip->client->config->send_options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - - /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, - options, 0, 0, 0, NULL, 0); - if (ip->client->packet_length < BOOTP_MIN_LEN) - ip->client->packet_length = BOOTP_MIN_LEN; - - ip->client->packet.op = BOOTREQUEST; - ip->client->packet.htype = ip->hw_address.htype; - ip->client->packet.hlen = ip->hw_address.hlen; - ip->client->packet.hops = 0; - ip->client->packet.xid = ip->client->xid; - ip->client->packet.secs = 0; /* Filled in by send_request. */ - - /* If we own the address we're requesting, put it in ciaddr; - otherwise set ciaddr to zero. */ - if (ip->client->state == S_BOUND || - ip->client->state == S_RENEWING || - ip->client->state == S_REBINDING) { - memcpy(&ip->client->packet.ciaddr, - lease->address.iabuf, lease->address.len); - ip->client->packet.flags = 0; - } else { - memset(&ip->client->packet.ciaddr, 0, - sizeof(ip->client->packet.ciaddr)); - ip->client->packet.flags = 0; - } - - memset(&ip->client->packet.yiaddr, 0, - sizeof(ip->client->packet.yiaddr)); - memset(&ip->client->packet.siaddr, 0, - sizeof(ip->client->packet.siaddr)); - memset(&ip->client->packet.giaddr, 0, - sizeof(ip->client->packet.giaddr)); - memcpy(ip->client->packet.chaddr, - ip->hw_address.haddr, ip->hw_address.hlen); -} - -void -make_decline(struct interface_info *ip, struct client_lease *lease) -{ - struct tree_cache *options[256], message_type_tree; - struct tree_cache requested_address_tree; - struct tree_cache server_id_tree, client_id_tree; - unsigned char decline = DHCPDECLINE; - int i; - - memset(options, 0, sizeof(options)); - memset(&ip->client->packet, 0, sizeof(ip->client->packet)); - - /* Set DHCP_MESSAGE_TYPE to DHCPDECLINE */ - i = DHO_DHCP_MESSAGE_TYPE; - options[i] = &message_type_tree; - options[i]->value = &decline; - options[i]->len = sizeof(decline); - options[i]->buf_size = sizeof(decline); - options[i]->timeout = 0xFFFFFFFF; - - /* Send back the server identifier... */ - i = DHO_DHCP_SERVER_IDENTIFIER; - options[i] = &server_id_tree; - options[i]->value = lease->options[i].data; - options[i]->len = lease->options[i].len; - options[i]->buf_size = lease->options[i].len; - options[i]->timeout = 0xFFFFFFFF; - - /* Send back the address we're declining. */ - i = DHO_DHCP_REQUESTED_ADDRESS; - options[i] = &requested_address_tree; - options[i]->value = lease->address.iabuf; - options[i]->len = lease->address.len; - options[i]->buf_size = lease->address.len; - options[i]->timeout = 0xFFFFFFFF; - - /* Send the uid if the user supplied one. */ - i = DHO_DHCP_CLIENT_IDENTIFIER; - if (ip->client->config->send_options[i].len) { - options[i] = &client_id_tree; - options[i]->value = ip->client->config->send_options[i].data; - options[i]->len = ip->client->config->send_options[i].len; - options[i]->buf_size = ip->client->config->send_options[i].len; - options[i]->timeout = 0xFFFFFFFF; - } - - - /* Set up the option buffer... */ - ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, - options, 0, 0, 0, NULL, 0); - if (ip->client->packet_length < BOOTP_MIN_LEN) - ip->client->packet_length = BOOTP_MIN_LEN; - - ip->client->packet.op = BOOTREQUEST; - ip->client->packet.htype = ip->hw_address.htype; - ip->client->packet.hlen = ip->hw_address.hlen; - ip->client->packet.hops = 0; - ip->client->packet.xid = ip->client->xid; - ip->client->packet.secs = 0; /* Filled in by send_request. */ - ip->client->packet.flags = 0; - - /* ciaddr must always be zero. */ - memset(&ip->client->packet.ciaddr, 0, - sizeof(ip->client->packet.ciaddr)); - memset(&ip->client->packet.yiaddr, 0, - sizeof(ip->client->packet.yiaddr)); - memset(&ip->client->packet.siaddr, 0, - sizeof(ip->client->packet.siaddr)); - memset(&ip->client->packet.giaddr, 0, - sizeof(ip->client->packet.giaddr)); - memcpy(ip->client->packet.chaddr, - ip->hw_address.haddr, ip->hw_address.hlen); -} - -void -free_client_lease(struct client_lease *lease) -{ - int i; - - if (lease->server_name) - free(lease->server_name); - if (lease->filename) - free(lease->filename); - for (i = 0; i < 256; i++) { - if (lease->options[i].len) - free(lease->options[i].data); - } - free(lease); -} - -FILE *leaseFile; - -void -rewrite_client_leases(struct interface_info *ifi) -{ - struct client_lease *lp; - - if (!leaseFile) { - leaseFile = fopen(path_dhclient_db, "w"); - if (!leaseFile) - error("can't create %s", path_dhclient_db); - } else { - fflush(leaseFile); - rewind(leaseFile); - } - - for (lp = ifi->client->leases; lp; lp = lp->next) - write_client_lease(ifi, lp, 1); - if (ifi->client->active) - write_client_lease(ifi, ifi->client->active, 1); - - fflush(leaseFile); -} - -void -write_client_lease(struct interface_info *ip, struct client_lease *lease, - int rewrite) -{ - static int leases_written; - struct tm *t; - int i; - - if (!rewrite) { - if (leases_written++ > 20) { - rewrite_client_leases(ip); - leases_written = 0; - } - } - - /* If the lease came from the config file, we don't need to stash - a copy in the lease database. */ - if (lease->is_static) - return; - - if (!leaseFile) { /* XXX */ - leaseFile = fopen(path_dhclient_db, "w"); - if (!leaseFile) { - error("can't create %s", path_dhclient_db); - return; - } - } - - fprintf(leaseFile, "lease {\n"); - if (lease->is_bootp) - fprintf(leaseFile, " bootp;\n"); - fprintf(leaseFile, " interface \"%s\";\n", ip->name); - fprintf(leaseFile, " fixed-address %s;\n", piaddr(lease->address)); - if (lease->filename) - fprintf(leaseFile, " filename \"%s\";\n", lease->filename); - if (lease->server_name) - fprintf(leaseFile, " server-name \"%s\";\n", - lease->server_name); - if (lease->medium) - fprintf(leaseFile, " medium \"%s\";\n", lease->medium->string); - for (i = 0; i < 256; i++) - if (lease->options[i].len) - fprintf(leaseFile, " option %s %s;\n", - dhcp_options[i].name, - pretty_print_option(i, lease->options[i].data, - lease->options[i].len, 1, 1)); - - t = gmtime(&lease->renewal); - if (t) - fprintf(leaseFile, " renew %d %d/%d/%d %02d:%02d:%02d;\n", - t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - t = gmtime(&lease->rebind); - if (t) - fprintf(leaseFile, " rebind %d %d/%d/%d %02d:%02d:%02d;\n", - t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - t = gmtime(&lease->expiry); - if (t) - fprintf(leaseFile, " expire %d %d/%d/%d %02d:%02d:%02d;\n", - t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - fprintf(leaseFile, "}\n"); - fflush(leaseFile); -} - -void -priv_script_init(struct interface_info *ip, char *reason, char *medium) -{ - if (ip) { - // XXX Do we need to do anything? - } -} - -void -priv_script_write_params(struct interface_info *ip, char *prefix, struct client_lease *lease) -{ - u_int8_t dbuf[1500]; - int i, len = 0; - -#if 0 - script_set_env(ip->client, prefix, "ip_address", - piaddr(lease->address)); -#endif - - if (lease->options[DHO_SUBNET_MASK].len && - (lease->options[DHO_SUBNET_MASK].len < - sizeof(lease->address.iabuf))) { - struct iaddr netmask, subnet, broadcast; - - memcpy(netmask.iabuf, lease->options[DHO_SUBNET_MASK].data, - lease->options[DHO_SUBNET_MASK].len); - netmask.len = lease->options[DHO_SUBNET_MASK].len; - - subnet = subnet_number(lease->address, netmask); - if (subnet.len) { -#if 0 - script_set_env(ip->client, prefix, "network_number", - piaddr(subnet)); -#endif - if (!lease->options[DHO_BROADCAST_ADDRESS].len) { - broadcast = broadcast_addr(subnet, netmask); - if (broadcast.len) -#if 0 - script_set_env(ip->client, prefix, - "broadcast_address", - piaddr(broadcast)); -#else - ; -#endif - } - } - } - -#if 0 - if (lease->filename) - script_set_env(ip->client, prefix, "filename", lease->filename); - if (lease->server_name) - script_set_env(ip->client, prefix, "server_name", - lease->server_name); -#endif - - for (i = 0; i < 256; i++) { - u_int8_t *dp = NULL; - - if (ip->client->config->defaults[i].len) { - if (lease->options[i].len) { - switch ( - ip->client->config->default_actions[i]) { - case ACTION_DEFAULT: - dp = lease->options[i].data; - len = lease->options[i].len; - break; - case ACTION_SUPERSEDE: -supersede: - dp = ip->client-> - config->defaults[i].data; - len = ip->client-> - config->defaults[i].len; - break; - case ACTION_PREPEND: - len = ip->client-> - config->defaults[i].len + - lease->options[i].len; - if (len >= sizeof(dbuf)) { - warning("no space to %s %s", - "prepend option", - dhcp_options[i].name); - goto supersede; - } - dp = dbuf; - memcpy(dp, - ip->client-> - config->defaults[i].data, - ip->client-> - config->defaults[i].len); - memcpy(dp + ip->client-> - config->defaults[i].len, - lease->options[i].data, - lease->options[i].len); - dp[len] = '\0'; - break; - case ACTION_APPEND: - len = ip->client-> - config->defaults[i].len + - lease->options[i].len + 1; - if (len > sizeof(dbuf)) { - warning("no space to %s %s", - "append option", - dhcp_options[i].name); - goto supersede; - } - dp = dbuf; - memcpy(dp, - lease->options[i].data, - lease->options[i].len); - memcpy(dp + lease->options[i].len, - ip->client-> - config->defaults[i].data, - ip->client-> - config->defaults[i].len); - dp[len-1] = '\0'; - } - } else { - dp = ip->client-> - config->defaults[i].data; - len = ip->client-> - config->defaults[i].len; - } - } else if (lease->options[i].len) { - len = lease->options[i].len; - dp = lease->options[i].data; - } else { - len = 0; - } -#if 0 - if (len) { - char name[256]; - - if (dhcp_option_ev_name(name, sizeof(name), - &dhcp_options[i])) - script_set_env(ip->client, prefix, name, - pretty_print_option(i, dp, len, 0, 0)); - } -#endif - } -#if 0 - snprintf(tbuf, sizeof(tbuf), "%d", (int)lease->expiry); - script_set_env(ip->client, prefix, "expiry", tbuf); -#endif -} - -int -dhcp_option_ev_name(char *buf, size_t buflen, struct dhcp_option *option) -{ - int i; - - for (i = 0; option->name[i]; i++) { - if (i + 1 == buflen) - return 0; - if (option->name[i] == '-') - buf[i] = '_'; - else - buf[i] = option->name[i]; - } - - buf[i] = 0; - return 1; -} - -#if 0 -void -go_daemon(void) -{ - static int state = 0; - - if (no_daemon || state) - return; - - state = 1; - - /* Stop logging to stderr... */ - log_perror = 0; - - if (daemon(1, 0) == -1) - error("daemon"); - - /* we are chrooted, daemon(3) fails to open /dev/null */ - if (nullfd != -1) { - dup2(nullfd, STDIN_FILENO); - dup2(nullfd, STDOUT_FILENO); - dup2(nullfd, STDERR_FILENO); - close(nullfd); - nullfd = -1; - } -} -#endif - -int -check_option(struct client_lease *l, int option) -{ - char *opbuf; - char *sbuf; - - /* we use this, since this is what gets passed to dhclient-script */ - - opbuf = pretty_print_option(option, l->options[option].data, - l->options[option].len, 0, 0); - - sbuf = option_as_string(option, l->options[option].data, - l->options[option].len); - - switch (option) { - case DHO_SUBNET_MASK: - case DHO_TIME_SERVERS: - case DHO_NAME_SERVERS: - case DHO_ROUTERS: - case DHO_DOMAIN_NAME_SERVERS: - case DHO_LOG_SERVERS: - case DHO_COOKIE_SERVERS: - case DHO_LPR_SERVERS: - case DHO_IMPRESS_SERVERS: - case DHO_RESOURCE_LOCATION_SERVERS: - case DHO_SWAP_SERVER: - case DHO_BROADCAST_ADDRESS: - case DHO_NIS_SERVERS: - case DHO_NTP_SERVERS: - case DHO_NETBIOS_NAME_SERVERS: - case DHO_NETBIOS_DD_SERVER: - case DHO_FONT_SERVERS: - case DHO_DHCP_SERVER_IDENTIFIER: - if (!ipv4addrs(opbuf)) { - warning("Invalid IP address in option(%d): %s", option, opbuf); - return (0); - } - return (1) ; - case DHO_HOST_NAME: - case DHO_DOMAIN_NAME: - case DHO_NIS_DOMAIN: - if (!res_hnok(sbuf)) - warning("Bogus Host Name option %d: %s (%s)", option, - sbuf, opbuf); - return (1); - case DHO_PAD: - case DHO_TIME_OFFSET: - case DHO_BOOT_SIZE: - case DHO_MERIT_DUMP: - case DHO_ROOT_PATH: - case DHO_EXTENSIONS_PATH: - case DHO_IP_FORWARDING: - case DHO_NON_LOCAL_SOURCE_ROUTING: - case DHO_POLICY_FILTER: - case DHO_MAX_DGRAM_REASSEMBLY: - case DHO_DEFAULT_IP_TTL: - case DHO_PATH_MTU_AGING_TIMEOUT: - case DHO_PATH_MTU_PLATEAU_TABLE: - case DHO_INTERFACE_MTU: - case DHO_ALL_SUBNETS_LOCAL: - case DHO_PERFORM_MASK_DISCOVERY: - case DHO_MASK_SUPPLIER: - case DHO_ROUTER_DISCOVERY: - case DHO_ROUTER_SOLICITATION_ADDRESS: - case DHO_STATIC_ROUTES: - case DHO_TRAILER_ENCAPSULATION: - case DHO_ARP_CACHE_TIMEOUT: - case DHO_IEEE802_3_ENCAPSULATION: - case DHO_DEFAULT_TCP_TTL: - case DHO_TCP_KEEPALIVE_INTERVAL: - case DHO_TCP_KEEPALIVE_GARBAGE: - case DHO_VENDOR_ENCAPSULATED_OPTIONS: - case DHO_NETBIOS_NODE_TYPE: - case DHO_NETBIOS_SCOPE: - case DHO_X_DISPLAY_MANAGER: - case DHO_DHCP_REQUESTED_ADDRESS: - case DHO_DHCP_LEASE_TIME: - case DHO_DHCP_OPTION_OVERLOAD: - case DHO_DHCP_MESSAGE_TYPE: - case DHO_DHCP_PARAMETER_REQUEST_LIST: - case DHO_DHCP_MESSAGE: - case DHO_DHCP_MAX_MESSAGE_SIZE: - case DHO_DHCP_RENEWAL_TIME: - case DHO_DHCP_REBINDING_TIME: - case DHO_DHCP_CLASS_IDENTIFIER: - case DHO_DHCP_CLIENT_IDENTIFIER: - case DHO_DHCP_USER_CLASS_ID: - case DHO_END: - return (1); - default: - warning("unknown dhcp option value 0x%x", option); - return (unknown_ok); - } -} - -int -res_hnok(const char *dn) -{ - int pch = PERIOD, ch = *dn++; - - while (ch != '\0') { - int nch = *dn++; - - if (periodchar(ch)) { - ; - } else if (periodchar(pch)) { - if (!borderchar(ch)) - return (0); - } else if (periodchar(nch) || nch == '\0') { - if (!borderchar(ch)) - return (0); - } else { - if (!middlechar(ch)) - return (0); - } - pch = ch, ch = nch; - } - return (1); -} - -/* Does buf consist only of dotted decimal ipv4 addrs? - * return how many if so, - * otherwise, return 0 - */ -int -ipv4addrs(char * buf) -{ - char *tmp; - struct in_addr jnk; - int i = 0; - - note("Input: %s", buf); - - do { - tmp = strtok(buf, " "); - note("got %s", tmp); - if( tmp && inet_aton(tmp, &jnk) ) i++; - buf = NULL; - } while( tmp ); - - return (i); -} - - -char * -option_as_string(unsigned int code, unsigned char *data, int len) -{ - static char optbuf[32768]; /* XXX */ - char *op = optbuf; - int opleft = sizeof(optbuf); - unsigned char *dp = data; - - if (code > 255) - error("option_as_string: bad code %d", code); - - for (; dp < data + len; dp++) { - if (!isascii(*dp) || !isprint(*dp)) { - if (dp + 1 != data + len || *dp != 0) { - _snprintf(op, opleft, "\\%03o", *dp); - op += 4; - opleft -= 4; - } - } else if (*dp == '"' || *dp == '\'' || *dp == '$' || - *dp == '`' || *dp == '\\') { - *op++ = '\\'; - *op++ = *dp; - opleft -= 2; - } else { - *op++ = *dp; - opleft--; - } - } - if (opleft < 1) - goto toobig; - *op = 0; - return optbuf; -toobig: - warning("dhcp option too large"); - return ""; -} - diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c index 07910684993..0c59fb7df90 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c @@ -6,63 +6,22 @@ * COPYRIGHT: Copyright 2005 Art Yerkes */ -#include +#include +#include +#include +#include #define NDEBUG #include -static HANDLE PipeHandle = INVALID_HANDLE_VALUE; +#define DHCP_TIMEOUT 1000 DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version) { - DWORD PipeMode; - - /* Wait for the pipe to be available */ - if (WaitNamedPipeW(DHCP_PIPE_NAME, NMPWAIT_USE_DEFAULT_WAIT)) - { - /* It's available, let's try to open it */ - PipeHandle = CreateFileW(DHCP_PIPE_NAME, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - 0, - NULL); - - /* Check if we succeeded in opening the pipe */ - if (PipeHandle == INVALID_HANDLE_VALUE) - { - /* We didn't */ - return GetLastError(); - } - else - { - /* Change the pipe into message mode */ - PipeMode = PIPE_READMODE_MESSAGE; - if (!SetNamedPipeHandleState(PipeHandle, &PipeMode, NULL, NULL)) - { - /* Mode change failed */ - CloseHandle(PipeHandle); - PipeHandle = INVALID_HANDLE_VALUE; - return GetLastError(); - } - else - { - /* We're good to go */ - *Version = 2; - return NO_ERROR; - } - } - } - else - { - /* No good, we failed */ - return GetLastError(); - } + *Version = 2; + return 0; } VOID APIENTRY DhcpCApiCleanup() { - CloseHandle(PipeHandle); - PipeHandle = INVALID_HANDLE_VALUE; } DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, @@ -74,20 +33,12 @@ DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; - ASSERT(PipeHandle != INVALID_HANDLE_VALUE); - Req.Type = DhcpReqQueryHWInfo; Req.AdapterIndex = AdapterIndex; - Result = TransactNamedPipe(PipeHandle, - &Req, sizeof(Req), - &Reply, sizeof(Reply), - &BytesRead, NULL); - if (!Result) - { - /* Pipe transaction failed */ - return 0; - } + Result = CallNamedPipeW + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); if( !Reply.Reply ) return 0; else { @@ -104,20 +55,12 @@ DWORD APIENTRY DhcpLeaseIpAddress( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; - ASSERT(PipeHandle != INVALID_HANDLE_VALUE); - Req.Type = DhcpReqLeaseIpAddress; Req.AdapterIndex = AdapterIndex; - Result = TransactNamedPipe(PipeHandle, - &Req, sizeof(Req), - &Reply, sizeof(Reply), - &BytesRead, NULL); - if (!Result) - { - /* Pipe transaction failed */ - return 0; - } + Result = CallNamedPipeW + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); return Reply.Reply; } @@ -128,20 +71,12 @@ DWORD APIENTRY DhcpReleaseIpAddressLease( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; - ASSERT(PipeHandle != INVALID_HANDLE_VALUE); - Req.Type = DhcpReqReleaseIpAddress; Req.AdapterIndex = AdapterIndex; - Result = TransactNamedPipe(PipeHandle, - &Req, sizeof(Req), - &Reply, sizeof(Reply), - &BytesRead, NULL); - if (!Result) - { - /* Pipe transaction failed */ - return 0; - } + Result = CallNamedPipeW + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); return Reply.Reply; } @@ -152,20 +87,12 @@ DWORD APIENTRY DhcpRenewIpAddressLease( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; - ASSERT(PipeHandle != INVALID_HANDLE_VALUE); - Req.Type = DhcpReqRenewIpAddress; Req.AdapterIndex = AdapterIndex; - Result = TransactNamedPipe(PipeHandle, - &Req, sizeof(Req), - &Reply, sizeof(Reply), - &BytesRead, NULL); - if (!Result) - { - /* Pipe transaction failed */ - return 0; - } + Result = CallNamedPipeW + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); return Reply.Reply; } @@ -178,22 +105,14 @@ DWORD APIENTRY DhcpStaticRefreshParams( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; - ASSERT(PipeHandle != INVALID_HANDLE_VALUE); - Req.Type = DhcpReqStaticRefreshParams; Req.AdapterIndex = AdapterIndex; Req.Body.StaticRefreshParams.IPAddress = Address; Req.Body.StaticRefreshParams.Netmask = Netmask; - Result = TransactNamedPipe(PipeHandle, - &Req, sizeof(Req), - &Reply, sizeof(Reply), - &BytesRead, NULL); - if (!Result) - { - /* Pipe transaction failed */ - return 0; - } + Result = CallNamedPipeW + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); return Reply.Reply; } @@ -234,7 +153,7 @@ DhcpNotifyConfigChange(LPWSTR ServerName, DWORD SubnetMask, int DhcpAction) { - DbgPrint("DHCPCSVC: DhcpNotifyConfigChange not implemented yet\n"); + DPRINT1("DhcpNotifyConfigChange not implemented yet\n"); return 0; } @@ -273,15 +192,12 @@ DWORD APIENTRY DhcpRosGetAdapterInfo( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; - ASSERT(PipeHandle != INVALID_HANDLE_VALUE); - Req.Type = DhcpReqGetAdapterInfo; Req.AdapterIndex = AdapterIndex; - Result = TransactNamedPipe(PipeHandle, - &Req, sizeof(Req), - &Reply, sizeof(Reply), - &BytesRead, NULL); + Result = CallNamedPipeW + ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), + &BytesRead, DHCP_TIMEOUT ); if ( 0 != Result && 0 != Reply.Reply ) { *DhcpEnabled = Reply.GetAdapterInfo.DhcpEnabled; diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild index 99ea9326dce..c2cc0a1e112 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild @@ -2,26 +2,8 @@ include ntdll - msvcrt ws2_32 iphlpapi - advapi32 - oldnames - adapter.c - alloc.c - api.c - compat.c - dhclient.c dhcpcsvc.c dhcpcsvc.rc - dispatch.c - hash.c - options.c - pipe.c - socket.c - tables.c - util.c - - rosdhcp.h - diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec index b9f95712bb4..d97b6e7f2ac 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec @@ -43,4 +43,5 @@ @ stub McastRenewAddress @ stub McastRequestAddress @ stdcall DhcpRosGetAdapterInfo(long ptr ptr ptr ptr) -@ stdcall ServiceMain(long ptr) +# The Windows DHCP client service is implemented in the DLL too +#@ stub ServiceMain diff --git a/reactos/dll/win32/dhcpcsvc/dispatch.c b/reactos/dll/win32/dhcpcsvc/dispatch.c deleted file mode 100644 index b429f9517e7..00000000000 --- a/reactos/dll/win32/dhcpcsvc/dispatch.c +++ /dev/null @@ -1,354 +0,0 @@ -/* $OpenBSD: dispatch.c,v 1.31 2004/09/21 04:07:03 david Exp $ */ - -/* - * Copyright 2004 Henning Brauer - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#include "rosdhcp.h" -#include "dhcpd.h" -//#include - -//#include -//#include -//#include - -struct protocol *protocols = NULL; -struct timeout *timeouts = NULL; -static struct timeout *free_timeouts = NULL; -void (*bootp_packet_handler)(struct interface_info *, - struct dhcp_packet *, int, unsigned int, - struct iaddr, struct hardware *); - -/* - * Wait for packets to come in using poll(). When a packet comes in, - * call receive_packet to receive the packet and possibly strip hardware - * addressing information from it, and then call through the - * bootp_packet_handler hook to try to do something with it. - */ -void -dispatch(void) -{ - int count, to_msec, err; - struct protocol *l; - fd_set fds; - time_t howlong, cur_time; - struct timeval timeval; - - if (!AdapterDiscover()) - return; - - ApiLock(); - - do { - /* - * Call any expired timeouts, and then if there's still - * a timeout registered, time out the select call then. - */ - time(&cur_time); - - if (timeouts) { - struct timeout *t; - - if (timeouts->when <= cur_time) { - t = timeouts; - timeouts = timeouts->next; - (*(t->func))(t->what); - t->next = free_timeouts; - free_timeouts = t; - continue; - } - - /* - * Figure timeout in milliseconds, and check for - * potential overflow, so we can cram into an - * int for poll, while not polling with a - * negative timeout and blocking indefinitely. - */ - howlong = timeouts->when - cur_time; - if (howlong > INT_MAX / 1000) - howlong = INT_MAX / 1000; - to_msec = howlong * 1000; - } else - to_msec = 5000; - - /* Set up the descriptors to be polled. */ - FD_ZERO(&fds); - - for (l = protocols; l; l = l->next) - FD_SET(l->fd, &fds); - - /* Wait for a packet or a timeout... XXX */ - timeval.tv_sec = to_msec / 1000; - timeval.tv_usec = to_msec % 1000; - - ApiUnlock(); - - if (protocols) - count = select(0, &fds, NULL, NULL, &timeval); - else { - Sleep(to_msec); - count = 0; - } - - ApiLock(); - - DH_DbgPrint(MID_TRACE,("Select: %d\n", count)); - - /* Not likely to be transitory... */ - if (count == SOCKET_ERROR) { - err = WSAGetLastError(); - error("poll: %d", err); - break; - } - - for (l = protocols; l; l = l->next) { - struct interface_info *ip; - ip = l->local; - if (FD_ISSET(l->fd, &fds)) { - if (ip && (l->handler != got_one || - !ip->dead)) { - DH_DbgPrint(MID_TRACE,("Handling %x\n", l)); - (*(l->handler))(l); - } - } - } - } while (1); - - ApiUnlock(); -} - -void -got_one(struct protocol *l) -{ - struct sockaddr_in from; - struct hardware hfrom; - struct iaddr ifrom; - ssize_t result; - union { - /* - * Packet input buffer. Must be as large as largest - * possible MTU. - */ - unsigned char packbuf[4095]; - struct dhcp_packet packet; - } u; - struct interface_info *ip = l->local; - PDHCP_ADAPTER adapter; - - if ((result = receive_packet(ip, u.packbuf, sizeof(u), &from, - &hfrom)) == -1) { - warning("receive_packet failed on %s: %d", ip->name, - WSAGetLastError()); - ip->errors++; - if (ip->errors > 20) { - /* our interface has gone away. */ - warning("Interface %s no longer appears valid.", - ip->name); - ip->dead = 1; - closesocket(l->fd); - remove_protocol(l); - adapter = AdapterFindInfo(ip); - if (adapter) { - RemoveEntryList(&adapter->ListEntry); - free(adapter); - } - } - return; - } - if (result == 0) - return; - - if (bootp_packet_handler) { - ifrom.len = 4; - memcpy(ifrom.iabuf, &from.sin_addr, ifrom.len); - - - adapter = AdapterFindByHardwareAddress(u.packet.chaddr, - u.packet.hlen); - - if (!adapter) { - warning("Discarding packet with a non-matching target physical address\n"); - return; - } - - (*bootp_packet_handler)(&adapter->DhclientInfo, &u.packet, result, - from.sin_port, ifrom, &hfrom); - } -} - -void -add_timeout(time_t when, void (*where)(void *), void *what) -{ - struct timeout *t, *q; - - DH_DbgPrint(MID_TRACE,("Adding timeout %x %p %x\n", when, where, what)); - /* See if this timeout supersedes an existing timeout. */ - t = NULL; - for (q = timeouts; q; q = q->next) { - if (q->func == where && q->what == what) { - if (t) - t->next = q->next; - else - timeouts = q->next; - break; - } - t = q; - } - - /* If we didn't supersede a timeout, allocate a timeout - structure now. */ - if (!q) { - if (free_timeouts) { - q = free_timeouts; - free_timeouts = q->next; - q->func = where; - q->what = what; - } else { - q = malloc(sizeof(struct timeout)); - if (!q) { - error("Can't allocate timeout structure!"); - return; - } - q->func = where; - q->what = what; - } - } - - q->when = when; - - /* Now sort this timeout into the timeout list. */ - - /* Beginning of list? */ - if (!timeouts || timeouts->when > q->when) { - q->next = timeouts; - timeouts = q; - return; - } - - /* Middle of list? */ - for (t = timeouts; t->next; t = t->next) { - if (t->next->when > q->when) { - q->next = t->next; - t->next = q; - return; - } - } - - /* End of list. */ - t->next = q; - q->next = NULL; -} - -void -cancel_timeout(void (*where)(void *), void *what) -{ - struct timeout *t, *q; - - /* Look for this timeout on the list, and unlink it if we find it. */ - t = NULL; - for (q = timeouts; q; q = q->next) { - if (q->func == where && q->what == what) { - if (t) - t->next = q->next; - else - timeouts = q->next; - break; - } - t = q; - } - - /* If we found the timeout, put it on the free list. */ - if (q) { - q->next = free_timeouts; - free_timeouts = q; - } -} - -/* Add a protocol to the list of protocols... */ -void -add_protocol(char *name, int fd, void (*handler)(struct protocol *), - void *local) -{ - struct protocol *p; - - p = malloc(sizeof(*p)); - if (!p) - error("can't allocate protocol struct for %s", name); - - p->fd = fd; - p->handler = handler; - p->local = local; - p->next = protocols; - protocols = p; -} - -void -remove_protocol(struct protocol *proto) -{ - struct protocol *p, *next, *prev; - - prev = NULL; - for (p = protocols; p; p = next) { - next = p->next; - if (p == proto) { - if (prev) - prev->next = p->next; - else - protocols = p->next; - free(p); - } - } -} - -struct protocol * -find_protocol_by_adapter(struct interface_info *info) -{ - struct protocol *p; - - for( p = protocols; p; p = p->next ) { - if( p->local == (void *)info ) return p; - } - - return NULL; -} - -int -interface_link_status(char *ifname) -{ - return (1); -} diff --git a/reactos/dll/win32/dhcpcsvc/hash.c b/reactos/dll/win32/dhcpcsvc/hash.c deleted file mode 100644 index 84c8c6a7ade..00000000000 --- a/reactos/dll/win32/dhcpcsvc/hash.c +++ /dev/null @@ -1,165 +0,0 @@ -/* hash.c - - Routines for manipulating hash tables... */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define lint -#ifndef lint -static char copyright[] = -"$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" - -static __inline int do_hash PROTO ((unsigned char *, int, int)); - -struct hash_table *new_hash () -{ - struct hash_table *rv = new_hash_table (DEFAULT_HASH_SIZE); - if (!rv) - return rv; - memset (&rv -> buckets [0], 0, - DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *)); - return rv; -} - -static __inline int do_hash (name, len, size) - unsigned char *name; - int len; - int size; -{ - register int accum = 0; - register unsigned char *s = name; - int i = len; - while (i--) { - /* Add the character in... */ - accum += *s++; - /* Add carry back in... */ - while (accum > 255) { - accum = (accum & 255) + (accum >> 8); - } - } - return accum % size; -} - -void add_hash (table, name, len, pointer) - struct hash_table *table; - int len; - unsigned char *name; - unsigned char *pointer; -{ - int hashno; - struct hash_bucket *bp; - - if (!table) - return; - if (!len) - len = strlen ((char *)name); - - hashno = do_hash (name, len, table -> hash_count); - bp = new_hash_bucket (); - - if (!bp) { - warn ("Can't add %s to hash table.", name); - return; - } - bp -> name = name; - bp -> value = pointer; - bp -> next = table -> buckets [hashno]; - bp -> len = len; - table -> buckets [hashno] = bp; -} - -void delete_hash_entry (table, name, len) - struct hash_table *table; - int len; - unsigned char *name; -{ - int hashno; - struct hash_bucket *bp, *pbp = (struct hash_bucket *)0; - - if (!table) - return; - if (!len) - len = strlen ((char *)name); - - hashno = do_hash (name, len, table -> hash_count); - - /* Go through the list looking for an entry that matches; - if we find it, delete it. */ - for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { - if ((!bp -> len && - !strcmp ((char *)bp -> name, (char *)name)) || - (bp -> len == len && - !memcmp (bp -> name, name, len))) { - if (pbp) { - pbp -> next = bp -> next; - } else { - table -> buckets [hashno] = bp -> next; - } - free_hash_bucket (bp, "delete_hash_entry"); - break; - } - pbp = bp; /* jwg, 9/6/96 - nice catch! */ - } -} - -unsigned char *hash_lookup (table, name, len) - struct hash_table *table; - unsigned char *name; - int len; -{ - int hashno; - struct hash_bucket *bp; - - if (!table) - return (unsigned char *)0; - - if (!len) - len = strlen ((char *)name); - - hashno = do_hash (name, len, table -> hash_count); - - for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { - if (len == bp -> len && !memcmp (bp -> name, name, len)) - return bp -> value; - } - return (unsigned char *)0; -} diff --git a/reactos/dll/win32/dhcpcsvc/include/debug.h b/reactos/dll/win32/dhcpcsvc/include/debug.h deleted file mode 100644 index de374aaba45..00000000000 --- a/reactos/dll/win32/dhcpcsvc/include/debug.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS TCP/IP protocol driver - * FILE: include/debug.h - * PURPOSE: Debugging support macros - * DEFINES: DBG - Enable debug output - * NASSERT - Disable assertions - */ - -#pragma once - -#define NORMAL_MASK 0x000000FF -#define SPECIAL_MASK 0xFFFFFF00 -#define MIN_TRACE 0x00000001 -#define MID_TRACE 0x00000002 -#define MAX_TRACE 0x00000003 - -#define DEBUG_ADAPTER 0x00000100 -#define DEBUG_ULTRA 0xFFFFFFFF - -#if DBG - -extern unsigned long debug_trace_level; - -#ifdef _MSC_VER - -#define DH_DbgPrint(_t_, _x_) \ - if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ - ((debug_trace_level & _t_) > NORMAL_MASK)) { \ - DbgPrint("(%s:%d) ", __FILE__, __LINE__); \ - DbgPrint _x_ ; \ - } - -#else /* _MSC_VER */ - -#define DH_DbgPrint(_t_, _x_) \ - if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ - ((debug_trace_level & _t_) > NORMAL_MASK)) { \ - DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \ - DbgPrint _x_ ; \ - } - -#endif /* _MSC_VER */ - -#else /* DBG */ - -#define DH_DbgPrint(_t_, _x_) - -#endif /* DBG */ - -/* EOF */ diff --git a/reactos/dll/win32/dhcpcsvc/include/dhcp.h b/reactos/dll/win32/dhcpcsvc/include/dhcp.h deleted file mode 100644 index 8ac8ed3a9e6..00000000000 --- a/reactos/dll/win32/dhcpcsvc/include/dhcp.h +++ /dev/null @@ -1,169 +0,0 @@ -/* $OpenBSD: dhcp.h,v 1.5 2004/05/04 15:49:49 deraadt Exp $ */ - -/* Protocol structures... */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ - 20 + /* IP header */ \ - 8) /* UDP header */ -#define DHCP_SNAME_LEN 64 -#define DHCP_FILE_LEN 128 -#define DHCP_FIXED_NON_UDP 236 -#define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) - /* Everything but options. */ -#define DHCP_MTU_MAX 1500 -#define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) - -#define BOOTP_MIN_LEN 300 -#define DHCP_MIN_LEN 548 - -struct dhcp_packet { - u_int8_t op; /* Message opcode/type */ - u_int8_t htype; /* Hardware addr type (see net/if_types.h) */ - u_int8_t hlen; /* Hardware addr length */ - u_int8_t hops; /* Number of relay agent hops from client */ - u_int32_t xid; /* Transaction ID */ - u_int16_t secs; /* Seconds since client started looking */ - u_int16_t flags; /* Flag bits */ - struct in_addr ciaddr; /* Client IP address (if already in use) */ - struct in_addr yiaddr; /* Client IP address */ - struct in_addr siaddr; /* IP address of next server to talk to */ - struct in_addr giaddr; /* DHCP relay agent IP address */ - unsigned char chaddr[16]; /* Client hardware address */ - char sname[DHCP_SNAME_LEN]; /* Server name */ - char file[DHCP_FILE_LEN]; /* Boot filename */ - unsigned char options[DHCP_OPTION_LEN]; - /* Optional parameters - (actual length dependent on MTU). */ -}; - -/* BOOTP (rfc951) message types */ -#define BOOTREQUEST 1 -#define BOOTREPLY 2 - -/* Possible values for flags field... */ -#define BOOTP_BROADCAST 32768L - -/* Possible values for hardware type (htype) field... */ -#define HTYPE_ETHER 1 /* Ethernet */ -#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ -#define HTYPE_FDDI 8 /* FDDI... */ - -/* Magic cookie validating dhcp options field (and bootp vendor - extensions field). */ -#define DHCP_OPTIONS_COOKIE "\143\202\123\143" - - -/* DHCP Option codes: */ - -#define DHO_PAD 0 -#define DHO_SUBNET_MASK 1 -#define DHO_TIME_OFFSET 2 -#define DHO_ROUTERS 3 -#define DHO_TIME_SERVERS 4 -#define DHO_NAME_SERVERS 5 -#define DHO_DOMAIN_NAME_SERVERS 6 -#define DHO_LOG_SERVERS 7 -#define DHO_COOKIE_SERVERS 8 -#define DHO_LPR_SERVERS 9 -#define DHO_IMPRESS_SERVERS 10 -#define DHO_RESOURCE_LOCATION_SERVERS 11 -#define DHO_HOST_NAME 12 -#define DHO_BOOT_SIZE 13 -#define DHO_MERIT_DUMP 14 -#define DHO_DOMAIN_NAME 15 -#define DHO_SWAP_SERVER 16 -#define DHO_ROOT_PATH 17 -#define DHO_EXTENSIONS_PATH 18 -#define DHO_IP_FORWARDING 19 -#define DHO_NON_LOCAL_SOURCE_ROUTING 20 -#define DHO_POLICY_FILTER 21 -#define DHO_MAX_DGRAM_REASSEMBLY 22 -#define DHO_DEFAULT_IP_TTL 23 -#define DHO_PATH_MTU_AGING_TIMEOUT 24 -#define DHO_PATH_MTU_PLATEAU_TABLE 25 -#define DHO_INTERFACE_MTU 26 -#define DHO_ALL_SUBNETS_LOCAL 27 -#define DHO_BROADCAST_ADDRESS 28 -#define DHO_PERFORM_MASK_DISCOVERY 29 -#define DHO_MASK_SUPPLIER 30 -#define DHO_ROUTER_DISCOVERY 31 -#define DHO_ROUTER_SOLICITATION_ADDRESS 32 -#define DHO_STATIC_ROUTES 33 -#define DHO_TRAILER_ENCAPSULATION 34 -#define DHO_ARP_CACHE_TIMEOUT 35 -#define DHO_IEEE802_3_ENCAPSULATION 36 -#define DHO_DEFAULT_TCP_TTL 37 -#define DHO_TCP_KEEPALIVE_INTERVAL 38 -#define DHO_TCP_KEEPALIVE_GARBAGE 39 -#define DHO_NIS_DOMAIN 40 -#define DHO_NIS_SERVERS 41 -#define DHO_NTP_SERVERS 42 -#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43 -#define DHO_NETBIOS_NAME_SERVERS 44 -#define DHO_NETBIOS_DD_SERVER 45 -#define DHO_NETBIOS_NODE_TYPE 46 -#define DHO_NETBIOS_SCOPE 47 -#define DHO_FONT_SERVERS 48 -#define DHO_X_DISPLAY_MANAGER 49 -#define DHO_DHCP_REQUESTED_ADDRESS 50 -#define DHO_DHCP_LEASE_TIME 51 -#define DHO_DHCP_OPTION_OVERLOAD 52 -#define DHO_DHCP_MESSAGE_TYPE 53 -#define DHO_DHCP_SERVER_IDENTIFIER 54 -#define DHO_DHCP_PARAMETER_REQUEST_LIST 55 -#define DHO_DHCP_MESSAGE 56 -#define DHO_DHCP_MAX_MESSAGE_SIZE 57 -#define DHO_DHCP_RENEWAL_TIME 58 -#define DHO_DHCP_REBINDING_TIME 59 -#define DHO_DHCP_CLASS_IDENTIFIER 60 -#define DHO_DHCP_CLIENT_IDENTIFIER 61 -#define DHO_DHCP_USER_CLASS_ID 77 -#define DHO_END 255 - -/* DHCP message types. */ -#define DHCPDISCOVER 1 -#define DHCPOFFER 2 -#define DHCPREQUEST 3 -#define DHCPDECLINE 4 -#define DHCPACK 5 -#define DHCPNAK 6 -#define DHCPRELEASE 7 -#define DHCPINFORM 8 diff --git a/reactos/dll/win32/dhcpcsvc/include/dhcpd.h b/reactos/dll/win32/dhcpcsvc/include/dhcpd.h deleted file mode 100644 index d6a2fa405b8..00000000000 --- a/reactos/dll/win32/dhcpcsvc/include/dhcpd.h +++ /dev/null @@ -1,485 +0,0 @@ -/* $OpenBSD: dhcpd.h,v 1.33 2004/05/06 22:29:15 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Henning Brauer - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#pragma once - -#include -#include -#include "stdint.h" - -#define IFNAMSIZ MAX_INTERFACE_NAME_LEN - -#define ETH_ALEN 6 -#define ETHER_ADDR_LEN ETH_ALEN -#include -struct ether_header -{ - u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */ - u_int16_t ether_type; /* packet type ID field */ -}; -#include - -struct ip - { - unsigned int ip_hl:4; /* header length */ - unsigned int ip_v:4; /* version */ - u_int8_t ip_tos; /* type of service */ - u_short ip_len; /* total length */ - u_short ip_id; /* identification */ - u_short ip_off; /* fragment offset field */ -#define IP_RF 0x8000 /* reserved fragment flag */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_int8_t ip_ttl; /* time to live */ - u_int8_t ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src, ip_dst; /* source and dest address */ - }; - -struct udphdr { - u_int16_t uh_sport; /* source port */ - u_int16_t uh_dport; /* destination port */ - u_int16_t uh_ulen; /* udp length */ - u_int16_t uh_sum; /* udp checksum */ -}; - -#define ETHERTYPE_IP 0x0800 -#define IPTOS_LOWDELAY 0x10 -#define ARPHRD_ETHER 1 - -// FIXME: I have no idea what this should be! -#define SIZE_T_MAX 1600 - -#define USE_SOCKET_RECEIVE -#define USE_SOCKET_SEND - -#include -#include -//#include -#include -#include -#include -//#include -#include -#include -#include -#include -//#include - -#include "dhcp.h" -#include "tree.h" - -#define LOCAL_PORT 68 -#define REMOTE_PORT 67 - -struct option_data { - int len; - u_int8_t *data; -}; - -struct string_list { - struct string_list *next; - char *string; -}; - -struct iaddr { - int len; - unsigned char iabuf[16]; -}; - -struct iaddrlist { - struct iaddrlist *next; - struct iaddr addr; -}; - -struct packet { - struct dhcp_packet *raw; - int packet_length; - int packet_type; - int options_valid; - int client_port; - struct iaddr client_addr; - struct interface_info *interface; - struct hardware *haddr; - struct option_data options[256]; -}; - -struct hardware { - u_int8_t htype; - u_int8_t hlen; - u_int8_t haddr[16]; -}; - -struct client_lease { - struct client_lease *next; - time_t expiry, renewal, rebind; - struct iaddr address; - char *server_name; -#ifdef __REACTOS__ - time_t obtained; - struct iaddr serveraddress; -#endif - char *filename; - struct string_list *medium; - unsigned int is_static : 1; - unsigned int is_bootp : 1; - struct option_data options[256]; -}; - -/* Possible states in which the client can be. */ -enum dhcp_state { - S_REBOOTING, - S_INIT, - S_SELECTING, - S_REQUESTING, - S_BOUND, - S_RENEWING, - S_REBINDING, - S_STATIC -}; - -struct client_config { - struct option_data defaults[256]; - enum { - ACTION_DEFAULT, - ACTION_SUPERSEDE, - ACTION_PREPEND, - ACTION_APPEND - } default_actions[256]; - - struct option_data send_options[256]; - u_int8_t required_options[256]; - u_int8_t requested_options[256]; - int requested_option_count; - time_t timeout; - time_t initial_interval; - time_t retry_interval; - time_t select_interval; - time_t reboot_timeout; - time_t backoff_cutoff; - struct string_list *media; - char *script_name; - enum { IGNORE, ACCEPT, PREFER } - bootp_policy; - struct string_list *medium; - struct iaddrlist *reject_list; -}; - -struct client_state { - struct client_lease *active; - struct client_lease *new; - struct client_lease *offered_leases; - struct client_lease *leases; - struct client_lease *alias; - enum dhcp_state state; - struct iaddr destination; - u_int32_t xid; - u_int16_t secs; - time_t first_sending; - time_t interval; - struct string_list *medium; - struct dhcp_packet packet; - int packet_length; - struct iaddr requested_address; - struct client_config *config; -}; - -struct interface_info { - struct interface_info *next; - struct hardware hw_address; - struct in_addr primary_address; - char name[IFNAMSIZ]; - int rfdesc; - int wfdesc; - unsigned char *rbuf; - size_t rbuf_max; - size_t rbuf_offset; - size_t rbuf_len; - struct client_state *client; - int noifmedia; - int errors; - int dead; - u_int16_t index; -}; - -struct timeout { - struct timeout *next; - time_t when; - void (*func)(void *); - void *what; -}; - -struct protocol { - struct protocol *next; - int fd; - void (*handler)(struct protocol *); - void *local; -}; - -#define DEFAULT_HASH_SIZE 97 - -struct hash_bucket { - struct hash_bucket *next; - unsigned char *name; - int len; - unsigned char *value; -}; - -struct hash_table { - int hash_count; - struct hash_bucket *buckets[DEFAULT_HASH_SIZE]; -}; - -/* Default path to dhcpd config file. */ -#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" -#define _PATH_DHCLIENT_DB "/var/db/dhclient.leases" -#define DHCPD_LOG_FACILITY LOG_DAEMON - -#define MAX_TIME 0x7fffffff -#define MIN_TIME 0 - -/* External definitions... */ - -/* options.c */ -int cons_options(struct packet *, struct dhcp_packet *, int, - struct tree_cache **, int, int, int, u_int8_t *, int); -char *pretty_print_option(unsigned int, - unsigned char *, int, int, int); -void do_packet(struct interface_info *, struct dhcp_packet *, - int, unsigned int, struct iaddr, struct hardware *); - -/* errwarn.c */ -extern int warnings_occurred; -#ifdef _MSC_VER -void error(char *, ...); -int warning(char *, ...); -int note(char *, ...); -int debug(char *, ...); -int parse_warn(char *, ...); -#else -void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); -#endif - -/* conflex.c */ -extern int lexline, lexchar; -extern char *token_line, *tlname; -extern char comments[4096]; -extern int comment_index; -extern int eol_token; -void new_parse(char *); -int next_token(char **, FILE *); -int peek_token(char **, FILE *); - -/* parse.c */ -void skip_to_semi(FILE *); -int parse_semi(FILE *); -char *parse_string(FILE *); -int parse_ip_addr(FILE *, struct iaddr *); -void parse_hardware_param(FILE *, struct hardware *); -void parse_lease_time(FILE *, time_t *); -unsigned char *parse_numeric_aggregate(FILE *, unsigned char *, int *, - int, int, int); -void convert_num(unsigned char *, char *, int, int); -time_t parse_date(FILE *); - -/* tree.c */ -pair cons(caddr_t, pair); - -/* alloc.c */ -struct string_list *new_string_list(size_t size); -struct hash_table *new_hash_table(int); -struct hash_bucket *new_hash_bucket(void); -void dfree(void *, char *); -void free_hash_bucket(struct hash_bucket *, char *); - - -/* bpf.c */ -int if_register_bpf(struct interface_info *); -void if_register_send(struct interface_info *); -void if_register_receive(struct interface_info *); -ssize_t send_packet(struct interface_info *, struct dhcp_packet *, size_t, - struct in_addr, struct sockaddr_in *, struct hardware *); -ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, - struct sockaddr_in *, struct hardware *); - -/* dispatch.c */ -extern void (*bootp_packet_handler)(struct interface_info *, - struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *); -void discover_interfaces(struct interface_info *); -void reinitialize_interfaces(void); -void dispatch(void); -void got_one(struct protocol *); -void add_timeout(time_t, void (*)(void *), void *); -void cancel_timeout(void (*)(void *), void *); -void add_protocol(char *, int, void (*)(struct protocol *), void *); -void remove_protocol(struct protocol *); -struct protocol *find_protocol_by_adapter( struct interface_info * ); -int interface_link_status(char *); - -/* hash.c */ -struct hash_table *new_hash(void); -void add_hash(struct hash_table *, unsigned char *, int, unsigned char *); -unsigned char *hash_lookup(struct hash_table *, unsigned char *, int); - -/* tables.c */ -extern struct dhcp_option dhcp_options[256]; -extern unsigned char dhcp_option_default_priority_list[]; -extern int sizeof_dhcp_option_default_priority_list; -extern struct hash_table universe_hash; -extern struct universe dhcp_universe; -void initialize_universes(void); - -/* convert.c */ -u_int32_t getULong(unsigned char *); -int32_t getLong(unsigned char *); -u_int16_t getUShort(unsigned char *); -int16_t getShort(unsigned char *); -void putULong(unsigned char *, u_int32_t); -void putLong(unsigned char *, int32_t); -void putUShort(unsigned char *, unsigned int); -void putShort(unsigned char *, int); - -/* inet.c */ -struct iaddr subnet_number(struct iaddr, struct iaddr); -struct iaddr broadcast_addr(struct iaddr, struct iaddr); -int addr_eq(struct iaddr, struct iaddr); -char *piaddr(struct iaddr); - -/* dhclient.c */ -extern char *path_dhclient_conf; -extern char *path_dhclient_db; -extern time_t cur_time; -extern int log_priority; -extern int log_perror; - -extern struct client_config top_level_config; - -void dhcpoffer(struct packet *); -void dhcpack(struct packet *); -void dhcpnak(struct packet *); - -void send_discover(void *); -void send_request(void *); -void send_decline(void *); - -void state_reboot(void *); -void state_init(void *); -void state_selecting(void *); -void state_requesting(void *); -void state_bound(void *); -void state_panic(void *); - -void bind_lease(struct interface_info *); - -void make_discover(struct interface_info *, struct client_lease *); -void make_request(struct interface_info *, struct client_lease *); -void make_decline(struct interface_info *, struct client_lease *); - -void free_client_lease(struct client_lease *); -void rewrite_client_leases(struct interface_info *); -void write_client_lease(struct interface_info *, struct client_lease *, int); - -void priv_script_init(struct interface_info *, char *, char *); -void priv_script_write_params(struct interface_info *, char *, struct client_lease *); -int priv_script_go(void); - -void script_init(char *, struct string_list *); -void script_write_params(char *, struct client_lease *); -int script_go(void); -void client_envadd(struct client_state *, - const char *, const char *, const char *, ...); -void script_set_env(struct client_state *, const char *, const char *, - const char *); -void script_flush_env(struct client_state *); -int dhcp_option_ev_name(char *, size_t, struct dhcp_option *); - -struct client_lease *packet_to_lease(struct packet *); -void go_daemon(void); -void client_location_changed(void); - -void bootp(struct packet *); -void dhcp(struct packet *); - -/* packet.c */ -void assemble_hw_header(struct interface_info *, unsigned char *, - int *, struct hardware *); -void assemble_udp_ip_header(unsigned char *, int *, u_int32_t, u_int32_t, - unsigned int, unsigned char *, int); -ssize_t decode_hw_header(unsigned char *, int, struct hardware *); -ssize_t decode_udp_ip_header(unsigned char *, int, struct sockaddr_in *, - unsigned char *, int); - -/* ethernet.c */ -void assemble_ethernet_header(struct interface_info *, unsigned char *, - int *, struct hardware *); -ssize_t decode_ethernet_header(struct interface_info *, unsigned char *, - int, struct hardware *); - -/* clparse.c */ -int read_client_conf(struct interface_info *); -void read_client_leases(void); -void parse_client_statement(FILE *, struct interface_info *, - struct client_config *); -int parse_X(FILE *, u_int8_t *, int); -int parse_option_list(FILE *, u_int8_t *); -void parse_interface_declaration(FILE *, struct client_config *); -struct interface_info *interface_or_dummy(char *); -void make_client_state(struct interface_info *); -void make_client_config(struct interface_info *, struct client_config *); -void parse_client_lease_statement(FILE *, int); -void parse_client_lease_declaration(FILE *, struct client_lease *, - struct interface_info **); -struct dhcp_option *parse_option_decl(FILE *, struct option_data *); -void parse_string_list(FILE *, struct string_list **, int); -void parse_reject_statement(FILE *, struct client_config *); - -/* privsep.c */ -struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); -int buf_close(int, struct buf *); -ssize_t buf_read(int, void *, size_t); -void dispatch_imsg(int); diff --git a/reactos/dll/win32/dhcpcsvc/include/hash.h b/reactos/dll/win32/dhcpcsvc/include/hash.h deleted file mode 100644 index 1bebb3140f8..00000000000 --- a/reactos/dll/win32/dhcpcsvc/include/hash.h +++ /dev/null @@ -1,56 +0,0 @@ -/* hash.h - - Definitions for hashing... */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define DEFAULT_HASH_SIZE 97 - -struct hash_bucket { - struct hash_bucket *next; - unsigned char *name; - int len; - unsigned char *value; -}; - -struct hash_table { - int hash_count; - struct hash_bucket *buckets [DEFAULT_HASH_SIZE]; -}; - diff --git a/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h b/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h deleted file mode 100644 index 48c67167f3e..00000000000 --- a/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef ROSDHCP_H -#define ROSDHCP_H - -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include -#include -#include -#include -#include -#include -#include -#include "debug.h" -#define IFNAMSIZ MAX_INTERFACE_NAME_LEN -#undef interface /* wine/objbase.h -- Grrr */ - -#undef IGNORE -#undef ACCEPT -#undef PREFER -#define DHCP_DISCOVER_INTERVAL 15 -#define DHCP_REBOOT_TIMEOUT 300 -#define DHCP_PANIC_TIMEOUT DHCP_REBOOT_TIMEOUT * 3 -#define DHCP_BACKOFF_MAX 300 -#define DHCP_DEFAULT_LEASE_TIME 43200 /* 12 hours */ -#define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid" -typedef void *VOIDPTR; -typedef unsigned char u_int8_t; -typedef unsigned short u_int16_t; -typedef unsigned int u_int32_t; -typedef char *caddr_t; - -#ifndef _SSIZE_T_DEFINED -#define _SSIZE_T_DEFINED -#undef ssize_t -#ifdef _WIN64 -#if defined(__GNUC__) && defined(__STRICT_ANSI__) - typedef int ssize_t __attribute__ ((mode (DI))); -#else - typedef __int64 ssize_t; -#endif -#else - typedef int ssize_t; -#endif -#endif - -typedef u_int32_t uintTIME; -#define TIME uintTIME -#include "dhcpd.h" - -#define INLINE inline -#define PROTO(x) x - -typedef void (*handler_t) PROTO ((struct packet *)); - -struct iaddr; -struct interface_info; - -typedef struct _DHCP_ADAPTER { - LIST_ENTRY ListEntry; - MIB_IFROW IfMib; - MIB_IPFORWARDROW RouterMib; - MIB_IPADDRROW IfAddr; - SOCKADDR Address; - ULONG NteContext,NteInstance; - struct interface_info DhclientInfo; - struct client_state DhclientState; - struct client_config DhclientConfig; - struct sockaddr_in ListenAddr; - unsigned int BindStatus; - unsigned char recv_buf[1]; -} DHCP_ADAPTER, *PDHCP_ADAPTER; - -typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply ); - -#define random rand -#define srandom srand - -void AdapterInit(VOID); -BOOLEAN AdapterDiscover(VOID); -void AdapterStop(VOID); -extern PDHCP_ADAPTER AdapterGetFirst(); -extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER); -extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); -extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); -extern PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ); -extern HANDLE PipeInit(); -extern VOID ApiInit(); -extern VOID ApiFree(); -extern VOID ApiLock(); -extern VOID ApiUnlock(); -extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); -extern int inet_aton(const char *s, struct in_addr *addr); -int warn( char *format, ... ); -#endif/*ROSDHCP_H*/ diff --git a/reactos/dll/win32/dhcpcsvc/include/tree.h b/reactos/dll/win32/dhcpcsvc/include/tree.h deleted file mode 100644 index 367ffa7d9a1..00000000000 --- a/reactos/dll/win32/dhcpcsvc/include/tree.h +++ /dev/null @@ -1,66 +0,0 @@ -/* $OpenBSD: tree.h,v 1.5 2004/05/06 22:29:15 deraadt Exp $ */ - -/* Definitions for address trees... */ - -/* - * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -/* A pair of pointers, suitable for making a linked list. */ -typedef struct _pair { - caddr_t car; - struct _pair *cdr; -} *pair; - -struct tree_cache { - unsigned char *value; - int len; - int buf_size; - time_t timeout; -}; - -struct universe { - char *name; - struct hash_table *hash; - struct dhcp_option *options[256]; -}; - -struct dhcp_option { - char *name; - char *format; - struct universe *universe; - unsigned char code; -}; diff --git a/reactos/dll/win32/dhcpcsvc/options.c b/reactos/dll/win32/dhcpcsvc/options.c deleted file mode 100644 index 27be626523a..00000000000 --- a/reactos/dll/win32/dhcpcsvc/options.c +++ /dev/null @@ -1,723 +0,0 @@ -/* $OpenBSD: options.c,v 1.15 2004/12/26 03:17:07 deraadt Exp $ */ - -/* DHCP options parsing and reassembly. */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#include -#include - -#define DHCP_OPTION_DATA -#include "rosdhcp.h" -#include "dhcpd.h" - -int bad_options = 0; -int bad_options_max = 5; - -void parse_options(struct packet *); -void parse_option_buffer(struct packet *, unsigned char *, int); -int store_options(unsigned char *, int, struct tree_cache **, - unsigned char *, int, int, int, int); - - -/* - * Parse all available options out of the specified packet. - */ -void -parse_options(struct packet *packet) -{ - /* Initially, zero all option pointers. */ - memset(packet->options, 0, sizeof(packet->options)); - - /* If we don't see the magic cookie, there's nothing to parse. */ - if (memcmp(packet->raw->options, DHCP_OPTIONS_COOKIE, 4)) { - packet->options_valid = 0; - return; - } - - /* - * Go through the options field, up to the end of the packet or - * the End field. - */ - parse_option_buffer(packet, &packet->raw->options[4], - packet->packet_length - DHCP_FIXED_NON_UDP - 4); - - /* - * If we parsed a DHCP Option Overload option, parse more - * options out of the buffer(s) containing them. - */ - if (packet->options_valid && - packet->options[DHO_DHCP_OPTION_OVERLOAD].data) { - if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1) - parse_option_buffer(packet, - (unsigned char *)packet->raw->file, - sizeof(packet->raw->file)); - if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2) - parse_option_buffer(packet, - (unsigned char *)packet->raw->sname, - sizeof(packet->raw->sname)); - } -} - -/* - * Parse options out of the specified buffer, storing addresses of - * option values in packet->options and setting packet->options_valid if - * no errors are encountered. - */ -void -parse_option_buffer(struct packet *packet, - unsigned char *buffer, int length) -{ - unsigned char *s, *t, *end = buffer + length; - int len, code; - - for (s = buffer; *s != DHO_END && s < end; ) { - code = s[0]; - - /* Pad options don't have a length - just skip them. */ - if (code == DHO_PAD) { - s++; - continue; - } - if (s + 2 > end) { - len = 65536; - goto bogus; - } - - /* - * All other fields (except end, see above) have a - * one-byte length. - */ - len = s[1]; - - /* - * If the length is outrageous, silently skip the rest, - * and mark the packet bad. Unfortunately some crappy - * dhcp servers always seem to give us garbage on the - * end of a packet. so rather than keep refusing, give - * up and try to take one after seeing a few without - * anything good. - */ - if (s + len + 2 > end) { - bogus: - bad_options++; - warning("option %s (%d) %s.", - dhcp_options[code].name, len, - "larger than buffer"); - if (bad_options == bad_options_max) { - packet->options_valid = 1; - bad_options = 0; - warning("Many bogus options seen in offers. " - "Taking this offer in spite of bogus " - "options - hope for the best!"); - } else { - warning("rejecting bogus offer."); - packet->options_valid = 0; - } - return; - } - /* - * If we haven't seen this option before, just make - * space for it and copy it there. - */ - if (!packet->options[code].data) { - if (!(t = calloc(1, len + 1))) - error("Can't allocate storage for option %s.", - dhcp_options[code].name); - /* - * Copy and NUL-terminate the option (in case - * it's an ASCII string. - */ - memcpy(t, &s[2], len); - t[len] = 0; - packet->options[code].len = len; - packet->options[code].data = t; - } else { - /* - * If it's a repeat, concatenate it to whatever - * we last saw. This is really only required - * for clients, but what the heck... - */ - t = calloc(1, len + packet->options[code].len + 1); - if (!t) { - error("Can't expand storage for option %s.", - dhcp_options[code].name); - return; - } - memcpy(t, packet->options[code].data, - packet->options[code].len); - memcpy(t + packet->options[code].len, - &s[2], len); - packet->options[code].len += len; - t[packet->options[code].len] = 0; - free(packet->options[code].data); - packet->options[code].data = t; - } - s += len + 2; - } - packet->options_valid = 1; -} - -/* - * cons options into a big buffer, and then split them out into the - * three separate buffers if needed. This allows us to cons up a set of - * vendor options using the same routine. - */ -int -cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, - int mms, struct tree_cache **options, - int overload, /* Overload flags that may be set. */ - int terminate, int bootpp, u_int8_t *prl, int prl_len) -{ - unsigned char priority_list[300], buffer[4096]; - int priority_len, main_buffer_size, mainbufix, bufix; - int option_size, length; - - /* - * If the client has provided a maximum DHCP message size, use - * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use - * up to the minimum IP MTU size (576 bytes). - * - * XXX if a BOOTP client specifies a max message size, we will - * honor it. - */ - if (!mms && - inpacket && - inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data && - (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >= - sizeof(u_int16_t))) - mms = getUShort( - inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data); - - if (mms) - main_buffer_size = mms - DHCP_FIXED_LEN; - else if (bootpp) - main_buffer_size = 64; - else - main_buffer_size = 576 - DHCP_FIXED_LEN; - - if (main_buffer_size > sizeof(buffer)) - main_buffer_size = sizeof(buffer); - - /* Preload the option priority list with mandatory options. */ - priority_len = 0; - priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE; - priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER; - priority_list[priority_len++] = DHO_DHCP_LEASE_TIME; - priority_list[priority_len++] = DHO_DHCP_MESSAGE; - - /* - * If the client has provided a list of options that it wishes - * returned, use it to prioritize. Otherwise, prioritize based - * on the default priority list. - */ - if (inpacket && - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) { - int prlen = - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len; - if (prlen + priority_len > sizeof(priority_list)) - prlen = sizeof(priority_list) - priority_len; - - memcpy(&priority_list[priority_len], - inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data, - prlen); - priority_len += prlen; - prl = priority_list; - } else if (prl) { - if (prl_len + priority_len > sizeof(priority_list)) - prl_len = sizeof(priority_list) - priority_len; - - memcpy(&priority_list[priority_len], prl, prl_len); - priority_len += prl_len; - prl = priority_list; - } else { - memcpy(&priority_list[priority_len], - dhcp_option_default_priority_list, - sizeof_dhcp_option_default_priority_list); - priority_len += sizeof_dhcp_option_default_priority_list; - } - - /* Copy the options into the big buffer... */ - option_size = store_options( - buffer, - (main_buffer_size - 7 + ((overload & 1) ? DHCP_FILE_LEN : 0) + - ((overload & 2) ? DHCP_SNAME_LEN : 0)), - options, priority_list, priority_len, main_buffer_size, - (main_buffer_size + ((overload & 1) ? DHCP_FILE_LEN : 0)), - terminate); - - /* Put the cookie up front... */ - memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4); - mainbufix = 4; - - /* - * If we're going to have to overload, store the overload option - * at the beginning. If we can, though, just store the whole - * thing in the packet's option buffer and leave it at that. - */ - if (option_size <= main_buffer_size - mainbufix) { - memcpy(&outpacket->options[mainbufix], - buffer, option_size); - mainbufix += option_size; - if (mainbufix < main_buffer_size) - outpacket->options[mainbufix++] = DHO_END; - length = DHCP_FIXED_NON_UDP + mainbufix; - } else { - outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD; - outpacket->options[mainbufix++] = 1; - if (option_size > - main_buffer_size - mainbufix + DHCP_FILE_LEN) - outpacket->options[mainbufix++] = 3; - else - outpacket->options[mainbufix++] = 1; - - memcpy(&outpacket->options[mainbufix], - buffer, main_buffer_size - mainbufix); - bufix = main_buffer_size - mainbufix; - length = DHCP_FIXED_NON_UDP + mainbufix; - if (overload & 1) { - if (option_size - bufix <= DHCP_FILE_LEN) { - memcpy(outpacket->file, - &buffer[bufix], option_size - bufix); - mainbufix = option_size - bufix; - if (mainbufix < DHCP_FILE_LEN) - outpacket->file[mainbufix++] = (char)DHO_END; - while (mainbufix < DHCP_FILE_LEN) - outpacket->file[mainbufix++] = (char)DHO_PAD; - } else { - memcpy(outpacket->file, - &buffer[bufix], DHCP_FILE_LEN); - bufix += DHCP_FILE_LEN; - } - } - if ((overload & 2) && option_size < bufix) { - memcpy(outpacket->sname, - &buffer[bufix], option_size - bufix); - - mainbufix = option_size - bufix; - if (mainbufix < DHCP_SNAME_LEN) - outpacket->file[mainbufix++] = (char)DHO_END; - while (mainbufix < DHCP_SNAME_LEN) - outpacket->file[mainbufix++] = (char)DHO_PAD; - } - } - return (length); -} - -/* - * Store all the requested options into the requested buffer. - */ -int -store_options(unsigned char *buffer, int buflen, struct tree_cache **options, - unsigned char *priority_list, int priority_len, int first_cutoff, - int second_cutoff, int terminate) -{ - int bufix = 0, option_stored[256], i, ix, tto; - - /* Zero out the stored-lengths array. */ - memset(option_stored, 0, sizeof(option_stored)); - - /* - * Copy out the options in the order that they appear in the - * priority list... - */ - for (i = 0; i < priority_len; i++) { - /* Code for next option to try to store. */ - int code = priority_list[i]; - int optstart; - - /* - * Number of bytes left to store (some may already have - * been stored by a previous pass). - */ - int length; - - /* If no data is available for this option, skip it. */ - if (!options[code]) { - continue; - } - - /* - * The client could ask for things that are mandatory, - * in which case we should avoid storing them twice... - */ - if (option_stored[code]) - continue; - option_stored[code] = 1; - - /* We should now have a constant length for the option. */ - length = options[code]->len; - - /* Do we add a NUL? */ - if (terminate && dhcp_options[code].format[0] == 't') { - length++; - tto = 1; - } else - tto = 0; - - /* Try to store the option. */ - - /* - * If the option's length is more than 255, we must - * store it in multiple hunks. Store 255-byte hunks - * first. However, in any case, if the option data will - * cross a buffer boundary, split it across that - * boundary. - */ - ix = 0; - - optstart = bufix; - while (length) { - unsigned char incr = length > 255 ? 255 : length; - - /* - * If this hunk of the buffer will cross a - * boundary, only go up to the boundary in this - * pass. - */ - if (bufix < first_cutoff && - bufix + incr > first_cutoff) - incr = first_cutoff - bufix; - else if (bufix < second_cutoff && - bufix + incr > second_cutoff) - incr = second_cutoff - bufix; - - /* - * If this option is going to overflow the - * buffer, skip it. - */ - if (bufix + 2 + incr > buflen) { - bufix = optstart; - break; - } - - /* Everything looks good - copy it in! */ - buffer[bufix] = code; - buffer[bufix + 1] = incr; - if (tto && incr == length) { - memcpy(buffer + bufix + 2, - options[code]->value + ix, incr - 1); - buffer[bufix + 2 + incr - 1] = 0; - } else - memcpy(buffer + bufix + 2, - options[code]->value + ix, incr); - length -= incr; - ix += incr; - bufix += 2 + incr; - } - } - return (bufix); -} - -/* - * Format the specified option so that a human can easily read it. - */ -char * -pretty_print_option(unsigned int code, unsigned char *data, int len, - int emit_commas, int emit_quotes) -{ - static char optbuf[32768]; /* XXX */ - int hunksize = 0, numhunk = -1, numelem = 0; - char fmtbuf[32], *op = optbuf; - int i, j, k, opleft = sizeof(optbuf); - unsigned char *dp = data; - struct in_addr foo; - char comma; - - /* Code should be between 0 and 255. */ - if (code > 255) - error("pretty_print_option: bad code %d", code); - - if (emit_commas) - comma = ','; - else - comma = ' '; - - /* Figure out the size of the data. */ - for (i = 0; dhcp_options[code].format[i]; i++) { - if (!numhunk) { - warning("%s: Excess information in format string: %s", - dhcp_options[code].name, - &(dhcp_options[code].format[i])); - break; - } - numelem++; - fmtbuf[i] = dhcp_options[code].format[i]; - switch (dhcp_options[code].format[i]) { - case 'A': - --numelem; - fmtbuf[i] = 0; - numhunk = 0; - break; - case 'X': - for (k = 0; k < len; k++) - if (!isascii(data[k]) || - !isprint(data[k])) - break; - if (k == len) { - fmtbuf[i] = 't'; - numhunk = -2; - } else { - fmtbuf[i] = 'x'; - hunksize++; - comma = ':'; - numhunk = 0; - } - fmtbuf[i + 1] = 0; - break; - case 't': - fmtbuf[i] = 't'; - fmtbuf[i + 1] = 0; - numhunk = -2; - break; - case 'I': - case 'l': - case 'L': - hunksize += 4; - break; - case 's': - case 'S': - hunksize += 2; - break; - case 'b': - case 'B': - case 'f': - hunksize++; - break; - case 'e': - break; - default: - warning("%s: garbage in format string: %s", - dhcp_options[code].name, - &(dhcp_options[code].format[i])); - break; - } - } - - /* Check for too few bytes... */ - if (hunksize > len) { - warning("%s: expecting at least %d bytes; got %d", - dhcp_options[code].name, hunksize, len); - return (""); - } - /* Check for too many bytes... */ - if (numhunk == -1 && hunksize < len) - warning("%s: %d extra bytes", - dhcp_options[code].name, len - hunksize); - - /* If this is an array, compute its size. */ - if (!numhunk) - numhunk = len / hunksize; - /* See if we got an exact number of hunks. */ - if (numhunk > 0 && numhunk * hunksize < len) - warning("%s: %d extra bytes at end of array", - dhcp_options[code].name, len - numhunk * hunksize); - - /* A one-hunk array prints the same as a single hunk. */ - if (numhunk < 0) - numhunk = 1; - - /* Cycle through the array (or hunk) printing the data. */ - for (i = 0; i < numhunk; i++) { - for (j = 0; j < numelem; j++) { - int opcount; - switch (fmtbuf[j]) { - case 't': - if (emit_quotes) { - *op++ = '"'; - opleft--; - } - for (; dp < data + len; dp++) { - if (!isascii(*dp) || - !isprint(*dp)) { - if (dp + 1 != data + len || - *dp != 0) { - _snprintf(op, opleft, - "\\%03o", *dp); - op += 4; - opleft -= 4; - } - } else if (*dp == '"' || - *dp == '\'' || - *dp == '$' || - *dp == '`' || - *dp == '\\') { - *op++ = '\\'; - *op++ = *dp; - opleft -= 2; - } else { - *op++ = *dp; - opleft--; - } - } - if (emit_quotes) { - *op++ = '"'; - opleft--; - } - - *op = 0; - break; - case 'I': - foo.s_addr = htonl(getULong(dp)); - strncpy(op, inet_ntoa(foo), opleft - 1); - op[opleft - 1] = ANSI_NULL; - opcount = strlen(op); - if (opcount >= opleft) - goto toobig; - opleft -= opcount; - dp += 4; - break; - case 'l': - opcount = _snprintf(op, opleft, "%ld", - (long)getLong(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 4; - break; - case 'L': - opcount = _snprintf(op, opleft, "%ld", - (unsigned long)getULong(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 4; - break; - case 's': - opcount = _snprintf(op, opleft, "%d", - getShort(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 2; - break; - case 'S': - opcount = _snprintf(op, opleft, "%d", - getUShort(dp)); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - dp += 2; - break; - case 'b': - opcount = _snprintf(op, opleft, "%d", - *(char *)dp++); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - break; - case 'B': - opcount = _snprintf(op, opleft, "%d", *dp++); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - break; - case 'x': - opcount = _snprintf(op, opleft, "%x", *dp++); - if (opcount >= opleft || opcount == -1) - goto toobig; - opleft -= opcount; - break; - case 'f': - opcount = (size_t) strncpy(op, *dp++ ? "true" : "false", opleft - 1); - op[opleft - 1] = ANSI_NULL; - if (opcount >= opleft) - goto toobig; - opleft -= opcount; - break; - default: - warning("Unexpected format code %c", fmtbuf[j]); - } - op += strlen(op); - opleft -= strlen(op); - if (opleft < 1) - goto toobig; - if (j + 1 < numelem && comma != ':') { - *op++ = ' '; - opleft--; - } - } - if (i + 1 < numhunk) { - *op++ = comma; - opleft--; - } - if (opleft < 1) - goto toobig; - - } - return (optbuf); - toobig: - warning("dhcp option too large"); - return (""); -} - -void -do_packet(struct interface_info *interface, struct dhcp_packet *packet, - int len, unsigned int from_port, struct iaddr from, struct hardware *hfrom) -{ - struct packet tp; - int i; - - if (packet->hlen > sizeof(packet->chaddr)) { - note("Discarding packet with invalid hlen."); - return; - } - - memset(&tp, 0, sizeof(tp)); - tp.raw = packet; - tp.packet_length = len; - tp.client_port = from_port; - tp.client_addr = from; - tp.interface = interface; - tp.haddr = hfrom; - - parse_options(&tp); - if (tp.options_valid && - tp.options[DHO_DHCP_MESSAGE_TYPE].data) - tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0]; - if (tp.packet_type) - dhcp(&tp); - else - bootp(&tp); - - /* Free the data associated with the options. */ - for (i = 0; i < 256; i++) - if (tp.options[i].len && tp.options[i].data) - free(tp.options[i].data); -} diff --git a/reactos/dll/win32/dhcpcsvc/pipe.c b/reactos/dll/win32/dhcpcsvc/pipe.c deleted file mode 100644 index 9ea0402c413..00000000000 --- a/reactos/dll/win32/dhcpcsvc/pipe.c +++ /dev/null @@ -1,120 +0,0 @@ -/* $Id: $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: subsys/system/dhcp/pipe.c - * PURPOSE: DHCP client pipe - * PROGRAMMER: arty - */ - -#include - -#define NDEBUG -#include - -static HANDLE CommPipe = INVALID_HANDLE_VALUE, CommThread; -DWORD CommThrId; - -#define COMM_PIPE_OUTPUT_BUFFER sizeof(COMM_DHCP_REQ) -#define COMM_PIPE_INPUT_BUFFER sizeof(COMM_DHCP_REPLY) -#define COMM_PIPE_DEFAULT_TIMEOUT 1000 - -DWORD PipeSend( COMM_DHCP_REPLY *Reply ) { - DWORD Written = 0; - BOOL Success = - WriteFile( CommPipe, - Reply, - sizeof(*Reply), - &Written, - NULL ); - return Success ? Written : -1; -} - -DWORD WINAPI PipeThreadProc( LPVOID Parameter ) { - DWORD BytesRead, BytesWritten; - COMM_DHCP_REQ Req; - COMM_DHCP_REPLY Reply; - BOOL Result, Connected; - - while( TRUE ) { - Connected = ConnectNamedPipe( CommPipe, NULL ) ? - TRUE : GetLastError() == ERROR_PIPE_CONNECTED; - - if (!Connected) { - DbgPrint("DHCP: Could not connect named pipe\n"); - CloseHandle( CommPipe ); - CommPipe = INVALID_HANDLE_VALUE; - break; - } - - Result = ReadFile( CommPipe, &Req, sizeof(Req), &BytesRead, NULL ); - if( Result ) { - switch( Req.Type ) { - case DhcpReqQueryHWInfo: - BytesWritten = DSQueryHWInfo( PipeSend, &Req ); - break; - - case DhcpReqLeaseIpAddress: - BytesWritten = DSLeaseIpAddress( PipeSend, &Req ); - break; - - case DhcpReqReleaseIpAddress: - BytesWritten = DSReleaseIpAddressLease( PipeSend, &Req ); - break; - - case DhcpReqRenewIpAddress: - BytesWritten = DSRenewIpAddressLease( PipeSend, &Req ); - break; - - case DhcpReqStaticRefreshParams: - BytesWritten = DSStaticRefreshParams( PipeSend, &Req ); - break; - - case DhcpReqGetAdapterInfo: - BytesWritten = DSGetAdapterInfo( PipeSend, &Req ); - break; - - default: - DPRINT1("Unrecognized request type %d\n", Req.Type); - ZeroMemory( &Reply, sizeof( COMM_DHCP_REPLY ) ); - Reply.Reply = 0; - BytesWritten = PipeSend( &Reply ); - break; - } - } - DisconnectNamedPipe( CommPipe ); - } - - return TRUE; -} - -HANDLE PipeInit() { - CommPipe = CreateNamedPipeW - ( DHCP_PIPE_NAME, - PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, - 1, - COMM_PIPE_OUTPUT_BUFFER, - COMM_PIPE_INPUT_BUFFER, - COMM_PIPE_DEFAULT_TIMEOUT, - NULL ); - - if( CommPipe == INVALID_HANDLE_VALUE ) { - DbgPrint("DHCP: Could not create named pipe\n"); - return CommPipe; - } - - CommThread = CreateThread( NULL, 0, PipeThreadProc, NULL, 0, &CommThrId ); - - if( !CommThread ) { - CloseHandle( CommPipe ); - CommPipe = INVALID_HANDLE_VALUE; - } - - return CommPipe; -} - -VOID PipeDestroy() { - CloseHandle( CommPipe ); - CommPipe = INVALID_HANDLE_VALUE; -} diff --git a/reactos/dll/win32/dhcpcsvc/socket.c b/reactos/dll/win32/dhcpcsvc/socket.c deleted file mode 100644 index 849d04943b5..00000000000 --- a/reactos/dll/win32/dhcpcsvc/socket.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "rosdhcp.h" - -SOCKET ServerSocket; - -void SocketInit() { - ServerSocket = socket( AF_INET, SOCK_DGRAM, 0 ); -} - -ssize_t send_packet( struct interface_info *ip, - struct dhcp_packet *p, - size_t size, - struct in_addr addr, - struct sockaddr_in *broadcast, - struct hardware *hardware ) { - int result = - sendto( ip->wfdesc, (char *)p, size, 0, - (struct sockaddr *)broadcast, sizeof(*broadcast) ); - - if (result < 0) { - note ("send_packet: %x", result); - if (result == WSAENETUNREACH) - note ("send_packet: please consult README file%s", - " regarding broadcast address."); - } - - return result; -} - -ssize_t receive_packet(struct interface_info *ip, - unsigned char *packet_data, - size_t packet_len, - struct sockaddr_in *dest, - struct hardware *hardware ) { - int recv_addr_size = sizeof(*dest); - int result = - recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0, - (struct sockaddr *)dest, &recv_addr_size ); - return result; -} diff --git a/reactos/dll/win32/dhcpcsvc/tables.c b/reactos/dll/win32/dhcpcsvc/tables.c deleted file mode 100644 index 3de26b7cef6..00000000000 --- a/reactos/dll/win32/dhcpcsvc/tables.c +++ /dev/null @@ -1,692 +0,0 @@ -/* tables.c - - Tables of information... */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ -#define lint -#ifndef lint -static char copyright[] = -"$Id: tables.c,v 1.13.2.4 1999/04/24 16:46:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" - -/* DHCP Option names, formats and codes, from RFC1533. - - Format codes: - - e - end of data - I - IP address - l - 32-bit signed integer - L - 32-bit unsigned integer - s - 16-bit signed integer - S - 16-bit unsigned integer - b - 8-bit signed integer - B - 8-bit unsigned integer - t - ASCII text - f - flag (true or false) - A - array of whatever precedes (e.g., IA means array of IP addresses) -*/ - -struct universe dhcp_universe; -struct dhcp_option dhcp_options [256] = { - { "pad", "", &dhcp_universe, 0 }, - { "subnet-mask", "I", &dhcp_universe, 1 }, - { "time-offset", "l", &dhcp_universe, 2 }, - { "routers", "IA", &dhcp_universe, 3 }, - { "time-servers", "IA", &dhcp_universe, 4 }, - { "ien116-name-servers", "IA", &dhcp_universe, 5 }, - { "domain-name-servers", "IA", &dhcp_universe, 6 }, - { "log-servers", "IA", &dhcp_universe, 7 }, - { "cookie-servers", "IA", &dhcp_universe, 8 }, - { "lpr-servers", "IA", &dhcp_universe, 9 }, - { "impress-servers", "IA", &dhcp_universe, 10 }, - { "resource-location-servers", "IA", &dhcp_universe, 11 }, - { "host-name", "X", &dhcp_universe, 12 }, - { "boot-size", "S", &dhcp_universe, 13 }, - { "merit-dump", "t", &dhcp_universe, 14 }, - { "domain-name", "t", &dhcp_universe, 15 }, - { "swap-server", "I", &dhcp_universe, 16 }, - { "root-path", "t", &dhcp_universe, 17 }, - { "extensions-path", "t", &dhcp_universe, 18 }, - { "ip-forwarding", "f", &dhcp_universe, 19 }, - { "non-local-source-routing", "f", &dhcp_universe, 20 }, - { "policy-filter", "IIA", &dhcp_universe, 21 }, - { "max-dgram-reassembly", "S", &dhcp_universe, 22 }, - { "default-ip-ttl", "B", &dhcp_universe, 23 }, - { "path-mtu-aging-timeout", "L", &dhcp_universe, 24 }, - { "path-mtu-plateau-table", "SA", &dhcp_universe, 25 }, - { "interface-mtu", "S", &dhcp_universe, 26 }, - { "all-subnets-local", "f", &dhcp_universe, 27 }, - { "broadcast-address", "I", &dhcp_universe, 28 }, - { "perform-mask-discovery", "f", &dhcp_universe, 29 }, - { "mask-supplier", "f", &dhcp_universe, 30 }, - { "router-discovery", "f", &dhcp_universe, 31 }, - { "router-solicitation-address", "I", &dhcp_universe, 32 }, - { "static-routes", "IIA", &dhcp_universe, 33 }, - { "trailer-encapsulation", "f", &dhcp_universe, 34 }, - { "arp-cache-timeout", "L", &dhcp_universe, 35 }, - { "ieee802-3-encapsulation", "f", &dhcp_universe, 36 }, - { "default-tcp-ttl", "B", &dhcp_universe, 37 }, - { "tcp-keepalive-interval", "L", &dhcp_universe, 38 }, - { "tcp-keepalive-garbage", "f", &dhcp_universe, 39 }, - { "nis-domain", "t", &dhcp_universe, 40 }, - { "nis-servers", "IA", &dhcp_universe, 41 }, - { "ntp-servers", "IA", &dhcp_universe, 42 }, - { "vendor-encapsulated-options", "X", &dhcp_universe, 43 }, - { "netbios-name-servers", "IA", &dhcp_universe, 44 }, - { "netbios-dd-server", "IA", &dhcp_universe, 45 }, - { "netbios-node-type", "B", &dhcp_universe, 46 }, - { "netbios-scope", "t", &dhcp_universe, 47 }, - { "font-servers", "IA", &dhcp_universe, 48 }, - { "x-display-manager", "IA", &dhcp_universe, 49 }, - { "dhcp-requested-address", "I", &dhcp_universe, 50 }, - { "dhcp-lease-time", "L", &dhcp_universe, 51 }, - { "dhcp-option-overload", "B", &dhcp_universe, 52 }, - { "dhcp-message-type", "B", &dhcp_universe, 53 }, - { "dhcp-server-identifier", "I", &dhcp_universe, 54 }, - { "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 }, - { "dhcp-message", "t", &dhcp_universe, 56 }, - { "dhcp-max-message-size", "S", &dhcp_universe, 57 }, - { "dhcp-renewal-time", "L", &dhcp_universe, 58 }, - { "dhcp-rebinding-time", "L", &dhcp_universe, 59 }, - { "dhcp-class-identifier", "t", &dhcp_universe, 60 }, - { "dhcp-client-identifier", "X", &dhcp_universe, 61 }, - { "option-62", "X", &dhcp_universe, 62 }, - { "option-63", "X", &dhcp_universe, 63 }, - { "nisplus-domain", "t", &dhcp_universe, 64 }, - { "nisplus-servers", "IA", &dhcp_universe, 65 }, - { "tftp-server-name", "t", &dhcp_universe, 66 }, - { "bootfile-name", "t", &dhcp_universe, 67 }, - { "mobile-ip-home-agent", "IA", &dhcp_universe, 68 }, - { "smtp-server", "IA", &dhcp_universe, 69 }, - { "pop-server", "IA", &dhcp_universe, 70 }, - { "nntp-server", "IA", &dhcp_universe, 71 }, - { "www-server", "IA", &dhcp_universe, 72 }, - { "finger-server", "IA", &dhcp_universe, 73 }, - { "irc-server", "IA", &dhcp_universe, 74 }, - { "streettalk-server", "IA", &dhcp_universe, 75 }, - { "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 }, - { "user-class", "t", &dhcp_universe, 77 }, - { "option-78", "X", &dhcp_universe, 78 }, - { "option-79", "X", &dhcp_universe, 79 }, - { "option-80", "X", &dhcp_universe, 80 }, - { "option-81", "X", &dhcp_universe, 81 }, - { "option-82", "X", &dhcp_universe, 82 }, - { "option-83", "X", &dhcp_universe, 83 }, - { "option-84", "X", &dhcp_universe, 84 }, - { "nds-servers", "IA", &dhcp_universe, 85 }, - { "nds-tree-name", "X", &dhcp_universe, 86 }, - { "nds-context", "X", &dhcp_universe, 87 }, - { "option-88", "X", &dhcp_universe, 88 }, - { "option-89", "X", &dhcp_universe, 89 }, - { "option-90", "X", &dhcp_universe, 90 }, - { "option-91", "X", &dhcp_universe, 91 }, - { "option-92", "X", &dhcp_universe, 92 }, - { "option-93", "X", &dhcp_universe, 93 }, - { "option-94", "X", &dhcp_universe, 94 }, - { "option-95", "X", &dhcp_universe, 95 }, - { "option-96", "X", &dhcp_universe, 96 }, - { "option-97", "X", &dhcp_universe, 97 }, - { "option-98", "X", &dhcp_universe, 98 }, - { "option-99", "X", &dhcp_universe, 99 }, - { "option-100", "X", &dhcp_universe, 100 }, - { "option-101", "X", &dhcp_universe, 101 }, - { "option-102", "X", &dhcp_universe, 102 }, - { "option-103", "X", &dhcp_universe, 103 }, - { "option-104", "X", &dhcp_universe, 104 }, - { "option-105", "X", &dhcp_universe, 105 }, - { "option-106", "X", &dhcp_universe, 106 }, - { "option-107", "X", &dhcp_universe, 107 }, - { "option-108", "X", &dhcp_universe, 108 }, - { "option-109", "X", &dhcp_universe, 109 }, - { "option-110", "X", &dhcp_universe, 110 }, - { "option-111", "X", &dhcp_universe, 111 }, - { "option-112", "X", &dhcp_universe, 112 }, - { "option-113", "X", &dhcp_universe, 113 }, - { "option-114", "X", &dhcp_universe, 114 }, - { "option-115", "X", &dhcp_universe, 115 }, - { "option-116", "X", &dhcp_universe, 116 }, - { "option-117", "X", &dhcp_universe, 117 }, - { "option-118", "X", &dhcp_universe, 118 }, - { "option-119", "X", &dhcp_universe, 119 }, - { "option-120", "X", &dhcp_universe, 120 }, - { "option-121", "X", &dhcp_universe, 121 }, - { "option-122", "X", &dhcp_universe, 122 }, - { "option-123", "X", &dhcp_universe, 123 }, - { "option-124", "X", &dhcp_universe, 124 }, - { "option-125", "X", &dhcp_universe, 125 }, - { "option-126", "X", &dhcp_universe, 126 }, - { "option-127", "X", &dhcp_universe, 127 }, - { "option-128", "X", &dhcp_universe, 128 }, - { "option-129", "X", &dhcp_universe, 129 }, - { "option-130", "X", &dhcp_universe, 130 }, - { "option-131", "X", &dhcp_universe, 131 }, - { "option-132", "X", &dhcp_universe, 132 }, - { "option-133", "X", &dhcp_universe, 133 }, - { "option-134", "X", &dhcp_universe, 134 }, - { "option-135", "X", &dhcp_universe, 135 }, - { "option-136", "X", &dhcp_universe, 136 }, - { "option-137", "X", &dhcp_universe, 137 }, - { "option-138", "X", &dhcp_universe, 138 }, - { "option-139", "X", &dhcp_universe, 139 }, - { "option-140", "X", &dhcp_universe, 140 }, - { "option-141", "X", &dhcp_universe, 141 }, - { "option-142", "X", &dhcp_universe, 142 }, - { "option-143", "X", &dhcp_universe, 143 }, - { "option-144", "X", &dhcp_universe, 144 }, - { "option-145", "X", &dhcp_universe, 145 }, - { "option-146", "X", &dhcp_universe, 146 }, - { "option-147", "X", &dhcp_universe, 147 }, - { "option-148", "X", &dhcp_universe, 148 }, - { "option-149", "X", &dhcp_universe, 149 }, - { "option-150", "X", &dhcp_universe, 150 }, - { "option-151", "X", &dhcp_universe, 151 }, - { "option-152", "X", &dhcp_universe, 152 }, - { "option-153", "X", &dhcp_universe, 153 }, - { "option-154", "X", &dhcp_universe, 154 }, - { "option-155", "X", &dhcp_universe, 155 }, - { "option-156", "X", &dhcp_universe, 156 }, - { "option-157", "X", &dhcp_universe, 157 }, - { "option-158", "X", &dhcp_universe, 158 }, - { "option-159", "X", &dhcp_universe, 159 }, - { "option-160", "X", &dhcp_universe, 160 }, - { "option-161", "X", &dhcp_universe, 161 }, - { "option-162", "X", &dhcp_universe, 162 }, - { "option-163", "X", &dhcp_universe, 163 }, - { "option-164", "X", &dhcp_universe, 164 }, - { "option-165", "X", &dhcp_universe, 165 }, - { "option-166", "X", &dhcp_universe, 166 }, - { "option-167", "X", &dhcp_universe, 167 }, - { "option-168", "X", &dhcp_universe, 168 }, - { "option-169", "X", &dhcp_universe, 169 }, - { "option-170", "X", &dhcp_universe, 170 }, - { "option-171", "X", &dhcp_universe, 171 }, - { "option-172", "X", &dhcp_universe, 172 }, - { "option-173", "X", &dhcp_universe, 173 }, - { "option-174", "X", &dhcp_universe, 174 }, - { "option-175", "X", &dhcp_universe, 175 }, - { "option-176", "X", &dhcp_universe, 176 }, - { "option-177", "X", &dhcp_universe, 177 }, - { "option-178", "X", &dhcp_universe, 178 }, - { "option-179", "X", &dhcp_universe, 179 }, - { "option-180", "X", &dhcp_universe, 180 }, - { "option-181", "X", &dhcp_universe, 181 }, - { "option-182", "X", &dhcp_universe, 182 }, - { "option-183", "X", &dhcp_universe, 183 }, - { "option-184", "X", &dhcp_universe, 184 }, - { "option-185", "X", &dhcp_universe, 185 }, - { "option-186", "X", &dhcp_universe, 186 }, - { "option-187", "X", &dhcp_universe, 187 }, - { "option-188", "X", &dhcp_universe, 188 }, - { "option-189", "X", &dhcp_universe, 189 }, - { "option-190", "X", &dhcp_universe, 190 }, - { "option-191", "X", &dhcp_universe, 191 }, - { "option-192", "X", &dhcp_universe, 192 }, - { "option-193", "X", &dhcp_universe, 193 }, - { "option-194", "X", &dhcp_universe, 194 }, - { "option-195", "X", &dhcp_universe, 195 }, - { "option-196", "X", &dhcp_universe, 196 }, - { "option-197", "X", &dhcp_universe, 197 }, - { "option-198", "X", &dhcp_universe, 198 }, - { "option-199", "X", &dhcp_universe, 199 }, - { "option-200", "X", &dhcp_universe, 200 }, - { "option-201", "X", &dhcp_universe, 201 }, - { "option-202", "X", &dhcp_universe, 202 }, - { "option-203", "X", &dhcp_universe, 203 }, - { "option-204", "X", &dhcp_universe, 204 }, - { "option-205", "X", &dhcp_universe, 205 }, - { "option-206", "X", &dhcp_universe, 206 }, - { "option-207", "X", &dhcp_universe, 207 }, - { "option-208", "X", &dhcp_universe, 208 }, - { "option-209", "X", &dhcp_universe, 209 }, - { "option-210", "X", &dhcp_universe, 210 }, - { "option-211", "X", &dhcp_universe, 211 }, - { "option-212", "X", &dhcp_universe, 212 }, - { "option-213", "X", &dhcp_universe, 213 }, - { "option-214", "X", &dhcp_universe, 214 }, - { "option-215", "X", &dhcp_universe, 215 }, - { "option-216", "X", &dhcp_universe, 216 }, - { "option-217", "X", &dhcp_universe, 217 }, - { "option-218", "X", &dhcp_universe, 218 }, - { "option-219", "X", &dhcp_universe, 219 }, - { "option-220", "X", &dhcp_universe, 220 }, - { "option-221", "X", &dhcp_universe, 221 }, - { "option-222", "X", &dhcp_universe, 222 }, - { "option-223", "X", &dhcp_universe, 223 }, - { "option-224", "X", &dhcp_universe, 224 }, - { "option-225", "X", &dhcp_universe, 225 }, - { "option-226", "X", &dhcp_universe, 226 }, - { "option-227", "X", &dhcp_universe, 227 }, - { "option-228", "X", &dhcp_universe, 228 }, - { "option-229", "X", &dhcp_universe, 229 }, - { "option-230", "X", &dhcp_universe, 230 }, - { "option-231", "X", &dhcp_universe, 231 }, - { "option-232", "X", &dhcp_universe, 232 }, - { "option-233", "X", &dhcp_universe, 233 }, - { "option-234", "X", &dhcp_universe, 234 }, - { "option-235", "X", &dhcp_universe, 235 }, - { "option-236", "X", &dhcp_universe, 236 }, - { "option-237", "X", &dhcp_universe, 237 }, - { "option-238", "X", &dhcp_universe, 238 }, - { "option-239", "X", &dhcp_universe, 239 }, - { "option-240", "X", &dhcp_universe, 240 }, - { "option-241", "X", &dhcp_universe, 241 }, - { "option-242", "X", &dhcp_universe, 242 }, - { "option-243", "X", &dhcp_universe, 243 }, - { "option-244", "X", &dhcp_universe, 244 }, - { "option-245", "X", &dhcp_universe, 245 }, - { "option-246", "X", &dhcp_universe, 246 }, - { "option-247", "X", &dhcp_universe, 247 }, - { "option-248", "X", &dhcp_universe, 248 }, - { "option-249", "X", &dhcp_universe, 249 }, - { "option-250", "X", &dhcp_universe, 250 }, - { "option-251", "X", &dhcp_universe, 251 }, - { "option-252", "X", &dhcp_universe, 252 }, - { "option-253", "X", &dhcp_universe, 253 }, - { "option-254", "X", &dhcp_universe, 254 }, - { "option-end", "e", &dhcp_universe, 255 }, -}; - -/* Default dhcp option priority list (this is ad hoc and should not be - mistaken for a carefully crafted and optimized list). */ -unsigned char dhcp_option_default_priority_list [] = { - DHO_DHCP_REQUESTED_ADDRESS, - DHO_DHCP_OPTION_OVERLOAD, - DHO_DHCP_MAX_MESSAGE_SIZE, - DHO_DHCP_RENEWAL_TIME, - DHO_DHCP_REBINDING_TIME, - DHO_DHCP_CLASS_IDENTIFIER, - DHO_DHCP_CLIENT_IDENTIFIER, - DHO_SUBNET_MASK, - DHO_TIME_OFFSET, - DHO_ROUTERS, - DHO_TIME_SERVERS, - DHO_NAME_SERVERS, - DHO_DOMAIN_NAME_SERVERS, - DHO_HOST_NAME, - DHO_LOG_SERVERS, - DHO_COOKIE_SERVERS, - DHO_LPR_SERVERS, - DHO_IMPRESS_SERVERS, - DHO_RESOURCE_LOCATION_SERVERS, - DHO_HOST_NAME, - DHO_BOOT_SIZE, - DHO_MERIT_DUMP, - DHO_DOMAIN_NAME, - DHO_SWAP_SERVER, - DHO_ROOT_PATH, - DHO_EXTENSIONS_PATH, - DHO_IP_FORWARDING, - DHO_NON_LOCAL_SOURCE_ROUTING, - DHO_POLICY_FILTER, - DHO_MAX_DGRAM_REASSEMBLY, - DHO_DEFAULT_IP_TTL, - DHO_PATH_MTU_AGING_TIMEOUT, - DHO_PATH_MTU_PLATEAU_TABLE, - DHO_INTERFACE_MTU, - DHO_ALL_SUBNETS_LOCAL, - DHO_BROADCAST_ADDRESS, - DHO_PERFORM_MASK_DISCOVERY, - DHO_MASK_SUPPLIER, - DHO_ROUTER_DISCOVERY, - DHO_ROUTER_SOLICITATION_ADDRESS, - DHO_STATIC_ROUTES, - DHO_TRAILER_ENCAPSULATION, - DHO_ARP_CACHE_TIMEOUT, - DHO_IEEE802_3_ENCAPSULATION, - DHO_DEFAULT_TCP_TTL, - DHO_TCP_KEEPALIVE_INTERVAL, - DHO_TCP_KEEPALIVE_GARBAGE, - DHO_NIS_DOMAIN, - DHO_NIS_SERVERS, - DHO_NTP_SERVERS, - DHO_VENDOR_ENCAPSULATED_OPTIONS, - DHO_NETBIOS_NAME_SERVERS, - DHO_NETBIOS_DD_SERVER, - DHO_NETBIOS_NODE_TYPE, - DHO_NETBIOS_SCOPE, - DHO_FONT_SERVERS, - DHO_X_DISPLAY_MANAGER, - DHO_DHCP_PARAMETER_REQUEST_LIST, - - /* Presently-undefined options... */ - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, -}; - -int sizeof_dhcp_option_default_priority_list = - sizeof dhcp_option_default_priority_list; - - -char *hardware_types [] = { - "unknown-0", - "ethernet", - "unknown-2", - "unknown-3", - "unknown-4", - "unknown-5", - "token-ring", - "unknown-7", - "fddi", - "unknown-9", - "unknown-10", - "unknown-11", - "unknown-12", - "unknown-13", - "unknown-14", - "unknown-15", - "unknown-16", - "unknown-17", - "unknown-18", - "unknown-19", - "unknown-20", - "unknown-21", - "unknown-22", - "unknown-23", - "unknown-24", - "unknown-25", - "unknown-26", - "unknown-27", - "unknown-28", - "unknown-29", - "unknown-30", - "unknown-31", - "unknown-32", - "unknown-33", - "unknown-34", - "unknown-35", - "unknown-36", - "unknown-37", - "unknown-38", - "unknown-39", - "unknown-40", - "unknown-41", - "unknown-42", - "unknown-43", - "unknown-44", - "unknown-45", - "unknown-46", - "unknown-47", - "unknown-48", - "unknown-49", - "unknown-50", - "unknown-51", - "unknown-52", - "unknown-53", - "unknown-54", - "unknown-55", - "unknown-56", - "unknown-57", - "unknown-58", - "unknown-59", - "unknown-60", - "unknown-61", - "unknown-62", - "unknown-63", - "unknown-64", - "unknown-65", - "unknown-66", - "unknown-67", - "unknown-68", - "unknown-69", - "unknown-70", - "unknown-71", - "unknown-72", - "unknown-73", - "unknown-74", - "unknown-75", - "unknown-76", - "unknown-77", - "unknown-78", - "unknown-79", - "unknown-80", - "unknown-81", - "unknown-82", - "unknown-83", - "unknown-84", - "unknown-85", - "unknown-86", - "unknown-87", - "unknown-88", - "unknown-89", - "unknown-90", - "unknown-91", - "unknown-92", - "unknown-93", - "unknown-94", - "unknown-95", - "unknown-96", - "unknown-97", - "unknown-98", - "unknown-99", - "unknown-100", - "unknown-101", - "unknown-102", - "unknown-103", - "unknown-104", - "unknown-105", - "unknown-106", - "unknown-107", - "unknown-108", - "unknown-109", - "unknown-110", - "unknown-111", - "unknown-112", - "unknown-113", - "unknown-114", - "unknown-115", - "unknown-116", - "unknown-117", - "unknown-118", - "unknown-119", - "unknown-120", - "unknown-121", - "unknown-122", - "unknown-123", - "unknown-124", - "unknown-125", - "unknown-126", - "unknown-127", - "unknown-128", - "unknown-129", - "unknown-130", - "unknown-131", - "unknown-132", - "unknown-133", - "unknown-134", - "unknown-135", - "unknown-136", - "unknown-137", - "unknown-138", - "unknown-139", - "unknown-140", - "unknown-141", - "unknown-142", - "unknown-143", - "unknown-144", - "unknown-145", - "unknown-146", - "unknown-147", - "unknown-148", - "unknown-149", - "unknown-150", - "unknown-151", - "unknown-152", - "unknown-153", - "unknown-154", - "unknown-155", - "unknown-156", - "unknown-157", - "unknown-158", - "unknown-159", - "unknown-160", - "unknown-161", - "unknown-162", - "unknown-163", - "unknown-164", - "unknown-165", - "unknown-166", - "unknown-167", - "unknown-168", - "unknown-169", - "unknown-170", - "unknown-171", - "unknown-172", - "unknown-173", - "unknown-174", - "unknown-175", - "unknown-176", - "unknown-177", - "unknown-178", - "unknown-179", - "unknown-180", - "unknown-181", - "unknown-182", - "unknown-183", - "unknown-184", - "unknown-185", - "unknown-186", - "unknown-187", - "unknown-188", - "unknown-189", - "unknown-190", - "unknown-191", - "unknown-192", - "unknown-193", - "unknown-194", - "unknown-195", - "unknown-196", - "unknown-197", - "unknown-198", - "unknown-199", - "unknown-200", - "unknown-201", - "unknown-202", - "unknown-203", - "unknown-204", - "unknown-205", - "unknown-206", - "unknown-207", - "unknown-208", - "unknown-209", - "unknown-210", - "unknown-211", - "unknown-212", - "unknown-213", - "unknown-214", - "unknown-215", - "unknown-216", - "unknown-217", - "unknown-218", - "unknown-219", - "unknown-220", - "unknown-221", - "unknown-222", - "unknown-223", - "unknown-224", - "unknown-225", - "unknown-226", - "unknown-227", - "unknown-228", - "unknown-229", - "unknown-230", - "unknown-231", - "unknown-232", - "unknown-233", - "unknown-234", - "unknown-235", - "unknown-236", - "unknown-237", - "unknown-238", - "unknown-239", - "unknown-240", - "unknown-241", - "unknown-242", - "unknown-243", - "unknown-244", - "unknown-245", - "unknown-246", - "unknown-247", - "unknown-248", - "unknown-249", - "unknown-250", - "unknown-251", - "unknown-252", - "unknown-253", - "unknown-254", - "unknown-255" }; - - - -struct hash_table universe_hash; - -void initialize_universes() -{ - int i; - - dhcp_universe.name = "dhcp"; - dhcp_universe.hash = new_hash (); - if (!dhcp_universe.hash) - error ("Can't allocate dhcp option hash table."); - for (i = 0; i < 256; i++) { - dhcp_universe.options [i] = &dhcp_options [i]; - add_hash (dhcp_universe.hash, - (unsigned char *)dhcp_options [i].name, 0, - (unsigned char *)&dhcp_options [i]); - } - universe_hash.hash_count = DEFAULT_HASH_SIZE; - add_hash (&universe_hash, - (unsigned char *)dhcp_universe.name, 0, - (unsigned char *)&dhcp_universe); -} diff --git a/reactos/dll/win32/dhcpcsvc/tree.c b/reactos/dll/win32/dhcpcsvc/tree.c deleted file mode 100644 index f721d08f897..00000000000 --- a/reactos/dll/win32/dhcpcsvc/tree.c +++ /dev/null @@ -1,412 +0,0 @@ -/* tree.c - - Routines for manipulating parse trees... */ - -/* - * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: tree.c,v 1.10 1997/05/09 08:14:57 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" - -static TIME tree_evaluate_recurse PROTO ((int *, unsigned char **, int *, - struct tree *)); -static TIME do_host_lookup PROTO ((int *, unsigned char **, int *, - struct dns_host_entry *)); -static void do_data_copy PROTO ((int *, unsigned char **, int *, - unsigned char *, int)); - -pair cons (car, cdr) - caddr_t car; - pair cdr; -{ - pair foo = (pair)dmalloc (sizeof *foo, "cons"); - if (!foo) - error ("no memory for cons."); - foo -> car = car; - foo -> cdr = cdr; - return foo; -} - -struct tree_cache *tree_cache (tree) - struct tree *tree; -{ - struct tree_cache *tc; - - tc = new_tree_cache ("tree_cache"); - if (!tc) - return 0; - tc -> value = (unsigned char *)0; - tc -> len = tc -> buf_size = 0; - tc -> timeout = 0; - tc -> tree = tree; - return tc; -} - -struct tree *tree_host_lookup (name) - char *name; -{ - struct tree *nt; - nt = new_tree ("tree_host_lookup"); - if (!nt) - error ("No memory for host lookup tree node."); - nt -> op = TREE_HOST_LOOKUP; - nt -> data.host_lookup.host = enter_dns_host (name); - return nt; -} - -struct dns_host_entry *enter_dns_host (name) - char *name; -{ - struct dns_host_entry *dh; - - if (!(dh = (struct dns_host_entry *)dmalloc - (sizeof (struct dns_host_entry), "enter_dns_host")) - || !(dh -> hostname = dmalloc (strlen (name) + 1, - "enter_dns_host"))) - error ("Can't allocate space for new host."); - strcpy (dh -> hostname, name); - dh -> data = (unsigned char *)0; - dh -> data_len = 0; - dh -> buf_len = 0; - dh -> timeout = 0; - return dh; -} - -struct tree *tree_const (data, len) - unsigned char *data; - int len; -{ - struct tree *nt; - if (!(nt = new_tree ("tree_const")) - || !(nt -> data.const_val.data = - (unsigned char *)dmalloc (len, "tree_const"))) - error ("No memory for constant data tree node."); - nt -> op = TREE_CONST; - memcpy (nt -> data.const_val.data, data, len); - nt -> data.const_val.len = len; - return nt; -} - -struct tree *tree_concat (left, right) - struct tree *left, *right; -{ - struct tree *nt; - - /* If we're concatenating a null tree to a non-null tree, just - return the non-null tree; if both trees are null, return - a null tree. */ - if (!left) - return right; - if (!right) - return left; - - /* If both trees are constant, combine them. */ - if (left -> op == TREE_CONST && right -> op == TREE_CONST) { - unsigned char *buf = dmalloc (left -> data.const_val.len - + right -> data.const_val.len, - "tree_concat"); - if (!buf) - error ("No memory to concatenate constants."); - memcpy (buf, left -> data.const_val.data, - left -> data.const_val.len); - memcpy (buf + left -> data.const_val.len, - right -> data.const_val.data, - right -> data.const_val.len); - dfree (left -> data.const_val.data, "tree_concat"); - dfree (right -> data.const_val.data, "tree_concat"); - left -> data.const_val.data = buf; - left -> data.const_val.len += right -> data.const_val.len; - free_tree (right, "tree_concat"); - return left; - } - - /* Otherwise, allocate a new node to concatenate the two. */ - if (!(nt = new_tree ("tree_concat"))) - error ("No memory for data tree concatenation node."); - nt -> op = TREE_CONCAT; - nt -> data.concat.left = left; - nt -> data.concat.right = right; - return nt; -} - -struct tree *tree_limit (tree, limit) - struct tree *tree; - int limit; -{ - struct tree *rv; - - /* If the tree we're limiting is constant, limit it now. */ - if (tree -> op == TREE_CONST) { - if (tree -> data.const_val.len > limit) - tree -> data.const_val.len = limit; - return tree; - } - - /* Otherwise, put in a node which enforces the limit on evaluation. */ - rv = new_tree ("tree_limit"); - if (!rv) - return (struct tree *)0; - rv -> op = TREE_LIMIT; - rv -> data.limit.tree = tree; - rv -> data.limit.limit = limit; - return rv; -} - -int tree_evaluate (tree_cache) - struct tree_cache *tree_cache; -{ - unsigned char *bp = tree_cache -> value; - int bc = tree_cache -> buf_size; - int bufix = 0; - - /* If there's no tree associated with this cache, it evaluates - to a constant and that was detected at startup. */ - if (!tree_cache -> tree) - return 1; - - /* Try to evaluate the tree without allocating more memory... */ - tree_cache -> timeout = tree_evaluate_recurse (&bufix, &bp, &bc, - tree_cache -> tree); - - /* No additional allocation needed? */ - if (bufix <= bc) { - tree_cache -> len = bufix; - return 1; - } - - /* If we can't allocate more memory, return with what we - have (maybe nothing). */ - if (!(bp = (unsigned char *)dmalloc (bufix, "tree_evaluate"))) - return 0; - - /* Record the change in conditions... */ - bc = bufix; - bufix = 0; - - /* Note that the size of the result shouldn't change on the - second call to tree_evaluate_recurse, since we haven't - changed the ``current'' time. */ - tree_evaluate_recurse (&bufix, &bp, &bc, tree_cache -> tree); - - /* Free the old buffer if needed, then store the new buffer - location and size and return. */ - if (tree_cache -> value) - dfree (tree_cache -> value, "tree_evaluate"); - tree_cache -> value = bp; - tree_cache -> len = bufix; - tree_cache -> buf_size = bc; - return 1; -} - -static TIME tree_evaluate_recurse (bufix, bufp, bufcount, tree) - int *bufix; - unsigned char **bufp; - int *bufcount; - struct tree *tree; -{ - int limit; - TIME t1, t2; - - switch (tree -> op) { - case TREE_CONCAT: - t1 = tree_evaluate_recurse (bufix, bufp, bufcount, - tree -> data.concat.left); - t2 = tree_evaluate_recurse (bufix, bufp, bufcount, - tree -> data.concat.right); - if (t1 > t2) - return t2; - return t1; - - case TREE_HOST_LOOKUP: - return do_host_lookup (bufix, bufp, bufcount, - tree -> data.host_lookup.host); - - case TREE_CONST: - do_data_copy (bufix, bufp, bufcount, - tree -> data.const_val.data, - tree -> data.const_val.len); - t1 = MAX_TIME; - return t1; - - case TREE_LIMIT: - limit = *bufix + tree -> data.limit.limit; - t1 = tree_evaluate_recurse (bufix, bufp, bufcount, - tree -> data.limit.tree); - *bufix = limit; - return t1; - - default: - warn ("Bad node id in tree: %d."); - t1 = MAX_TIME; - return t1; - } -} - -static TIME do_host_lookup (bufix, bufp, bufcount, dns) - int *bufix; - unsigned char **bufp; - int *bufcount; - struct dns_host_entry *dns; -{ - struct hostent *h; - int i; - int new_len; - -#ifdef DEBUG_EVAL - debug ("time: now = %d dns = %d %d diff = %d", - cur_time, dns -> timeout, cur_time - dns -> timeout); -#endif - - /* If the record hasn't timed out, just copy the data and return. */ - if (cur_time <= dns -> timeout) { -#ifdef DEBUG_EVAL - debug ("easy copy: %x %d %x", - dns -> data, dns -> data_len, - dns -> data ? *(int *)(dns -> data) : 0); -#endif - do_data_copy (bufix, bufp, bufcount, - dns -> data, dns -> data_len); - return dns -> timeout; - } -#ifdef DEBUG_EVAL - debug ("Looking up %s", dns -> hostname); -#endif - - /* Otherwise, look it up... */ - h = gethostbyname (dns -> hostname); - if (!h) { -#ifndef NO_H_ERRNO - switch (h_errno) { - case HOST_NOT_FOUND: -#endif - warn ("%s: host unknown.", dns -> hostname); -#ifndef NO_H_ERRNO - break; - case TRY_AGAIN: - warn ("%s: temporary name server failure", - dns -> hostname); - break; - case NO_RECOVERY: - warn ("%s: name server failed", dns -> hostname); - break; - case NO_DATA: - warn ("%s: no A record associated with address", - dns -> hostname); - } -#endif /* !NO_H_ERRNO */ - - /* Okay to try again after a minute. */ - return cur_time + 60; - } - -#ifdef DEBUG_EVAL - debug ("Lookup succeeded; first address is %x", - h -> h_addr_list [0]); -#endif - - /* Count the number of addresses we got... */ - for (i = 0; h -> h_addr_list [i]; i++) - ; - - /* Do we need to allocate more memory? */ - new_len = i * h -> h_length; - if (dns -> buf_len < i) { - unsigned char *buf = - (unsigned char *)dmalloc (new_len, "do_host_lookup"); - /* If we didn't get more memory, use what we have. */ - if (!buf) { - new_len = dns -> buf_len; - if (!dns -> buf_len) { - dns -> timeout = cur_time + 60; - return dns -> timeout; - } - } else { - if (dns -> data) - dfree (dns -> data, "do_host_lookup"); - dns -> data = buf; - dns -> buf_len = new_len; - } - } - - /* Addresses are conveniently stored one to the buffer, so we - have to copy them out one at a time... :'( */ - for (i = 0; i < new_len / h -> h_length; i++) { - memcpy (dns -> data + h -> h_length * i, - h -> h_addr_list [i], h -> h_length); - } -#ifdef DEBUG_EVAL - debug ("dns -> data: %x h -> h_addr_list [0]: %x", - *(int *)(dns -> data), h -> h_addr_list [0]); -#endif - dns -> data_len = new_len; - - /* Set the timeout for an hour from now. - XXX This should really use the time on the DNS reply. */ - dns -> timeout = cur_time + 3600; - -#ifdef DEBUG_EVAL - debug ("hard copy: %x %d %x", - dns -> data, dns -> data_len, *(int *)(dns -> data)); -#endif - do_data_copy (bufix, bufp, bufcount, dns -> data, dns -> data_len); - return dns -> timeout; -} - -static void do_data_copy (bufix, bufp, bufcount, data, len) - int *bufix; - unsigned char **bufp; - int *bufcount; - unsigned char *data; - int len; -{ - int space = *bufcount - *bufix; - - /* If there's more space than we need, use only what we need. */ - if (space > len) - space = len; - - /* Copy as much data as will fit, then increment the buffer index - by the amount we actually had to copy, which could be more. */ - if (space > 0) - memcpy (*bufp + *bufix, data, space); - *bufix += len; -} diff --git a/reactos/dll/win32/dhcpcsvc/util.c b/reactos/dll/win32/dhcpcsvc/util.c deleted file mode 100644 index 238a788e283..00000000000 --- a/reactos/dll/win32/dhcpcsvc/util.c +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include "rosdhcp.h" - -#define NDEBUG -#include - -char *piaddr( struct iaddr addr ) { - struct sockaddr_in sa; - memcpy(&sa.sin_addr,addr.iabuf,sizeof(sa.sin_addr)); - return inet_ntoa( sa.sin_addr ); -} - -int note( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("NOTE: %s\n", buf); - - return ret; -} - -int debug( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("DEBUG: %s\n", buf); - - return ret; -} - -int warn( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("WARN: %s\n", buf); - - return ret; -} - -int warning( char *format, ... ) { - char buf[0x100]; - int ret; - va_list arg_begin; - va_start( arg_begin, format ); - - ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT("WARNING: %s\n", buf); - - return ret; -} - -void error( char *format, ... ) { - char buf[0x100]; - va_list arg_begin; - va_start( arg_begin, format ); - - _vsnprintf( buf, sizeof(buf), format, arg_begin ); - - DPRINT1("ERROR: %s\n", buf); -} - -int16_t getShort( unsigned char *data ) { - return (int16_t) ntohs(*(int16_t*) data); -} - -u_int16_t getUShort( unsigned char *data ) { - return (u_int16_t) ntohs(*(u_int16_t*) data); -} - -int32_t getLong( unsigned char *data ) { - return (int32_t) ntohl(*(u_int32_t*) data); -} - -u_int32_t getULong( unsigned char *data ) { - return ntohl(*(u_int32_t*)data); -} - -int addr_eq( struct iaddr a, struct iaddr b ) { - return a.len == b.len && !memcmp( a.iabuf, b.iabuf, a.len ); -} - -void *dmalloc( int size, char *name ) { return malloc( size ); } - -int read_client_conf(struct interface_info *ifi) { - /* What a strange dance */ - struct client_config *config; - char ComputerName [MAX_COMPUTERNAME_LENGTH + 1]; - LPSTR lpCompName; - DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0]; - - if ((ifi!= NULL) && (ifi->client->config != NULL)) - config = ifi->client->config; - else - { - warn("util.c read_client_conf poorly implemented!"); - return 0; - } - - - GetComputerName(ComputerName, & ComputerNameSize); - debug("Hostname: %s, length: %lu", - ComputerName, ComputerNameSize); - /* This never gets freed since it's only called once */ - lpCompName = - HeapAlloc(GetProcessHeap(), 0, ComputerNameSize + 1); - if (lpCompName !=NULL) { - memcpy(lpCompName, ComputerName, ComputerNameSize + 1); - /* Send our hostname, some dhcpds use this to update DNS */ - config->send_options[DHO_HOST_NAME].data = (u_int8_t*)lpCompName; - config->send_options[DHO_HOST_NAME].len = ComputerNameSize; - debug("Hostname: %s, length: %d", - config->send_options[DHO_HOST_NAME].data, - config->send_options[DHO_HOST_NAME].len); - } else { - error("Failed to allocate heap for hostname"); - } - /* Both Linux and Windows send this */ - config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].data = - ifi->hw_address.haddr; - config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].len = - ifi->hw_address.hlen; - - /* Setup the requested option list */ - config->requested_options - [config->requested_option_count++] = DHO_SUBNET_MASK; - config->requested_options - [config->requested_option_count++] = DHO_BROADCAST_ADDRESS; - config->requested_options - [config->requested_option_count++] = DHO_TIME_OFFSET; - config->requested_options - [config->requested_option_count++] = DHO_ROUTERS; - config->requested_options - [config->requested_option_count++] = DHO_DOMAIN_NAME; - config->requested_options - [config->requested_option_count++] = DHO_DOMAIN_NAME_SERVERS; - config->requested_options - [config->requested_option_count++] = DHO_HOST_NAME; - config->requested_options - [config->requested_option_count++] = DHO_NTP_SERVERS; - - warn("util.c read_client_conf poorly implemented!"); - return 0; -} - -struct iaddr broadcast_addr( struct iaddr addr, struct iaddr mask ) { - struct iaddr bcast = { 0 }; - return bcast; -} - -struct iaddr subnet_number( struct iaddr addr, struct iaddr mask ) { - struct iaddr bcast = { 0 }; - return bcast; -} From 2835ee84edb76ef77fe4416b2bcd0a276dc3b072 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 21 May 2010 19:30:13 +0000 Subject: [PATCH 143/151] [DHCP] - Restore SVN history - Part 2 of x svn path=/trunk/; revision=47291 --- reactos/base/services/dhcp/adapter.c | 446 ++++ reactos/base/services/dhcp/alloc.c | 93 + reactos/base/services/dhcp/api.c | 197 ++ reactos/base/services/dhcp/compat.c | 67 + reactos/base/services/dhcp/design.txt | 33 + reactos/base/services/dhcp/dhclient.c | 2170 +++++++++++++++++ reactos/base/services/dhcp/dhcp.rbuild | 30 + reactos/base/services/dhcp/dhcp.rc | 6 + reactos/base/services/dhcp/dhcpmain.c | 72 + reactos/base/services/dhcp/dispatch.c | 356 +++ reactos/base/services/dhcp/hash.c | 165 ++ reactos/base/services/dhcp/include/cdefs.h | 57 + reactos/base/services/dhcp/include/debug.h | 51 + reactos/base/services/dhcp/include/dhcp.h | 169 ++ reactos/base/services/dhcp/include/dhcpd.h | 485 ++++ reactos/base/services/dhcp/include/dhctoken.h | 136 ++ reactos/base/services/dhcp/include/hash.h | 56 + reactos/base/services/dhcp/include/inet.h | 52 + reactos/base/services/dhcp/include/osdep.h | 294 +++ reactos/base/services/dhcp/include/predec.h | 4 + reactos/base/services/dhcp/include/privsep.h | 47 + reactos/base/services/dhcp/include/rosdhcp.h | 94 + reactos/base/services/dhcp/include/site.h | 100 + reactos/base/services/dhcp/include/stdint.h | 10 + reactos/base/services/dhcp/include/sysconf.h | 52 + reactos/base/services/dhcp/include/tree.h | 66 + reactos/base/services/dhcp/include/version.h | 3 + reactos/base/services/dhcp/memory.c | 919 +++++++ reactos/base/services/dhcp/options.c | 723 ++++++ reactos/base/services/dhcp/pipe.c | 120 + reactos/base/services/dhcp/privsep.c | 225 ++ reactos/base/services/dhcp/socket.c | 39 + reactos/base/services/dhcp/tables.c | 692 ++++++ reactos/base/services/dhcp/timer.c | 2 + reactos/base/services/dhcp/tree.c | 412 ++++ reactos/base/services/dhcp/util.c | 166 ++ 36 files changed, 8609 insertions(+) create mode 100644 reactos/base/services/dhcp/adapter.c create mode 100644 reactos/base/services/dhcp/alloc.c create mode 100644 reactos/base/services/dhcp/api.c create mode 100644 reactos/base/services/dhcp/compat.c create mode 100644 reactos/base/services/dhcp/design.txt create mode 100644 reactos/base/services/dhcp/dhclient.c create mode 100644 reactos/base/services/dhcp/dhcp.rbuild create mode 100644 reactos/base/services/dhcp/dhcp.rc create mode 100644 reactos/base/services/dhcp/dhcpmain.c create mode 100644 reactos/base/services/dhcp/dispatch.c create mode 100644 reactos/base/services/dhcp/hash.c create mode 100644 reactos/base/services/dhcp/include/cdefs.h create mode 100644 reactos/base/services/dhcp/include/debug.h create mode 100644 reactos/base/services/dhcp/include/dhcp.h create mode 100644 reactos/base/services/dhcp/include/dhcpd.h create mode 100644 reactos/base/services/dhcp/include/dhctoken.h create mode 100644 reactos/base/services/dhcp/include/hash.h create mode 100644 reactos/base/services/dhcp/include/inet.h create mode 100644 reactos/base/services/dhcp/include/osdep.h create mode 100644 reactos/base/services/dhcp/include/predec.h create mode 100644 reactos/base/services/dhcp/include/privsep.h create mode 100644 reactos/base/services/dhcp/include/rosdhcp.h create mode 100644 reactos/base/services/dhcp/include/site.h create mode 100644 reactos/base/services/dhcp/include/stdint.h create mode 100644 reactos/base/services/dhcp/include/sysconf.h create mode 100644 reactos/base/services/dhcp/include/tree.h create mode 100644 reactos/base/services/dhcp/include/version.h create mode 100644 reactos/base/services/dhcp/memory.c create mode 100644 reactos/base/services/dhcp/options.c create mode 100644 reactos/base/services/dhcp/pipe.c create mode 100644 reactos/base/services/dhcp/privsep.c create mode 100644 reactos/base/services/dhcp/socket.c create mode 100644 reactos/base/services/dhcp/tables.c create mode 100644 reactos/base/services/dhcp/timer.c create mode 100644 reactos/base/services/dhcp/tree.c create mode 100644 reactos/base/services/dhcp/util.c diff --git a/reactos/base/services/dhcp/adapter.c b/reactos/base/services/dhcp/adapter.c new file mode 100644 index 00000000000..ea848bc8bcc --- /dev/null +++ b/reactos/base/services/dhcp/adapter.c @@ -0,0 +1,446 @@ +#include "rosdhcp.h" + +static SOCKET DhcpSocket = INVALID_SOCKET; +static LIST_ENTRY AdapterList; +static WSADATA wsd; + +PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { + int i = 0; + DWORD Error; + HKEY MainKey; + PCHAR *Out, OutKeyName; + DWORD CharTotal = 0, AppendLen = 1 + strlen(Append); + DWORD MaxSubKeyLen = 0, MaxSubKeys = 0; + + Error = RegOpenKey( HKEY_LOCAL_MACHINE, MainKeyName, &MainKey ); + + if( Error ) return NULL; + + Error = RegQueryInfoKey + ( MainKey, + NULL, NULL, NULL, + &MaxSubKeys, &MaxSubKeyLen, + NULL, NULL, NULL, NULL, NULL, NULL ); + + DH_DbgPrint(MID_TRACE,("MaxSubKeys: %d, MaxSubKeyLen %d\n", + MaxSubKeys, MaxSubKeyLen)); + + CharTotal = (sizeof(PCHAR) + MaxSubKeyLen + AppendLen) * (MaxSubKeys + 1); + + DH_DbgPrint(MID_TRACE,("AppendLen: %d, CharTotal: %d\n", + AppendLen, CharTotal)); + + Out = (CHAR**) malloc( CharTotal ); + OutKeyName = ((PCHAR)&Out[MaxSubKeys+1]); + + if( !Out ) { RegCloseKey( MainKey ); return NULL; } + + i = 0; + do { + Out[i] = OutKeyName; + Error = RegEnumKey( MainKey, i, OutKeyName, MaxSubKeyLen ); + if( !Error ) { + strcat( OutKeyName, Append ); + DH_DbgPrint(MID_TRACE,("[%d]: %s\n", i, OutKeyName)); + OutKeyName += strlen(OutKeyName) + 1; + i++; + } else Out[i] = 0; + } while( Error == ERROR_SUCCESS ); + + RegCloseKey( MainKey ); + + return Out; +} + +PCHAR RegReadString( HKEY Root, PCHAR Subkey, PCHAR Value ) { + PCHAR SubOut = NULL; + DWORD SubOutLen = 0, Error = 0; + HKEY ValueKey = NULL; + + DH_DbgPrint(MID_TRACE,("Looking in %x:%s:%s\n", Root, Subkey, Value )); + + if( Subkey && strlen(Subkey) ) { + if( RegOpenKey( Root, Subkey, &ValueKey ) != ERROR_SUCCESS ) + goto regerror; + } else ValueKey = Root; + + DH_DbgPrint(MID_TRACE,("Got Key %x\n", ValueKey)); + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s has size %d\n", Value, SubOutLen)); + + if( !(SubOut = (CHAR*) malloc(SubOutLen)) ) + goto regerror; + + if( (Error = RegQueryValueEx( ValueKey, Value, NULL, NULL, + (LPBYTE)SubOut, &SubOutLen )) != ERROR_SUCCESS ) + goto regerror; + + DH_DbgPrint(MID_TRACE,("Value %s is %s\n", Value, SubOut)); + + goto cleanup; + +regerror: + if( SubOut ) { free( SubOut ); SubOut = NULL; } +cleanup: + if( ValueKey && ValueKey != Root ) { + DH_DbgPrint(MID_TRACE,("Closing key %x\n", ValueKey)); + RegCloseKey( ValueKey ); + } + + DH_DbgPrint(MID_TRACE,("Returning %x with error %d\n", SubOut, Error)); + + return SubOut; +} + +HKEY FindAdapterKey( PDHCP_ADAPTER Adapter ) { + int i = 0; + PCHAR EnumKeyName = + "SYSTEM\\CurrentControlSet\\Control\\Class\\" + "{4D36E972-E325-11CE-BFC1-08002BE10318}"; + PCHAR TargetKeyNameStart = + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; + PCHAR TargetKeyName = NULL; + PCHAR *EnumKeysLinkage = GetSubkeyNames( EnumKeyName, "\\Linkage" ); + PCHAR *EnumKeysTop = GetSubkeyNames( EnumKeyName, "" ); + PCHAR RootDevice = NULL; + HKEY EnumKey, OutKey = NULL; + DWORD Error = ERROR_SUCCESS; + + if( !EnumKeysLinkage || !EnumKeysTop ) goto cleanup; + + Error = RegOpenKey( HKEY_LOCAL_MACHINE, EnumKeyName, &EnumKey ); + + if( Error ) goto cleanup; + + for( i = 0; EnumKeysLinkage[i]; i++ ) { + RootDevice = RegReadString + ( EnumKey, EnumKeysLinkage[i], "RootDevice" ); + + if( RootDevice && + !strcmp( RootDevice, Adapter->DhclientInfo.name ) ) { + TargetKeyName = + (CHAR*) malloc( strlen( TargetKeyNameStart ) + + strlen( RootDevice ) + 1); + if( !TargetKeyName ) goto cleanup; + sprintf( TargetKeyName, "%s%s", + TargetKeyNameStart, RootDevice ); + Error = RegCreateKeyExA( HKEY_LOCAL_MACHINE, TargetKeyName, 0, NULL, 0, KEY_READ, NULL, &OutKey, NULL ); + break; + } else { + free( RootDevice ); RootDevice = 0; + } + } + +cleanup: + if( RootDevice ) free( RootDevice ); + if( EnumKeysLinkage ) free( EnumKeysLinkage ); + if( EnumKeysTop ) free( EnumKeysTop ); + if( TargetKeyName ) free( TargetKeyName ); + + return OutKey; +} + +BOOL PrepareAdapterForService( PDHCP_ADAPTER Adapter ) { + HKEY AdapterKey = NULL; + PCHAR IPAddress = NULL, Netmask = NULL, DefaultGateway = NULL; + NTSTATUS Status = STATUS_SUCCESS; + DWORD Error = ERROR_SUCCESS; + + Adapter->DhclientState.config = &Adapter->DhclientConfig; + strncpy(Adapter->DhclientInfo.name, (char*)Adapter->IfMib.bDescr, + sizeof(Adapter->DhclientInfo.name)); + + AdapterKey = FindAdapterKey( Adapter ); + if( AdapterKey ) + IPAddress = RegReadString( AdapterKey, NULL, "IPAddress" ); + + if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) { + /* Non-automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus, + IPAddress)); + + Adapter->DhclientState.state = S_STATIC; + + Netmask = RegReadString( AdapterKey, NULL, "Subnetmask" ); + + Status = AddIPAddress( inet_addr( IPAddress ), + inet_addr( Netmask ? Netmask : "255.255.255.0" ), + Adapter->IfMib.dwIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + + DefaultGateway = RegReadString( AdapterKey, NULL, "DefaultGateway" ); + + if( DefaultGateway ) { + Adapter->RouterMib.dwForwardDest = 0; + Adapter->RouterMib.dwForwardMask = 0; + Adapter->RouterMib.dwForwardMetric1 = 1; + Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; + Adapter->RouterMib.dwForwardNextHop = inet_addr(DefaultGateway); + Error = CreateIpForwardEntry( &Adapter->RouterMib ); + if( Error ) + warning("Failed to set default gateway %s: %ld\n", + DefaultGateway, Error); + } + + if( DefaultGateway ) free( DefaultGateway ); + if( Netmask ) free( Netmask ); + } else { + /* Automatic case */ + DH_DbgPrint + (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (dynamic)\n", + Adapter->DhclientInfo.name, + Adapter->BindStatus)); + + Adapter->DhclientInfo.client->state = S_INIT; + } + + if( IPAddress ) free( IPAddress ); + + return TRUE; +} + +void AdapterInit() { + WSAStartup(0x0101,&wsd); + + InitializeListHead( &AdapterList ); +} + +int +InterfaceConnected(MIB_IFROW IfEntry) +{ + if (IfEntry.dwOperStatus == IF_OPER_STATUS_CONNECTED || + IfEntry.dwOperStatus == IF_OPER_STATUS_OPERATIONAL) + return 1; + + DH_DbgPrint(MID_TRACE,("Interface %d is down\n", IfEntry.dwIndex)); + return 0; +} + +/* + * XXX Figure out the way to bind a specific adapter to a socket. + */ +BOOLEAN AdapterDiscover() { + PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE)); + DWORD Error, Size = sizeof(MIB_IFTABLE); + PDHCP_ADAPTER Adapter = NULL; + struct interface_info *ifi = NULL; + int i; + BOOLEAN ret = TRUE; + + DH_DbgPrint(MID_TRACE,("Getting Adapter List...\n")); + + while( (Error = GetIfTable(Table, &Size, 0 )) == + ERROR_INSUFFICIENT_BUFFER ) { + DH_DbgPrint(MID_TRACE,("Error %d, New Buffer Size: %d\n", Error, Size)); + free( Table ); + Table = (PMIB_IFTABLE) malloc( Size ); + } + + if( Error != NO_ERROR ) { + ret = FALSE; + goto term; + } + + DH_DbgPrint(MID_TRACE,("Got Adapter List (%d entries)\n", Table->dwNumEntries)); + + for( i = Table->dwNumEntries - 1; i >= 0; i-- ) { + DH_DbgPrint(MID_TRACE,("Getting adapter %d attributes\n", + Table->table[i].dwIndex)); + + if ((Adapter = AdapterFindByHardwareAddress(Table->table[i].bPhysAddr, Table->table[i].dwPhysAddrLen))) + { + /* This is an existing adapter */ + if (InterfaceConnected(Table->table[i])) { + /* We're still active so we stay in the list */ + ifi = &Adapter->DhclientInfo; + } else { + /* We've lost our link so out we go */ + RemoveEntryList(&Adapter->ListEntry); + free(Adapter); + } + + continue; + } + + Adapter = (DHCP_ADAPTER*) calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 ); + + if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET && InterfaceConnected(Table->table[i])) { + memcpy( &Adapter->IfMib, &Table->table[i], + sizeof(Adapter->IfMib) ); + Adapter->DhclientInfo.client = &Adapter->DhclientState; + Adapter->DhclientInfo.rbuf = Adapter->recv_buf; + Adapter->DhclientInfo.rbuf_max = Table->table[i].dwMtu; + Adapter->DhclientInfo.rbuf_len = + Adapter->DhclientInfo.rbuf_offset = 0; + memcpy(Adapter->DhclientInfo.hw_address.haddr, + Adapter->IfMib.bPhysAddr, + Adapter->IfMib.dwPhysAddrLen); + Adapter->DhclientInfo.hw_address.hlen = + Adapter->IfMib.dwPhysAddrLen; + /* I'm not sure where else to set this, but + some DHCP servers won't take a zero. + We checked the hardware type earlier in + the if statement. */ + Adapter->DhclientInfo.hw_address.htype = + HTYPE_ETHER; + + if( DhcpSocket == INVALID_SOCKET ) { + DhcpSocket = + Adapter->DhclientInfo.rfdesc = + Adapter->DhclientInfo.wfdesc = + socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); + + if (DhcpSocket != INVALID_SOCKET) { + Adapter->ListenAddr.sin_family = AF_INET; + Adapter->ListenAddr.sin_port = htons(LOCAL_PORT); + Adapter->BindStatus = + (bind( Adapter->DhclientInfo.rfdesc, + (struct sockaddr *)&Adapter->ListenAddr, + sizeof(Adapter->ListenAddr) ) == 0) ? + 0 : WSAGetLastError(); + } else { + error("socket() failed: %d\n", WSAGetLastError()); + } + } else { + Adapter->DhclientInfo.rfdesc = + Adapter->DhclientInfo.wfdesc = DhcpSocket; + } + + Adapter->DhclientConfig.timeout = DHCP_PANIC_TIMEOUT; + Adapter->DhclientConfig.initial_interval = DHCP_DISCOVER_INTERVAL; + Adapter->DhclientConfig.retry_interval = DHCP_DISCOVER_INTERVAL; + Adapter->DhclientConfig.select_interval = 1; + Adapter->DhclientConfig.reboot_timeout = DHCP_REBOOT_TIMEOUT; + Adapter->DhclientConfig.backoff_cutoff = DHCP_BACKOFF_MAX; + Adapter->DhclientState.interval = + Adapter->DhclientConfig.retry_interval; + + if( PrepareAdapterForService( Adapter ) ) { + Adapter->DhclientInfo.next = ifi; + ifi = &Adapter->DhclientInfo; + + read_client_conf(&Adapter->DhclientInfo); + + if (Adapter->DhclientInfo.client->state == S_INIT) + { + add_protocol(Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, + got_one, &Adapter->DhclientInfo); + + state_init(&Adapter->DhclientInfo); + } + + InsertTailList( &AdapterList, &Adapter->ListEntry ); + } else { free( Adapter ); Adapter = 0; } + } else { free( Adapter ); Adapter = 0; } + + if( !Adapter ) + DH_DbgPrint(MID_TRACE,("Adapter %d was rejected\n", + Table->table[i].dwIndex)); + } + + DH_DbgPrint(MID_TRACE,("done with AdapterInit\n")); + +term: + if( Table ) free( Table ); + return ret; +} + +void AdapterStop() { + PLIST_ENTRY ListEntry; + PDHCP_ADAPTER Adapter; + while( !IsListEmpty( &AdapterList ) ) { + ListEntry = (PLIST_ENTRY)RemoveHeadList( &AdapterList ); + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + free( Adapter ); + } + WSACleanup(); +} + +PDHCP_ADAPTER AdapterFindIndex( unsigned int indx ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for( ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink ) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if( Adapter->IfMib.dwIndex == indx ) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterFindName( const WCHAR *name ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for( ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink ) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if( !wcsicmp( Adapter->IfMib.wszName, name ) ) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterFindInfo( struct interface_info *ip ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for( ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink ) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if( ip == &Adapter->DhclientInfo ) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ) { + PDHCP_ADAPTER Adapter; + PLIST_ENTRY ListEntry; + + for(ListEntry = AdapterList.Flink; + ListEntry != &AdapterList; + ListEntry = ListEntry->Flink) { + Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry ); + if (Adapter->DhclientInfo.hw_address.hlen == hlen && + !memcmp(Adapter->DhclientInfo.hw_address.haddr, + haddr, + hlen)) return Adapter; + } + + return NULL; +} + +PDHCP_ADAPTER AdapterGetFirst() { + if( IsListEmpty( &AdapterList ) ) return NULL; else { + return CONTAINING_RECORD + ( AdapterList.Flink, DHCP_ADAPTER, ListEntry ); + } +} + +PDHCP_ADAPTER AdapterGetNext( PDHCP_ADAPTER This ) +{ + if( This->ListEntry.Flink == &AdapterList ) return NULL; + return CONTAINING_RECORD + ( This->ListEntry.Flink, DHCP_ADAPTER, ListEntry ); +} + +void if_register_send(struct interface_info *ip) { + +} + +void if_register_receive(struct interface_info *ip) { +} diff --git a/reactos/base/services/dhcp/alloc.c b/reactos/base/services/dhcp/alloc.c new file mode 100644 index 00000000000..97027fa4445 --- /dev/null +++ b/reactos/base/services/dhcp/alloc.c @@ -0,0 +1,93 @@ +/* $OpenBSD: alloc.c,v 1.9 2004/05/04 20:28:40 deraadt Exp $ */ + +/* Memory allocation... */ + +/* + * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#include "rosdhcp.h" +#include "dhcpd.h" + +struct string_list * +new_string_list(size_t size) +{ + struct string_list *rval; + + rval = calloc(1, sizeof(struct string_list) + size); + if (rval != NULL) + rval->string = ((char *)rval) + sizeof(struct string_list); + return (rval); +} + +struct hash_table * +new_hash_table(int count) +{ + struct hash_table *rval; + + rval = calloc(1, sizeof(struct hash_table) - + (DEFAULT_HASH_SIZE * sizeof(struct hash_bucket *)) + + (count * sizeof(struct hash_bucket *))); + if (rval == NULL) + return (NULL); + rval->hash_count = count; + return (rval); +} + +struct hash_bucket * +new_hash_bucket(void) +{ + struct hash_bucket *rval = calloc(1, sizeof(struct hash_bucket)); + + return (rval); +} + +void +dfree(void *ptr, char *name) +{ + if (!ptr) { + warning("dfree %s: free on null pointer.", name); + return; + } + free(ptr); +} + +void +free_hash_bucket(struct hash_bucket *ptr, char *name) +{ + dfree(ptr, name); +} diff --git a/reactos/base/services/dhcp/api.c b/reactos/base/services/dhcp/api.c new file mode 100644 index 00000000000..268466980b6 --- /dev/null +++ b/reactos/base/services/dhcp/api.c @@ -0,0 +1,197 @@ +/* $Id: $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: subsys/system/dhcp/api.c + * PURPOSE: DHCP client api handlers + * PROGRAMMER: arty + */ + +#include "rosdhcp.h" +#include +#include + +#define NDEBUG +#include + +static CRITICAL_SECTION ApiCriticalSection; + +VOID ApiInit() { + InitializeCriticalSection( &ApiCriticalSection ); +} + +VOID ApiLock() { + EnterCriticalSection( &ApiCriticalSection ); +} + +VOID ApiUnlock() { + LeaveCriticalSection( &ApiCriticalSection ); +} + +/* This represents the service portion of the DHCP client API */ + +DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + add_protocol( Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, got_one, + &Adapter->DhclientInfo ); + Adapter->DhclientInfo.client->state = S_INIT; + state_reboot(&Adapter->DhclientInfo); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if (Adapter) { + Reply.QueryHWInfo.AdapterIndex = Req->AdapterIndex; + Reply.QueryHWInfo.MediaType = Adapter->IfMib.dwType; + Reply.QueryHWInfo.Mtu = Adapter->IfMib.dwMtu; + Reply.QueryHWInfo.Speed = Adapter->IfMib.dwSpeed; + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + struct protocol* proto; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + if (Adapter->NteContext) + DeleteIPAddress( Adapter->NteContext ); + + proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); + if (proto) + remove_protocol(proto); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + if( !Adapter || Adapter->DhclientState.state == S_STATIC ) { + Reply.Reply = 0; + ApiUnlock(); + return Send( &Reply ); + } + + Reply.Reply = 1; + + add_protocol( Adapter->DhclientInfo.name, + Adapter->DhclientInfo.rfdesc, got_one, + &Adapter->DhclientInfo ); + Adapter->DhclientInfo.client->state = S_INIT; + state_reboot(&Adapter->DhclientInfo); + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + NTSTATUS Status; + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + struct protocol* proto; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + if (Adapter->NteContext) + DeleteIPAddress( Adapter->NteContext ); + Adapter->DhclientState.state = S_STATIC; + proto = find_protocol_by_adapter( &Adapter->DhclientInfo ); + if (proto) + remove_protocol(proto); + Status = AddIPAddress( Req->Body.StaticRefreshParams.IPAddress, + Req->Body.StaticRefreshParams.Netmask, + Req->AdapterIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + Reply.Reply = NT_SUCCESS(Status); + } + + ApiUnlock(); + + return Send( &Reply ); +} + +DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { + COMM_DHCP_REPLY Reply; + PDHCP_ADAPTER Adapter; + + ApiLock(); + + Adapter = AdapterFindIndex( Req->AdapterIndex ); + + Reply.Reply = Adapter ? 1 : 0; + + if( Adapter ) { + Reply.GetAdapterInfo.DhcpEnabled = (S_STATIC != Adapter->DhclientState.state); + if (S_BOUND == Adapter->DhclientState.state) { + if (sizeof(Reply.GetAdapterInfo.DhcpServer) == + Adapter->DhclientState.active->serveraddress.len) { + memcpy(&Reply.GetAdapterInfo.DhcpServer, + Adapter->DhclientState.active->serveraddress.iabuf, + Adapter->DhclientState.active->serveraddress.len); + } else { + DPRINT1("Unexpected server address len %d\n", + Adapter->DhclientState.active->serveraddress.len); + Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); + } + Reply.GetAdapterInfo.LeaseObtained = Adapter->DhclientState.active->obtained; + Reply.GetAdapterInfo.LeaseExpires = Adapter->DhclientState.active->expiry; + } else { + Reply.GetAdapterInfo.DhcpServer = htonl(INADDR_NONE); + Reply.GetAdapterInfo.LeaseObtained = 0; + Reply.GetAdapterInfo.LeaseExpires = 0; + } + } + + ApiUnlock(); + + return Send( &Reply ); +} diff --git a/reactos/base/services/dhcp/compat.c b/reactos/base/services/dhcp/compat.c new file mode 100644 index 00000000000..83c9c12ea8c --- /dev/null +++ b/reactos/base/services/dhcp/compat.c @@ -0,0 +1,67 @@ +#include "rosdhcp.h" +#include "dhcpd.h" +#include "stdint.h" + +size_t strlcpy(char *d, const char *s, size_t bufsize) +{ + size_t len = strlen(s); + size_t ret = len; + if (bufsize > 0) { + if (len >= bufsize) + len = bufsize-1; + memcpy(d, s, len); + d[len] = 0; + } + return ret; +} + +// not really random :( +u_int32_t arc4random() +{ + static int did_srand = 0; + u_int32_t ret; + + if (!did_srand) { + srand(0); + did_srand = 1; + } + + ret = rand() << 10 ^ rand(); + return ret; +} + + +int inet_aton(const char *cp, struct in_addr *inp) +/* inet_addr code from ROS, slightly modified. */ +{ + ULONG Octets[4] = {0,0,0,0}; + ULONG i = 0; + + if(!cp) + return 0; + + while(*cp) + { + CHAR c = *cp; + cp++; + + if(c == '.') + { + i++; + continue; + } + + if(c < '0' || c > '9') + return 0; + + Octets[i] *= 10; + Octets[i] += (c - '0'); + + if(Octets[i] > 255) + return 0; + } + + inp->S_un.S_addr = (Octets[3] << 24) + (Octets[2] << 16) + (Octets[1] << 8) + Octets[0]; + return 1; +} + diff --git a/reactos/base/services/dhcp/design.txt b/reactos/base/services/dhcp/design.txt new file mode 100644 index 00000000000..17c9a29194b --- /dev/null +++ b/reactos/base/services/dhcp/design.txt @@ -0,0 +1,33 @@ +Acknowledgements: + + Tinus provided the initial port of these dhclient file. + +Ok I need these things: + +1) Adapter concept thingy + + Needs a name and index + Current IP address etc + interface_info + + Must be able to get one from an adapter index or name + Must query the ip address and such + Must be able to set the address + +2) System state doodad + + List of adapters + List of parameter changes + List of persistent stuff + + Must be able to initialize from the registry + (persistent stuff, some adapter info) + Save changes to persistent set + +3) Parameter change set + + TODO + +4) Persistent queries + + TODO \ No newline at end of file diff --git a/reactos/base/services/dhcp/dhclient.c b/reactos/base/services/dhcp/dhclient.c new file mode 100644 index 00000000000..db263bc4ab5 --- /dev/null +++ b/reactos/base/services/dhcp/dhclient.c @@ -0,0 +1,2170 @@ +/* $OpenBSD: dhclient.c,v 1.62 2004/12/05 18:35:51 deraadt Exp $ */ + +/* + * Copyright 2004 Henning Brauer + * Copyright (c) 1995, 1996, 1997, 1998, 1999 + * The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + * + * This client was substantially modified and enhanced by Elliot Poger + * for use on Linux while he was working on the MosquitoNet project at + * Stanford. + * + * The current version owes much to Elliot's Linux enhancements, but + * was substantially reorganized and partially rewritten by Ted Lemon + * so as to use the same networking framework that the Internet Software + * Consortium DHCP server uses. Much system-specific configuration code + * was moved into a shell script so that as support for more operating + * systems is added, it will not be necessary to port and maintain + * system-specific configuration code to these operating systems - instead, + * the shell script can invoke the native tools to accomplish the same + * purpose. + */ + +#include "rosdhcp.h" +#include +#include "dhcpd.h" +#include "privsep.h" +#include "debug.h" + +#define PERIOD 0x2e +#define hyphenchar(c) ((c) == 0x2d) +#define bslashchar(c) ((c) == 0x5c) +#define periodchar(c) ((c) == PERIOD) +#define asterchar(c) ((c) == 0x2a) +#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) || \ + ((c) >= 0x61 && (c) <= 0x7a)) +#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) + +#define borderchar(c) (alphachar(c) || digitchar(c)) +#define middlechar(c) (borderchar(c) || hyphenchar(c)) +#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) + +unsigned long debug_trace_level = 0; /* DEBUG_ULTRA */ + +char *path_dhclient_conf = _PATH_DHCLIENT_CONF; +char *path_dhclient_db = NULL; + +int log_perror = 1; +int privfd; +//int nullfd = -1; + +struct iaddr iaddr_broadcast = { 4, { 255, 255, 255, 255 } }; +struct in_addr inaddr_any; +struct sockaddr_in sockaddr_broadcast; + +/* + * ASSERT_STATE() does nothing now; it used to be + * assert (state_is == state_shouldbe). + */ +#define ASSERT_STATE(state_is, state_shouldbe) {} + +#define TIME_MAX 2147483647 + +int log_priority; +int no_daemon; +int unknown_ok = 1; +int routefd; + +void usage(void); +int check_option(struct client_lease *l, int option); +int ipv4addrs(char * buf); +int res_hnok(const char *dn); +char *option_as_string(unsigned int code, unsigned char *data, int len); +int fork_privchld(int, int); +int check_arp( struct interface_info *ip, struct client_lease *lp ); + +#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) + +time_t scripttime; + + +static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv); +static WCHAR ServiceName[] = L"DHCP"; +static SERVICE_TABLE_ENTRYW ServiceTable[] = +{ + {ServiceName, ServiceMain}, + {NULL, NULL} +}; + +SERVICE_STATUS_HANDLE ServiceStatusHandle; +SERVICE_STATUS ServiceStatus; + + +/* XXX Implement me */ +int check_arp( struct interface_info *ip, struct client_lease *lp ) { + return 1; +} + + +static VOID +UpdateServiceStatus(DWORD dwState) +{ + ServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS; + ServiceStatus.dwCurrentState = dwState; + + ServiceStatus.dwControlsAccepted = 0; + + ServiceStatus.dwWin32ExitCode = 0; + ServiceStatus.dwServiceSpecificExitCode = 0; + ServiceStatus.dwCheckPoint = 0; + + if (dwState == SERVICE_START_PENDING || + dwState == SERVICE_STOP_PENDING || + dwState == SERVICE_PAUSE_PENDING || + dwState == SERVICE_CONTINUE_PENDING) + ServiceStatus.dwWaitHint = 10000; + else + ServiceStatus.dwWaitHint = 0; + + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); +} + + +static DWORD WINAPI +ServiceControlHandler(DWORD dwControl, + DWORD dwEventType, + LPVOID lpEventData, + LPVOID lpContext) +{ + switch (dwControl) + { + case SERVICE_CONTROL_STOP: + UpdateServiceStatus(SERVICE_STOP_PENDING); + UpdateServiceStatus(SERVICE_STOPPED); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_PAUSE: + UpdateServiceStatus(SERVICE_PAUSED); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_CONTINUE: + UpdateServiceStatus(SERVICE_START_PENDING); + UpdateServiceStatus(SERVICE_RUNNING); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_INTERROGATE: + SetServiceStatus(ServiceStatusHandle, + &ServiceStatus); + return ERROR_SUCCESS; + + case SERVICE_CONTROL_SHUTDOWN: + UpdateServiceStatus(SERVICE_STOP_PENDING); + UpdateServiceStatus(SERVICE_STOPPED); + return ERROR_SUCCESS; + + default : + return ERROR_CALL_NOT_IMPLEMENTED; + } +} + + +static VOID CALLBACK +ServiceMain(DWORD argc, LPWSTR *argv) +{ + ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, + ServiceControlHandler, + NULL); + if (!ServiceStatusHandle) + { + return; + } + + UpdateServiceStatus(SERVICE_START_PENDING); + + UpdateServiceStatus(SERVICE_RUNNING); + + dispatch(); +} + + +int +main(int argc, char *argv[]) +{ + ApiInit(); + AdapterInit(); + PipeInit(); + + tzset(); + + memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); + sockaddr_broadcast.sin_family = AF_INET; + sockaddr_broadcast.sin_port = htons(REMOTE_PORT); + sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; + inaddr_any.s_addr = INADDR_ANY; + + DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); + + bootp_packet_handler = do_packet; + + DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); + + StartServiceCtrlDispatcherW(ServiceTable); + + /* not reached */ + return (0); +} + +void +usage(void) +{ +// extern char *__progname; + +// fprintf(stderr, "usage: %s [-dqu] ", __progname); + fprintf(stderr, "usage: dhclient [-dqu] "); + fprintf(stderr, "[-c conffile] [-l leasefile] interface\n"); + exit(1); +} + +/* + * Individual States: + * + * Each routine is called from the dhclient_state_machine() in one of + * these conditions: + * -> entering INIT state + * -> recvpacket_flag == 0: timeout in this state + * -> otherwise: received a packet in this state + * + * Return conditions as handled by dhclient_state_machine(): + * Returns 1, sendpacket_flag = 1: send packet, reset timer. + * Returns 1, sendpacket_flag = 0: just reset the timer (wait for a milestone). + * Returns 0: finish the nap which was interrupted for no good reason. + * + * Several per-interface variables are used to keep track of the process: + * active_lease: the lease that is being used on the interface + * (null pointer if not configured yet). + * offered_leases: leases corresponding to DHCPOFFER messages that have + * been sent to us by DHCP servers. + * acked_leases: leases corresponding to DHCPACK messages that have been + * sent to us by DHCP servers. + * sendpacket: DHCP packet we're trying to send. + * destination: IP address to send sendpacket to + * In addition, there are several relevant per-lease variables. + * T1_expiry, T2_expiry, lease_expiry: lease milestones + * In the active lease, these control the process of renewing the lease; + * In leases on the acked_leases list, this simply determines when we + * can no longer legitimately use the lease. + */ + +void +state_reboot(void *ipp) +{ + struct interface_info *ip = ipp; + ULONG foo = (ULONG) GetTickCount(); + + /* If we don't remember an active lease, go straight to INIT. */ + if (!ip->client->active || ip->client->active->is_bootp) { + state_init(ip); + return; + } + + /* We are in the rebooting state. */ + ip->client->state = S_REBOOTING; + + /* make_request doesn't initialize xid because it normally comes + from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER, + so pick an xid now. */ + ip->client->xid = RtlRandom(&foo); + + /* Make a DHCPREQUEST packet, and set appropriate per-interface + flags. */ + make_request(ip, ip->client->active); + ip->client->destination = iaddr_broadcast; + time(&ip->client->first_sending); + ip->client->interval = ip->client->config->initial_interval; + + /* Zap the medium list... */ + ip->client->medium = NULL; + + /* Send out the first DHCPREQUEST packet. */ + send_request(ip); +} + +/* + * Called when a lease has completely expired and we've + * been unable to renew it. + */ +void +state_init(void *ipp) +{ + struct interface_info *ip = ipp; + + ASSERT_STATE(state, S_INIT); + + /* Make a DHCPDISCOVER packet, and set appropriate per-interface + flags. */ + make_discover(ip, ip->client->active); + ip->client->xid = ip->client->packet.xid; + ip->client->destination = iaddr_broadcast; + ip->client->state = S_SELECTING; + time(&ip->client->first_sending); + ip->client->interval = ip->client->config->initial_interval; + + /* Add an immediate timeout to cause the first DHCPDISCOVER packet + to go out. */ + send_discover(ip); +} + +/* + * state_selecting is called when one or more DHCPOFFER packets + * have been received and a configurable period of time has passed. + */ +void +state_selecting(void *ipp) +{ + struct interface_info *ip = ipp; + struct client_lease *lp, *next, *picked; + time_t cur_time; + + ASSERT_STATE(state, S_SELECTING); + + time(&cur_time); + + /* Cancel state_selecting and send_discover timeouts, since either + one could have got us here. */ + cancel_timeout(state_selecting, ip); + cancel_timeout(send_discover, ip); + + /* We have received one or more DHCPOFFER packets. Currently, + the only criterion by which we judge leases is whether or + not we get a response when we arp for them. */ + picked = NULL; + for (lp = ip->client->offered_leases; lp; lp = next) { + next = lp->next; + + /* Check to see if we got an ARPREPLY for the address + in this particular lease. */ + if (!picked) { + if( !check_arp(ip,lp) ) goto freeit; + picked = lp; + picked->next = NULL; + } else { +freeit: + free_client_lease(lp); + } + } + ip->client->offered_leases = NULL; + + /* If we just tossed all the leases we were offered, go back + to square one. */ + if (!picked) { + ip->client->state = S_INIT; + state_init(ip); + return; + } + + /* If it was a BOOTREPLY, we can just take the address right now. */ + if (!picked->options[DHO_DHCP_MESSAGE_TYPE].len) { + ip->client->new = picked; + + /* Make up some lease expiry times + XXX these should be configurable. */ + ip->client->new->expiry = cur_time + 12000; + ip->client->new->renewal += cur_time + 8000; + ip->client->new->rebind += cur_time + 10000; + + ip->client->state = S_REQUESTING; + + /* Bind to the address we received. */ + bind_lease(ip); + return; + } + + /* Go to the REQUESTING state. */ + ip->client->destination = iaddr_broadcast; + ip->client->state = S_REQUESTING; + ip->client->first_sending = cur_time; + ip->client->interval = ip->client->config->initial_interval; + + /* Make a DHCPREQUEST packet from the lease we picked. */ + make_request(ip, picked); + ip->client->xid = ip->client->packet.xid; + + /* Toss the lease we picked - we'll get it back in a DHCPACK. */ + free_client_lease(picked); + + /* Add an immediate timeout to send the first DHCPREQUEST packet. */ + send_request(ip); +} + +/* state_requesting is called when we receive a DHCPACK message after + having sent out one or more DHCPREQUEST packets. */ + +void +dhcpack(struct packet *packet) +{ + struct interface_info *ip = packet->interface; + struct client_lease *lease; + time_t cur_time; + + time(&cur_time); + + /* If we're not receptive to an offer right now, or if the offer + has an unrecognizable transaction id, then just drop it. */ + if (packet->interface->client->xid != packet->raw->xid || + (packet->interface->hw_address.hlen != packet->raw->hlen) || + (memcmp(packet->interface->hw_address.haddr, + packet->raw->chaddr, packet->raw->hlen))) + return; + + if (ip->client->state != S_REBOOTING && + ip->client->state != S_REQUESTING && + ip->client->state != S_RENEWING && + ip->client->state != S_REBINDING) + return; + + note("DHCPACK from %s", piaddr(packet->client_addr)); + + lease = packet_to_lease(packet); + if (!lease) { + note("packet_to_lease failed."); + return; + } + + ip->client->new = lease; + + /* Stop resending DHCPREQUEST. */ + cancel_timeout(send_request, ip); + + /* Figure out the lease time. */ + if (ip->client->new->options[DHO_DHCP_LEASE_TIME].data) + ip->client->new->expiry = getULong( + ip->client->new->options[DHO_DHCP_LEASE_TIME].data); + else + ip->client->new->expiry = DHCP_DEFAULT_LEASE_TIME; + /* A number that looks negative here is really just very large, + because the lease expiry offset is unsigned. */ + if (ip->client->new->expiry < 0) + ip->client->new->expiry = TIME_MAX; + /* XXX should be fixed by resetting the client state */ + if (ip->client->new->expiry < 60) + ip->client->new->expiry = 60; + + /* Take the server-provided renewal time if there is one; + otherwise figure it out according to the spec. */ + if (ip->client->new->options[DHO_DHCP_RENEWAL_TIME].len) + ip->client->new->renewal = getULong( + ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data); + else + ip->client->new->renewal = ip->client->new->expiry / 2; + + /* Same deal with the rebind time. */ + if (ip->client->new->options[DHO_DHCP_REBINDING_TIME].len) + ip->client->new->rebind = getULong( + ip->client->new->options[DHO_DHCP_REBINDING_TIME].data); + else + ip->client->new->rebind = ip->client->new->renewal + + ip->client->new->renewal / 2 + ip->client->new->renewal / 4; + +#ifdef __REACTOS__ + ip->client->new->obtained = cur_time; +#endif + ip->client->new->expiry += cur_time; + /* Lease lengths can never be negative. */ + if (ip->client->new->expiry < cur_time) + ip->client->new->expiry = TIME_MAX; + ip->client->new->renewal += cur_time; + if (ip->client->new->renewal < cur_time) + ip->client->new->renewal = TIME_MAX; + ip->client->new->rebind += cur_time; + if (ip->client->new->rebind < cur_time) + ip->client->new->rebind = TIME_MAX; + + bind_lease(ip); +} + +void set_name_servers( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { + CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; + HKEY RegKey; + + strcat(Buffer, Adapter->DhclientInfo.name); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &RegKey ) != ERROR_SUCCESS) + return; + + + if( new_lease->options[DHO_DOMAIN_NAME_SERVERS].len ) { + + struct iaddr nameserver; + char *nsbuf; + int i, addrs = + new_lease->options[DHO_DOMAIN_NAME_SERVERS].len / sizeof(ULONG); + + nsbuf = malloc( addrs * sizeof(IP_ADDRESS_STRING) ); + + if( nsbuf) { + nsbuf[0] = 0; + for( i = 0; i < addrs; i++ ) { + nameserver.len = sizeof(ULONG); + memcpy( nameserver.iabuf, + new_lease->options[DHO_DOMAIN_NAME_SERVERS].data + + (i * sizeof(ULONG)), sizeof(ULONG) ); + strcat( nsbuf, piaddr(nameserver) ); + if( i != addrs-1 ) strcat( nsbuf, "," ); + } + + DH_DbgPrint(MID_TRACE,("Setting DhcpNameserver: %s\n", nsbuf)); + + RegSetValueExA( RegKey, "DhcpNameServer", 0, REG_SZ, + (LPBYTE)nsbuf, strlen(nsbuf) + 1 ); + free( nsbuf ); + } + + } else { + RegDeleteValueW( RegKey, L"DhcpNameServer" ); + } + + RegCloseKey( RegKey ); + +} + +void setup_adapter( PDHCP_ADAPTER Adapter, struct client_lease *new_lease ) { + CHAR Buffer[200] = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\"; + struct iaddr netmask; + HKEY hkey; + int i; + DWORD dwEnableDHCP; + + strcat(Buffer, Adapter->DhclientInfo.name); + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_WRITE, &hkey) != ERROR_SUCCESS) + hkey = NULL; + + + if( Adapter->NteContext ) + DeleteIPAddress( Adapter->NteContext ); + + /* Set up our default router if we got one from the DHCP server */ + if( new_lease->options[DHO_SUBNET_MASK].len ) { + NTSTATUS Status; + + memcpy( netmask.iabuf, + new_lease->options[DHO_SUBNET_MASK].data, + new_lease->options[DHO_SUBNET_MASK].len ); + Status = AddIPAddress + ( *((ULONG*)new_lease->address.iabuf), + *((ULONG*)netmask.iabuf), + Adapter->IfMib.dwIndex, + &Adapter->NteContext, + &Adapter->NteInstance ); + if (hkey) { + RegSetValueExA(hkey, "DhcpIPAddress", 0, REG_SZ, (LPBYTE)piaddr(new_lease->address), strlen(piaddr(new_lease->address))+1); + Buffer[0] = '\0'; + for(i = 0; i < new_lease->options[DHO_SUBNET_MASK].len; i++) + { + sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_SUBNET_MASK].data[i]); + if (i + 1 < new_lease->options[DHO_SUBNET_MASK].len) + strcat(Buffer, "."); + } + RegSetValueExA(hkey, "DhcpSubnetMask", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); + RegSetValueExA(hkey, "IPAddress", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); + RegSetValueExA(hkey, "SubnetMask", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); + dwEnableDHCP = 1; + RegSetValueExA(hkey, "EnableDHCP", 0, REG_DWORD, (LPBYTE)&dwEnableDHCP, sizeof(DWORD)); + } + + if( !NT_SUCCESS(Status) ) + warning("AddIPAddress: %lx\n", Status); + } + + if( new_lease->options[DHO_ROUTERS].len ) { + NTSTATUS Status; + + Adapter->RouterMib.dwForwardDest = 0; /* Default route */ + Adapter->RouterMib.dwForwardMask = 0; + Adapter->RouterMib.dwForwardMetric1 = 1; + Adapter->RouterMib.dwForwardIfIndex = Adapter->IfMib.dwIndex; + + if( Adapter->RouterMib.dwForwardNextHop ) { + /* If we set a default route before, delete it before continuing */ + DeleteIpForwardEntry( &Adapter->RouterMib ); + } + + Adapter->RouterMib.dwForwardNextHop = + *((ULONG*)new_lease->options[DHO_ROUTERS].data); + + Status = CreateIpForwardEntry( &Adapter->RouterMib ); + + if( !NT_SUCCESS(Status) ) + warning("CreateIpForwardEntry: %lx\n", Status); + + if (hkey) { + Buffer[0] = '\0'; + for(i = 0; i < new_lease->options[DHO_ROUTERS].len; i++) + { + sprintf(&Buffer[strlen(Buffer)], "%u", new_lease->options[DHO_ROUTERS].data[i]); + if (i + 1 < new_lease->options[DHO_ROUTERS].len) + strcat(Buffer, "."); + } + RegSetValueExA(hkey, "DhcpDefaultGateway", 0, REG_SZ, (LPBYTE)Buffer, strlen(Buffer)+1); + RegSetValueExA(hkey, "DefaultGateway", 0, REG_SZ, (LPBYTE)"0.0.0.0", 8); + } + } + + if (hkey) + RegCloseKey(hkey); +} + + +void +bind_lease(struct interface_info *ip) +{ + PDHCP_ADAPTER Adapter; + struct client_lease *new_lease = ip->client->new; + time_t cur_time; + + time(&cur_time); + + /* Remember the medium. */ + ip->client->new->medium = ip->client->medium; + ip->client->active = ip->client->new; + ip->client->new = NULL; + + /* Set up a timeout to start the renewal process. */ + /* Timeout of zero means no timeout (some implementations seem to use + * one day). + */ + if( ip->client->active->renewal - cur_time ) + add_timeout(ip->client->active->renewal, state_bound, ip); + + note("bound to %s -- renewal in %ld seconds.", + piaddr(ip->client->active->address), + (long int)(ip->client->active->renewal - cur_time)); + + ip->client->state = S_BOUND; + + Adapter = AdapterFindInfo( ip ); + + if( Adapter ) setup_adapter( Adapter, new_lease ); + else { + warning("Could not find adapter for info %p\n", ip); + return; + } + set_name_servers( Adapter, new_lease ); +} + +/* + * state_bound is called when we've successfully bound to a particular + * lease, but the renewal time on that lease has expired. We are + * expected to unicast a DHCPREQUEST to the server that gave us our + * original lease. + */ +void +state_bound(void *ipp) +{ + struct interface_info *ip = ipp; + + ASSERT_STATE(state, S_BOUND); + + /* T1 has expired. */ + make_request(ip, ip->client->active); + ip->client->xid = ip->client->packet.xid; + + if (ip->client->active->options[DHO_DHCP_SERVER_IDENTIFIER].len == 4) { + memcpy(ip->client->destination.iabuf, ip->client->active-> + options[DHO_DHCP_SERVER_IDENTIFIER].data, 4); + ip->client->destination.len = 4; + } else + ip->client->destination = iaddr_broadcast; + + time(&ip->client->first_sending); + ip->client->interval = ip->client->config->initial_interval; + ip->client->state = S_RENEWING; + + /* Send the first packet immediately. */ + send_request(ip); +} + +void +bootp(struct packet *packet) +{ + struct iaddrlist *ap; + + if (packet->raw->op != BOOTREPLY) + return; + + /* If there's a reject list, make sure this packet's sender isn't + on it. */ + for (ap = packet->interface->client->config->reject_list; + ap; ap = ap->next) { + if (addr_eq(packet->client_addr, ap->addr)) { + note("BOOTREPLY from %s rejected.", piaddr(ap->addr)); + return; + } + } + dhcpoffer(packet); +} + +void +dhcp(struct packet *packet) +{ + struct iaddrlist *ap; + void (*handler)(struct packet *); + char *type; + + switch (packet->packet_type) { + case DHCPOFFER: + handler = dhcpoffer; + type = "DHCPOFFER"; + break; + case DHCPNAK: + handler = dhcpnak; + type = "DHCPNACK"; + break; + case DHCPACK: + handler = dhcpack; + type = "DHCPACK"; + break; + default: + return; + } + + /* If there's a reject list, make sure this packet's sender isn't + on it. */ + for (ap = packet->interface->client->config->reject_list; + ap; ap = ap->next) { + if (addr_eq(packet->client_addr, ap->addr)) { + note("%s from %s rejected.", type, piaddr(ap->addr)); + return; + } + } + (*handler)(packet); +} + +void +dhcpoffer(struct packet *packet) +{ + struct interface_info *ip = packet->interface; + struct client_lease *lease, *lp; + int i; + int arp_timeout_needed = 0, stop_selecting; + char *name = packet->options[DHO_DHCP_MESSAGE_TYPE].len ? + "DHCPOFFER" : "BOOTREPLY"; + time_t cur_time; + + time(&cur_time); + + /* If we're not receptive to an offer right now, or if the offer + has an unrecognizable transaction id, then just drop it. */ + if (ip->client->state != S_SELECTING || + packet->interface->client->xid != packet->raw->xid || + (packet->interface->hw_address.hlen != packet->raw->hlen) || + (memcmp(packet->interface->hw_address.haddr, + packet->raw->chaddr, packet->raw->hlen))) + return; + + note("%s from %s", name, piaddr(packet->client_addr)); + + + /* If this lease doesn't supply the minimum required parameters, + blow it off. */ + for (i = 0; ip->client->config->required_options[i]; i++) { + if (!packet->options[ip->client->config-> + required_options[i]].len) { + note("%s isn't satisfactory.", name); + return; + } + } + + /* If we've already seen this lease, don't record it again. */ + for (lease = ip->client->offered_leases; + lease; lease = lease->next) { + if (lease->address.len == sizeof(packet->raw->yiaddr) && + !memcmp(lease->address.iabuf, + &packet->raw->yiaddr, lease->address.len)) { + debug("%s already seen.", name); + return; + } + } + + lease = packet_to_lease(packet); + if (!lease) { + note("packet_to_lease failed."); + return; + } + + /* If this lease was acquired through a BOOTREPLY, record that + fact. */ + if (!packet->options[DHO_DHCP_MESSAGE_TYPE].len) + lease->is_bootp = 1; + + /* Record the medium under which this lease was offered. */ + lease->medium = ip->client->medium; + + /* Send out an ARP Request for the offered IP address. */ + if( !check_arp( ip, lease ) ) { + note("Arp check failed\n"); + return; + } + + /* Figure out when we're supposed to stop selecting. */ + stop_selecting = + ip->client->first_sending + ip->client->config->select_interval; + + /* If this is the lease we asked for, put it at the head of the + list, and don't mess with the arp request timeout. */ + if (lease->address.len == ip->client->requested_address.len && + !memcmp(lease->address.iabuf, + ip->client->requested_address.iabuf, + ip->client->requested_address.len)) { + lease->next = ip->client->offered_leases; + ip->client->offered_leases = lease; + } else { + /* If we already have an offer, and arping for this + offer would take us past the selection timeout, + then don't extend the timeout - just hope for the + best. */ + if (ip->client->offered_leases && + (cur_time + arp_timeout_needed) > stop_selecting) + arp_timeout_needed = 0; + + /* Put the lease at the end of the list. */ + lease->next = NULL; + if (!ip->client->offered_leases) + ip->client->offered_leases = lease; + else { + for (lp = ip->client->offered_leases; lp->next; + lp = lp->next) + ; /* nothing */ + lp->next = lease; + } + } + + /* If we're supposed to stop selecting before we've had time + to wait for the ARPREPLY, add some delay to wait for + the ARPREPLY. */ + if (stop_selecting - cur_time < arp_timeout_needed) + stop_selecting = cur_time + arp_timeout_needed; + + /* If the selecting interval has expired, go immediately to + state_selecting(). Otherwise, time out into + state_selecting at the select interval. */ + if (stop_selecting <= 0) + state_selecting(ip); + else { + add_timeout(stop_selecting, state_selecting, ip); + cancel_timeout(send_discover, ip); + } +} + +/* Allocate a client_lease structure and initialize it from the parameters + in the specified packet. */ + +struct client_lease * +packet_to_lease(struct packet *packet) +{ + struct client_lease *lease; + int i; + + lease = malloc(sizeof(struct client_lease)); + + if (!lease) { + warning("dhcpoffer: no memory to record lease."); + return (NULL); + } + + memset(lease, 0, sizeof(*lease)); + + /* Copy the lease options. */ + for (i = 0; i < 256; i++) { + if (packet->options[i].len) { + lease->options[i].data = + malloc(packet->options[i].len + 1); + if (!lease->options[i].data) { + warning("dhcpoffer: no memory for option %d", i); + free_client_lease(lease); + return (NULL); + } else { + memcpy(lease->options[i].data, + packet->options[i].data, + packet->options[i].len); + lease->options[i].len = + packet->options[i].len; + lease->options[i].data[lease->options[i].len] = + 0; + } + if (!check_option(lease,i)) { + /* ignore a bogus lease offer */ + warning("Invalid lease option - ignoring offer"); + free_client_lease(lease); + return (NULL); + } + } + } + + lease->address.len = sizeof(packet->raw->yiaddr); + memcpy(lease->address.iabuf, &packet->raw->yiaddr, lease->address.len); +#ifdef __REACTOS__ + lease->serveraddress.len = sizeof(packet->raw->siaddr); + memcpy(lease->serveraddress.iabuf, &packet->raw->siaddr, lease->address.len); +#endif + + /* If the server name was filled out, copy it. */ + if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || + !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2)) && + packet->raw->sname[0]) { + lease->server_name = malloc(DHCP_SNAME_LEN + 1); + if (!lease->server_name) { + warning("dhcpoffer: no memory for server name."); + free_client_lease(lease); + return (NULL); + } + memcpy(lease->server_name, packet->raw->sname, DHCP_SNAME_LEN); + lease->server_name[DHCP_SNAME_LEN]='\0'; + if (!res_hnok(lease->server_name) ) { + warning("Bogus server name %s", lease->server_name ); + free_client_lease(lease); + return (NULL); + } + + } + + /* Ditto for the filename. */ + if ((!packet->options[DHO_DHCP_OPTION_OVERLOAD].len || + !(packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1)) && + packet->raw->file[0]) { + /* Don't count on the NUL terminator. */ + lease->filename = malloc(DHCP_FILE_LEN + 1); + if (!lease->filename) { + warning("dhcpoffer: no memory for filename."); + free_client_lease(lease); + return (NULL); + } + memcpy(lease->filename, packet->raw->file, DHCP_FILE_LEN); + lease->filename[DHCP_FILE_LEN]='\0'; + } + return lease; +} + +void +dhcpnak(struct packet *packet) +{ + struct interface_info *ip = packet->interface; + + /* If we're not receptive to an offer right now, or if the offer + has an unrecognizable transaction id, then just drop it. */ + if (packet->interface->client->xid != packet->raw->xid || + (packet->interface->hw_address.hlen != packet->raw->hlen) || + (memcmp(packet->interface->hw_address.haddr, + packet->raw->chaddr, packet->raw->hlen))) + return; + + if (ip->client->state != S_REBOOTING && + ip->client->state != S_REQUESTING && + ip->client->state != S_RENEWING && + ip->client->state != S_REBINDING) + return; + + note("DHCPNAK from %s", piaddr(packet->client_addr)); + + if (!ip->client->active) { + note("DHCPNAK with no active lease.\n"); + return; + } + + free_client_lease(ip->client->active); + ip->client->active = NULL; + + /* Stop sending DHCPREQUEST packets... */ + cancel_timeout(send_request, ip); + + ip->client->state = S_INIT; + state_init(ip); +} + +/* Send out a DHCPDISCOVER packet, and set a timeout to send out another + one after the right interval has expired. If we don't get an offer by + the time we reach the panic interval, call the panic function. */ + +void +send_discover(void *ipp) +{ + struct interface_info *ip = ipp; + int interval, increase = 1; + time_t cur_time; + + DH_DbgPrint(MID_TRACE,("Doing discover on interface %p\n",ip)); + + time(&cur_time); + + /* Figure out how long it's been since we started transmitting. */ + interval = cur_time - ip->client->first_sending; + + /* If we're past the panic timeout, call the script and tell it + we haven't found anything for this interface yet. */ + if (interval > ip->client->config->timeout) { + state_panic(ip); + return; + } + + /* If we're selecting media, try the whole list before doing + the exponential backoff, but if we've already received an + offer, stop looping, because we obviously have it right. */ + if (!ip->client->offered_leases && + ip->client->config->media) { + int fail = 0; + + if (ip->client->medium) { + ip->client->medium = ip->client->medium->next; + increase = 0; + } + if (!ip->client->medium) { + if (fail) + error("No valid media types for %s!", ip->name); + ip->client->medium = ip->client->config->media; + increase = 1; + } + + note("Trying medium \"%s\" %d", ip->client->medium->string, + increase); + /* XXX Support other media types eventually */ + } + + /* + * If we're supposed to increase the interval, do so. If it's + * currently zero (i.e., we haven't sent any packets yet), set + * it to one; otherwise, add to it a random number between zero + * and two times itself. On average, this means that it will + * double with every transmission. + */ + if (increase) { + if (!ip->client->interval) + ip->client->interval = + ip->client->config->initial_interval; + else { + ip->client->interval += (rand() >> 2) % + (2 * ip->client->interval); + } + + /* Don't backoff past cutoff. */ + if (ip->client->interval > + ip->client->config->backoff_cutoff) + ip->client->interval = + ((ip->client->config->backoff_cutoff / 2) + + ((rand() >> 2) % + ip->client->config->backoff_cutoff)); + } else if (!ip->client->interval) + ip->client->interval = + ip->client->config->initial_interval; + + /* If the backoff would take us to the panic timeout, just use that + as the interval. */ + if (cur_time + ip->client->interval > + ip->client->first_sending + ip->client->config->timeout) + ip->client->interval = + (ip->client->first_sending + + ip->client->config->timeout) - cur_time + 1; + + /* Record the number of seconds since we started sending. */ + if (interval < 65536) + ip->client->packet.secs = htons(interval); + else + ip->client->packet.secs = htons(65535); + ip->client->secs = ip->client->packet.secs; + + note("DHCPDISCOVER on %s to %s port %d interval %ld", + ip->name, inet_ntoa(sockaddr_broadcast.sin_addr), + ntohs(sockaddr_broadcast.sin_port), (long int)ip->client->interval); + + /* Send out a packet. */ + (void)send_packet(ip, &ip->client->packet, ip->client->packet_length, + inaddr_any, &sockaddr_broadcast, NULL); + + DH_DbgPrint(MID_TRACE,("discover timeout: now %x -> then %x\n", + cur_time, cur_time + ip->client->interval)); + + add_timeout(cur_time + ip->client->interval, send_discover, ip); +} + +/* + * state_panic gets called if we haven't received any offers in a preset + * amount of time. When this happens, we try to use existing leases + * that haven't yet expired, and failing that, we call the client script + * and hope it can do something. + */ +void +state_panic(void *ipp) +{ + struct interface_info *ip = ipp; + struct client_lease *loop = ip->client->active; + struct client_lease *lp; + time_t cur_time; + + note("No DHCPOFFERS received."); + + time(&cur_time); + + /* We may not have an active lease, but we may have some + predefined leases that we can try. */ + if (!ip->client->active && ip->client->leases) + goto activate_next; + + /* Run through the list of leases and see if one can be used. */ + while (ip->client->active) { + if (ip->client->active->expiry > cur_time) { + note("Trying recorded lease %s", + piaddr(ip->client->active->address)); + /* Run the client script with the existing + parameters. */ + script_init("TIMEOUT", + ip->client->active->medium); + script_write_params("new_", ip->client->active); + if (ip->client->alias) + script_write_params("alias_", + ip->client->alias); + + /* If the old lease is still good and doesn't + yet need renewal, go into BOUND state and + timeout at the renewal time. */ + if (cur_time < + ip->client->active->renewal) { + ip->client->state = S_BOUND; + note("bound: renewal in %ld seconds.", + (long int)(ip->client->active->renewal - + cur_time)); + add_timeout( + ip->client->active->renewal, + state_bound, ip); + } else { + ip->client->state = S_BOUND; + note("bound: immediate renewal."); + state_bound(ip); + } + return; + } + + /* If there are no other leases, give up. */ + if (!ip->client->leases) { + ip->client->leases = ip->client->active; + ip->client->active = NULL; + break; + } + +activate_next: + /* Otherwise, put the active lease at the end of the + lease list, and try another lease.. */ + for (lp = ip->client->leases; lp->next; lp = lp->next) + ; + lp->next = ip->client->active; + if (lp->next) + lp->next->next = NULL; + ip->client->active = ip->client->leases; + ip->client->leases = ip->client->leases->next; + + /* If we already tried this lease, we've exhausted the + set of leases, so we might as well give up for + now. */ + if (ip->client->active == loop) + break; + else if (!loop) + loop = ip->client->active; + } + + /* No leases were available, or what was available didn't work, so + tell the shell script that we failed to allocate an address, + and try again later. */ + note("No working leases in persistent database - sleeping.\n"); + ip->client->state = S_INIT; + add_timeout(cur_time + ip->client->config->retry_interval, state_init, + ip); + /* XXX Take any failure actions necessary */ +} + +void +send_request(void *ipp) +{ + struct interface_info *ip = ipp; + struct sockaddr_in destination; + struct in_addr from; + int interval; + time_t cur_time; + + time(&cur_time); + + /* Figure out how long it's been since we started transmitting. */ + interval = cur_time - ip->client->first_sending; + + /* If we're in the INIT-REBOOT or REQUESTING state and we're + past the reboot timeout, go to INIT and see if we can + DISCOVER an address... */ + /* XXX In the INIT-REBOOT state, if we don't get an ACK, it + means either that we're on a network with no DHCP server, + or that our server is down. In the latter case, assuming + that there is a backup DHCP server, DHCPDISCOVER will get + us a new address, but we could also have successfully + reused our old address. In the former case, we're hosed + anyway. This is not a win-prone situation. */ + if ((ip->client->state == S_REBOOTING || + ip->client->state == S_REQUESTING) && + interval > ip->client->config->reboot_timeout) { + ip->client->state = S_INIT; + cancel_timeout(send_request, ip); + state_init(ip); + return; + } + + /* If we're in the reboot state, make sure the media is set up + correctly. */ + if (ip->client->state == S_REBOOTING && + !ip->client->medium && + ip->client->active->medium ) { + script_init("MEDIUM", ip->client->active->medium); + + /* If the medium we chose won't fly, go to INIT state. */ + /* XXX Nothing for now */ + + /* Record the medium. */ + ip->client->medium = ip->client->active->medium; + } + + /* If the lease has expired, relinquish the address and go back + to the INIT state. */ + if (ip->client->state != S_REQUESTING && + cur_time > ip->client->active->expiry) { + PDHCP_ADAPTER Adapter = AdapterFindInfo( ip ); + /* Run the client script with the new parameters. */ + /* No script actions necessary in the expiry case */ + /* Now do a preinit on the interface so that we can + discover a new address. */ + + if( Adapter ) + DeleteIPAddress( Adapter->NteContext ); + + ip->client->state = S_INIT; + state_init(ip); + return; + } + + /* Do the exponential backoff... */ + if (!ip->client->interval) + ip->client->interval = ip->client->config->initial_interval; + else + ip->client->interval += ((rand() >> 2) % + (2 * ip->client->interval)); + + /* Don't backoff past cutoff. */ + if (ip->client->interval > + ip->client->config->backoff_cutoff) + ip->client->interval = + ((ip->client->config->backoff_cutoff / 2) + + ((rand() >> 2) % ip->client->interval)); + + /* If the backoff would take us to the expiry time, just set the + timeout to the expiry time. */ + if (ip->client->state != S_REQUESTING && + cur_time + ip->client->interval > + ip->client->active->expiry) + ip->client->interval = + ip->client->active->expiry - cur_time + 1; + + /* If the lease T2 time has elapsed, or if we're not yet bound, + broadcast the DHCPREQUEST rather than unicasting. */ + memset(&destination, 0, sizeof(destination)); + if (ip->client->state == S_REQUESTING || + ip->client->state == S_REBOOTING || + cur_time > ip->client->active->rebind) + destination.sin_addr.s_addr = INADDR_BROADCAST; + else + memcpy(&destination.sin_addr.s_addr, + ip->client->destination.iabuf, + sizeof(destination.sin_addr.s_addr)); + destination.sin_port = htons(REMOTE_PORT); + destination.sin_family = AF_INET; +// destination.sin_len = sizeof(destination); + + if (ip->client->state != S_REQUESTING) + memcpy(&from, ip->client->active->address.iabuf, + sizeof(from)); + else + from.s_addr = INADDR_ANY; + + /* Record the number of seconds since we started sending. */ + if (ip->client->state == S_REQUESTING) + ip->client->packet.secs = ip->client->secs; + else { + if (interval < 65536) + ip->client->packet.secs = htons(interval); + else + ip->client->packet.secs = htons(65535); + } + + note("DHCPREQUEST on %s to %s port %d", ip->name, + inet_ntoa(destination.sin_addr), ntohs(destination.sin_port)); + + /* Send out a packet. */ + (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, + from, &destination, NULL); + + add_timeout(cur_time + ip->client->interval, send_request, ip); +} + +void +send_decline(void *ipp) +{ + struct interface_info *ip = ipp; + + note("DHCPDECLINE on %s to %s port %d", ip->name, + inet_ntoa(sockaddr_broadcast.sin_addr), + ntohs(sockaddr_broadcast.sin_port)); + + /* Send out a packet. */ + (void) send_packet(ip, &ip->client->packet, ip->client->packet_length, + inaddr_any, &sockaddr_broadcast, NULL); +} + +void +make_discover(struct interface_info *ip, struct client_lease *lease) +{ + unsigned char discover = DHCPDISCOVER; + struct tree_cache *options[256]; + struct tree_cache option_elements[256]; + int i; + ULONG foo = (ULONG) GetTickCount(); + + memset(option_elements, 0, sizeof(option_elements)); + memset(options, 0, sizeof(options)); + memset(&ip->client->packet, 0, sizeof(ip->client->packet)); + + /* Set DHCP_MESSAGE_TYPE to DHCPDISCOVER */ + i = DHO_DHCP_MESSAGE_TYPE; + options[i] = &option_elements[i]; + options[i]->value = &discover; + options[i]->len = sizeof(discover); + options[i]->buf_size = sizeof(discover); + options[i]->timeout = 0xFFFFFFFF; + + /* Request the options we want */ + i = DHO_DHCP_PARAMETER_REQUEST_LIST; + options[i] = &option_elements[i]; + options[i]->value = ip->client->config->requested_options; + options[i]->len = ip->client->config->requested_option_count; + options[i]->buf_size = + ip->client->config->requested_option_count; + options[i]->timeout = 0xFFFFFFFF; + + /* If we had an address, try to get it again. */ + if (lease) { + ip->client->requested_address = lease->address; + i = DHO_DHCP_REQUESTED_ADDRESS; + options[i] = &option_elements[i]; + options[i]->value = lease->address.iabuf; + options[i]->len = lease->address.len; + options[i]->buf_size = lease->address.len; + options[i]->timeout = 0xFFFFFFFF; + } else + ip->client->requested_address.len = 0; + + /* Send any options requested in the config file. */ + for (i = 0; i < 256; i++) + if (!options[i] && + ip->client->config->send_options[i].data) { + options[i] = &option_elements[i]; + options[i]->value = + ip->client->config->send_options[i].data; + options[i]->len = + ip->client->config->send_options[i].len; + options[i]->buf_size = + ip->client->config->send_options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + + /* Set up the option buffer... */ + ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + options, 0, 0, 0, NULL, 0); + if (ip->client->packet_length < BOOTP_MIN_LEN) + ip->client->packet_length = BOOTP_MIN_LEN; + + ip->client->packet.op = BOOTREQUEST; + ip->client->packet.htype = ip->hw_address.htype; + ip->client->packet.hlen = ip->hw_address.hlen; + ip->client->packet.hops = 0; + ip->client->packet.xid = RtlRandom(&foo); + ip->client->packet.secs = 0; /* filled in by send_discover. */ + ip->client->packet.flags = 0; + + memset(&(ip->client->packet.ciaddr), + 0, sizeof(ip->client->packet.ciaddr)); + memset(&(ip->client->packet.yiaddr), + 0, sizeof(ip->client->packet.yiaddr)); + memset(&(ip->client->packet.siaddr), + 0, sizeof(ip->client->packet.siaddr)); + memset(&(ip->client->packet.giaddr), + 0, sizeof(ip->client->packet.giaddr)); + memcpy(ip->client->packet.chaddr, + ip->hw_address.haddr, ip->hw_address.hlen); +} + + +void +make_request(struct interface_info *ip, struct client_lease * lease) +{ + unsigned char request = DHCPREQUEST; + struct tree_cache *options[256]; + struct tree_cache option_elements[256]; + int i; + + memset(options, 0, sizeof(options)); + memset(&ip->client->packet, 0, sizeof(ip->client->packet)); + + /* Set DHCP_MESSAGE_TYPE to DHCPREQUEST */ + i = DHO_DHCP_MESSAGE_TYPE; + options[i] = &option_elements[i]; + options[i]->value = &request; + options[i]->len = sizeof(request); + options[i]->buf_size = sizeof(request); + options[i]->timeout = 0xFFFFFFFF; + + /* Request the options we want */ + i = DHO_DHCP_PARAMETER_REQUEST_LIST; + options[i] = &option_elements[i]; + options[i]->value = ip->client->config->requested_options; + options[i]->len = ip->client->config->requested_option_count; + options[i]->buf_size = + ip->client->config->requested_option_count; + options[i]->timeout = 0xFFFFFFFF; + + /* If we are requesting an address that hasn't yet been assigned + to us, use the DHCP Requested Address option. */ + if (ip->client->state == S_REQUESTING) { + /* Send back the server identifier... */ + i = DHO_DHCP_SERVER_IDENTIFIER; + options[i] = &option_elements[i]; + options[i]->value = lease->options[i].data; + options[i]->len = lease->options[i].len; + options[i]->buf_size = lease->options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + if (ip->client->state == S_REQUESTING || + ip->client->state == S_REBOOTING) { + ip->client->requested_address = lease->address; + i = DHO_DHCP_REQUESTED_ADDRESS; + options[i] = &option_elements[i]; + options[i]->value = lease->address.iabuf; + options[i]->len = lease->address.len; + options[i]->buf_size = lease->address.len; + options[i]->timeout = 0xFFFFFFFF; + } else + ip->client->requested_address.len = 0; + + /* Send any options requested in the config file. */ + for (i = 0; i < 256; i++) + if (!options[i] && + ip->client->config->send_options[i].data) { + options[i] = &option_elements[i]; + options[i]->value = + ip->client->config->send_options[i].data; + options[i]->len = + ip->client->config->send_options[i].len; + options[i]->buf_size = + ip->client->config->send_options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + + /* Set up the option buffer... */ + ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + options, 0, 0, 0, NULL, 0); + if (ip->client->packet_length < BOOTP_MIN_LEN) + ip->client->packet_length = BOOTP_MIN_LEN; + + ip->client->packet.op = BOOTREQUEST; + ip->client->packet.htype = ip->hw_address.htype; + ip->client->packet.hlen = ip->hw_address.hlen; + ip->client->packet.hops = 0; + ip->client->packet.xid = ip->client->xid; + ip->client->packet.secs = 0; /* Filled in by send_request. */ + + /* If we own the address we're requesting, put it in ciaddr; + otherwise set ciaddr to zero. */ + if (ip->client->state == S_BOUND || + ip->client->state == S_RENEWING || + ip->client->state == S_REBINDING) { + memcpy(&ip->client->packet.ciaddr, + lease->address.iabuf, lease->address.len); + ip->client->packet.flags = 0; + } else { + memset(&ip->client->packet.ciaddr, 0, + sizeof(ip->client->packet.ciaddr)); + ip->client->packet.flags = 0; + } + + memset(&ip->client->packet.yiaddr, 0, + sizeof(ip->client->packet.yiaddr)); + memset(&ip->client->packet.siaddr, 0, + sizeof(ip->client->packet.siaddr)); + memset(&ip->client->packet.giaddr, 0, + sizeof(ip->client->packet.giaddr)); + memcpy(ip->client->packet.chaddr, + ip->hw_address.haddr, ip->hw_address.hlen); +} + +void +make_decline(struct interface_info *ip, struct client_lease *lease) +{ + struct tree_cache *options[256], message_type_tree; + struct tree_cache requested_address_tree; + struct tree_cache server_id_tree, client_id_tree; + unsigned char decline = DHCPDECLINE; + int i; + + memset(options, 0, sizeof(options)); + memset(&ip->client->packet, 0, sizeof(ip->client->packet)); + + /* Set DHCP_MESSAGE_TYPE to DHCPDECLINE */ + i = DHO_DHCP_MESSAGE_TYPE; + options[i] = &message_type_tree; + options[i]->value = &decline; + options[i]->len = sizeof(decline); + options[i]->buf_size = sizeof(decline); + options[i]->timeout = 0xFFFFFFFF; + + /* Send back the server identifier... */ + i = DHO_DHCP_SERVER_IDENTIFIER; + options[i] = &server_id_tree; + options[i]->value = lease->options[i].data; + options[i]->len = lease->options[i].len; + options[i]->buf_size = lease->options[i].len; + options[i]->timeout = 0xFFFFFFFF; + + /* Send back the address we're declining. */ + i = DHO_DHCP_REQUESTED_ADDRESS; + options[i] = &requested_address_tree; + options[i]->value = lease->address.iabuf; + options[i]->len = lease->address.len; + options[i]->buf_size = lease->address.len; + options[i]->timeout = 0xFFFFFFFF; + + /* Send the uid if the user supplied one. */ + i = DHO_DHCP_CLIENT_IDENTIFIER; + if (ip->client->config->send_options[i].len) { + options[i] = &client_id_tree; + options[i]->value = ip->client->config->send_options[i].data; + options[i]->len = ip->client->config->send_options[i].len; + options[i]->buf_size = ip->client->config->send_options[i].len; + options[i]->timeout = 0xFFFFFFFF; + } + + + /* Set up the option buffer... */ + ip->client->packet_length = cons_options(NULL, &ip->client->packet, 0, + options, 0, 0, 0, NULL, 0); + if (ip->client->packet_length < BOOTP_MIN_LEN) + ip->client->packet_length = BOOTP_MIN_LEN; + + ip->client->packet.op = BOOTREQUEST; + ip->client->packet.htype = ip->hw_address.htype; + ip->client->packet.hlen = ip->hw_address.hlen; + ip->client->packet.hops = 0; + ip->client->packet.xid = ip->client->xid; + ip->client->packet.secs = 0; /* Filled in by send_request. */ + ip->client->packet.flags = 0; + + /* ciaddr must always be zero. */ + memset(&ip->client->packet.ciaddr, 0, + sizeof(ip->client->packet.ciaddr)); + memset(&ip->client->packet.yiaddr, 0, + sizeof(ip->client->packet.yiaddr)); + memset(&ip->client->packet.siaddr, 0, + sizeof(ip->client->packet.siaddr)); + memset(&ip->client->packet.giaddr, 0, + sizeof(ip->client->packet.giaddr)); + memcpy(ip->client->packet.chaddr, + ip->hw_address.haddr, ip->hw_address.hlen); +} + +void +free_client_lease(struct client_lease *lease) +{ + int i; + + if (lease->server_name) + free(lease->server_name); + if (lease->filename) + free(lease->filename); + for (i = 0; i < 256; i++) { + if (lease->options[i].len) + free(lease->options[i].data); + } + free(lease); +} + +FILE *leaseFile; + +void +rewrite_client_leases(struct interface_info *ifi) +{ + struct client_lease *lp; + + if (!leaseFile) { + leaseFile = fopen(path_dhclient_db, "w"); + if (!leaseFile) + error("can't create %s", path_dhclient_db); + } else { + fflush(leaseFile); + rewind(leaseFile); + } + + for (lp = ifi->client->leases; lp; lp = lp->next) + write_client_lease(ifi, lp, 1); + if (ifi->client->active) + write_client_lease(ifi, ifi->client->active, 1); + + fflush(leaseFile); +} + +void +write_client_lease(struct interface_info *ip, struct client_lease *lease, + int rewrite) +{ + static int leases_written; + struct tm *t; + int i; + + if (!rewrite) { + if (leases_written++ > 20) { + rewrite_client_leases(ip); + leases_written = 0; + } + } + + /* If the lease came from the config file, we don't need to stash + a copy in the lease database. */ + if (lease->is_static) + return; + + if (!leaseFile) { /* XXX */ + leaseFile = fopen(path_dhclient_db, "w"); + if (!leaseFile) { + error("can't create %s", path_dhclient_db); + return; + } + } + + fprintf(leaseFile, "lease {\n"); + if (lease->is_bootp) + fprintf(leaseFile, " bootp;\n"); + fprintf(leaseFile, " interface \"%s\";\n", ip->name); + fprintf(leaseFile, " fixed-address %s;\n", piaddr(lease->address)); + if (lease->filename) + fprintf(leaseFile, " filename \"%s\";\n", lease->filename); + if (lease->server_name) + fprintf(leaseFile, " server-name \"%s\";\n", + lease->server_name); + if (lease->medium) + fprintf(leaseFile, " medium \"%s\";\n", lease->medium->string); + for (i = 0; i < 256; i++) + if (lease->options[i].len) + fprintf(leaseFile, " option %s %s;\n", + dhcp_options[i].name, + pretty_print_option(i, lease->options[i].data, + lease->options[i].len, 1, 1)); + + t = gmtime(&lease->renewal); + if (t) + fprintf(leaseFile, " renew %d %d/%d/%d %02d:%02d:%02d;\n", + t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + t = gmtime(&lease->rebind); + if (t) + fprintf(leaseFile, " rebind %d %d/%d/%d %02d:%02d:%02d;\n", + t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + t = gmtime(&lease->expiry); + if (t) + fprintf(leaseFile, " expire %d %d/%d/%d %02d:%02d:%02d;\n", + t->tm_wday, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + fprintf(leaseFile, "}\n"); + fflush(leaseFile); +} + +void +script_init(char *reason, struct string_list *medium) +{ + size_t len, mediumlen = 0; + struct imsg_hdr hdr; + struct buf *buf; + int errs; + + if (medium != NULL && medium->string != NULL) + mediumlen = strlen(medium->string); + + hdr.code = IMSG_SCRIPT_INIT; + hdr.len = sizeof(struct imsg_hdr) + + sizeof(size_t) + mediumlen + + sizeof(size_t) + strlen(reason); + + if ((buf = buf_open(hdr.len)) == NULL) + return; + + errs = 0; + errs += buf_add(buf, &hdr, sizeof(hdr)); + errs += buf_add(buf, &mediumlen, sizeof(mediumlen)); + if (mediumlen > 0) + errs += buf_add(buf, medium->string, mediumlen); + len = strlen(reason); + errs += buf_add(buf, &len, sizeof(len)); + errs += buf_add(buf, reason, len); + + if (errs) + error("buf_add: %d", WSAGetLastError()); + + if (buf_close(privfd, buf) == -1) + error("buf_close: %d", WSAGetLastError()); +} + +void +priv_script_init(struct interface_info *ip, char *reason, char *medium) +{ + if (ip) { + // XXX Do we need to do anything? + } +} + +void +priv_script_write_params(struct interface_info *ip, char *prefix, struct client_lease *lease) +{ + u_int8_t dbuf[1500]; + int i, len = 0; + +#if 0 + script_set_env(ip->client, prefix, "ip_address", + piaddr(lease->address)); +#endif + + if (lease->options[DHO_SUBNET_MASK].len && + (lease->options[DHO_SUBNET_MASK].len < + sizeof(lease->address.iabuf))) { + struct iaddr netmask, subnet, broadcast; + + memcpy(netmask.iabuf, lease->options[DHO_SUBNET_MASK].data, + lease->options[DHO_SUBNET_MASK].len); + netmask.len = lease->options[DHO_SUBNET_MASK].len; + + subnet = subnet_number(lease->address, netmask); + if (subnet.len) { +#if 0 + script_set_env(ip->client, prefix, "network_number", + piaddr(subnet)); +#endif + if (!lease->options[DHO_BROADCAST_ADDRESS].len) { + broadcast = broadcast_addr(subnet, netmask); + if (broadcast.len) +#if 0 + script_set_env(ip->client, prefix, + "broadcast_address", + piaddr(broadcast)); +#else + ; +#endif + } + } + } + +#if 0 + if (lease->filename) + script_set_env(ip->client, prefix, "filename", lease->filename); + if (lease->server_name) + script_set_env(ip->client, prefix, "server_name", + lease->server_name); +#endif + + for (i = 0; i < 256; i++) { + u_int8_t *dp = NULL; + + if (ip->client->config->defaults[i].len) { + if (lease->options[i].len) { + switch ( + ip->client->config->default_actions[i]) { + case ACTION_DEFAULT: + dp = lease->options[i].data; + len = lease->options[i].len; + break; + case ACTION_SUPERSEDE: +supersede: + dp = ip->client-> + config->defaults[i].data; + len = ip->client-> + config->defaults[i].len; + break; + case ACTION_PREPEND: + len = ip->client-> + config->defaults[i].len + + lease->options[i].len; + if (len >= sizeof(dbuf)) { + warning("no space to %s %s", + "prepend option", + dhcp_options[i].name); + goto supersede; + } + dp = dbuf; + memcpy(dp, + ip->client-> + config->defaults[i].data, + ip->client-> + config->defaults[i].len); + memcpy(dp + ip->client-> + config->defaults[i].len, + lease->options[i].data, + lease->options[i].len); + dp[len] = '\0'; + break; + case ACTION_APPEND: + len = ip->client-> + config->defaults[i].len + + lease->options[i].len + 1; + if (len > sizeof(dbuf)) { + warning("no space to %s %s", + "append option", + dhcp_options[i].name); + goto supersede; + } + dp = dbuf; + memcpy(dp, + lease->options[i].data, + lease->options[i].len); + memcpy(dp + lease->options[i].len, + ip->client-> + config->defaults[i].data, + ip->client-> + config->defaults[i].len); + dp[len-1] = '\0'; + } + } else { + dp = ip->client-> + config->defaults[i].data; + len = ip->client-> + config->defaults[i].len; + } + } else if (lease->options[i].len) { + len = lease->options[i].len; + dp = lease->options[i].data; + } else { + len = 0; + } +#if 0 + if (len) { + char name[256]; + + if (dhcp_option_ev_name(name, sizeof(name), + &dhcp_options[i])) + script_set_env(ip->client, prefix, name, + pretty_print_option(i, dp, len, 0, 0)); + } +#endif + } +#if 0 + snprintf(tbuf, sizeof(tbuf), "%d", (int)lease->expiry); + script_set_env(ip->client, prefix, "expiry", tbuf); +#endif +} + +void +script_write_params(char *prefix, struct client_lease *lease) +{ + size_t fn_len = 0, sn_len = 0, pr_len = 0; + struct imsg_hdr hdr; + struct buf *buf; + int errs, i; + + if (lease->filename != NULL) + fn_len = strlen(lease->filename); + if (lease->server_name != NULL) + sn_len = strlen(lease->server_name); + if (prefix != NULL) + pr_len = strlen(prefix); + + hdr.code = IMSG_SCRIPT_WRITE_PARAMS; + hdr.len = sizeof(hdr) + sizeof(struct client_lease) + + sizeof(size_t) + fn_len + sizeof(size_t) + sn_len + + sizeof(size_t) + pr_len; + + for (i = 0; i < 256; i++) + hdr.len += sizeof(int) + lease->options[i].len; + + scripttime = time(NULL); + + if ((buf = buf_open(hdr.len)) == NULL) + return; + + errs = 0; + errs += buf_add(buf, &hdr, sizeof(hdr)); + errs += buf_add(buf, lease, sizeof(struct client_lease)); + errs += buf_add(buf, &fn_len, sizeof(fn_len)); + errs += buf_add(buf, lease->filename, fn_len); + errs += buf_add(buf, &sn_len, sizeof(sn_len)); + errs += buf_add(buf, lease->server_name, sn_len); + errs += buf_add(buf, &pr_len, sizeof(pr_len)); + errs += buf_add(buf, prefix, pr_len); + + for (i = 0; i < 256; i++) { + errs += buf_add(buf, &lease->options[i].len, + sizeof(lease->options[i].len)); + errs += buf_add(buf, lease->options[i].data, + lease->options[i].len); + } + + if (errs) + error("buf_add: %d", WSAGetLastError()); + + if (buf_close(privfd, buf) == -1) + error("buf_close: %d", WSAGetLastError()); +} + +int +dhcp_option_ev_name(char *buf, size_t buflen, struct dhcp_option *option) +{ + int i; + + for (i = 0; option->name[i]; i++) { + if (i + 1 == buflen) + return 0; + if (option->name[i] == '-') + buf[i] = '_'; + else + buf[i] = option->name[i]; + } + + buf[i] = 0; + return 1; +} + +#if 0 +void +go_daemon(void) +{ + static int state = 0; + + if (no_daemon || state) + return; + + state = 1; + + /* Stop logging to stderr... */ + log_perror = 0; + + if (daemon(1, 0) == -1) + error("daemon"); + + /* we are chrooted, daemon(3) fails to open /dev/null */ + if (nullfd != -1) { + dup2(nullfd, STDIN_FILENO); + dup2(nullfd, STDOUT_FILENO); + dup2(nullfd, STDERR_FILENO); + close(nullfd); + nullfd = -1; + } +} +#endif + +int +check_option(struct client_lease *l, int option) +{ + char *opbuf; + char *sbuf; + + /* we use this, since this is what gets passed to dhclient-script */ + + opbuf = pretty_print_option(option, l->options[option].data, + l->options[option].len, 0, 0); + + sbuf = option_as_string(option, l->options[option].data, + l->options[option].len); + + switch (option) { + case DHO_SUBNET_MASK: + case DHO_TIME_SERVERS: + case DHO_NAME_SERVERS: + case DHO_ROUTERS: + case DHO_DOMAIN_NAME_SERVERS: + case DHO_LOG_SERVERS: + case DHO_COOKIE_SERVERS: + case DHO_LPR_SERVERS: + case DHO_IMPRESS_SERVERS: + case DHO_RESOURCE_LOCATION_SERVERS: + case DHO_SWAP_SERVER: + case DHO_BROADCAST_ADDRESS: + case DHO_NIS_SERVERS: + case DHO_NTP_SERVERS: + case DHO_NETBIOS_NAME_SERVERS: + case DHO_NETBIOS_DD_SERVER: + case DHO_FONT_SERVERS: + case DHO_DHCP_SERVER_IDENTIFIER: + if (!ipv4addrs(opbuf)) { + warning("Invalid IP address in option(%d): %s", option, opbuf); + return (0); + } + return (1) ; + case DHO_HOST_NAME: + case DHO_DOMAIN_NAME: + case DHO_NIS_DOMAIN: + if (!res_hnok(sbuf)) + warning("Bogus Host Name option %d: %s (%s)", option, + sbuf, opbuf); + return (1); + case DHO_PAD: + case DHO_TIME_OFFSET: + case DHO_BOOT_SIZE: + case DHO_MERIT_DUMP: + case DHO_ROOT_PATH: + case DHO_EXTENSIONS_PATH: + case DHO_IP_FORWARDING: + case DHO_NON_LOCAL_SOURCE_ROUTING: + case DHO_POLICY_FILTER: + case DHO_MAX_DGRAM_REASSEMBLY: + case DHO_DEFAULT_IP_TTL: + case DHO_PATH_MTU_AGING_TIMEOUT: + case DHO_PATH_MTU_PLATEAU_TABLE: + case DHO_INTERFACE_MTU: + case DHO_ALL_SUBNETS_LOCAL: + case DHO_PERFORM_MASK_DISCOVERY: + case DHO_MASK_SUPPLIER: + case DHO_ROUTER_DISCOVERY: + case DHO_ROUTER_SOLICITATION_ADDRESS: + case DHO_STATIC_ROUTES: + case DHO_TRAILER_ENCAPSULATION: + case DHO_ARP_CACHE_TIMEOUT: + case DHO_IEEE802_3_ENCAPSULATION: + case DHO_DEFAULT_TCP_TTL: + case DHO_TCP_KEEPALIVE_INTERVAL: + case DHO_TCP_KEEPALIVE_GARBAGE: + case DHO_VENDOR_ENCAPSULATED_OPTIONS: + case DHO_NETBIOS_NODE_TYPE: + case DHO_NETBIOS_SCOPE: + case DHO_X_DISPLAY_MANAGER: + case DHO_DHCP_REQUESTED_ADDRESS: + case DHO_DHCP_LEASE_TIME: + case DHO_DHCP_OPTION_OVERLOAD: + case DHO_DHCP_MESSAGE_TYPE: + case DHO_DHCP_PARAMETER_REQUEST_LIST: + case DHO_DHCP_MESSAGE: + case DHO_DHCP_MAX_MESSAGE_SIZE: + case DHO_DHCP_RENEWAL_TIME: + case DHO_DHCP_REBINDING_TIME: + case DHO_DHCP_CLASS_IDENTIFIER: + case DHO_DHCP_CLIENT_IDENTIFIER: + case DHO_DHCP_USER_CLASS_ID: + case DHO_END: + return (1); + default: + warning("unknown dhcp option value 0x%x", option); + return (unknown_ok); + } +} + +int +res_hnok(const char *dn) +{ + int pch = PERIOD, ch = *dn++; + + while (ch != '\0') { + int nch = *dn++; + + if (periodchar(ch)) { + ; + } else if (periodchar(pch)) { + if (!borderchar(ch)) + return (0); + } else if (periodchar(nch) || nch == '\0') { + if (!borderchar(ch)) + return (0); + } else { + if (!middlechar(ch)) + return (0); + } + pch = ch, ch = nch; + } + return (1); +} + +/* Does buf consist only of dotted decimal ipv4 addrs? + * return how many if so, + * otherwise, return 0 + */ +int +ipv4addrs(char * buf) +{ + char *tmp; + struct in_addr jnk; + int i = 0; + + note("Input: %s", buf); + + do { + tmp = strtok(buf, " "); + note("got %s", tmp); + if( tmp && inet_aton(tmp, &jnk) ) i++; + buf = NULL; + } while( tmp ); + + return (i); +} + + +char * +option_as_string(unsigned int code, unsigned char *data, int len) +{ + static char optbuf[32768]; /* XXX */ + char *op = optbuf; + int opleft = sizeof(optbuf); + unsigned char *dp = data; + + if (code > 255) + error("option_as_string: bad code %d", code); + + for (; dp < data + len; dp++) { + if (!isascii(*dp) || !isprint(*dp)) { + if (dp + 1 != data + len || *dp != 0) { + _snprintf(op, opleft, "\\%03o", *dp); + op += 4; + opleft -= 4; + } + } else if (*dp == '"' || *dp == '\'' || *dp == '$' || + *dp == '`' || *dp == '\\') { + *op++ = '\\'; + *op++ = *dp; + opleft -= 2; + } else { + *op++ = *dp; + opleft--; + } + } + if (opleft < 1) + goto toobig; + *op = 0; + return optbuf; +toobig: + warning("dhcp option too large"); + return ""; +} + diff --git a/reactos/base/services/dhcp/dhcp.rbuild b/reactos/base/services/dhcp/dhcp.rbuild new file mode 100644 index 00000000000..ffa05b78465 --- /dev/null +++ b/reactos/base/services/dhcp/dhcp.rbuild @@ -0,0 +1,30 @@ + + + + . + include + + ntdll + ws2_32 + iphlpapi + advapi32 + oldnames + adapter.c + alloc.c + api.c + compat.c + dhclient.c + dispatch.c + hash.c + options.c + pipe.c + privsep.c + socket.c + tables.c + timer.c + util.c + dhcp.rc + + rosdhcp.h + + diff --git a/reactos/base/services/dhcp/dhcp.rc b/reactos/base/services/dhcp/dhcp.rc new file mode 100644 index 00000000000..35e404f893e --- /dev/null +++ b/reactos/base/services/dhcp/dhcp.rc @@ -0,0 +1,6 @@ +/* $Id: regsvr32.rc 12852 2005-01-06 13:58:04Z mf $ */ + +#define REACTOS_STR_FILE_DESCRIPTION "DHCP Client Service" +#define REACTOS_STR_INTERNAL_NAME "dhcp\0" +#define REACTOS_STR_ORIGINAL_FILENAME "dhcp.exe\0" +#include diff --git a/reactos/base/services/dhcp/dhcpmain.c b/reactos/base/services/dhcp/dhcpmain.c new file mode 100644 index 00000000000..c1a1b30328e --- /dev/null +++ b/reactos/base/services/dhcp/dhcpmain.c @@ -0,0 +1,72 @@ +/* $Id:$ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Service + * FILE: subsys/system/dhcp + * PURPOSE: DHCP client service entry point + * PROGRAMMER: Art Yerkes (arty@users.sf.net) + * UPDATE HISTORY: + * Created 03/08/2005 + */ + +#include +#include "dhcpd.h" +#include "version.h" + +typedef struct _DHCP_API_REQUEST { + int type; + UINT flags; + LPDHCPAPI_CLASSID class_id; + DHCP_API_PARAMS_ARRAY vendor_params; + DHCP_API_PARAMS_ARRAY general_params; + LPWSTR request_id, adapter_name; +} DHCP_API_REQUEST; + +typedef struct _DHCP_MANAGED_ADAPTER { + LPWSTR adapter_name, hostname, dns_server; + UINT adapter_index; + struct sockaddr_in address, netmask; + struct interface_info *dhcp_info; +} DHCP_MANAGED_ADAPTER; + +#define DHCP_REQUESTPARAM WM_USER + 0 +#define DHCP_PARAMCHANGE WM_USER + 1 +#define DHCP_CANCELREQUEST WM_USER + 2 +#define DHCP_NOPARAMCHANGE WM_USER + 3 +#define DHCP_MANAGEADAPTER WM_USER + 4 +#define DHCP_UNMANAGEADAPTER WM_USER + 5 + +UINT DhcpEventTimer; +HANDLE DhcpServiceThread; +DWORD DhcpServiceThreadId; +LIST_ENTRY ManagedAdapters; + +LRESULT WINAPI ServiceThread( PVOID Data ) { + MSG msg; + + while( GetMessage( &msg, 0, 0, 0 ) ) { + switch( msg.message ) { + case DHCP_MANAGEADAPTER: + + break; + + case DHCP_UNMANAGEADAPTER: + break; + + case DHCP_REQUESTPARAM: + break; + + case DHCP_CANCELREQUEST: + break; + + case DHCP_PARAMCHANGE: + break; + + case DHCP_NOPARAMCHANGE: + break; + } + } +} + +int main( int argc, char **argv ) { +} diff --git a/reactos/base/services/dhcp/dispatch.c b/reactos/base/services/dhcp/dispatch.c new file mode 100644 index 00000000000..c26ead72701 --- /dev/null +++ b/reactos/base/services/dhcp/dispatch.c @@ -0,0 +1,356 @@ +/* $OpenBSD: dispatch.c,v 1.31 2004/09/21 04:07:03 david Exp $ */ + +/* + * Copyright 2004 Henning Brauer + * Copyright (c) 1995, 1996, 1997, 1998, 1999 + * The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#include "rosdhcp.h" +#include "dhcpd.h" +//#include + +//#include +//#include +//#include + +struct protocol *protocols = NULL; +struct timeout *timeouts = NULL; +static struct timeout *free_timeouts = NULL; +void (*bootp_packet_handler)(struct interface_info *, + struct dhcp_packet *, int, unsigned int, + struct iaddr, struct hardware *); + +/* + * Wait for packets to come in using poll(). When a packet comes in, + * call receive_packet to receive the packet and possibly strip hardware + * addressing information from it, and then call through the + * bootp_packet_handler hook to try to do something with it. + */ +void +dispatch(void) +{ + int count, to_msec, err; + struct protocol *l; + fd_set fds; + time_t howlong, cur_time; + struct timeval timeval; + + if (!AdapterDiscover()) { + AdapterStop(); + return; + } + + ApiLock(); + + do { + /* + * Call any expired timeouts, and then if there's still + * a timeout registered, time out the select call then. + */ + time(&cur_time); + + if (timeouts) { + struct timeout *t; + + if (timeouts->when <= cur_time) { + t = timeouts; + timeouts = timeouts->next; + (*(t->func))(t->what); + t->next = free_timeouts; + free_timeouts = t; + continue; + } + + /* + * Figure timeout in milliseconds, and check for + * potential overflow, so we can cram into an + * int for poll, while not polling with a + * negative timeout and blocking indefinitely. + */ + howlong = timeouts->when - cur_time; + if (howlong > INT_MAX / 1000) + howlong = INT_MAX / 1000; + to_msec = howlong * 1000; + } else + to_msec = 5000; + + /* Set up the descriptors to be polled. */ + FD_ZERO(&fds); + + for (l = protocols; l; l = l->next) + FD_SET(l->fd, &fds); + + /* Wait for a packet or a timeout... XXX */ + timeval.tv_sec = to_msec / 1000; + timeval.tv_usec = to_msec % 1000; + + ApiUnlock(); + + if (protocols) + count = select(0, &fds, NULL, NULL, &timeval); + else { + Sleep(to_msec); + count = 0; + } + + ApiLock(); + + DH_DbgPrint(MID_TRACE,("Select: %d\n", count)); + + /* Not likely to be transitory... */ + if (count == SOCKET_ERROR) { + err = WSAGetLastError(); + error("poll: %d", err); + break; + } + + for (l = protocols; l; l = l->next) { + struct interface_info *ip; + ip = l->local; + if (FD_ISSET(l->fd, &fds)) { + if (ip && (l->handler != got_one || + !ip->dead)) { + DH_DbgPrint(MID_TRACE,("Handling %x\n", l)); + (*(l->handler))(l); + } + } + } + } while (1); + + ApiUnlock(); /* Not reached currently */ +} + +void +got_one(struct protocol *l) +{ + struct sockaddr_in from; + struct hardware hfrom; + struct iaddr ifrom; + ssize_t result; + union { + /* + * Packet input buffer. Must be as large as largest + * possible MTU. + */ + unsigned char packbuf[4095]; + struct dhcp_packet packet; + } u; + struct interface_info *ip = l->local; + PDHCP_ADAPTER adapter; + + if ((result = receive_packet(ip, u.packbuf, sizeof(u), &from, + &hfrom)) == -1) { + warning("receive_packet failed on %s: %d", ip->name, + WSAGetLastError()); + ip->errors++; + if (ip->errors > 20) { + /* our interface has gone away. */ + warning("Interface %s no longer appears valid.", + ip->name); + ip->dead = 1; + close(l->fd); + remove_protocol(l); + adapter = AdapterFindInfo(ip); + if (adapter) { + RemoveEntryList(&adapter->ListEntry); + free(adapter); + } + } + return; + } + if (result == 0) + return; + + if (bootp_packet_handler) { + ifrom.len = 4; + memcpy(ifrom.iabuf, &from.sin_addr, ifrom.len); + + + adapter = AdapterFindByHardwareAddress(u.packet.chaddr, + u.packet.hlen); + + if (!adapter) { + warning("Discarding packet with a non-matching target physical address\n"); + return; + } + + (*bootp_packet_handler)(&adapter->DhclientInfo, &u.packet, result, + from.sin_port, ifrom, &hfrom); + } +} + +void +add_timeout(time_t when, void (*where)(void *), void *what) +{ + struct timeout *t, *q; + + DH_DbgPrint(MID_TRACE,("Adding timeout %x %p %x\n", when, where, what)); + /* See if this timeout supersedes an existing timeout. */ + t = NULL; + for (q = timeouts; q; q = q->next) { + if (q->func == where && q->what == what) { + if (t) + t->next = q->next; + else + timeouts = q->next; + break; + } + t = q; + } + + /* If we didn't supersede a timeout, allocate a timeout + structure now. */ + if (!q) { + if (free_timeouts) { + q = free_timeouts; + free_timeouts = q->next; + q->func = where; + q->what = what; + } else { + q = malloc(sizeof(struct timeout)); + if (!q) { + error("Can't allocate timeout structure!"); + return; + } + q->func = where; + q->what = what; + } + } + + q->when = when; + + /* Now sort this timeout into the timeout list. */ + + /* Beginning of list? */ + if (!timeouts || timeouts->when > q->when) { + q->next = timeouts; + timeouts = q; + return; + } + + /* Middle of list? */ + for (t = timeouts; t->next; t = t->next) { + if (t->next->when > q->when) { + q->next = t->next; + t->next = q; + return; + } + } + + /* End of list. */ + t->next = q; + q->next = NULL; +} + +void +cancel_timeout(void (*where)(void *), void *what) +{ + struct timeout *t, *q; + + /* Look for this timeout on the list, and unlink it if we find it. */ + t = NULL; + for (q = timeouts; q; q = q->next) { + if (q->func == where && q->what == what) { + if (t) + t->next = q->next; + else + timeouts = q->next; + break; + } + t = q; + } + + /* If we found the timeout, put it on the free list. */ + if (q) { + q->next = free_timeouts; + free_timeouts = q; + } +} + +/* Add a protocol to the list of protocols... */ +void +add_protocol(char *name, int fd, void (*handler)(struct protocol *), + void *local) +{ + struct protocol *p; + + p = malloc(sizeof(*p)); + if (!p) + error("can't allocate protocol struct for %s", name); + + p->fd = fd; + p->handler = handler; + p->local = local; + p->next = protocols; + protocols = p; +} + +void +remove_protocol(struct protocol *proto) +{ + struct protocol *p, *next, *prev; + + prev = NULL; + for (p = protocols; p; p = next) { + next = p->next; + if (p == proto) { + if (prev) + prev->next = p->next; + else + protocols = p->next; + free(p); + } + } +} + +struct protocol * +find_protocol_by_adapter(struct interface_info *info) +{ + struct protocol *p; + + for( p = protocols; p; p = p->next ) { + if( p->local == (void *)info ) return p; + } + + return NULL; +} + +int +interface_link_status(char *ifname) +{ + return (1); +} diff --git a/reactos/base/services/dhcp/hash.c b/reactos/base/services/dhcp/hash.c new file mode 100644 index 00000000000..84c8c6a7ade --- /dev/null +++ b/reactos/base/services/dhcp/hash.c @@ -0,0 +1,165 @@ +/* hash.c + + Routines for manipulating hash tables... */ + +/* + * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define lint +#ifndef lint +static char copyright[] = +"$Id: hash.c,v 1.9.2.3 1999/04/09 17:39:41 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "rosdhcp.h" + +static __inline int do_hash PROTO ((unsigned char *, int, int)); + +struct hash_table *new_hash () +{ + struct hash_table *rv = new_hash_table (DEFAULT_HASH_SIZE); + if (!rv) + return rv; + memset (&rv -> buckets [0], 0, + DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *)); + return rv; +} + +static __inline int do_hash (name, len, size) + unsigned char *name; + int len; + int size; +{ + register int accum = 0; + register unsigned char *s = name; + int i = len; + while (i--) { + /* Add the character in... */ + accum += *s++; + /* Add carry back in... */ + while (accum > 255) { + accum = (accum & 255) + (accum >> 8); + } + } + return accum % size; +} + +void add_hash (table, name, len, pointer) + struct hash_table *table; + int len; + unsigned char *name; + unsigned char *pointer; +{ + int hashno; + struct hash_bucket *bp; + + if (!table) + return; + if (!len) + len = strlen ((char *)name); + + hashno = do_hash (name, len, table -> hash_count); + bp = new_hash_bucket (); + + if (!bp) { + warn ("Can't add %s to hash table.", name); + return; + } + bp -> name = name; + bp -> value = pointer; + bp -> next = table -> buckets [hashno]; + bp -> len = len; + table -> buckets [hashno] = bp; +} + +void delete_hash_entry (table, name, len) + struct hash_table *table; + int len; + unsigned char *name; +{ + int hashno; + struct hash_bucket *bp, *pbp = (struct hash_bucket *)0; + + if (!table) + return; + if (!len) + len = strlen ((char *)name); + + hashno = do_hash (name, len, table -> hash_count); + + /* Go through the list looking for an entry that matches; + if we find it, delete it. */ + for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { + if ((!bp -> len && + !strcmp ((char *)bp -> name, (char *)name)) || + (bp -> len == len && + !memcmp (bp -> name, name, len))) { + if (pbp) { + pbp -> next = bp -> next; + } else { + table -> buckets [hashno] = bp -> next; + } + free_hash_bucket (bp, "delete_hash_entry"); + break; + } + pbp = bp; /* jwg, 9/6/96 - nice catch! */ + } +} + +unsigned char *hash_lookup (table, name, len) + struct hash_table *table; + unsigned char *name; + int len; +{ + int hashno; + struct hash_bucket *bp; + + if (!table) + return (unsigned char *)0; + + if (!len) + len = strlen ((char *)name); + + hashno = do_hash (name, len, table -> hash_count); + + for (bp = table -> buckets [hashno]; bp; bp = bp -> next) { + if (len == bp -> len && !memcmp (bp -> name, name, len)) + return bp -> value; + } + return (unsigned char *)0; +} diff --git a/reactos/base/services/dhcp/include/cdefs.h b/reactos/base/services/dhcp/include/cdefs.h new file mode 100644 index 00000000000..2bc67a5251a --- /dev/null +++ b/reactos/base/services/dhcp/include/cdefs.h @@ -0,0 +1,57 @@ +/* cdefs.h + + Standard C definitions... */ + +/* + * Copyright (c) 1996 The Internet Software Consortium. + * All Rights Reserved. + * Copyright (c) 1995 RadioMail Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of RadioMail Corporation, the Internet Software + * Consortium nor the names of its contributors may be used to endorse + * or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY RADIOMAIL CORPORATION, THE INTERNET + * SOFTWARE CONSORTIUM AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL RADIOMAIL CORPORATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software was written for RadioMail Corporation by Ted Lemon + * under a contract with Vixie Enterprises. Further modifications have + * been made for the Internet Software Consortium under a contract + * with Vixie Laboratories. + */ + +#if (defined (__GNUC__) || defined (__STDC__)) && !defined (BROKEN_ANSI) +#define PROTO(x) x +#define KandR(x) +#define ANSI_DECL(x) x +#if defined (__GNUC__) +#define INLINE inline +#else +#define INLINE +#endif /* __GNUC__ */ +#else +#define PROTO(x) () +#define KandR(x) x +#define ANSI_DECL(x) +#define INLINE +#endif /* __GNUC__ || __STDC__ */ diff --git a/reactos/base/services/dhcp/include/debug.h b/reactos/base/services/dhcp/include/debug.h new file mode 100644 index 00000000000..de374aaba45 --- /dev/null +++ b/reactos/base/services/dhcp/include/debug.h @@ -0,0 +1,51 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS TCP/IP protocol driver + * FILE: include/debug.h + * PURPOSE: Debugging support macros + * DEFINES: DBG - Enable debug output + * NASSERT - Disable assertions + */ + +#pragma once + +#define NORMAL_MASK 0x000000FF +#define SPECIAL_MASK 0xFFFFFF00 +#define MIN_TRACE 0x00000001 +#define MID_TRACE 0x00000002 +#define MAX_TRACE 0x00000003 + +#define DEBUG_ADAPTER 0x00000100 +#define DEBUG_ULTRA 0xFFFFFFFF + +#if DBG + +extern unsigned long debug_trace_level; + +#ifdef _MSC_VER + +#define DH_DbgPrint(_t_, _x_) \ + if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ + ((debug_trace_level & _t_) > NORMAL_MASK)) { \ + DbgPrint("(%s:%d) ", __FILE__, __LINE__); \ + DbgPrint _x_ ; \ + } + +#else /* _MSC_VER */ + +#define DH_DbgPrint(_t_, _x_) \ + if (((debug_trace_level & NORMAL_MASK) >= _t_) || \ + ((debug_trace_level & _t_) > NORMAL_MASK)) { \ + DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \ + DbgPrint _x_ ; \ + } + +#endif /* _MSC_VER */ + +#else /* DBG */ + +#define DH_DbgPrint(_t_, _x_) + +#endif /* DBG */ + +/* EOF */ diff --git a/reactos/base/services/dhcp/include/dhcp.h b/reactos/base/services/dhcp/include/dhcp.h new file mode 100644 index 00000000000..8ac8ed3a9e6 --- /dev/null +++ b/reactos/base/services/dhcp/include/dhcp.h @@ -0,0 +1,169 @@ +/* $OpenBSD: dhcp.h,v 1.5 2004/05/04 15:49:49 deraadt Exp $ */ + +/* Protocol structures... */ + +/* + * Copyright (c) 1995, 1996 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define DHCP_UDP_OVERHEAD (14 + /* Ethernet header */ \ + 20 + /* IP header */ \ + 8) /* UDP header */ +#define DHCP_SNAME_LEN 64 +#define DHCP_FILE_LEN 128 +#define DHCP_FIXED_NON_UDP 236 +#define DHCP_FIXED_LEN (DHCP_FIXED_NON_UDP + DHCP_UDP_OVERHEAD) + /* Everything but options. */ +#define DHCP_MTU_MAX 1500 +#define DHCP_OPTION_LEN (DHCP_MTU_MAX - DHCP_FIXED_LEN) + +#define BOOTP_MIN_LEN 300 +#define DHCP_MIN_LEN 548 + +struct dhcp_packet { + u_int8_t op; /* Message opcode/type */ + u_int8_t htype; /* Hardware addr type (see net/if_types.h) */ + u_int8_t hlen; /* Hardware addr length */ + u_int8_t hops; /* Number of relay agent hops from client */ + u_int32_t xid; /* Transaction ID */ + u_int16_t secs; /* Seconds since client started looking */ + u_int16_t flags; /* Flag bits */ + struct in_addr ciaddr; /* Client IP address (if already in use) */ + struct in_addr yiaddr; /* Client IP address */ + struct in_addr siaddr; /* IP address of next server to talk to */ + struct in_addr giaddr; /* DHCP relay agent IP address */ + unsigned char chaddr[16]; /* Client hardware address */ + char sname[DHCP_SNAME_LEN]; /* Server name */ + char file[DHCP_FILE_LEN]; /* Boot filename */ + unsigned char options[DHCP_OPTION_LEN]; + /* Optional parameters + (actual length dependent on MTU). */ +}; + +/* BOOTP (rfc951) message types */ +#define BOOTREQUEST 1 +#define BOOTREPLY 2 + +/* Possible values for flags field... */ +#define BOOTP_BROADCAST 32768L + +/* Possible values for hardware type (htype) field... */ +#define HTYPE_ETHER 1 /* Ethernet */ +#define HTYPE_IEEE802 6 /* IEEE 802.2 Token Ring... */ +#define HTYPE_FDDI 8 /* FDDI... */ + +/* Magic cookie validating dhcp options field (and bootp vendor + extensions field). */ +#define DHCP_OPTIONS_COOKIE "\143\202\123\143" + + +/* DHCP Option codes: */ + +#define DHO_PAD 0 +#define DHO_SUBNET_MASK 1 +#define DHO_TIME_OFFSET 2 +#define DHO_ROUTERS 3 +#define DHO_TIME_SERVERS 4 +#define DHO_NAME_SERVERS 5 +#define DHO_DOMAIN_NAME_SERVERS 6 +#define DHO_LOG_SERVERS 7 +#define DHO_COOKIE_SERVERS 8 +#define DHO_LPR_SERVERS 9 +#define DHO_IMPRESS_SERVERS 10 +#define DHO_RESOURCE_LOCATION_SERVERS 11 +#define DHO_HOST_NAME 12 +#define DHO_BOOT_SIZE 13 +#define DHO_MERIT_DUMP 14 +#define DHO_DOMAIN_NAME 15 +#define DHO_SWAP_SERVER 16 +#define DHO_ROOT_PATH 17 +#define DHO_EXTENSIONS_PATH 18 +#define DHO_IP_FORWARDING 19 +#define DHO_NON_LOCAL_SOURCE_ROUTING 20 +#define DHO_POLICY_FILTER 21 +#define DHO_MAX_DGRAM_REASSEMBLY 22 +#define DHO_DEFAULT_IP_TTL 23 +#define DHO_PATH_MTU_AGING_TIMEOUT 24 +#define DHO_PATH_MTU_PLATEAU_TABLE 25 +#define DHO_INTERFACE_MTU 26 +#define DHO_ALL_SUBNETS_LOCAL 27 +#define DHO_BROADCAST_ADDRESS 28 +#define DHO_PERFORM_MASK_DISCOVERY 29 +#define DHO_MASK_SUPPLIER 30 +#define DHO_ROUTER_DISCOVERY 31 +#define DHO_ROUTER_SOLICITATION_ADDRESS 32 +#define DHO_STATIC_ROUTES 33 +#define DHO_TRAILER_ENCAPSULATION 34 +#define DHO_ARP_CACHE_TIMEOUT 35 +#define DHO_IEEE802_3_ENCAPSULATION 36 +#define DHO_DEFAULT_TCP_TTL 37 +#define DHO_TCP_KEEPALIVE_INTERVAL 38 +#define DHO_TCP_KEEPALIVE_GARBAGE 39 +#define DHO_NIS_DOMAIN 40 +#define DHO_NIS_SERVERS 41 +#define DHO_NTP_SERVERS 42 +#define DHO_VENDOR_ENCAPSULATED_OPTIONS 43 +#define DHO_NETBIOS_NAME_SERVERS 44 +#define DHO_NETBIOS_DD_SERVER 45 +#define DHO_NETBIOS_NODE_TYPE 46 +#define DHO_NETBIOS_SCOPE 47 +#define DHO_FONT_SERVERS 48 +#define DHO_X_DISPLAY_MANAGER 49 +#define DHO_DHCP_REQUESTED_ADDRESS 50 +#define DHO_DHCP_LEASE_TIME 51 +#define DHO_DHCP_OPTION_OVERLOAD 52 +#define DHO_DHCP_MESSAGE_TYPE 53 +#define DHO_DHCP_SERVER_IDENTIFIER 54 +#define DHO_DHCP_PARAMETER_REQUEST_LIST 55 +#define DHO_DHCP_MESSAGE 56 +#define DHO_DHCP_MAX_MESSAGE_SIZE 57 +#define DHO_DHCP_RENEWAL_TIME 58 +#define DHO_DHCP_REBINDING_TIME 59 +#define DHO_DHCP_CLASS_IDENTIFIER 60 +#define DHO_DHCP_CLIENT_IDENTIFIER 61 +#define DHO_DHCP_USER_CLASS_ID 77 +#define DHO_END 255 + +/* DHCP message types. */ +#define DHCPDISCOVER 1 +#define DHCPOFFER 2 +#define DHCPREQUEST 3 +#define DHCPDECLINE 4 +#define DHCPACK 5 +#define DHCPNAK 6 +#define DHCPRELEASE 7 +#define DHCPINFORM 8 diff --git a/reactos/base/services/dhcp/include/dhcpd.h b/reactos/base/services/dhcp/include/dhcpd.h new file mode 100644 index 00000000000..d6a2fa405b8 --- /dev/null +++ b/reactos/base/services/dhcp/include/dhcpd.h @@ -0,0 +1,485 @@ +/* $OpenBSD: dhcpd.h,v 1.33 2004/05/06 22:29:15 deraadt Exp $ */ + +/* + * Copyright (c) 2004 Henning Brauer + * Copyright (c) 1995, 1996, 1997, 1998, 1999 + * The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#pragma once + +#include +#include +#include "stdint.h" + +#define IFNAMSIZ MAX_INTERFACE_NAME_LEN + +#define ETH_ALEN 6 +#define ETHER_ADDR_LEN ETH_ALEN +#include +struct ether_header +{ + u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ + u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */ + u_int16_t ether_type; /* packet type ID field */ +}; +#include + +struct ip + { + unsigned int ip_hl:4; /* header length */ + unsigned int ip_v:4; /* version */ + u_int8_t ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_int8_t ip_ttl; /* time to live */ + u_int8_t ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src, ip_dst; /* source and dest address */ + }; + +struct udphdr { + u_int16_t uh_sport; /* source port */ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* udp length */ + u_int16_t uh_sum; /* udp checksum */ +}; + +#define ETHERTYPE_IP 0x0800 +#define IPTOS_LOWDELAY 0x10 +#define ARPHRD_ETHER 1 + +// FIXME: I have no idea what this should be! +#define SIZE_T_MAX 1600 + +#define USE_SOCKET_RECEIVE +#define USE_SOCKET_SEND + +#include +#include +//#include +#include +#include +#include +//#include +#include +#include +#include +#include +//#include + +#include "dhcp.h" +#include "tree.h" + +#define LOCAL_PORT 68 +#define REMOTE_PORT 67 + +struct option_data { + int len; + u_int8_t *data; +}; + +struct string_list { + struct string_list *next; + char *string; +}; + +struct iaddr { + int len; + unsigned char iabuf[16]; +}; + +struct iaddrlist { + struct iaddrlist *next; + struct iaddr addr; +}; + +struct packet { + struct dhcp_packet *raw; + int packet_length; + int packet_type; + int options_valid; + int client_port; + struct iaddr client_addr; + struct interface_info *interface; + struct hardware *haddr; + struct option_data options[256]; +}; + +struct hardware { + u_int8_t htype; + u_int8_t hlen; + u_int8_t haddr[16]; +}; + +struct client_lease { + struct client_lease *next; + time_t expiry, renewal, rebind; + struct iaddr address; + char *server_name; +#ifdef __REACTOS__ + time_t obtained; + struct iaddr serveraddress; +#endif + char *filename; + struct string_list *medium; + unsigned int is_static : 1; + unsigned int is_bootp : 1; + struct option_data options[256]; +}; + +/* Possible states in which the client can be. */ +enum dhcp_state { + S_REBOOTING, + S_INIT, + S_SELECTING, + S_REQUESTING, + S_BOUND, + S_RENEWING, + S_REBINDING, + S_STATIC +}; + +struct client_config { + struct option_data defaults[256]; + enum { + ACTION_DEFAULT, + ACTION_SUPERSEDE, + ACTION_PREPEND, + ACTION_APPEND + } default_actions[256]; + + struct option_data send_options[256]; + u_int8_t required_options[256]; + u_int8_t requested_options[256]; + int requested_option_count; + time_t timeout; + time_t initial_interval; + time_t retry_interval; + time_t select_interval; + time_t reboot_timeout; + time_t backoff_cutoff; + struct string_list *media; + char *script_name; + enum { IGNORE, ACCEPT, PREFER } + bootp_policy; + struct string_list *medium; + struct iaddrlist *reject_list; +}; + +struct client_state { + struct client_lease *active; + struct client_lease *new; + struct client_lease *offered_leases; + struct client_lease *leases; + struct client_lease *alias; + enum dhcp_state state; + struct iaddr destination; + u_int32_t xid; + u_int16_t secs; + time_t first_sending; + time_t interval; + struct string_list *medium; + struct dhcp_packet packet; + int packet_length; + struct iaddr requested_address; + struct client_config *config; +}; + +struct interface_info { + struct interface_info *next; + struct hardware hw_address; + struct in_addr primary_address; + char name[IFNAMSIZ]; + int rfdesc; + int wfdesc; + unsigned char *rbuf; + size_t rbuf_max; + size_t rbuf_offset; + size_t rbuf_len; + struct client_state *client; + int noifmedia; + int errors; + int dead; + u_int16_t index; +}; + +struct timeout { + struct timeout *next; + time_t when; + void (*func)(void *); + void *what; +}; + +struct protocol { + struct protocol *next; + int fd; + void (*handler)(struct protocol *); + void *local; +}; + +#define DEFAULT_HASH_SIZE 97 + +struct hash_bucket { + struct hash_bucket *next; + unsigned char *name; + int len; + unsigned char *value; +}; + +struct hash_table { + int hash_count; + struct hash_bucket *buckets[DEFAULT_HASH_SIZE]; +}; + +/* Default path to dhcpd config file. */ +#define _PATH_DHCLIENT_CONF "/etc/dhclient.conf" +#define _PATH_DHCLIENT_DB "/var/db/dhclient.leases" +#define DHCPD_LOG_FACILITY LOG_DAEMON + +#define MAX_TIME 0x7fffffff +#define MIN_TIME 0 + +/* External definitions... */ + +/* options.c */ +int cons_options(struct packet *, struct dhcp_packet *, int, + struct tree_cache **, int, int, int, u_int8_t *, int); +char *pretty_print_option(unsigned int, + unsigned char *, int, int, int); +void do_packet(struct interface_info *, struct dhcp_packet *, + int, unsigned int, struct iaddr, struct hardware *); + +/* errwarn.c */ +extern int warnings_occurred; +#ifdef _MSC_VER +void error(char *, ...); +int warning(char *, ...); +int note(char *, ...); +int debug(char *, ...); +int parse_warn(char *, ...); +#else +void error(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int warning(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int note(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int debug(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +int parse_warn(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2))); +#endif + +/* conflex.c */ +extern int lexline, lexchar; +extern char *token_line, *tlname; +extern char comments[4096]; +extern int comment_index; +extern int eol_token; +void new_parse(char *); +int next_token(char **, FILE *); +int peek_token(char **, FILE *); + +/* parse.c */ +void skip_to_semi(FILE *); +int parse_semi(FILE *); +char *parse_string(FILE *); +int parse_ip_addr(FILE *, struct iaddr *); +void parse_hardware_param(FILE *, struct hardware *); +void parse_lease_time(FILE *, time_t *); +unsigned char *parse_numeric_aggregate(FILE *, unsigned char *, int *, + int, int, int); +void convert_num(unsigned char *, char *, int, int); +time_t parse_date(FILE *); + +/* tree.c */ +pair cons(caddr_t, pair); + +/* alloc.c */ +struct string_list *new_string_list(size_t size); +struct hash_table *new_hash_table(int); +struct hash_bucket *new_hash_bucket(void); +void dfree(void *, char *); +void free_hash_bucket(struct hash_bucket *, char *); + + +/* bpf.c */ +int if_register_bpf(struct interface_info *); +void if_register_send(struct interface_info *); +void if_register_receive(struct interface_info *); +ssize_t send_packet(struct interface_info *, struct dhcp_packet *, size_t, + struct in_addr, struct sockaddr_in *, struct hardware *); +ssize_t receive_packet(struct interface_info *, unsigned char *, size_t, + struct sockaddr_in *, struct hardware *); + +/* dispatch.c */ +extern void (*bootp_packet_handler)(struct interface_info *, + struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *); +void discover_interfaces(struct interface_info *); +void reinitialize_interfaces(void); +void dispatch(void); +void got_one(struct protocol *); +void add_timeout(time_t, void (*)(void *), void *); +void cancel_timeout(void (*)(void *), void *); +void add_protocol(char *, int, void (*)(struct protocol *), void *); +void remove_protocol(struct protocol *); +struct protocol *find_protocol_by_adapter( struct interface_info * ); +int interface_link_status(char *); + +/* hash.c */ +struct hash_table *new_hash(void); +void add_hash(struct hash_table *, unsigned char *, int, unsigned char *); +unsigned char *hash_lookup(struct hash_table *, unsigned char *, int); + +/* tables.c */ +extern struct dhcp_option dhcp_options[256]; +extern unsigned char dhcp_option_default_priority_list[]; +extern int sizeof_dhcp_option_default_priority_list; +extern struct hash_table universe_hash; +extern struct universe dhcp_universe; +void initialize_universes(void); + +/* convert.c */ +u_int32_t getULong(unsigned char *); +int32_t getLong(unsigned char *); +u_int16_t getUShort(unsigned char *); +int16_t getShort(unsigned char *); +void putULong(unsigned char *, u_int32_t); +void putLong(unsigned char *, int32_t); +void putUShort(unsigned char *, unsigned int); +void putShort(unsigned char *, int); + +/* inet.c */ +struct iaddr subnet_number(struct iaddr, struct iaddr); +struct iaddr broadcast_addr(struct iaddr, struct iaddr); +int addr_eq(struct iaddr, struct iaddr); +char *piaddr(struct iaddr); + +/* dhclient.c */ +extern char *path_dhclient_conf; +extern char *path_dhclient_db; +extern time_t cur_time; +extern int log_priority; +extern int log_perror; + +extern struct client_config top_level_config; + +void dhcpoffer(struct packet *); +void dhcpack(struct packet *); +void dhcpnak(struct packet *); + +void send_discover(void *); +void send_request(void *); +void send_decline(void *); + +void state_reboot(void *); +void state_init(void *); +void state_selecting(void *); +void state_requesting(void *); +void state_bound(void *); +void state_panic(void *); + +void bind_lease(struct interface_info *); + +void make_discover(struct interface_info *, struct client_lease *); +void make_request(struct interface_info *, struct client_lease *); +void make_decline(struct interface_info *, struct client_lease *); + +void free_client_lease(struct client_lease *); +void rewrite_client_leases(struct interface_info *); +void write_client_lease(struct interface_info *, struct client_lease *, int); + +void priv_script_init(struct interface_info *, char *, char *); +void priv_script_write_params(struct interface_info *, char *, struct client_lease *); +int priv_script_go(void); + +void script_init(char *, struct string_list *); +void script_write_params(char *, struct client_lease *); +int script_go(void); +void client_envadd(struct client_state *, + const char *, const char *, const char *, ...); +void script_set_env(struct client_state *, const char *, const char *, + const char *); +void script_flush_env(struct client_state *); +int dhcp_option_ev_name(char *, size_t, struct dhcp_option *); + +struct client_lease *packet_to_lease(struct packet *); +void go_daemon(void); +void client_location_changed(void); + +void bootp(struct packet *); +void dhcp(struct packet *); + +/* packet.c */ +void assemble_hw_header(struct interface_info *, unsigned char *, + int *, struct hardware *); +void assemble_udp_ip_header(unsigned char *, int *, u_int32_t, u_int32_t, + unsigned int, unsigned char *, int); +ssize_t decode_hw_header(unsigned char *, int, struct hardware *); +ssize_t decode_udp_ip_header(unsigned char *, int, struct sockaddr_in *, + unsigned char *, int); + +/* ethernet.c */ +void assemble_ethernet_header(struct interface_info *, unsigned char *, + int *, struct hardware *); +ssize_t decode_ethernet_header(struct interface_info *, unsigned char *, + int, struct hardware *); + +/* clparse.c */ +int read_client_conf(struct interface_info *); +void read_client_leases(void); +void parse_client_statement(FILE *, struct interface_info *, + struct client_config *); +int parse_X(FILE *, u_int8_t *, int); +int parse_option_list(FILE *, u_int8_t *); +void parse_interface_declaration(FILE *, struct client_config *); +struct interface_info *interface_or_dummy(char *); +void make_client_state(struct interface_info *); +void make_client_config(struct interface_info *, struct client_config *); +void parse_client_lease_statement(FILE *, int); +void parse_client_lease_declaration(FILE *, struct client_lease *, + struct interface_info **); +struct dhcp_option *parse_option_decl(FILE *, struct option_data *); +void parse_string_list(FILE *, struct string_list **, int); +void parse_reject_statement(FILE *, struct client_config *); + +/* privsep.c */ +struct buf *buf_open(size_t); +int buf_add(struct buf *, void *, size_t); +int buf_close(int, struct buf *); +ssize_t buf_read(int, void *, size_t); +void dispatch_imsg(int); diff --git a/reactos/base/services/dhcp/include/dhctoken.h b/reactos/base/services/dhcp/include/dhctoken.h new file mode 100644 index 00000000000..2aeb5303af1 --- /dev/null +++ b/reactos/base/services/dhcp/include/dhctoken.h @@ -0,0 +1,136 @@ +/* dhctoken.h + + Tokens for config file lexer and parser. */ + +/* + * Copyright (c) 1995, 1996, 1997, 1998, 1999 + * The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define SEMI ';' +#define DOT '.' +#define COLON ':' +#define COMMA ',' +#define SLASH '/' +#define LBRACE '{' +#define RBRACE '}' + +#define FIRST_TOKEN HOST +#define HOST 256 +#define HARDWARE 257 +#define FILENAME 258 +#define FIXED_ADDR 259 +#define OPTION 260 +#define ETHERNET 261 +#define STRING 262 +#define NUMBER 263 +#define NUMBER_OR_NAME 264 +#define NAME 265 +#define TIMESTAMP 266 +#define STARTS 267 +#define ENDS 268 +#define UID 269 +#define CLASS 270 +#define LEASE 271 +#define RANGE 272 +#define PACKET 273 +#define CIADDR 274 +#define YIADDR 275 +#define SIADDR 276 +#define GIADDR 277 +#define SUBNET 278 +#define NETMASK 279 +#define DEFAULT_LEASE_TIME 280 +#define MAX_LEASE_TIME 281 +#define VENDOR_CLASS 282 +#define USER_CLASS 283 +#define SHARED_NETWORK 284 +#define SERVER_NAME 285 +#define DYNAMIC_BOOTP 286 +#define SERVER_IDENTIFIER 287 +#define DYNAMIC_BOOTP_LEASE_CUTOFF 288 +#define DYNAMIC_BOOTP_LEASE_LENGTH 289 +#define BOOT_UNKNOWN_CLIENTS 290 +#define NEXT_SERVER 291 +#define TOKEN_RING 292 +#define GROUP 293 +#define ONE_LEASE_PER_CLIENT 294 +#define GET_LEASE_HOSTNAMES 295 +#define USE_HOST_DECL_NAMES 296 +#define SEND 297 +#define CLIENT_IDENTIFIER 298 +#define REQUEST 299 +#define REQUIRE 300 +#define TIMEOUT 301 +#define RETRY 302 +#define SELECT_TIMEOUT 303 +#define SCRIPT 304 +#define INTERFACE 305 +#define RENEW 306 +#define REBIND 307 +#define EXPIRE 308 +#define UNKNOWN_CLIENTS 309 +#define ALLOW 310 +#define BOOTP 311 +#define DENY 312 +#define BOOTING 313 +#define DEFAULT 314 +#define MEDIA 315 +#define MEDIUM 316 +#define ALIAS 317 +#define REBOOT 318 +#define ABANDONED 319 +#define BACKOFF_CUTOFF 320 +#define INITIAL_INTERVAL 321 +#define NAMESERVER 322 +#define DOMAIN 323 +#define SEARCH 324 +#define SUPERSEDE 325 +#define APPEND 326 +#define PREPEND 327 +#define HOSTNAME 328 +#define CLIENT_HOSTNAME 329 +#define REJECT 330 +#define FDDI 331 +#define USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 332 +#define AUTHORITATIVE 333 +#define TOKEN_NOT 334 +#define ALWAYS_REPLY_RFC1048 335 + +#define is_identifier(x) ((x) >= FIRST_TOKEN && \ + (x) != STRING && \ + (x) != NUMBER && \ + (x) != EOF) diff --git a/reactos/base/services/dhcp/include/hash.h b/reactos/base/services/dhcp/include/hash.h new file mode 100644 index 00000000000..1bebb3140f8 --- /dev/null +++ b/reactos/base/services/dhcp/include/hash.h @@ -0,0 +1,56 @@ +/* hash.h + + Definitions for hashing... */ + +/* + * Copyright (c) 1995, 1996 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define DEFAULT_HASH_SIZE 97 + +struct hash_bucket { + struct hash_bucket *next; + unsigned char *name; + int len; + unsigned char *value; +}; + +struct hash_table { + int hash_count; + struct hash_bucket *buckets [DEFAULT_HASH_SIZE]; +}; + diff --git a/reactos/base/services/dhcp/include/inet.h b/reactos/base/services/dhcp/include/inet.h new file mode 100644 index 00000000000..a45f92265de --- /dev/null +++ b/reactos/base/services/dhcp/include/inet.h @@ -0,0 +1,52 @@ +/* inet.h + + Portable definitions for internet addresses */ + +/* + * Copyright (c) 1996 The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +/* An internet address of up to 128 bits. */ + +typedef struct _iaddr { + int len; + unsigned char iabuf [16]; +} iaddr; + +typedef struct _iaddrlist { + struct _iaddrlist *next; + iaddr addr; +} iaddrlist; diff --git a/reactos/base/services/dhcp/include/osdep.h b/reactos/base/services/dhcp/include/osdep.h new file mode 100644 index 00000000000..71a985980e1 --- /dev/null +++ b/reactos/base/services/dhcp/include/osdep.h @@ -0,0 +1,294 @@ +/* osdep.h + + Operating system dependencies... */ + +/* + * Copyright (c) 1996, 1997, 1998, 1999 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This software was written for the Internet Software Consortium by Ted Lemon + * under a contract with Vixie Laboratories. + */ + +#include "site.h" + +/* Porting:: + + If you add a new network API, you must add a check for it below: */ + +#if !defined (USE_SOCKETS) && \ + !defined (USE_SOCKET_SEND) && \ + !defined (USE_SOCKET_RECEIVE) && \ + !defined (USE_RAW_SOCKETS) && \ + !defined (USE_RAW_SEND) && \ + !defined (USE_SOCKET_RECEIVE) && \ + !defined (USE_BPF) && \ + !defined (USE_BPF_SEND) && \ + !defined (USE_BPF_RECEIVE) && \ + !defined (USE_LPF) && \ + !defined (USE_LPF_SEND) && \ + !defined (USE_LPF_RECEIVE) && \ + !defined (USE_NIT) && \ + !defined (USE_NIT_SEND) && \ + !defined (USE_NIT_RECEIVE) && \ + !defined (USR_DLPI_SEND) && \ + !defined (USE_DLPI_RECEIVE) +# define USE_DEFAULT_NETWORK +#endif + + +/* Porting:: + + If you add a new system configuration file, include it here: */ + +#if defined (sun) +# if defined (__svr4__) || defined (__SVR4) +# include "cf/sunos5-5.h" +# else +# include "cf/sunos4.h" +# endif +#endif + +#ifdef aix +# include "cf/aix.h" +#endif + +#ifdef bsdi +# include "cf/bsdos.h" +#endif + +#ifdef __NetBSD__ +# include "cf/netbsd.h" +#endif + +#ifdef __FreeBSD__ +# include "cf/freebsd.h" +#endif + +#if defined (__osf__) && defined (__alpha) +# include "cf/alphaosf.h" +#endif + +#ifdef ultrix +# include "cf/ultrix.h" +#endif + +#ifdef linux +# include "cf/linux.h" +#endif + +#ifdef SCO +# include "cf/sco.h" +#endif + +#if defined (hpux) || defined (__hpux) +# include "cf/hpux.h" +#endif + +#ifdef __QNX__ +# include "cf/qnx.h" +#endif + +#ifdef __CYGWIN32__ +# include "cf/cygwin32.h" +#endif + +#ifdef __APPLE__ +# include "cf/rhapsody.h" +#else +# if defined (NeXT) +# include "cf/nextstep.h" +# endif +#endif + +#if defined(IRIX) || defined(__sgi) +# include "cf/irix.h" +#endif + +#if !defined (TIME_MAX) +# define TIME_MAX 2147483647 +#endif + +/* Porting:: + + If you add a new network API, and have it set up so that it can be + used for sending or receiving, but doesn't have to be used for both, + then set up an ifdef like the ones below: */ + +#ifdef USE_SOCKETS +# define USE_SOCKET_SEND +# define USE_SOCKET_RECEIVE +#endif + +#ifdef USE_RAW_SOCKETS +# define USE_RAW_SEND +# define USE_SOCKET_RECEIVE +#endif + +#ifdef USE_BPF +# define USE_BPF_SEND +# define USE_BPF_RECEIVE +#endif + +#ifdef USE_LPF +# define USE_LPF_SEND +# define USE_LPF_RECEIVE +#endif + +#ifdef USE_NIT +# define USE_NIT_SEND +# define USE_NIT_RECEIVE +#endif + +#ifdef USE_DLPI +# define USE_DLPI_SEND +# define USE_DLPI_RECEIVE +#endif + +#ifdef USE_UPF +# define USE_UPF_SEND +# define USE_UPF_RECEIVE +#endif + +/* Porting:: + + If you add support for sending packets directly out an interface, + and your support does not do ARP or routing, you must use a fallback + mechanism to deal with packets that need to be sent to routers. + Currently, all low-level packet interfaces use BSD sockets as a + fallback. */ + +#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ + defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || defined (USE_LPF_SEND) +# define USE_SOCKET_FALLBACK +# define USE_FALLBACK +#endif + +/* Porting:: + + If you add support for sending packets directly out an interface + and need to be able to assemble packets, add the USE_XXX_SEND + definition for your interface to the list tested below. */ + +#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ + defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ + defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) +# define PACKET_ASSEMBLY +#endif + +/* Porting:: + + If you add support for receiving packets directly from an interface + and need to be able to decode raw packets, add the USE_XXX_RECEIVE + definition for your interface to the list tested below. */ + +#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ + defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ + defined (USE_DLPI_RECEIVE) || \ + defined (USE_LPF_SEND) || \ + (defined (USE_SOCKET_SEND) && defined (SO_BINDTODEVICE)) +# define PACKET_DECODING +#endif + +/* If we don't have a DLPI packet filter, we have to filter in userland. + Probably not worth doing, actually. */ +#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) +# define USERLAND_FILTER +#endif + +/* jmp_buf is assumed to be a struct unless otherwise defined in the + system header. */ +#ifndef jbp_decl +# define jbp_decl(x) jmp_buf *x +#endif +#ifndef jref +# define jref(x) (&(x)) +#endif +#ifndef jdref +# define jdref(x) (*(x)) +#endif +#ifndef jrefproto +# define jrefproto jmp_buf * +#endif + +#ifndef BPF_FORMAT +# define BPF_FORMAT "/dev/bpf%d" +#endif + +#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) +# define HAVE_IFF_POINTOPOINT +#endif + +#if defined (AF_LINK) && !defined (HAVE_AF_LINK) +# define HAVE_AF_LINK +#endif + +#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) +# define HAVE_ARPHRD_TUNNEL +#endif + +#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) +# define HAVE_ARPHRD_LOOPBACK +#endif + +#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) +# define HAVE_ARPHRD_ROSE +#endif + +#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) +# define HAVE_ARPHRD_IEEE802 +#endif + +#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) +# define HAVE_ARPHRD_FDDI +#endif + +#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) +# define HAVE_ARPHRD_AX25 +#endif + +#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) +# define HAVE_ARPHRD_NETROM +#endif + +#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) +# define HAVE_ARPHRD_METRICOM +#endif + +#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) +# define HAVE_SO_BINDTODEVICE +#endif + +#if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR) +# define HAVE_SIOCGIFHWADDR +#endif + +#if defined (AF_LINK) && !defined (HAVE_AF_LINK) +# define HAVE_AF_LINK +#endif diff --git a/reactos/base/services/dhcp/include/predec.h b/reactos/base/services/dhcp/include/predec.h new file mode 100644 index 00000000000..59fb94b003c --- /dev/null +++ b/reactos/base/services/dhcp/include/predec.h @@ -0,0 +1,4 @@ +#pragma once + +struct iaddr; +struct interface_info; diff --git a/reactos/base/services/dhcp/include/privsep.h b/reactos/base/services/dhcp/include/privsep.h new file mode 100644 index 00000000000..e1fc52d5b69 --- /dev/null +++ b/reactos/base/services/dhcp/include/privsep.h @@ -0,0 +1,47 @@ +/* $OpenBSD: privsep.h,v 1.2 2004/05/04 18:51:18 henning Exp $ */ + +/* + * Copyright (c) 2004 Henning Brauer + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +//#include +//#include + +struct buf { + u_char *buf; + size_t size; + size_t wpos; + size_t rpos; +}; + +enum imsg_code { + IMSG_NONE, + IMSG_SCRIPT_INIT, + IMSG_SCRIPT_WRITE_PARAMS, + IMSG_SCRIPT_GO, + IMSG_SCRIPT_GO_RET +}; + +struct imsg_hdr { + enum imsg_code code; + size_t len; +}; + +struct buf *buf_open(size_t); +int buf_add(struct buf *, void *, size_t); +int buf_close(int, struct buf *); +ssize_t buf_read(int sock, void *, size_t); diff --git a/reactos/base/services/dhcp/include/rosdhcp.h b/reactos/base/services/dhcp/include/rosdhcp.h new file mode 100644 index 00000000000..6b1dab6f0cc --- /dev/null +++ b/reactos/base/services/dhcp/include/rosdhcp.h @@ -0,0 +1,94 @@ +#ifndef ROSDHCP_H +#define ROSDHCP_H + +#define WIN32_NO_STATUS +#include +#define NTOS_MODE_USER +#include +#include +#include +#include +#include +#include +#include "stdint.h" +#include "predec.h" +#include +#include "debug.h" +#define IFNAMSIZ MAX_INTERFACE_NAME_LEN +#undef interface /* wine/objbase.h -- Grrr */ + +#undef IGNORE +#undef ACCEPT +#undef PREFER +#define DHCP_DISCOVER_INTERVAL 15 +#define DHCP_REBOOT_TIMEOUT 300 +#define DHCP_PANIC_TIMEOUT DHCP_REBOOT_TIMEOUT * 3 +#define DHCP_BACKOFF_MAX 300 +#define DHCP_DEFAULT_LEASE_TIME 43200 /* 12 hours */ +#define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid" +typedef void *VOIDPTR; + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif + +typedef u_int32_t uintTIME; +#define TIME uintTIME +#include "dhcpd.h" + +#define INLINE inline +#define PROTO(x) x + +typedef void (*handler_t) PROTO ((struct packet *)); + +typedef struct _DHCP_ADAPTER { + LIST_ENTRY ListEntry; + MIB_IFROW IfMib; + MIB_IPFORWARDROW RouterMib; + MIB_IPADDRROW IfAddr; + SOCKADDR Address; + ULONG NteContext,NteInstance; + struct interface_info DhclientInfo; + struct client_state DhclientState; + struct client_config DhclientConfig; + struct sockaddr_in ListenAddr; + unsigned int BindStatus; + unsigned char recv_buf[1]; +} DHCP_ADAPTER, *PDHCP_ADAPTER; + +typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply ); + +#define random rand +#define srandom srand + +void AdapterInit(VOID); +BOOLEAN AdapterDiscover(VOID); +void AdapterStop(VOID); +HANDLE PipeInit(VOID); +extern PDHCP_ADAPTER AdapterGetFirst(); +extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER); +extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); +extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); +extern PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ); +extern VOID ApiInit(); +extern VOID ApiLock(); +extern VOID ApiUnlock(); +extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSRenewIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSReleaseIpAddressLease( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSStaticRefreshParams( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern DWORD DSGetAdapterInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); +extern int inet_aton(const char *s, struct in_addr *addr); +int warn( char *format, ... ); +#endif/*ROSDHCP_H*/ diff --git a/reactos/base/services/dhcp/include/site.h b/reactos/base/services/dhcp/include/site.h new file mode 100644 index 00000000000..30fdb703005 --- /dev/null +++ b/reactos/base/services/dhcp/include/site.h @@ -0,0 +1,100 @@ +/* Site-specific definitions. + + For supported systems, you shouldn't need to make any changes here. + However, you may want to, in order to deal with site-specific + differences. */ + +/* Add any site-specific definitions and inclusions here... */ + +/* #include */ +/* #define SITE_FOOBAR */ + +/* Define this if you don't want dhcpd to run as a daemon and do want + to see all its output printed to stdout instead of being logged via + syslog(). This also makes dhcpd use the dhcpd.conf in its working + directory and write the dhcpd.leases file there. */ + +/* #define DEBUG */ + +/* Define this to see what the parser is parsing. You probably don't + want to see this. */ + +/* #define DEBUG_TOKENS */ + +/* Define this to see dumps of incoming and outgoing packets. This + slows things down quite a bit... */ + +/* #define DEBUG_PACKET */ + +/* Define this if you want to see dumps of tree evaluations. The most + common reason for doing this is to watch what happens with DNS name + lookups. */ + +/* #define DEBUG_EVAL */ + +/* Define this if you want the dhcpd.pid file to go somewhere other than + the default (which varies from system to system, but is usually either + /etc or /var/run. */ + +/* #define _PATH_DHCPD_PID "/var/run/dhcpd.pid" */ + +/* Define this if you want the dhcpd.leases file (the dynamic lease database) + to go somewhere other than the default location, which is normally + /etc/dhcpd.leases. */ + +/* #define _PATH_DHCPD_DB "/etc/dhcpd.leases" */ + +/* Define this if you want the dhcpd.conf file to go somewhere other than + the default location. By default, it goes in /etc/dhcpd.conf. */ + +/* #define _PATH_DHCPD_CONF "/etc/dhcpd.conf" */ + +/* Network API definitions. You do not need to choose one of these - if + you don't choose, one will be chosen for you in your system's config + header. DON'T MESS WITH THIS UNLESS YOU KNOW WHAT YOU'RE DOING!!! */ + +/* Define this to use the standard BSD socket API. + + On many systems, the BSD socket API does not provide the ability to + send packets to the 255.255.255.255 broadcast address, which can + prevent some clients (e.g., Win95) from seeing replies. This is + not a problem on Solaris. + + In addition, the BSD socket API will not work when more than one + network interface is configured on the server. + + However, the BSD socket API is about as efficient as you can get, so if + the aforementioned problems do not matter to you, or if no other + API is supported for your system, you may want to go with it. */ + +/* #define USE_SOCKETS */ + +/* Define this to use the Sun Streams NIT API. + + The Sun Streams NIT API is only supported on SunOS 4.x releases. */ + +/* #define USE_NIT */ + +/* Define this to use the Berkeley Packet Filter API. + + The BPF API is available on all 4.4-BSD derivatives, including + NetBSD, FreeBSD and BSDI's BSD/OS. It's also available on + DEC Alpha OSF/1 in a compatibility mode supported by the Alpha OSF/1 + packetfilter interface. */ + +/* #define USE_BPF */ + +/* Define this to use the raw socket API. + + The raw socket API is provided on many BSD derivatives, and provides + a way to send out raw IP packets. It is only supported for sending + packets - packets must be received with the regular socket API. + This code is experimental - I've never gotten it to actually transmit + a packet to the 255.255.255.255 broadcast address - so use it at your + own risk. */ + +/* #define USE_RAW_SOCKETS */ + +/* Define this to change the logging facility used by dhcpd. */ + +/* #define DHCPD_LOG_FACILITY LOG_DAEMON */ diff --git a/reactos/base/services/dhcp/include/stdint.h b/reactos/base/services/dhcp/include/stdint.h new file mode 100644 index 00000000000..a45def0e663 --- /dev/null +++ b/reactos/base/services/dhcp/include/stdint.h @@ -0,0 +1,10 @@ +#pragma once + +typedef signed char int8_t; +typedef unsigned char u_int8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; + +typedef char *caddr_t; diff --git a/reactos/base/services/dhcp/include/sysconf.h b/reactos/base/services/dhcp/include/sysconf.h new file mode 100644 index 00000000000..5feb4c75c70 --- /dev/null +++ b/reactos/base/services/dhcp/include/sysconf.h @@ -0,0 +1,52 @@ +/* systat.h + + Definitions for systat protocol... */ + +/* + * Copyright (c) 1997 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#define SYSCONF_SOCKET "/var/run/sysconf" + +struct sysconf_header { + u_int32_t type; /* Type of status message... */ + u_int32_t length; /* Length of message. */ +}; + +/* Message types... */ +#define NETWORK_LOCATION_CHANGED 1 + diff --git a/reactos/base/services/dhcp/include/tree.h b/reactos/base/services/dhcp/include/tree.h new file mode 100644 index 00000000000..367ffa7d9a1 --- /dev/null +++ b/reactos/base/services/dhcp/include/tree.h @@ -0,0 +1,66 @@ +/* $OpenBSD: tree.h,v 1.5 2004/05/06 22:29:15 deraadt Exp $ */ + +/* Definitions for address trees... */ + +/* + * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +/* A pair of pointers, suitable for making a linked list. */ +typedef struct _pair { + caddr_t car; + struct _pair *cdr; +} *pair; + +struct tree_cache { + unsigned char *value; + int len; + int buf_size; + time_t timeout; +}; + +struct universe { + char *name; + struct hash_table *hash; + struct dhcp_option *options[256]; +}; + +struct dhcp_option { + char *name; + char *format; + struct universe *universe; + unsigned char code; +}; diff --git a/reactos/base/services/dhcp/include/version.h b/reactos/base/services/dhcp/include/version.h new file mode 100644 index 00000000000..303fbfa332b --- /dev/null +++ b/reactos/base/services/dhcp/include/version.h @@ -0,0 +1,3 @@ +/* Current version of ISC DHCP Distribution. */ + +#define DHCP_VERSION "2.0pl5" diff --git a/reactos/base/services/dhcp/memory.c b/reactos/base/services/dhcp/memory.c new file mode 100644 index 00000000000..2752422d2c7 --- /dev/null +++ b/reactos/base/services/dhcp/memory.c @@ -0,0 +1,919 @@ +/* memory.c + + Memory-resident database... */ + +/* + * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#ifndef lint +static char copyright[] = +"$Id: memory.c,v 1.35.2.4 1999/05/27 17:47:43 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "rosdhcp.h" +#include "dhcpd.h" + +struct subnet *subnets; +struct shared_network *shared_networks; +static struct hash_table *host_hw_addr_hash; +static struct hash_table *host_uid_hash; +static struct hash_table *lease_uid_hash; +static struct hash_table *lease_ip_addr_hash; +static struct hash_table *lease_hw_addr_hash; +struct lease *dangling_leases; + +static struct hash_table *vendor_class_hash; +static struct hash_table *user_class_hash; + +void enter_host (hd) + struct host_decl *hd; +{ + struct host_decl *hp = (struct host_decl *)0; + struct host_decl *np = (struct host_decl *)0; + + hd -> n_ipaddr = (struct host_decl *)0; + + if (hd -> interface.hlen) { + if (!host_hw_addr_hash) + host_hw_addr_hash = new_hash (); + else + hp = (struct host_decl *) + hash_lookup (host_hw_addr_hash, + hd -> interface.haddr, + hd -> interface.hlen); + + /* If there isn't already a host decl matching this + address, add it to the hash table. */ + if (!hp) + add_hash (host_hw_addr_hash, + hd -> interface.haddr, hd -> interface.hlen, + (unsigned char *)hd); + } + + /* If there was already a host declaration for this hardware + address, add this one to the end of the list. */ + + if (hp) { + for (np = hp; np -> n_ipaddr; np = np -> n_ipaddr) + ; + np -> n_ipaddr = hd; + } + + + if (hd -> group -> options [DHO_DHCP_CLIENT_IDENTIFIER]) { + if (!tree_evaluate (hd -> group -> options + [DHO_DHCP_CLIENT_IDENTIFIER])) + return; + + /* If there's no uid hash, make one; otherwise, see if + there's already an entry in the hash for this host. */ + if (!host_uid_hash) { + host_uid_hash = new_hash (); + hp = (struct host_decl *)0; + } else + hp = (struct host_decl *) hash_lookup + (host_uid_hash, + hd -> group -> options + [DHO_DHCP_CLIENT_IDENTIFIER] -> value, + hd -> group -> options + [DHO_DHCP_CLIENT_IDENTIFIER] -> len); + + /* If there's already a host declaration for this + client identifier, add this one to the end of the + list. Otherwise, add it to the hash table. */ + if (hp) { + /* Don't link it in twice... */ + if (!np) { + for (np = hp; np -> n_ipaddr; + np = np -> n_ipaddr) + ; + np -> n_ipaddr = hd; + } + } else { + add_hash (host_uid_hash, + hd -> group -> options + [DHO_DHCP_CLIENT_IDENTIFIER] -> value, + hd -> group -> options + [DHO_DHCP_CLIENT_IDENTIFIER] -> len, + (unsigned char *)hd); + } + } +} + +struct host_decl *find_hosts_by_haddr (htype, haddr, hlen) + int htype; + unsigned char *haddr; + int hlen; +{ + struct host_decl *foo; + + foo = (struct host_decl *)hash_lookup (host_hw_addr_hash, + haddr, hlen); + return foo; +} + +struct host_decl *find_hosts_by_uid (data, len) + unsigned char *data; + int len; +{ + struct host_decl *foo; + + foo = (struct host_decl *)hash_lookup (host_uid_hash, data, len); + return foo; +} + +/* More than one host_decl can be returned by find_hosts_by_haddr or + find_hosts_by_uid, and each host_decl can have multiple addresses. + Loop through the list of hosts, and then for each host, through the + list of addresses, looking for an address that's in the same shared + network as the one specified. Store the matching address through + the addr pointer, update the host pointer to point at the host_decl + that matched, and return the subnet that matched. */ + +subnet *find_host_for_network (struct host_decl **host, iaddr *addr, + shared_network *share) +{ + int i; + subnet *subnet; + iaddr ip_address; + struct host_decl *hp; + + for (hp = *host; hp; hp = hp -> n_ipaddr) { + if (!hp -> fixed_addr || !tree_evaluate (hp -> fixed_addr)) + continue; + for (i = 0; i < hp -> fixed_addr -> len; i += 4) { + ip_address.len = 4; + memcpy (ip_address.iabuf, + hp -> fixed_addr -> value + i, 4); + subnet = find_grouped_subnet (share, ip_address); + if (subnet) { + *addr = ip_address; + *host = hp; + return subnet; + } + } + } + return (struct _subnet *)0; +} + +void new_address_range (iaddr low, iaddr high, subnet *subnet, int dynamic) +{ + lease *address_range, *lp, *plp; + iaddr net; + int min, max, i; + char lowbuf [16], highbuf [16], netbuf [16]; + shared_network *share = subnet -> shared_network; + struct hostent *h; + struct in_addr ia; + + /* All subnets should have attached shared network structures. */ + if (!share) { + strcpy (netbuf, piaddr (subnet -> net)); + error ("No shared network for network %s (%s)", + netbuf, piaddr (subnet -> netmask)); + } + + /* Initialize the hash table if it hasn't been done yet. */ + if (!lease_uid_hash) + lease_uid_hash = new_hash (); + if (!lease_ip_addr_hash) + lease_ip_addr_hash = new_hash (); + if (!lease_hw_addr_hash) + lease_hw_addr_hash = new_hash (); + + /* Make sure that high and low addresses are in same subnet. */ + net = subnet_number (low, subnet -> netmask); + if (!addr_eq (net, subnet_number (high, subnet -> netmask))) { + strcpy (lowbuf, piaddr (low)); + strcpy (highbuf, piaddr (high)); + strcpy (netbuf, piaddr (subnet -> netmask)); + error ("Address range %s to %s, netmask %s spans %s!", + lowbuf, highbuf, netbuf, "multiple subnets"); + } + + /* Make sure that the addresses are on the correct subnet. */ + if (!addr_eq (net, subnet -> net)) { + strcpy (lowbuf, piaddr (low)); + strcpy (highbuf, piaddr (high)); + strcpy (netbuf, piaddr (subnet -> netmask)); + error ("Address range %s to %s not on net %s/%s!", + lowbuf, highbuf, piaddr (subnet -> net), netbuf); + } + + /* Get the high and low host addresses... */ + max = host_addr (high, subnet -> netmask); + min = host_addr (low, subnet -> netmask); + + /* Allow range to be specified high-to-low as well as low-to-high. */ + if (min > max) { + max = min; + min = host_addr (high, subnet -> netmask); + } + + /* Get a lease structure for each address in the range. */ + address_range = new_leases (max - min + 1, "new_address_range"); + if (!address_range) { + strcpy (lowbuf, piaddr (low)); + strcpy (highbuf, piaddr (high)); + error ("No memory for address range %s-%s.", lowbuf, highbuf); + } + memset (address_range, 0, (sizeof *address_range) * (max - min + 1)); + + /* Fill in the last lease if it hasn't been already... */ + if (!share -> last_lease) { + share -> last_lease = &address_range [0]; + } + + /* Fill out the lease structures with some minimal information. */ + for (i = 0; i < max - min + 1; i++) { + address_range [i].ip_addr = + ip_addr (subnet -> net, subnet -> netmask, i + min); + address_range [i].starts = + address_range [i].timestamp = MIN_TIME; + address_range [i].ends = MIN_TIME; + address_range [i].subnet = subnet; + address_range [i].shared_network = share; + address_range [i].flags = dynamic ? DYNAMIC_BOOTP_OK : 0; + + memcpy (&ia, address_range [i].ip_addr.iabuf, 4); + + if (subnet -> group -> get_lease_hostnames) { + h = gethostbyaddr ((char *)&ia, sizeof ia, AF_INET); + if (!h) + warn ("No hostname for %s", inet_ntoa (ia)); + else { + address_range [i].hostname = + malloc (strlen (h -> h_name) + 1); + if (!address_range [i].hostname) + error ("no memory for hostname %s.", + h -> h_name); + strcpy (address_range [i].hostname, + h -> h_name); + } + } + + /* Link this entry into the list. */ + address_range [i].next = share -> leases; + address_range [i].prev = (struct lease *)0; + share -> leases = &address_range [i]; + if (address_range [i].next) + address_range [i].next -> prev = share -> leases; + add_hash (lease_ip_addr_hash, + address_range [i].ip_addr.iabuf, + address_range [i].ip_addr.len, + (unsigned char *)&address_range [i]); + } + + /* Find out if any dangling leases are in range... */ + plp = (struct lease *)0; + for (lp = dangling_leases; lp; lp = lp -> next) { + iaddr lnet; + int lhost; + + lnet = subnet_number (lp -> ip_addr, subnet -> netmask); + lhost = host_addr (lp -> ip_addr, subnet -> netmask); + + /* If it's in range, fill in the real lease structure with + the dangling lease's values, and remove the lease from + the list of dangling leases. */ + if (addr_eq (lnet, subnet -> net) && + lhost >= i && lhost <= max) { + if (plp) { + plp -> next = lp -> next; + } else { + dangling_leases = lp -> next; + } + lp -> next = (struct lease *)0; + address_range [lhost - i].hostname = lp -> hostname; + address_range [lhost - i].client_hostname = + lp -> client_hostname; + supersede_lease (&address_range [lhost - i], lp, 0); + free_lease (lp, "new_address_range"); + } else + plp = lp; + } +} + +subnet *find_subnet (iaddr addr) +{ + subnet *rv; + + for (rv = subnets; rv; rv = rv -> next_subnet) { + if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) + return rv; + } + return (subnet *)0; +} + +subnet *find_grouped_subnet (shared_network *share, iaddr addr) +{ + subnet *rv; + + for (rv = share -> subnets; rv; rv = rv -> next_sibling) { + if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) + return rv; + } + return (subnet *)0; +} + +int subnet_inner_than (struct _subnet *subnet, struct _subnet *scan, int warnp) +{ + if (addr_eq (subnet_number (subnet -> net, scan -> netmask), + scan -> net) || + addr_eq (subnet_number (scan -> net, subnet -> netmask), + subnet -> net)) { + char n1buf [16]; + int i, j; + for (i = 0; i < 32; i++) + if (subnet -> netmask.iabuf [3 - (i >> 3)] + & (1 << (i & 7))) + break; + for (j = 0; j < 32; j++) + if (scan -> netmask.iabuf [3 - (j >> 3)] & + (1 << (j & 7))) + break; + strcpy (n1buf, piaddr (subnet -> net)); + if (warnp) + warn ("%ssubnet %s/%d conflicts with subnet %s/%d", + "Warning: ", n1buf, 32 - i, + piaddr (scan -> net), 32 - j); + if (i < j) + return 1; + } + return 0; +} + +/* Enter a new subnet into the subnet list. */ + +void enter_subnet (struct _subnet *subnet) +{ + struct _subnet *scan, *prev = (struct _subnet *)0; + + /* Check for duplicates... */ + for (scan = subnets; scan; scan = scan -> next_subnet) { + /* When we find a conflict, make sure that the + subnet with the narrowest subnet mask comes + first. */ + if (subnet_inner_than (subnet, scan, 1)) { + if (prev) { + prev -> next_subnet = subnet; + } else + subnets = subnet; + subnet -> next_subnet = scan; + return; + } + prev = scan; + } + + /* XXX use the BSD radix tree code instead of a linked list. */ + subnet -> next_subnet = subnets; + subnets = subnet; +} + +/* Enter a new shared network into the shared network list. */ + +void enter_shared_network (shared_network *share) +{ + /* XXX Sort the nets into a balanced tree to make searching quicker. */ + share -> next = shared_networks; + shared_networks = share; +} + +/* Enter a lease into the system. This is called by the parser each + time it reads in a new lease. If the subnet for that lease has + already been read in (usually the case), just update that lease; + otherwise, allocate temporary storage for the lease and keep it around + until we're done reading in the config file. */ + +void enter_lease (struct _lease *lease) +{ + struct _lease *comp = find_lease_by_ip_addr (lease -> ip_addr); + + /* If we don't have a place for this lease yet, save it for + later. */ + if (!comp) { + comp = new_lease ("enter_lease"); + if (!comp) { + error ("No memory for lease %s\n", + piaddr (lease -> ip_addr)); + } + *comp = *lease; + comp -> next = dangling_leases; + comp -> prev = (struct lease *)0; + dangling_leases = comp; + } else { + /* Record the hostname information in the lease. */ + comp -> hostname = lease -> hostname; + comp -> client_hostname = lease -> client_hostname; + supersede_lease (comp, lease, 0); + } +} + +/* Replace the data in an existing lease with the data in a new lease; + adjust hash tables to suit, and insertion sort the lease into the + list of leases by expiry time so that we can always find the oldest + lease. */ + +int supersede_lease (struct _lease *comp, struct _lease *lease, int commit) +{ + int enter_uid = 0; + int enter_hwaddr = 0; + struct _lease *lp; + + /* Static leases are not currently kept in the database... */ + if (lease -> flags & STATIC_LEASE) + return 1; + + /* If the existing lease hasn't expired and has a different + unique identifier or, if it doesn't have a unique + identifier, a different hardware address, then the two + leases are in conflict. If the existing lease has a uid + and the new one doesn't, but they both have the same + hardware address, and dynamic bootp is allowed on this + lease, then we allow that, in case a dynamic BOOTP lease is + requested *after* a DHCP lease has been assigned. */ + + if (!(lease -> flags & ABANDONED_LEASE) && + comp -> ends > cur_time && + (((comp -> uid && lease -> uid) && + (comp -> uid_len != lease -> uid_len || + memcmp (comp -> uid, lease -> uid, comp -> uid_len))) || + (!comp -> uid && + ((comp -> hardware_addr.htype != + lease -> hardware_addr.htype) || + (comp -> hardware_addr.hlen != + lease -> hardware_addr.hlen) || + memcmp (comp -> hardware_addr.haddr, + lease -> hardware_addr.haddr, + comp -> hardware_addr.hlen))))) { + warn ("Lease conflict at %s", + piaddr (comp -> ip_addr)); + return 0; + } else { + /* If there's a Unique ID, dissociate it from the hash + table and free it if necessary. */ + if (comp -> uid) { + uid_hash_delete (comp); + enter_uid = 1; + if (comp -> uid != &comp -> uid_buf [0]) { + free (comp -> uid); + comp -> uid_max = 0; + comp -> uid_len = 0; + } + comp -> uid = (unsigned char *)0; + } else + enter_uid = 1; + + if (comp -> hardware_addr.htype && + ((comp -> hardware_addr.hlen != + lease -> hardware_addr.hlen) || + (comp -> hardware_addr.htype != + lease -> hardware_addr.htype) || + memcmp (comp -> hardware_addr.haddr, + lease -> hardware_addr.haddr, + comp -> hardware_addr.hlen))) { + hw_hash_delete (comp); + enter_hwaddr = 1; + } else if (!comp -> hardware_addr.htype) + enter_hwaddr = 1; + + /* Copy the data files, but not the linkages. */ + comp -> starts = lease -> starts; + if (lease -> uid) { + if (lease -> uid_len < sizeof (lease -> uid_buf)) { + memcpy (comp -> uid_buf, + lease -> uid, lease -> uid_len); + comp -> uid = &comp -> uid_buf [0]; + comp -> uid_max = sizeof comp -> uid_buf; + } else if (lease -> uid != &lease -> uid_buf [0]) { + comp -> uid = lease -> uid; + comp -> uid_max = lease -> uid_max; + lease -> uid = (unsigned char *)0; + lease -> uid_max = 0; + } else { + error ("corrupt lease uid."); /* XXX */ + } + } else { + comp -> uid = (unsigned char *)0; + comp -> uid_max = 0; + } + comp -> uid_len = lease -> uid_len; + comp -> host = lease -> host; + comp -> hardware_addr = lease -> hardware_addr; + comp -> flags = ((lease -> flags & ~PERSISTENT_FLAGS) | + (comp -> flags & ~EPHEMERAL_FLAGS)); + + /* Record the lease in the uid hash if necessary. */ + if (enter_uid && lease -> uid) { + uid_hash_add (comp); + } + + /* Record it in the hardware address hash if necessary. */ + if (enter_hwaddr && lease -> hardware_addr.htype) { + hw_hash_add (comp); + } + + /* Remove the lease from its current place in the + timeout sequence. */ + if (comp -> prev) { + comp -> prev -> next = comp -> next; + } else { + comp -> shared_network -> leases = comp -> next; + } + if (comp -> next) { + comp -> next -> prev = comp -> prev; + } + if (comp -> shared_network -> last_lease == comp) { + comp -> shared_network -> last_lease = comp -> prev; + } + + /* Find the last insertion point... */ + if (comp == comp -> shared_network -> insertion_point || + !comp -> shared_network -> insertion_point) { + lp = comp -> shared_network -> leases; + } else { + lp = comp -> shared_network -> insertion_point; + } + + if (!lp) { + /* Nothing on the list yet? Just make comp the + head of the list. */ + comp -> shared_network -> leases = comp; + comp -> shared_network -> last_lease = comp; + } else if (lp -> ends > lease -> ends) { + /* Skip down the list until we run out of list + or find a place for comp. */ + while (lp -> next && lp -> ends > lease -> ends) { + lp = lp -> next; + } + if (lp -> ends > lease -> ends) { + /* If we ran out of list, put comp + at the end. */ + lp -> next = comp; + comp -> prev = lp; + comp -> next = (struct lease *)0; + comp -> shared_network -> last_lease = comp; + } else { + /* If we didn't, put it between lp and + the previous item on the list. */ + if ((comp -> prev = lp -> prev)) + comp -> prev -> next = comp; + comp -> next = lp; + lp -> prev = comp; + } + } else { + /* Skip up the list until we run out of list + or find a place for comp. */ + while (lp -> prev && lp -> ends < lease -> ends) { + lp = lp -> prev; + } + if (lp -> ends < lease -> ends) { + /* If we ran out of list, put comp + at the beginning. */ + lp -> prev = comp; + comp -> next = lp; + comp -> prev = (struct lease *)0; + comp -> shared_network -> leases = comp; + } else { + /* If we didn't, put it between lp and + the next item on the list. */ + if ((comp -> next = lp -> next)) + comp -> next -> prev = comp; + comp -> prev = lp; + lp -> next = comp; + } + } + comp -> shared_network -> insertion_point = comp; + comp -> ends = lease -> ends; + } + + /* Return zero if we didn't commit the lease to permanent storage; + nonzero if we did. */ + return commit && write_lease (comp) && commit_leases (); +} + +/* Release the specified lease and re-hash it as appropriate. */ + +void release_lease (struct _lease *lease) +{ + struct _lease lt; + + lt = *lease; + if (lt.ends > cur_time) { + lt.ends = cur_time; + supersede_lease (lease, <, 1); + } +} + +/* Abandon the specified lease (set its timeout to infinity and its + particulars to zero, and re-hash it as appropriate. */ + +void abandon_lease (struct _lease *lease, char *message) +{ + struct _lease lt; + + lease -> flags |= ABANDONED_LEASE; + lt = *lease; + lt.ends = cur_time; + warn ("Abandoning IP address %s: %s", + piaddr (lease -> ip_addr), message); + lt.hardware_addr.htype = 0; + lt.hardware_addr.hlen = 0; + lt.uid = (unsigned char *)0; + lt.uid_len = 0; + supersede_lease (lease, <, 1); +} + +/* Locate the lease associated with a given IP address... */ + +lease *find_lease_by_ip_addr (iaddr addr) +{ + lease *lease = (struct _lease *)hash_lookup (lease_ip_addr_hash, + addr.iabuf, + addr.len); + return lease; +} + +lease *find_lease_by_uid (unsigned char *uid, int len) +{ + lease *lease = (struct lease *)hash_lookup (lease_uid_hash, + uid, len); + return lease; +} + +lease *find_lease_by_hw_addr (unsigned char *hwaddr, int hwlen) +{ + struct _lease *lease = + (struct _lease *)hash_lookup (lease_hw_addr_hash, + hwaddr, hwlen); + return lease; +} + +/* Add the specified lease to the uid hash. */ + +void uid_hash_add (lease *lease) +{ + struct _lease *head = find_lease_by_uid (lease -> uid, lease -> uid_len); + struct _lease *scan; + +#ifdef DEBUG + if (lease -> n_uid) + abort (); +#endif + + /* If it's not in the hash, just add it. */ + if (!head) + add_hash (lease_uid_hash, lease -> uid, + lease -> uid_len, (unsigned char *)lease); + else { + /* Otherwise, attach it to the end of the list. */ + for (scan = head; scan -> n_uid; scan = scan -> n_uid) +#ifdef DEBUG + if (scan == lease) + abort () +#endif + ; + scan -> n_uid = lease; + } +} + +/* Delete the specified lease from the uid hash. */ + +void uid_hash_delete (lease *lease) +{ + struct _lease *head = + find_lease_by_uid (lease -> uid, lease -> uid_len); + struct _lease *scan; + + /* If it's not in the hash, we have no work to do. */ + if (!head) { + lease -> n_uid = (struct lease *)0; + return; + } + + /* If the lease we're freeing is at the head of the list, + remove the hash table entry and add a new one with the + next lease on the list (if there is one). */ + if (head == lease) { + delete_hash_entry (lease_uid_hash, + lease -> uid, lease -> uid_len); + if (lease -> n_uid) + add_hash (lease_uid_hash, + lease -> n_uid -> uid, + lease -> n_uid -> uid_len, + (unsigned char *)(lease -> n_uid)); + } else { + /* Otherwise, look for the lease in the list of leases + attached to the hash table entry, and remove it if + we find it. */ + for (scan = head; scan -> n_uid; scan = scan -> n_uid) { + if (scan -> n_uid == lease) { + scan -> n_uid = scan -> n_uid -> n_uid; + break; + } + } + } + lease -> n_uid = (struct lease *)0; +} + +/* Add the specified lease to the hardware address hash. */ + +void hw_hash_add (lease *lease) +{ + struct _lease *head = + find_lease_by_hw_addr (lease -> hardware_addr.haddr, + lease -> hardware_addr.hlen); + struct _lease *scan; + + /* If it's not in the hash, just add it. */ + if (!head) + add_hash (lease_hw_addr_hash, + lease -> hardware_addr.haddr, + lease -> hardware_addr.hlen, + (unsigned char *)lease); + else { + /* Otherwise, attach it to the end of the list. */ + for (scan = head; scan -> n_hw; scan = scan -> n_hw) + ; + scan -> n_hw = lease; + } +} + +/* Delete the specified lease from the hardware address hash. */ + +void hw_hash_delete (lease *lease) +{ + struct _lease *head = + find_lease_by_hw_addr (lease -> hardware_addr.haddr, + lease -> hardware_addr.hlen); + struct _lease *scan; + + /* If it's not in the hash, we have no work to do. */ + if (!head) { + lease -> n_hw = (struct lease *)0; + return; + } + + /* If the lease we're freeing is at the head of the list, + remove the hash table entry and add a new one with the + next lease on the list (if there is one). */ + if (head == lease) { + delete_hash_entry (lease_hw_addr_hash, + lease -> hardware_addr.haddr, + lease -> hardware_addr.hlen); + if (lease -> n_hw) + add_hash (lease_hw_addr_hash, + lease -> n_hw -> hardware_addr.haddr, + lease -> n_hw -> hardware_addr.hlen, + (unsigned char *)(lease -> n_hw)); + } else { + /* Otherwise, look for the lease in the list of leases + attached to the hash table entry, and remove it if + we find it. */ + for (scan = head; scan -> n_hw; scan = scan -> n_hw) { + if (scan -> n_hw == lease) { + scan -> n_hw = scan -> n_hw -> n_hw; + break; + } + } + } + lease -> n_hw = (struct lease *)0; +} + + +struct class *add_class (type, name) + int type; + char *name; +{ + struct class *class = new_class ("add_class"); + char *tname = (char *)malloc (strlen (name) + 1); + + if (!vendor_class_hash) + vendor_class_hash = new_hash (); + if (!user_class_hash) + user_class_hash = new_hash (); + + if (!tname || !class || !vendor_class_hash || !user_class_hash) + { + if (tname != NULL) + free(tname); + return (struct class *)0; + } + + memset (class, 0, sizeof *class); + strcpy (tname, name); + class -> name = tname; + + if (type) + add_hash (user_class_hash, + (unsigned char *)tname, strlen (tname), + (unsigned char *)class); + else + add_hash (vendor_class_hash, + (unsigned char *)tname, strlen (tname), + (unsigned char *)class); + return class; +} + +struct class *find_class (type, name, len) + int type; + unsigned char *name; + int len; +{ + struct class *class = + (struct class *)hash_lookup (type + ? user_class_hash + : vendor_class_hash, name, len); + return class; +} + +struct group *clone_group (group, caller) + struct group *group; + char *caller; +{ + struct group *g = new_group (caller); + if (!g) + error ("%s: can't allocate new group", caller); + *g = *group; + return g; +} + +/* Write all interesting leases to permanent storage. */ + +void write_leases () +{ + lease *l; + shared_network *s; + + for (s = shared_networks; s; s = (shared_network *)s -> next) { + for (l = s -> leases; l; l = l -> next) { + if (l -> hardware_addr.hlen || + l -> uid_len || + (l -> flags & ABANDONED_LEASE)) + if (!write_lease (l)) + error ("Can't rewrite lease database"); + } + } + if (!commit_leases ()) + error ("Can't commit leases to new database: %m"); +} + +void dump_subnets () +{ + struct _lease *l; + shared_network *s; + subnet *n; + + note ("Subnets:"); + for (n = subnets; n; n = n -> next_subnet) { + debug (" Subnet %s", piaddr (n -> net)); + debug (" netmask %s", + piaddr (n -> netmask)); + } + note ("Shared networks:"); + for (s = shared_networks; s; s = (shared_network *)s -> next) { + note (" %s", s -> name); + for (l = s -> leases; l; l = l -> next) { + print_lease (l); + } + if (s -> last_lease) { + debug (" Last Lease:"); + print_lease (s -> last_lease); + } + } +} diff --git a/reactos/base/services/dhcp/options.c b/reactos/base/services/dhcp/options.c new file mode 100644 index 00000000000..27be626523a --- /dev/null +++ b/reactos/base/services/dhcp/options.c @@ -0,0 +1,723 @@ +/* $OpenBSD: options.c,v 1.15 2004/12/26 03:17:07 deraadt Exp $ */ + +/* DHCP options parsing and reassembly. */ + +/* + * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#include +#include + +#define DHCP_OPTION_DATA +#include "rosdhcp.h" +#include "dhcpd.h" + +int bad_options = 0; +int bad_options_max = 5; + +void parse_options(struct packet *); +void parse_option_buffer(struct packet *, unsigned char *, int); +int store_options(unsigned char *, int, struct tree_cache **, + unsigned char *, int, int, int, int); + + +/* + * Parse all available options out of the specified packet. + */ +void +parse_options(struct packet *packet) +{ + /* Initially, zero all option pointers. */ + memset(packet->options, 0, sizeof(packet->options)); + + /* If we don't see the magic cookie, there's nothing to parse. */ + if (memcmp(packet->raw->options, DHCP_OPTIONS_COOKIE, 4)) { + packet->options_valid = 0; + return; + } + + /* + * Go through the options field, up to the end of the packet or + * the End field. + */ + parse_option_buffer(packet, &packet->raw->options[4], + packet->packet_length - DHCP_FIXED_NON_UDP - 4); + + /* + * If we parsed a DHCP Option Overload option, parse more + * options out of the buffer(s) containing them. + */ + if (packet->options_valid && + packet->options[DHO_DHCP_OPTION_OVERLOAD].data) { + if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 1) + parse_option_buffer(packet, + (unsigned char *)packet->raw->file, + sizeof(packet->raw->file)); + if (packet->options[DHO_DHCP_OPTION_OVERLOAD].data[0] & 2) + parse_option_buffer(packet, + (unsigned char *)packet->raw->sname, + sizeof(packet->raw->sname)); + } +} + +/* + * Parse options out of the specified buffer, storing addresses of + * option values in packet->options and setting packet->options_valid if + * no errors are encountered. + */ +void +parse_option_buffer(struct packet *packet, + unsigned char *buffer, int length) +{ + unsigned char *s, *t, *end = buffer + length; + int len, code; + + for (s = buffer; *s != DHO_END && s < end; ) { + code = s[0]; + + /* Pad options don't have a length - just skip them. */ + if (code == DHO_PAD) { + s++; + continue; + } + if (s + 2 > end) { + len = 65536; + goto bogus; + } + + /* + * All other fields (except end, see above) have a + * one-byte length. + */ + len = s[1]; + + /* + * If the length is outrageous, silently skip the rest, + * and mark the packet bad. Unfortunately some crappy + * dhcp servers always seem to give us garbage on the + * end of a packet. so rather than keep refusing, give + * up and try to take one after seeing a few without + * anything good. + */ + if (s + len + 2 > end) { + bogus: + bad_options++; + warning("option %s (%d) %s.", + dhcp_options[code].name, len, + "larger than buffer"); + if (bad_options == bad_options_max) { + packet->options_valid = 1; + bad_options = 0; + warning("Many bogus options seen in offers. " + "Taking this offer in spite of bogus " + "options - hope for the best!"); + } else { + warning("rejecting bogus offer."); + packet->options_valid = 0; + } + return; + } + /* + * If we haven't seen this option before, just make + * space for it and copy it there. + */ + if (!packet->options[code].data) { + if (!(t = calloc(1, len + 1))) + error("Can't allocate storage for option %s.", + dhcp_options[code].name); + /* + * Copy and NUL-terminate the option (in case + * it's an ASCII string. + */ + memcpy(t, &s[2], len); + t[len] = 0; + packet->options[code].len = len; + packet->options[code].data = t; + } else { + /* + * If it's a repeat, concatenate it to whatever + * we last saw. This is really only required + * for clients, but what the heck... + */ + t = calloc(1, len + packet->options[code].len + 1); + if (!t) { + error("Can't expand storage for option %s.", + dhcp_options[code].name); + return; + } + memcpy(t, packet->options[code].data, + packet->options[code].len); + memcpy(t + packet->options[code].len, + &s[2], len); + packet->options[code].len += len; + t[packet->options[code].len] = 0; + free(packet->options[code].data); + packet->options[code].data = t; + } + s += len + 2; + } + packet->options_valid = 1; +} + +/* + * cons options into a big buffer, and then split them out into the + * three separate buffers if needed. This allows us to cons up a set of + * vendor options using the same routine. + */ +int +cons_options(struct packet *inpacket, struct dhcp_packet *outpacket, + int mms, struct tree_cache **options, + int overload, /* Overload flags that may be set. */ + int terminate, int bootpp, u_int8_t *prl, int prl_len) +{ + unsigned char priority_list[300], buffer[4096]; + int priority_len, main_buffer_size, mainbufix, bufix; + int option_size, length; + + /* + * If the client has provided a maximum DHCP message size, use + * that; otherwise, if it's BOOTP, only 64 bytes; otherwise use + * up to the minimum IP MTU size (576 bytes). + * + * XXX if a BOOTP client specifies a max message size, we will + * honor it. + */ + if (!mms && + inpacket && + inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data && + (inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].len >= + sizeof(u_int16_t))) + mms = getUShort( + inpacket->options[DHO_DHCP_MAX_MESSAGE_SIZE].data); + + if (mms) + main_buffer_size = mms - DHCP_FIXED_LEN; + else if (bootpp) + main_buffer_size = 64; + else + main_buffer_size = 576 - DHCP_FIXED_LEN; + + if (main_buffer_size > sizeof(buffer)) + main_buffer_size = sizeof(buffer); + + /* Preload the option priority list with mandatory options. */ + priority_len = 0; + priority_list[priority_len++] = DHO_DHCP_MESSAGE_TYPE; + priority_list[priority_len++] = DHO_DHCP_SERVER_IDENTIFIER; + priority_list[priority_len++] = DHO_DHCP_LEASE_TIME; + priority_list[priority_len++] = DHO_DHCP_MESSAGE; + + /* + * If the client has provided a list of options that it wishes + * returned, use it to prioritize. Otherwise, prioritize based + * on the default priority list. + */ + if (inpacket && + inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) { + int prlen = + inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].len; + if (prlen + priority_len > sizeof(priority_list)) + prlen = sizeof(priority_list) - priority_len; + + memcpy(&priority_list[priority_len], + inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data, + prlen); + priority_len += prlen; + prl = priority_list; + } else if (prl) { + if (prl_len + priority_len > sizeof(priority_list)) + prl_len = sizeof(priority_list) - priority_len; + + memcpy(&priority_list[priority_len], prl, prl_len); + priority_len += prl_len; + prl = priority_list; + } else { + memcpy(&priority_list[priority_len], + dhcp_option_default_priority_list, + sizeof_dhcp_option_default_priority_list); + priority_len += sizeof_dhcp_option_default_priority_list; + } + + /* Copy the options into the big buffer... */ + option_size = store_options( + buffer, + (main_buffer_size - 7 + ((overload & 1) ? DHCP_FILE_LEN : 0) + + ((overload & 2) ? DHCP_SNAME_LEN : 0)), + options, priority_list, priority_len, main_buffer_size, + (main_buffer_size + ((overload & 1) ? DHCP_FILE_LEN : 0)), + terminate); + + /* Put the cookie up front... */ + memcpy(outpacket->options, DHCP_OPTIONS_COOKIE, 4); + mainbufix = 4; + + /* + * If we're going to have to overload, store the overload option + * at the beginning. If we can, though, just store the whole + * thing in the packet's option buffer and leave it at that. + */ + if (option_size <= main_buffer_size - mainbufix) { + memcpy(&outpacket->options[mainbufix], + buffer, option_size); + mainbufix += option_size; + if (mainbufix < main_buffer_size) + outpacket->options[mainbufix++] = DHO_END; + length = DHCP_FIXED_NON_UDP + mainbufix; + } else { + outpacket->options[mainbufix++] = DHO_DHCP_OPTION_OVERLOAD; + outpacket->options[mainbufix++] = 1; + if (option_size > + main_buffer_size - mainbufix + DHCP_FILE_LEN) + outpacket->options[mainbufix++] = 3; + else + outpacket->options[mainbufix++] = 1; + + memcpy(&outpacket->options[mainbufix], + buffer, main_buffer_size - mainbufix); + bufix = main_buffer_size - mainbufix; + length = DHCP_FIXED_NON_UDP + mainbufix; + if (overload & 1) { + if (option_size - bufix <= DHCP_FILE_LEN) { + memcpy(outpacket->file, + &buffer[bufix], option_size - bufix); + mainbufix = option_size - bufix; + if (mainbufix < DHCP_FILE_LEN) + outpacket->file[mainbufix++] = (char)DHO_END; + while (mainbufix < DHCP_FILE_LEN) + outpacket->file[mainbufix++] = (char)DHO_PAD; + } else { + memcpy(outpacket->file, + &buffer[bufix], DHCP_FILE_LEN); + bufix += DHCP_FILE_LEN; + } + } + if ((overload & 2) && option_size < bufix) { + memcpy(outpacket->sname, + &buffer[bufix], option_size - bufix); + + mainbufix = option_size - bufix; + if (mainbufix < DHCP_SNAME_LEN) + outpacket->file[mainbufix++] = (char)DHO_END; + while (mainbufix < DHCP_SNAME_LEN) + outpacket->file[mainbufix++] = (char)DHO_PAD; + } + } + return (length); +} + +/* + * Store all the requested options into the requested buffer. + */ +int +store_options(unsigned char *buffer, int buflen, struct tree_cache **options, + unsigned char *priority_list, int priority_len, int first_cutoff, + int second_cutoff, int terminate) +{ + int bufix = 0, option_stored[256], i, ix, tto; + + /* Zero out the stored-lengths array. */ + memset(option_stored, 0, sizeof(option_stored)); + + /* + * Copy out the options in the order that they appear in the + * priority list... + */ + for (i = 0; i < priority_len; i++) { + /* Code for next option to try to store. */ + int code = priority_list[i]; + int optstart; + + /* + * Number of bytes left to store (some may already have + * been stored by a previous pass). + */ + int length; + + /* If no data is available for this option, skip it. */ + if (!options[code]) { + continue; + } + + /* + * The client could ask for things that are mandatory, + * in which case we should avoid storing them twice... + */ + if (option_stored[code]) + continue; + option_stored[code] = 1; + + /* We should now have a constant length for the option. */ + length = options[code]->len; + + /* Do we add a NUL? */ + if (terminate && dhcp_options[code].format[0] == 't') { + length++; + tto = 1; + } else + tto = 0; + + /* Try to store the option. */ + + /* + * If the option's length is more than 255, we must + * store it in multiple hunks. Store 255-byte hunks + * first. However, in any case, if the option data will + * cross a buffer boundary, split it across that + * boundary. + */ + ix = 0; + + optstart = bufix; + while (length) { + unsigned char incr = length > 255 ? 255 : length; + + /* + * If this hunk of the buffer will cross a + * boundary, only go up to the boundary in this + * pass. + */ + if (bufix < first_cutoff && + bufix + incr > first_cutoff) + incr = first_cutoff - bufix; + else if (bufix < second_cutoff && + bufix + incr > second_cutoff) + incr = second_cutoff - bufix; + + /* + * If this option is going to overflow the + * buffer, skip it. + */ + if (bufix + 2 + incr > buflen) { + bufix = optstart; + break; + } + + /* Everything looks good - copy it in! */ + buffer[bufix] = code; + buffer[bufix + 1] = incr; + if (tto && incr == length) { + memcpy(buffer + bufix + 2, + options[code]->value + ix, incr - 1); + buffer[bufix + 2 + incr - 1] = 0; + } else + memcpy(buffer + bufix + 2, + options[code]->value + ix, incr); + length -= incr; + ix += incr; + bufix += 2 + incr; + } + } + return (bufix); +} + +/* + * Format the specified option so that a human can easily read it. + */ +char * +pretty_print_option(unsigned int code, unsigned char *data, int len, + int emit_commas, int emit_quotes) +{ + static char optbuf[32768]; /* XXX */ + int hunksize = 0, numhunk = -1, numelem = 0; + char fmtbuf[32], *op = optbuf; + int i, j, k, opleft = sizeof(optbuf); + unsigned char *dp = data; + struct in_addr foo; + char comma; + + /* Code should be between 0 and 255. */ + if (code > 255) + error("pretty_print_option: bad code %d", code); + + if (emit_commas) + comma = ','; + else + comma = ' '; + + /* Figure out the size of the data. */ + for (i = 0; dhcp_options[code].format[i]; i++) { + if (!numhunk) { + warning("%s: Excess information in format string: %s", + dhcp_options[code].name, + &(dhcp_options[code].format[i])); + break; + } + numelem++; + fmtbuf[i] = dhcp_options[code].format[i]; + switch (dhcp_options[code].format[i]) { + case 'A': + --numelem; + fmtbuf[i] = 0; + numhunk = 0; + break; + case 'X': + for (k = 0; k < len; k++) + if (!isascii(data[k]) || + !isprint(data[k])) + break; + if (k == len) { + fmtbuf[i] = 't'; + numhunk = -2; + } else { + fmtbuf[i] = 'x'; + hunksize++; + comma = ':'; + numhunk = 0; + } + fmtbuf[i + 1] = 0; + break; + case 't': + fmtbuf[i] = 't'; + fmtbuf[i + 1] = 0; + numhunk = -2; + break; + case 'I': + case 'l': + case 'L': + hunksize += 4; + break; + case 's': + case 'S': + hunksize += 2; + break; + case 'b': + case 'B': + case 'f': + hunksize++; + break; + case 'e': + break; + default: + warning("%s: garbage in format string: %s", + dhcp_options[code].name, + &(dhcp_options[code].format[i])); + break; + } + } + + /* Check for too few bytes... */ + if (hunksize > len) { + warning("%s: expecting at least %d bytes; got %d", + dhcp_options[code].name, hunksize, len); + return (""); + } + /* Check for too many bytes... */ + if (numhunk == -1 && hunksize < len) + warning("%s: %d extra bytes", + dhcp_options[code].name, len - hunksize); + + /* If this is an array, compute its size. */ + if (!numhunk) + numhunk = len / hunksize; + /* See if we got an exact number of hunks. */ + if (numhunk > 0 && numhunk * hunksize < len) + warning("%s: %d extra bytes at end of array", + dhcp_options[code].name, len - numhunk * hunksize); + + /* A one-hunk array prints the same as a single hunk. */ + if (numhunk < 0) + numhunk = 1; + + /* Cycle through the array (or hunk) printing the data. */ + for (i = 0; i < numhunk; i++) { + for (j = 0; j < numelem; j++) { + int opcount; + switch (fmtbuf[j]) { + case 't': + if (emit_quotes) { + *op++ = '"'; + opleft--; + } + for (; dp < data + len; dp++) { + if (!isascii(*dp) || + !isprint(*dp)) { + if (dp + 1 != data + len || + *dp != 0) { + _snprintf(op, opleft, + "\\%03o", *dp); + op += 4; + opleft -= 4; + } + } else if (*dp == '"' || + *dp == '\'' || + *dp == '$' || + *dp == '`' || + *dp == '\\') { + *op++ = '\\'; + *op++ = *dp; + opleft -= 2; + } else { + *op++ = *dp; + opleft--; + } + } + if (emit_quotes) { + *op++ = '"'; + opleft--; + } + + *op = 0; + break; + case 'I': + foo.s_addr = htonl(getULong(dp)); + strncpy(op, inet_ntoa(foo), opleft - 1); + op[opleft - 1] = ANSI_NULL; + opcount = strlen(op); + if (opcount >= opleft) + goto toobig; + opleft -= opcount; + dp += 4; + break; + case 'l': + opcount = _snprintf(op, opleft, "%ld", + (long)getLong(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 4; + break; + case 'L': + opcount = _snprintf(op, opleft, "%ld", + (unsigned long)getULong(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 4; + break; + case 's': + opcount = _snprintf(op, opleft, "%d", + getShort(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 2; + break; + case 'S': + opcount = _snprintf(op, opleft, "%d", + getUShort(dp)); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + dp += 2; + break; + case 'b': + opcount = _snprintf(op, opleft, "%d", + *(char *)dp++); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + break; + case 'B': + opcount = _snprintf(op, opleft, "%d", *dp++); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + break; + case 'x': + opcount = _snprintf(op, opleft, "%x", *dp++); + if (opcount >= opleft || opcount == -1) + goto toobig; + opleft -= opcount; + break; + case 'f': + opcount = (size_t) strncpy(op, *dp++ ? "true" : "false", opleft - 1); + op[opleft - 1] = ANSI_NULL; + if (opcount >= opleft) + goto toobig; + opleft -= opcount; + break; + default: + warning("Unexpected format code %c", fmtbuf[j]); + } + op += strlen(op); + opleft -= strlen(op); + if (opleft < 1) + goto toobig; + if (j + 1 < numelem && comma != ':') { + *op++ = ' '; + opleft--; + } + } + if (i + 1 < numhunk) { + *op++ = comma; + opleft--; + } + if (opleft < 1) + goto toobig; + + } + return (optbuf); + toobig: + warning("dhcp option too large"); + return (""); +} + +void +do_packet(struct interface_info *interface, struct dhcp_packet *packet, + int len, unsigned int from_port, struct iaddr from, struct hardware *hfrom) +{ + struct packet tp; + int i; + + if (packet->hlen > sizeof(packet->chaddr)) { + note("Discarding packet with invalid hlen."); + return; + } + + memset(&tp, 0, sizeof(tp)); + tp.raw = packet; + tp.packet_length = len; + tp.client_port = from_port; + tp.client_addr = from; + tp.interface = interface; + tp.haddr = hfrom; + + parse_options(&tp); + if (tp.options_valid && + tp.options[DHO_DHCP_MESSAGE_TYPE].data) + tp.packet_type = tp.options[DHO_DHCP_MESSAGE_TYPE].data[0]; + if (tp.packet_type) + dhcp(&tp); + else + bootp(&tp); + + /* Free the data associated with the options. */ + for (i = 0; i < 256; i++) + if (tp.options[i].len && tp.options[i].data) + free(tp.options[i].data); +} diff --git a/reactos/base/services/dhcp/pipe.c b/reactos/base/services/dhcp/pipe.c new file mode 100644 index 00000000000..9ea0402c413 --- /dev/null +++ b/reactos/base/services/dhcp/pipe.c @@ -0,0 +1,120 @@ +/* $Id: $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: subsys/system/dhcp/pipe.c + * PURPOSE: DHCP client pipe + * PROGRAMMER: arty + */ + +#include + +#define NDEBUG +#include + +static HANDLE CommPipe = INVALID_HANDLE_VALUE, CommThread; +DWORD CommThrId; + +#define COMM_PIPE_OUTPUT_BUFFER sizeof(COMM_DHCP_REQ) +#define COMM_PIPE_INPUT_BUFFER sizeof(COMM_DHCP_REPLY) +#define COMM_PIPE_DEFAULT_TIMEOUT 1000 + +DWORD PipeSend( COMM_DHCP_REPLY *Reply ) { + DWORD Written = 0; + BOOL Success = + WriteFile( CommPipe, + Reply, + sizeof(*Reply), + &Written, + NULL ); + return Success ? Written : -1; +} + +DWORD WINAPI PipeThreadProc( LPVOID Parameter ) { + DWORD BytesRead, BytesWritten; + COMM_DHCP_REQ Req; + COMM_DHCP_REPLY Reply; + BOOL Result, Connected; + + while( TRUE ) { + Connected = ConnectNamedPipe( CommPipe, NULL ) ? + TRUE : GetLastError() == ERROR_PIPE_CONNECTED; + + if (!Connected) { + DbgPrint("DHCP: Could not connect named pipe\n"); + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; + break; + } + + Result = ReadFile( CommPipe, &Req, sizeof(Req), &BytesRead, NULL ); + if( Result ) { + switch( Req.Type ) { + case DhcpReqQueryHWInfo: + BytesWritten = DSQueryHWInfo( PipeSend, &Req ); + break; + + case DhcpReqLeaseIpAddress: + BytesWritten = DSLeaseIpAddress( PipeSend, &Req ); + break; + + case DhcpReqReleaseIpAddress: + BytesWritten = DSReleaseIpAddressLease( PipeSend, &Req ); + break; + + case DhcpReqRenewIpAddress: + BytesWritten = DSRenewIpAddressLease( PipeSend, &Req ); + break; + + case DhcpReqStaticRefreshParams: + BytesWritten = DSStaticRefreshParams( PipeSend, &Req ); + break; + + case DhcpReqGetAdapterInfo: + BytesWritten = DSGetAdapterInfo( PipeSend, &Req ); + break; + + default: + DPRINT1("Unrecognized request type %d\n", Req.Type); + ZeroMemory( &Reply, sizeof( COMM_DHCP_REPLY ) ); + Reply.Reply = 0; + BytesWritten = PipeSend( &Reply ); + break; + } + } + DisconnectNamedPipe( CommPipe ); + } + + return TRUE; +} + +HANDLE PipeInit() { + CommPipe = CreateNamedPipeW + ( DHCP_PIPE_NAME, + PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + 1, + COMM_PIPE_OUTPUT_BUFFER, + COMM_PIPE_INPUT_BUFFER, + COMM_PIPE_DEFAULT_TIMEOUT, + NULL ); + + if( CommPipe == INVALID_HANDLE_VALUE ) { + DbgPrint("DHCP: Could not create named pipe\n"); + return CommPipe; + } + + CommThread = CreateThread( NULL, 0, PipeThreadProc, NULL, 0, &CommThrId ); + + if( !CommThread ) { + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; + } + + return CommPipe; +} + +VOID PipeDestroy() { + CloseHandle( CommPipe ); + CommPipe = INVALID_HANDLE_VALUE; +} diff --git a/reactos/base/services/dhcp/privsep.c b/reactos/base/services/dhcp/privsep.c new file mode 100644 index 00000000000..7a13bfed21b --- /dev/null +++ b/reactos/base/services/dhcp/privsep.c @@ -0,0 +1,225 @@ +/* $OpenBSD: privsep.c,v 1.7 2004/05/10 18:34:42 deraadt Exp $ */ + +/* + * Copyright (c) 2004 Henning Brauer + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include "rosdhcp.h" +#include "dhcpd.h" +#include "privsep.h" + +struct buf * +buf_open(size_t len) +{ + struct buf *buf; + + if ((buf = calloc(1, sizeof(struct buf))) == NULL) + return (NULL); + if ((buf->buf = malloc(len)) == NULL) { + free(buf); + return (NULL); + } + buf->size = len; + + return (buf); +} + +int +buf_add(struct buf *buf, void *data, size_t len) +{ + if (buf->wpos + len > buf->size) + return (-1); + + memcpy(buf->buf + buf->wpos, data, len); + buf->wpos += len; + return (0); +} + +int +buf_close(int sock, struct buf *buf) +{ + ssize_t n; + + n = write(sock, buf->buf + buf->rpos, buf->size - buf->rpos); + if (n != -1) + buf->rpos += n; + if (n == 0) { /* connection closed */ + return (-1); + } + + if (buf->rpos < buf->size) + error("short write: wanted %lu got %ld bytes", + (unsigned long)buf->size, (long)buf->rpos); + + free(buf->buf); + free(buf); + return (n); +} + +ssize_t +buf_read(int sock, void *buf, size_t nbytes) +{ + ssize_t n, r = 0; + char *p = buf; + + n = read(sock, p, nbytes); + if (n == 0) + error("connection closed"); + if (n != -1) { + r += n; + p += n; + nbytes -= n; + } + + if (n == -1) + error("buf_read: %d", WSAGetLastError()); + + if (r < nbytes) + error("short read: wanted %lu got %ld bytes", + (unsigned long)nbytes, (long)r); + + return (r); +} + +void +dispatch_imsg(int fd) +{ + struct imsg_hdr hdr; + char *medium, *reason, *filename, + *servername, *prefix; + size_t medium_len, reason_len, filename_len, + servername_len, prefix_len, totlen; + struct client_lease lease; + int ret, i, optlen; + struct buf *buf; + + buf_read(fd, &hdr, sizeof(hdr)); + + switch (hdr.code) { + case IMSG_SCRIPT_INIT: + if (hdr.len < sizeof(hdr) + sizeof(size_t)) + error("corrupted message received"); + buf_read(fd, &medium_len, sizeof(medium_len)); + if (hdr.len < medium_len + sizeof(size_t) + sizeof(hdr) + + sizeof(size_t) || medium_len == SIZE_T_MAX) + error("corrupted message received"); + if (medium_len > 0) { + if ((medium = calloc(1, medium_len + 1)) != NULL) + buf_read(fd, medium, medium_len); + } else + medium = NULL; + + buf_read(fd, &reason_len, sizeof(reason_len)); + if (hdr.len < medium_len + reason_len + sizeof(hdr) || + reason_len == SIZE_T_MAX) + error("corrupted message received"); + if (reason_len > 0) { + if ((reason = calloc(1, reason_len + 1)) != NULL) + buf_read(fd, reason, reason_len); + } else + reason = NULL; + +// priv_script_init(reason, medium); + free(reason); + free(medium); + break; + case IMSG_SCRIPT_WRITE_PARAMS: + //bzero(&lease, sizeof lease); + memset(&lease, 0, sizeof(lease)); + totlen = sizeof(hdr) + sizeof(lease) + sizeof(size_t); + if (hdr.len < totlen) + error("corrupted message received"); + buf_read(fd, &lease, sizeof(lease)); + + buf_read(fd, &filename_len, sizeof(filename_len)); + totlen += filename_len + sizeof(size_t); + if (hdr.len < totlen || filename_len == SIZE_T_MAX) + error("corrupted message received"); + if (filename_len > 0) { + if ((filename = calloc(1, filename_len + 1)) != NULL) + buf_read(fd, filename, filename_len); + } else + filename = NULL; + + buf_read(fd, &servername_len, sizeof(servername_len)); + totlen += servername_len + sizeof(size_t); + if (hdr.len < totlen || servername_len == SIZE_T_MAX) + error("corrupted message received"); + if (servername_len > 0) { + if ((servername = + calloc(1, servername_len + 1)) != NULL) + buf_read(fd, servername, servername_len); + } else + servername = NULL; + + buf_read(fd, &prefix_len, sizeof(prefix_len)); + totlen += prefix_len; + if (hdr.len < totlen || prefix_len == SIZE_T_MAX) + error("corrupted message received"); + if (prefix_len > 0) { + if ((prefix = calloc(1, prefix_len + 1)) != NULL) + buf_read(fd, prefix, prefix_len); + } else + prefix = NULL; + + for (i = 0; i < 256; i++) { + totlen += sizeof(optlen); + if (hdr.len < totlen) + error("corrupted message received"); + buf_read(fd, &optlen, sizeof(optlen)); + lease.options[i].data = NULL; + lease.options[i].len = optlen; + if (optlen > 0) { + totlen += optlen; + if (hdr.len < totlen || optlen == SIZE_T_MAX) + error("corrupted message received"); + lease.options[i].data = + calloc(1, optlen + 1); + if (lease.options[i].data != NULL) + buf_read(fd, lease.options[i].data, optlen); + } + } + lease.server_name = servername; + lease.filename = filename; + +// priv_script_write_params(prefix, &lease); + + free(servername); + free(filename); + free(prefix); + for (i = 0; i < 256; i++) + if (lease.options[i].len > 0) + free(lease.options[i].data); + break; + case IMSG_SCRIPT_GO: + if (hdr.len != sizeof(hdr)) + error("corrupted message received"); + +// ret = priv_script_go(); + + hdr.code = IMSG_SCRIPT_GO_RET; + hdr.len = sizeof(struct imsg_hdr) + sizeof(int); + buf = buf_open(hdr.len); + + if (buf != NULL) { + buf_add(buf, &hdr, sizeof(hdr)); + buf_add(buf, &ret, sizeof(ret)); + buf_close(fd, buf); + } + break; + default: + error("received unknown message, code %d", hdr.code); + } +} diff --git a/reactos/base/services/dhcp/socket.c b/reactos/base/services/dhcp/socket.c new file mode 100644 index 00000000000..849d04943b5 --- /dev/null +++ b/reactos/base/services/dhcp/socket.c @@ -0,0 +1,39 @@ +#include "rosdhcp.h" + +SOCKET ServerSocket; + +void SocketInit() { + ServerSocket = socket( AF_INET, SOCK_DGRAM, 0 ); +} + +ssize_t send_packet( struct interface_info *ip, + struct dhcp_packet *p, + size_t size, + struct in_addr addr, + struct sockaddr_in *broadcast, + struct hardware *hardware ) { + int result = + sendto( ip->wfdesc, (char *)p, size, 0, + (struct sockaddr *)broadcast, sizeof(*broadcast) ); + + if (result < 0) { + note ("send_packet: %x", result); + if (result == WSAENETUNREACH) + note ("send_packet: please consult README file%s", + " regarding broadcast address."); + } + + return result; +} + +ssize_t receive_packet(struct interface_info *ip, + unsigned char *packet_data, + size_t packet_len, + struct sockaddr_in *dest, + struct hardware *hardware ) { + int recv_addr_size = sizeof(*dest); + int result = + recvfrom (ip -> rfdesc, (char *)packet_data, packet_len, 0, + (struct sockaddr *)dest, &recv_addr_size ); + return result; +} diff --git a/reactos/base/services/dhcp/tables.c b/reactos/base/services/dhcp/tables.c new file mode 100644 index 00000000000..3de26b7cef6 --- /dev/null +++ b/reactos/base/services/dhcp/tables.c @@ -0,0 +1,692 @@ +/* tables.c + + Tables of information... */ + +/* + * Copyright (c) 1995, 1996 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ +#define lint +#ifndef lint +static char copyright[] = +"$Id: tables.c,v 1.13.2.4 1999/04/24 16:46:44 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "rosdhcp.h" + +/* DHCP Option names, formats and codes, from RFC1533. + + Format codes: + + e - end of data + I - IP address + l - 32-bit signed integer + L - 32-bit unsigned integer + s - 16-bit signed integer + S - 16-bit unsigned integer + b - 8-bit signed integer + B - 8-bit unsigned integer + t - ASCII text + f - flag (true or false) + A - array of whatever precedes (e.g., IA means array of IP addresses) +*/ + +struct universe dhcp_universe; +struct dhcp_option dhcp_options [256] = { + { "pad", "", &dhcp_universe, 0 }, + { "subnet-mask", "I", &dhcp_universe, 1 }, + { "time-offset", "l", &dhcp_universe, 2 }, + { "routers", "IA", &dhcp_universe, 3 }, + { "time-servers", "IA", &dhcp_universe, 4 }, + { "ien116-name-servers", "IA", &dhcp_universe, 5 }, + { "domain-name-servers", "IA", &dhcp_universe, 6 }, + { "log-servers", "IA", &dhcp_universe, 7 }, + { "cookie-servers", "IA", &dhcp_universe, 8 }, + { "lpr-servers", "IA", &dhcp_universe, 9 }, + { "impress-servers", "IA", &dhcp_universe, 10 }, + { "resource-location-servers", "IA", &dhcp_universe, 11 }, + { "host-name", "X", &dhcp_universe, 12 }, + { "boot-size", "S", &dhcp_universe, 13 }, + { "merit-dump", "t", &dhcp_universe, 14 }, + { "domain-name", "t", &dhcp_universe, 15 }, + { "swap-server", "I", &dhcp_universe, 16 }, + { "root-path", "t", &dhcp_universe, 17 }, + { "extensions-path", "t", &dhcp_universe, 18 }, + { "ip-forwarding", "f", &dhcp_universe, 19 }, + { "non-local-source-routing", "f", &dhcp_universe, 20 }, + { "policy-filter", "IIA", &dhcp_universe, 21 }, + { "max-dgram-reassembly", "S", &dhcp_universe, 22 }, + { "default-ip-ttl", "B", &dhcp_universe, 23 }, + { "path-mtu-aging-timeout", "L", &dhcp_universe, 24 }, + { "path-mtu-plateau-table", "SA", &dhcp_universe, 25 }, + { "interface-mtu", "S", &dhcp_universe, 26 }, + { "all-subnets-local", "f", &dhcp_universe, 27 }, + { "broadcast-address", "I", &dhcp_universe, 28 }, + { "perform-mask-discovery", "f", &dhcp_universe, 29 }, + { "mask-supplier", "f", &dhcp_universe, 30 }, + { "router-discovery", "f", &dhcp_universe, 31 }, + { "router-solicitation-address", "I", &dhcp_universe, 32 }, + { "static-routes", "IIA", &dhcp_universe, 33 }, + { "trailer-encapsulation", "f", &dhcp_universe, 34 }, + { "arp-cache-timeout", "L", &dhcp_universe, 35 }, + { "ieee802-3-encapsulation", "f", &dhcp_universe, 36 }, + { "default-tcp-ttl", "B", &dhcp_universe, 37 }, + { "tcp-keepalive-interval", "L", &dhcp_universe, 38 }, + { "tcp-keepalive-garbage", "f", &dhcp_universe, 39 }, + { "nis-domain", "t", &dhcp_universe, 40 }, + { "nis-servers", "IA", &dhcp_universe, 41 }, + { "ntp-servers", "IA", &dhcp_universe, 42 }, + { "vendor-encapsulated-options", "X", &dhcp_universe, 43 }, + { "netbios-name-servers", "IA", &dhcp_universe, 44 }, + { "netbios-dd-server", "IA", &dhcp_universe, 45 }, + { "netbios-node-type", "B", &dhcp_universe, 46 }, + { "netbios-scope", "t", &dhcp_universe, 47 }, + { "font-servers", "IA", &dhcp_universe, 48 }, + { "x-display-manager", "IA", &dhcp_universe, 49 }, + { "dhcp-requested-address", "I", &dhcp_universe, 50 }, + { "dhcp-lease-time", "L", &dhcp_universe, 51 }, + { "dhcp-option-overload", "B", &dhcp_universe, 52 }, + { "dhcp-message-type", "B", &dhcp_universe, 53 }, + { "dhcp-server-identifier", "I", &dhcp_universe, 54 }, + { "dhcp-parameter-request-list", "BA", &dhcp_universe, 55 }, + { "dhcp-message", "t", &dhcp_universe, 56 }, + { "dhcp-max-message-size", "S", &dhcp_universe, 57 }, + { "dhcp-renewal-time", "L", &dhcp_universe, 58 }, + { "dhcp-rebinding-time", "L", &dhcp_universe, 59 }, + { "dhcp-class-identifier", "t", &dhcp_universe, 60 }, + { "dhcp-client-identifier", "X", &dhcp_universe, 61 }, + { "option-62", "X", &dhcp_universe, 62 }, + { "option-63", "X", &dhcp_universe, 63 }, + { "nisplus-domain", "t", &dhcp_universe, 64 }, + { "nisplus-servers", "IA", &dhcp_universe, 65 }, + { "tftp-server-name", "t", &dhcp_universe, 66 }, + { "bootfile-name", "t", &dhcp_universe, 67 }, + { "mobile-ip-home-agent", "IA", &dhcp_universe, 68 }, + { "smtp-server", "IA", &dhcp_universe, 69 }, + { "pop-server", "IA", &dhcp_universe, 70 }, + { "nntp-server", "IA", &dhcp_universe, 71 }, + { "www-server", "IA", &dhcp_universe, 72 }, + { "finger-server", "IA", &dhcp_universe, 73 }, + { "irc-server", "IA", &dhcp_universe, 74 }, + { "streettalk-server", "IA", &dhcp_universe, 75 }, + { "streettalk-directory-assistance-server", "IA", &dhcp_universe, 76 }, + { "user-class", "t", &dhcp_universe, 77 }, + { "option-78", "X", &dhcp_universe, 78 }, + { "option-79", "X", &dhcp_universe, 79 }, + { "option-80", "X", &dhcp_universe, 80 }, + { "option-81", "X", &dhcp_universe, 81 }, + { "option-82", "X", &dhcp_universe, 82 }, + { "option-83", "X", &dhcp_universe, 83 }, + { "option-84", "X", &dhcp_universe, 84 }, + { "nds-servers", "IA", &dhcp_universe, 85 }, + { "nds-tree-name", "X", &dhcp_universe, 86 }, + { "nds-context", "X", &dhcp_universe, 87 }, + { "option-88", "X", &dhcp_universe, 88 }, + { "option-89", "X", &dhcp_universe, 89 }, + { "option-90", "X", &dhcp_universe, 90 }, + { "option-91", "X", &dhcp_universe, 91 }, + { "option-92", "X", &dhcp_universe, 92 }, + { "option-93", "X", &dhcp_universe, 93 }, + { "option-94", "X", &dhcp_universe, 94 }, + { "option-95", "X", &dhcp_universe, 95 }, + { "option-96", "X", &dhcp_universe, 96 }, + { "option-97", "X", &dhcp_universe, 97 }, + { "option-98", "X", &dhcp_universe, 98 }, + { "option-99", "X", &dhcp_universe, 99 }, + { "option-100", "X", &dhcp_universe, 100 }, + { "option-101", "X", &dhcp_universe, 101 }, + { "option-102", "X", &dhcp_universe, 102 }, + { "option-103", "X", &dhcp_universe, 103 }, + { "option-104", "X", &dhcp_universe, 104 }, + { "option-105", "X", &dhcp_universe, 105 }, + { "option-106", "X", &dhcp_universe, 106 }, + { "option-107", "X", &dhcp_universe, 107 }, + { "option-108", "X", &dhcp_universe, 108 }, + { "option-109", "X", &dhcp_universe, 109 }, + { "option-110", "X", &dhcp_universe, 110 }, + { "option-111", "X", &dhcp_universe, 111 }, + { "option-112", "X", &dhcp_universe, 112 }, + { "option-113", "X", &dhcp_universe, 113 }, + { "option-114", "X", &dhcp_universe, 114 }, + { "option-115", "X", &dhcp_universe, 115 }, + { "option-116", "X", &dhcp_universe, 116 }, + { "option-117", "X", &dhcp_universe, 117 }, + { "option-118", "X", &dhcp_universe, 118 }, + { "option-119", "X", &dhcp_universe, 119 }, + { "option-120", "X", &dhcp_universe, 120 }, + { "option-121", "X", &dhcp_universe, 121 }, + { "option-122", "X", &dhcp_universe, 122 }, + { "option-123", "X", &dhcp_universe, 123 }, + { "option-124", "X", &dhcp_universe, 124 }, + { "option-125", "X", &dhcp_universe, 125 }, + { "option-126", "X", &dhcp_universe, 126 }, + { "option-127", "X", &dhcp_universe, 127 }, + { "option-128", "X", &dhcp_universe, 128 }, + { "option-129", "X", &dhcp_universe, 129 }, + { "option-130", "X", &dhcp_universe, 130 }, + { "option-131", "X", &dhcp_universe, 131 }, + { "option-132", "X", &dhcp_universe, 132 }, + { "option-133", "X", &dhcp_universe, 133 }, + { "option-134", "X", &dhcp_universe, 134 }, + { "option-135", "X", &dhcp_universe, 135 }, + { "option-136", "X", &dhcp_universe, 136 }, + { "option-137", "X", &dhcp_universe, 137 }, + { "option-138", "X", &dhcp_universe, 138 }, + { "option-139", "X", &dhcp_universe, 139 }, + { "option-140", "X", &dhcp_universe, 140 }, + { "option-141", "X", &dhcp_universe, 141 }, + { "option-142", "X", &dhcp_universe, 142 }, + { "option-143", "X", &dhcp_universe, 143 }, + { "option-144", "X", &dhcp_universe, 144 }, + { "option-145", "X", &dhcp_universe, 145 }, + { "option-146", "X", &dhcp_universe, 146 }, + { "option-147", "X", &dhcp_universe, 147 }, + { "option-148", "X", &dhcp_universe, 148 }, + { "option-149", "X", &dhcp_universe, 149 }, + { "option-150", "X", &dhcp_universe, 150 }, + { "option-151", "X", &dhcp_universe, 151 }, + { "option-152", "X", &dhcp_universe, 152 }, + { "option-153", "X", &dhcp_universe, 153 }, + { "option-154", "X", &dhcp_universe, 154 }, + { "option-155", "X", &dhcp_universe, 155 }, + { "option-156", "X", &dhcp_universe, 156 }, + { "option-157", "X", &dhcp_universe, 157 }, + { "option-158", "X", &dhcp_universe, 158 }, + { "option-159", "X", &dhcp_universe, 159 }, + { "option-160", "X", &dhcp_universe, 160 }, + { "option-161", "X", &dhcp_universe, 161 }, + { "option-162", "X", &dhcp_universe, 162 }, + { "option-163", "X", &dhcp_universe, 163 }, + { "option-164", "X", &dhcp_universe, 164 }, + { "option-165", "X", &dhcp_universe, 165 }, + { "option-166", "X", &dhcp_universe, 166 }, + { "option-167", "X", &dhcp_universe, 167 }, + { "option-168", "X", &dhcp_universe, 168 }, + { "option-169", "X", &dhcp_universe, 169 }, + { "option-170", "X", &dhcp_universe, 170 }, + { "option-171", "X", &dhcp_universe, 171 }, + { "option-172", "X", &dhcp_universe, 172 }, + { "option-173", "X", &dhcp_universe, 173 }, + { "option-174", "X", &dhcp_universe, 174 }, + { "option-175", "X", &dhcp_universe, 175 }, + { "option-176", "X", &dhcp_universe, 176 }, + { "option-177", "X", &dhcp_universe, 177 }, + { "option-178", "X", &dhcp_universe, 178 }, + { "option-179", "X", &dhcp_universe, 179 }, + { "option-180", "X", &dhcp_universe, 180 }, + { "option-181", "X", &dhcp_universe, 181 }, + { "option-182", "X", &dhcp_universe, 182 }, + { "option-183", "X", &dhcp_universe, 183 }, + { "option-184", "X", &dhcp_universe, 184 }, + { "option-185", "X", &dhcp_universe, 185 }, + { "option-186", "X", &dhcp_universe, 186 }, + { "option-187", "X", &dhcp_universe, 187 }, + { "option-188", "X", &dhcp_universe, 188 }, + { "option-189", "X", &dhcp_universe, 189 }, + { "option-190", "X", &dhcp_universe, 190 }, + { "option-191", "X", &dhcp_universe, 191 }, + { "option-192", "X", &dhcp_universe, 192 }, + { "option-193", "X", &dhcp_universe, 193 }, + { "option-194", "X", &dhcp_universe, 194 }, + { "option-195", "X", &dhcp_universe, 195 }, + { "option-196", "X", &dhcp_universe, 196 }, + { "option-197", "X", &dhcp_universe, 197 }, + { "option-198", "X", &dhcp_universe, 198 }, + { "option-199", "X", &dhcp_universe, 199 }, + { "option-200", "X", &dhcp_universe, 200 }, + { "option-201", "X", &dhcp_universe, 201 }, + { "option-202", "X", &dhcp_universe, 202 }, + { "option-203", "X", &dhcp_universe, 203 }, + { "option-204", "X", &dhcp_universe, 204 }, + { "option-205", "X", &dhcp_universe, 205 }, + { "option-206", "X", &dhcp_universe, 206 }, + { "option-207", "X", &dhcp_universe, 207 }, + { "option-208", "X", &dhcp_universe, 208 }, + { "option-209", "X", &dhcp_universe, 209 }, + { "option-210", "X", &dhcp_universe, 210 }, + { "option-211", "X", &dhcp_universe, 211 }, + { "option-212", "X", &dhcp_universe, 212 }, + { "option-213", "X", &dhcp_universe, 213 }, + { "option-214", "X", &dhcp_universe, 214 }, + { "option-215", "X", &dhcp_universe, 215 }, + { "option-216", "X", &dhcp_universe, 216 }, + { "option-217", "X", &dhcp_universe, 217 }, + { "option-218", "X", &dhcp_universe, 218 }, + { "option-219", "X", &dhcp_universe, 219 }, + { "option-220", "X", &dhcp_universe, 220 }, + { "option-221", "X", &dhcp_universe, 221 }, + { "option-222", "X", &dhcp_universe, 222 }, + { "option-223", "X", &dhcp_universe, 223 }, + { "option-224", "X", &dhcp_universe, 224 }, + { "option-225", "X", &dhcp_universe, 225 }, + { "option-226", "X", &dhcp_universe, 226 }, + { "option-227", "X", &dhcp_universe, 227 }, + { "option-228", "X", &dhcp_universe, 228 }, + { "option-229", "X", &dhcp_universe, 229 }, + { "option-230", "X", &dhcp_universe, 230 }, + { "option-231", "X", &dhcp_universe, 231 }, + { "option-232", "X", &dhcp_universe, 232 }, + { "option-233", "X", &dhcp_universe, 233 }, + { "option-234", "X", &dhcp_universe, 234 }, + { "option-235", "X", &dhcp_universe, 235 }, + { "option-236", "X", &dhcp_universe, 236 }, + { "option-237", "X", &dhcp_universe, 237 }, + { "option-238", "X", &dhcp_universe, 238 }, + { "option-239", "X", &dhcp_universe, 239 }, + { "option-240", "X", &dhcp_universe, 240 }, + { "option-241", "X", &dhcp_universe, 241 }, + { "option-242", "X", &dhcp_universe, 242 }, + { "option-243", "X", &dhcp_universe, 243 }, + { "option-244", "X", &dhcp_universe, 244 }, + { "option-245", "X", &dhcp_universe, 245 }, + { "option-246", "X", &dhcp_universe, 246 }, + { "option-247", "X", &dhcp_universe, 247 }, + { "option-248", "X", &dhcp_universe, 248 }, + { "option-249", "X", &dhcp_universe, 249 }, + { "option-250", "X", &dhcp_universe, 250 }, + { "option-251", "X", &dhcp_universe, 251 }, + { "option-252", "X", &dhcp_universe, 252 }, + { "option-253", "X", &dhcp_universe, 253 }, + { "option-254", "X", &dhcp_universe, 254 }, + { "option-end", "e", &dhcp_universe, 255 }, +}; + +/* Default dhcp option priority list (this is ad hoc and should not be + mistaken for a carefully crafted and optimized list). */ +unsigned char dhcp_option_default_priority_list [] = { + DHO_DHCP_REQUESTED_ADDRESS, + DHO_DHCP_OPTION_OVERLOAD, + DHO_DHCP_MAX_MESSAGE_SIZE, + DHO_DHCP_RENEWAL_TIME, + DHO_DHCP_REBINDING_TIME, + DHO_DHCP_CLASS_IDENTIFIER, + DHO_DHCP_CLIENT_IDENTIFIER, + DHO_SUBNET_MASK, + DHO_TIME_OFFSET, + DHO_ROUTERS, + DHO_TIME_SERVERS, + DHO_NAME_SERVERS, + DHO_DOMAIN_NAME_SERVERS, + DHO_HOST_NAME, + DHO_LOG_SERVERS, + DHO_COOKIE_SERVERS, + DHO_LPR_SERVERS, + DHO_IMPRESS_SERVERS, + DHO_RESOURCE_LOCATION_SERVERS, + DHO_HOST_NAME, + DHO_BOOT_SIZE, + DHO_MERIT_DUMP, + DHO_DOMAIN_NAME, + DHO_SWAP_SERVER, + DHO_ROOT_PATH, + DHO_EXTENSIONS_PATH, + DHO_IP_FORWARDING, + DHO_NON_LOCAL_SOURCE_ROUTING, + DHO_POLICY_FILTER, + DHO_MAX_DGRAM_REASSEMBLY, + DHO_DEFAULT_IP_TTL, + DHO_PATH_MTU_AGING_TIMEOUT, + DHO_PATH_MTU_PLATEAU_TABLE, + DHO_INTERFACE_MTU, + DHO_ALL_SUBNETS_LOCAL, + DHO_BROADCAST_ADDRESS, + DHO_PERFORM_MASK_DISCOVERY, + DHO_MASK_SUPPLIER, + DHO_ROUTER_DISCOVERY, + DHO_ROUTER_SOLICITATION_ADDRESS, + DHO_STATIC_ROUTES, + DHO_TRAILER_ENCAPSULATION, + DHO_ARP_CACHE_TIMEOUT, + DHO_IEEE802_3_ENCAPSULATION, + DHO_DEFAULT_TCP_TTL, + DHO_TCP_KEEPALIVE_INTERVAL, + DHO_TCP_KEEPALIVE_GARBAGE, + DHO_NIS_DOMAIN, + DHO_NIS_SERVERS, + DHO_NTP_SERVERS, + DHO_VENDOR_ENCAPSULATED_OPTIONS, + DHO_NETBIOS_NAME_SERVERS, + DHO_NETBIOS_DD_SERVER, + DHO_NETBIOS_NODE_TYPE, + DHO_NETBIOS_SCOPE, + DHO_FONT_SERVERS, + DHO_X_DISPLAY_MANAGER, + DHO_DHCP_PARAMETER_REQUEST_LIST, + + /* Presently-undefined options... */ + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, +}; + +int sizeof_dhcp_option_default_priority_list = + sizeof dhcp_option_default_priority_list; + + +char *hardware_types [] = { + "unknown-0", + "ethernet", + "unknown-2", + "unknown-3", + "unknown-4", + "unknown-5", + "token-ring", + "unknown-7", + "fddi", + "unknown-9", + "unknown-10", + "unknown-11", + "unknown-12", + "unknown-13", + "unknown-14", + "unknown-15", + "unknown-16", + "unknown-17", + "unknown-18", + "unknown-19", + "unknown-20", + "unknown-21", + "unknown-22", + "unknown-23", + "unknown-24", + "unknown-25", + "unknown-26", + "unknown-27", + "unknown-28", + "unknown-29", + "unknown-30", + "unknown-31", + "unknown-32", + "unknown-33", + "unknown-34", + "unknown-35", + "unknown-36", + "unknown-37", + "unknown-38", + "unknown-39", + "unknown-40", + "unknown-41", + "unknown-42", + "unknown-43", + "unknown-44", + "unknown-45", + "unknown-46", + "unknown-47", + "unknown-48", + "unknown-49", + "unknown-50", + "unknown-51", + "unknown-52", + "unknown-53", + "unknown-54", + "unknown-55", + "unknown-56", + "unknown-57", + "unknown-58", + "unknown-59", + "unknown-60", + "unknown-61", + "unknown-62", + "unknown-63", + "unknown-64", + "unknown-65", + "unknown-66", + "unknown-67", + "unknown-68", + "unknown-69", + "unknown-70", + "unknown-71", + "unknown-72", + "unknown-73", + "unknown-74", + "unknown-75", + "unknown-76", + "unknown-77", + "unknown-78", + "unknown-79", + "unknown-80", + "unknown-81", + "unknown-82", + "unknown-83", + "unknown-84", + "unknown-85", + "unknown-86", + "unknown-87", + "unknown-88", + "unknown-89", + "unknown-90", + "unknown-91", + "unknown-92", + "unknown-93", + "unknown-94", + "unknown-95", + "unknown-96", + "unknown-97", + "unknown-98", + "unknown-99", + "unknown-100", + "unknown-101", + "unknown-102", + "unknown-103", + "unknown-104", + "unknown-105", + "unknown-106", + "unknown-107", + "unknown-108", + "unknown-109", + "unknown-110", + "unknown-111", + "unknown-112", + "unknown-113", + "unknown-114", + "unknown-115", + "unknown-116", + "unknown-117", + "unknown-118", + "unknown-119", + "unknown-120", + "unknown-121", + "unknown-122", + "unknown-123", + "unknown-124", + "unknown-125", + "unknown-126", + "unknown-127", + "unknown-128", + "unknown-129", + "unknown-130", + "unknown-131", + "unknown-132", + "unknown-133", + "unknown-134", + "unknown-135", + "unknown-136", + "unknown-137", + "unknown-138", + "unknown-139", + "unknown-140", + "unknown-141", + "unknown-142", + "unknown-143", + "unknown-144", + "unknown-145", + "unknown-146", + "unknown-147", + "unknown-148", + "unknown-149", + "unknown-150", + "unknown-151", + "unknown-152", + "unknown-153", + "unknown-154", + "unknown-155", + "unknown-156", + "unknown-157", + "unknown-158", + "unknown-159", + "unknown-160", + "unknown-161", + "unknown-162", + "unknown-163", + "unknown-164", + "unknown-165", + "unknown-166", + "unknown-167", + "unknown-168", + "unknown-169", + "unknown-170", + "unknown-171", + "unknown-172", + "unknown-173", + "unknown-174", + "unknown-175", + "unknown-176", + "unknown-177", + "unknown-178", + "unknown-179", + "unknown-180", + "unknown-181", + "unknown-182", + "unknown-183", + "unknown-184", + "unknown-185", + "unknown-186", + "unknown-187", + "unknown-188", + "unknown-189", + "unknown-190", + "unknown-191", + "unknown-192", + "unknown-193", + "unknown-194", + "unknown-195", + "unknown-196", + "unknown-197", + "unknown-198", + "unknown-199", + "unknown-200", + "unknown-201", + "unknown-202", + "unknown-203", + "unknown-204", + "unknown-205", + "unknown-206", + "unknown-207", + "unknown-208", + "unknown-209", + "unknown-210", + "unknown-211", + "unknown-212", + "unknown-213", + "unknown-214", + "unknown-215", + "unknown-216", + "unknown-217", + "unknown-218", + "unknown-219", + "unknown-220", + "unknown-221", + "unknown-222", + "unknown-223", + "unknown-224", + "unknown-225", + "unknown-226", + "unknown-227", + "unknown-228", + "unknown-229", + "unknown-230", + "unknown-231", + "unknown-232", + "unknown-233", + "unknown-234", + "unknown-235", + "unknown-236", + "unknown-237", + "unknown-238", + "unknown-239", + "unknown-240", + "unknown-241", + "unknown-242", + "unknown-243", + "unknown-244", + "unknown-245", + "unknown-246", + "unknown-247", + "unknown-248", + "unknown-249", + "unknown-250", + "unknown-251", + "unknown-252", + "unknown-253", + "unknown-254", + "unknown-255" }; + + + +struct hash_table universe_hash; + +void initialize_universes() +{ + int i; + + dhcp_universe.name = "dhcp"; + dhcp_universe.hash = new_hash (); + if (!dhcp_universe.hash) + error ("Can't allocate dhcp option hash table."); + for (i = 0; i < 256; i++) { + dhcp_universe.options [i] = &dhcp_options [i]; + add_hash (dhcp_universe.hash, + (unsigned char *)dhcp_options [i].name, 0, + (unsigned char *)&dhcp_options [i]); + } + universe_hash.hash_count = DEFAULT_HASH_SIZE; + add_hash (&universe_hash, + (unsigned char *)dhcp_universe.name, 0, + (unsigned char *)&dhcp_universe); +} diff --git a/reactos/base/services/dhcp/timer.c b/reactos/base/services/dhcp/timer.c new file mode 100644 index 00000000000..ccd817188ec --- /dev/null +++ b/reactos/base/services/dhcp/timer.c @@ -0,0 +1,2 @@ +#include "rosdhcp.h" + diff --git a/reactos/base/services/dhcp/tree.c b/reactos/base/services/dhcp/tree.c new file mode 100644 index 00000000000..f721d08f897 --- /dev/null +++ b/reactos/base/services/dhcp/tree.c @@ -0,0 +1,412 @@ +/* tree.c + + Routines for manipulating parse trees... */ + +/* + * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of The Internet Software Consortium nor the names + * of its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This software has been written for the Internet Software Consortium + * by Ted Lemon in cooperation with Vixie + * Enterprises. To learn more about the Internet Software Consortium, + * see ``http://www.vix.com/isc''. To learn more about Vixie + * Enterprises, see ``http://www.vix.com''. + */ + +#ifndef lint +static char copyright[] = +"$Id: tree.c,v 1.10 1997/05/09 08:14:57 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n"; +#endif /* not lint */ + +#include "rosdhcp.h" + +static TIME tree_evaluate_recurse PROTO ((int *, unsigned char **, int *, + struct tree *)); +static TIME do_host_lookup PROTO ((int *, unsigned char **, int *, + struct dns_host_entry *)); +static void do_data_copy PROTO ((int *, unsigned char **, int *, + unsigned char *, int)); + +pair cons (car, cdr) + caddr_t car; + pair cdr; +{ + pair foo = (pair)dmalloc (sizeof *foo, "cons"); + if (!foo) + error ("no memory for cons."); + foo -> car = car; + foo -> cdr = cdr; + return foo; +} + +struct tree_cache *tree_cache (tree) + struct tree *tree; +{ + struct tree_cache *tc; + + tc = new_tree_cache ("tree_cache"); + if (!tc) + return 0; + tc -> value = (unsigned char *)0; + tc -> len = tc -> buf_size = 0; + tc -> timeout = 0; + tc -> tree = tree; + return tc; +} + +struct tree *tree_host_lookup (name) + char *name; +{ + struct tree *nt; + nt = new_tree ("tree_host_lookup"); + if (!nt) + error ("No memory for host lookup tree node."); + nt -> op = TREE_HOST_LOOKUP; + nt -> data.host_lookup.host = enter_dns_host (name); + return nt; +} + +struct dns_host_entry *enter_dns_host (name) + char *name; +{ + struct dns_host_entry *dh; + + if (!(dh = (struct dns_host_entry *)dmalloc + (sizeof (struct dns_host_entry), "enter_dns_host")) + || !(dh -> hostname = dmalloc (strlen (name) + 1, + "enter_dns_host"))) + error ("Can't allocate space for new host."); + strcpy (dh -> hostname, name); + dh -> data = (unsigned char *)0; + dh -> data_len = 0; + dh -> buf_len = 0; + dh -> timeout = 0; + return dh; +} + +struct tree *tree_const (data, len) + unsigned char *data; + int len; +{ + struct tree *nt; + if (!(nt = new_tree ("tree_const")) + || !(nt -> data.const_val.data = + (unsigned char *)dmalloc (len, "tree_const"))) + error ("No memory for constant data tree node."); + nt -> op = TREE_CONST; + memcpy (nt -> data.const_val.data, data, len); + nt -> data.const_val.len = len; + return nt; +} + +struct tree *tree_concat (left, right) + struct tree *left, *right; +{ + struct tree *nt; + + /* If we're concatenating a null tree to a non-null tree, just + return the non-null tree; if both trees are null, return + a null tree. */ + if (!left) + return right; + if (!right) + return left; + + /* If both trees are constant, combine them. */ + if (left -> op == TREE_CONST && right -> op == TREE_CONST) { + unsigned char *buf = dmalloc (left -> data.const_val.len + + right -> data.const_val.len, + "tree_concat"); + if (!buf) + error ("No memory to concatenate constants."); + memcpy (buf, left -> data.const_val.data, + left -> data.const_val.len); + memcpy (buf + left -> data.const_val.len, + right -> data.const_val.data, + right -> data.const_val.len); + dfree (left -> data.const_val.data, "tree_concat"); + dfree (right -> data.const_val.data, "tree_concat"); + left -> data.const_val.data = buf; + left -> data.const_val.len += right -> data.const_val.len; + free_tree (right, "tree_concat"); + return left; + } + + /* Otherwise, allocate a new node to concatenate the two. */ + if (!(nt = new_tree ("tree_concat"))) + error ("No memory for data tree concatenation node."); + nt -> op = TREE_CONCAT; + nt -> data.concat.left = left; + nt -> data.concat.right = right; + return nt; +} + +struct tree *tree_limit (tree, limit) + struct tree *tree; + int limit; +{ + struct tree *rv; + + /* If the tree we're limiting is constant, limit it now. */ + if (tree -> op == TREE_CONST) { + if (tree -> data.const_val.len > limit) + tree -> data.const_val.len = limit; + return tree; + } + + /* Otherwise, put in a node which enforces the limit on evaluation. */ + rv = new_tree ("tree_limit"); + if (!rv) + return (struct tree *)0; + rv -> op = TREE_LIMIT; + rv -> data.limit.tree = tree; + rv -> data.limit.limit = limit; + return rv; +} + +int tree_evaluate (tree_cache) + struct tree_cache *tree_cache; +{ + unsigned char *bp = tree_cache -> value; + int bc = tree_cache -> buf_size; + int bufix = 0; + + /* If there's no tree associated with this cache, it evaluates + to a constant and that was detected at startup. */ + if (!tree_cache -> tree) + return 1; + + /* Try to evaluate the tree without allocating more memory... */ + tree_cache -> timeout = tree_evaluate_recurse (&bufix, &bp, &bc, + tree_cache -> tree); + + /* No additional allocation needed? */ + if (bufix <= bc) { + tree_cache -> len = bufix; + return 1; + } + + /* If we can't allocate more memory, return with what we + have (maybe nothing). */ + if (!(bp = (unsigned char *)dmalloc (bufix, "tree_evaluate"))) + return 0; + + /* Record the change in conditions... */ + bc = bufix; + bufix = 0; + + /* Note that the size of the result shouldn't change on the + second call to tree_evaluate_recurse, since we haven't + changed the ``current'' time. */ + tree_evaluate_recurse (&bufix, &bp, &bc, tree_cache -> tree); + + /* Free the old buffer if needed, then store the new buffer + location and size and return. */ + if (tree_cache -> value) + dfree (tree_cache -> value, "tree_evaluate"); + tree_cache -> value = bp; + tree_cache -> len = bufix; + tree_cache -> buf_size = bc; + return 1; +} + +static TIME tree_evaluate_recurse (bufix, bufp, bufcount, tree) + int *bufix; + unsigned char **bufp; + int *bufcount; + struct tree *tree; +{ + int limit; + TIME t1, t2; + + switch (tree -> op) { + case TREE_CONCAT: + t1 = tree_evaluate_recurse (bufix, bufp, bufcount, + tree -> data.concat.left); + t2 = tree_evaluate_recurse (bufix, bufp, bufcount, + tree -> data.concat.right); + if (t1 > t2) + return t2; + return t1; + + case TREE_HOST_LOOKUP: + return do_host_lookup (bufix, bufp, bufcount, + tree -> data.host_lookup.host); + + case TREE_CONST: + do_data_copy (bufix, bufp, bufcount, + tree -> data.const_val.data, + tree -> data.const_val.len); + t1 = MAX_TIME; + return t1; + + case TREE_LIMIT: + limit = *bufix + tree -> data.limit.limit; + t1 = tree_evaluate_recurse (bufix, bufp, bufcount, + tree -> data.limit.tree); + *bufix = limit; + return t1; + + default: + warn ("Bad node id in tree: %d."); + t1 = MAX_TIME; + return t1; + } +} + +static TIME do_host_lookup (bufix, bufp, bufcount, dns) + int *bufix; + unsigned char **bufp; + int *bufcount; + struct dns_host_entry *dns; +{ + struct hostent *h; + int i; + int new_len; + +#ifdef DEBUG_EVAL + debug ("time: now = %d dns = %d %d diff = %d", + cur_time, dns -> timeout, cur_time - dns -> timeout); +#endif + + /* If the record hasn't timed out, just copy the data and return. */ + if (cur_time <= dns -> timeout) { +#ifdef DEBUG_EVAL + debug ("easy copy: %x %d %x", + dns -> data, dns -> data_len, + dns -> data ? *(int *)(dns -> data) : 0); +#endif + do_data_copy (bufix, bufp, bufcount, + dns -> data, dns -> data_len); + return dns -> timeout; + } +#ifdef DEBUG_EVAL + debug ("Looking up %s", dns -> hostname); +#endif + + /* Otherwise, look it up... */ + h = gethostbyname (dns -> hostname); + if (!h) { +#ifndef NO_H_ERRNO + switch (h_errno) { + case HOST_NOT_FOUND: +#endif + warn ("%s: host unknown.", dns -> hostname); +#ifndef NO_H_ERRNO + break; + case TRY_AGAIN: + warn ("%s: temporary name server failure", + dns -> hostname); + break; + case NO_RECOVERY: + warn ("%s: name server failed", dns -> hostname); + break; + case NO_DATA: + warn ("%s: no A record associated with address", + dns -> hostname); + } +#endif /* !NO_H_ERRNO */ + + /* Okay to try again after a minute. */ + return cur_time + 60; + } + +#ifdef DEBUG_EVAL + debug ("Lookup succeeded; first address is %x", + h -> h_addr_list [0]); +#endif + + /* Count the number of addresses we got... */ + for (i = 0; h -> h_addr_list [i]; i++) + ; + + /* Do we need to allocate more memory? */ + new_len = i * h -> h_length; + if (dns -> buf_len < i) { + unsigned char *buf = + (unsigned char *)dmalloc (new_len, "do_host_lookup"); + /* If we didn't get more memory, use what we have. */ + if (!buf) { + new_len = dns -> buf_len; + if (!dns -> buf_len) { + dns -> timeout = cur_time + 60; + return dns -> timeout; + } + } else { + if (dns -> data) + dfree (dns -> data, "do_host_lookup"); + dns -> data = buf; + dns -> buf_len = new_len; + } + } + + /* Addresses are conveniently stored one to the buffer, so we + have to copy them out one at a time... :'( */ + for (i = 0; i < new_len / h -> h_length; i++) { + memcpy (dns -> data + h -> h_length * i, + h -> h_addr_list [i], h -> h_length); + } +#ifdef DEBUG_EVAL + debug ("dns -> data: %x h -> h_addr_list [0]: %x", + *(int *)(dns -> data), h -> h_addr_list [0]); +#endif + dns -> data_len = new_len; + + /* Set the timeout for an hour from now. + XXX This should really use the time on the DNS reply. */ + dns -> timeout = cur_time + 3600; + +#ifdef DEBUG_EVAL + debug ("hard copy: %x %d %x", + dns -> data, dns -> data_len, *(int *)(dns -> data)); +#endif + do_data_copy (bufix, bufp, bufcount, dns -> data, dns -> data_len); + return dns -> timeout; +} + +static void do_data_copy (bufix, bufp, bufcount, data, len) + int *bufix; + unsigned char **bufp; + int *bufcount; + unsigned char *data; + int len; +{ + int space = *bufcount - *bufix; + + /* If there's more space than we need, use only what we need. */ + if (space > len) + space = len; + + /* Copy as much data as will fit, then increment the buffer index + by the amount we actually had to copy, which could be more. */ + if (space > 0) + memcpy (*bufp + *bufix, data, space); + *bufix += len; +} diff --git a/reactos/base/services/dhcp/util.c b/reactos/base/services/dhcp/util.c new file mode 100644 index 00000000000..238a788e283 --- /dev/null +++ b/reactos/base/services/dhcp/util.c @@ -0,0 +1,166 @@ +#include +#include "rosdhcp.h" + +#define NDEBUG +#include + +char *piaddr( struct iaddr addr ) { + struct sockaddr_in sa; + memcpy(&sa.sin_addr,addr.iabuf,sizeof(sa.sin_addr)); + return inet_ntoa( sa.sin_addr ); +} + +int note( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("NOTE: %s\n", buf); + + return ret; +} + +int debug( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("DEBUG: %s\n", buf); + + return ret; +} + +int warn( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("WARN: %s\n", buf); + + return ret; +} + +int warning( char *format, ... ) { + char buf[0x100]; + int ret; + va_list arg_begin; + va_start( arg_begin, format ); + + ret = _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT("WARNING: %s\n", buf); + + return ret; +} + +void error( char *format, ... ) { + char buf[0x100]; + va_list arg_begin; + va_start( arg_begin, format ); + + _vsnprintf( buf, sizeof(buf), format, arg_begin ); + + DPRINT1("ERROR: %s\n", buf); +} + +int16_t getShort( unsigned char *data ) { + return (int16_t) ntohs(*(int16_t*) data); +} + +u_int16_t getUShort( unsigned char *data ) { + return (u_int16_t) ntohs(*(u_int16_t*) data); +} + +int32_t getLong( unsigned char *data ) { + return (int32_t) ntohl(*(u_int32_t*) data); +} + +u_int32_t getULong( unsigned char *data ) { + return ntohl(*(u_int32_t*)data); +} + +int addr_eq( struct iaddr a, struct iaddr b ) { + return a.len == b.len && !memcmp( a.iabuf, b.iabuf, a.len ); +} + +void *dmalloc( int size, char *name ) { return malloc( size ); } + +int read_client_conf(struct interface_info *ifi) { + /* What a strange dance */ + struct client_config *config; + char ComputerName [MAX_COMPUTERNAME_LENGTH + 1]; + LPSTR lpCompName; + DWORD ComputerNameSize = sizeof ComputerName / sizeof ComputerName[0]; + + if ((ifi!= NULL) && (ifi->client->config != NULL)) + config = ifi->client->config; + else + { + warn("util.c read_client_conf poorly implemented!"); + return 0; + } + + + GetComputerName(ComputerName, & ComputerNameSize); + debug("Hostname: %s, length: %lu", + ComputerName, ComputerNameSize); + /* This never gets freed since it's only called once */ + lpCompName = + HeapAlloc(GetProcessHeap(), 0, ComputerNameSize + 1); + if (lpCompName !=NULL) { + memcpy(lpCompName, ComputerName, ComputerNameSize + 1); + /* Send our hostname, some dhcpds use this to update DNS */ + config->send_options[DHO_HOST_NAME].data = (u_int8_t*)lpCompName; + config->send_options[DHO_HOST_NAME].len = ComputerNameSize; + debug("Hostname: %s, length: %d", + config->send_options[DHO_HOST_NAME].data, + config->send_options[DHO_HOST_NAME].len); + } else { + error("Failed to allocate heap for hostname"); + } + /* Both Linux and Windows send this */ + config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].data = + ifi->hw_address.haddr; + config->send_options[DHO_DHCP_CLIENT_IDENTIFIER].len = + ifi->hw_address.hlen; + + /* Setup the requested option list */ + config->requested_options + [config->requested_option_count++] = DHO_SUBNET_MASK; + config->requested_options + [config->requested_option_count++] = DHO_BROADCAST_ADDRESS; + config->requested_options + [config->requested_option_count++] = DHO_TIME_OFFSET; + config->requested_options + [config->requested_option_count++] = DHO_ROUTERS; + config->requested_options + [config->requested_option_count++] = DHO_DOMAIN_NAME; + config->requested_options + [config->requested_option_count++] = DHO_DOMAIN_NAME_SERVERS; + config->requested_options + [config->requested_option_count++] = DHO_HOST_NAME; + config->requested_options + [config->requested_option_count++] = DHO_NTP_SERVERS; + + warn("util.c read_client_conf poorly implemented!"); + return 0; +} + +struct iaddr broadcast_addr( struct iaddr addr, struct iaddr mask ) { + struct iaddr bcast = { 0 }; + return bcast; +} + +struct iaddr subnet_number( struct iaddr addr, struct iaddr mask ) { + struct iaddr bcast = { 0 }; + return bcast; +} From 0a0e20e1bd7495ce4c477786396ed113a1eded17 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 21 May 2010 20:14:56 +0000 Subject: [PATCH 144/151] [DHCP/DHCPCSVC] - Restore the SVN history - Part 3 of 3 (hopefully) svn path=/trunk/; revision=47292 --- reactos/base/services/dhcp/design.txt | 33 - reactos/base/services/dhcp/dhcp.rbuild | 30 - reactos/base/services/dhcp/dhcp.rc | 6 - reactos/base/services/dhcp/dhcpmain.c | 72 -- reactos/base/services/dhcp/include/cdefs.h | 57 -- reactos/base/services/dhcp/include/dhctoken.h | 136 --- reactos/base/services/dhcp/include/inet.h | 52 - reactos/base/services/dhcp/include/osdep.h | 294 ------ reactos/base/services/dhcp/include/predec.h | 4 - reactos/base/services/dhcp/include/privsep.h | 47 - reactos/base/services/dhcp/include/site.h | 100 -- reactos/base/services/dhcp/include/stdint.h | 10 - reactos/base/services/dhcp/include/sysconf.h | 52 - reactos/base/services/dhcp/include/version.h | 3 - reactos/base/services/dhcp/memory.c | 919 ------------------ reactos/base/services/dhcp/privsep.c | 225 ----- reactos/base/services/dhcp/timer.c | 2 - .../win32/dhcpcsvc}/dhcp/adapter.c | 0 .../win32/dhcpcsvc}/dhcp/alloc.c | 0 .../win32/dhcpcsvc}/dhcp/api.c | 4 + .../win32/dhcpcsvc}/dhcp/compat.c | 0 .../win32/dhcpcsvc}/dhcp/dhclient.c | 248 +---- .../win32/dhcpcsvc}/dhcp/dispatch.c | 8 +- .../win32/dhcpcsvc}/dhcp/hash.c | 0 .../win32/dhcpcsvc}/dhcp/options.c | 0 .../win32/dhcpcsvc}/dhcp/pipe.c | 0 .../win32/dhcpcsvc}/dhcp/socket.c | 0 .../win32/dhcpcsvc}/dhcp/tables.c | 0 .../win32/dhcpcsvc}/dhcp/tree.c | 0 .../win32/dhcpcsvc}/dhcp/util.c | 0 reactos/dll/win32/dhcpcsvc/dhcpcsvc.c | 136 ++- reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild | 20 + reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec | 3 +- .../win32/dhcpcsvc}/include/debug.h | 0 .../win32/dhcpcsvc}/include/dhcp.h | 0 .../win32/dhcpcsvc}/include/dhcpd.h | 0 .../win32/dhcpcsvc}/include/hash.h | 0 .../win32/dhcpcsvc}/include/rosdhcp.h | 16 +- .../win32/dhcpcsvc}/include/tree.h | 0 39 files changed, 186 insertions(+), 2291 deletions(-) delete mode 100644 reactos/base/services/dhcp/design.txt delete mode 100644 reactos/base/services/dhcp/dhcp.rbuild delete mode 100644 reactos/base/services/dhcp/dhcp.rc delete mode 100644 reactos/base/services/dhcp/dhcpmain.c delete mode 100644 reactos/base/services/dhcp/include/cdefs.h delete mode 100644 reactos/base/services/dhcp/include/dhctoken.h delete mode 100644 reactos/base/services/dhcp/include/inet.h delete mode 100644 reactos/base/services/dhcp/include/osdep.h delete mode 100644 reactos/base/services/dhcp/include/predec.h delete mode 100644 reactos/base/services/dhcp/include/privsep.h delete mode 100644 reactos/base/services/dhcp/include/site.h delete mode 100644 reactos/base/services/dhcp/include/stdint.h delete mode 100644 reactos/base/services/dhcp/include/sysconf.h delete mode 100644 reactos/base/services/dhcp/include/version.h delete mode 100644 reactos/base/services/dhcp/memory.c delete mode 100644 reactos/base/services/dhcp/privsep.c delete mode 100644 reactos/base/services/dhcp/timer.c rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/adapter.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/alloc.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/api.c (98%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/compat.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/dhclient.c (90%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/dispatch.c (98%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/hash.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/options.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/pipe.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/socket.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/tables.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/tree.c (100%) rename reactos/{base/services => dll/win32/dhcpcsvc}/dhcp/util.c (100%) rename reactos/{base/services/dhcp => dll/win32/dhcpcsvc}/include/debug.h (100%) rename reactos/{base/services/dhcp => dll/win32/dhcpcsvc}/include/dhcp.h (100%) rename reactos/{base/services/dhcp => dll/win32/dhcpcsvc}/include/dhcpd.h (100%) rename reactos/{base/services/dhcp => dll/win32/dhcpcsvc}/include/hash.h (100%) rename reactos/{base/services/dhcp => dll/win32/dhcpcsvc}/include/rosdhcp.h (92%) rename reactos/{base/services/dhcp => dll/win32/dhcpcsvc}/include/tree.h (100%) diff --git a/reactos/base/services/dhcp/design.txt b/reactos/base/services/dhcp/design.txt deleted file mode 100644 index 17c9a29194b..00000000000 --- a/reactos/base/services/dhcp/design.txt +++ /dev/null @@ -1,33 +0,0 @@ -Acknowledgements: - - Tinus provided the initial port of these dhclient file. - -Ok I need these things: - -1) Adapter concept thingy - - Needs a name and index - Current IP address etc - interface_info - - Must be able to get one from an adapter index or name - Must query the ip address and such - Must be able to set the address - -2) System state doodad - - List of adapters - List of parameter changes - List of persistent stuff - - Must be able to initialize from the registry - (persistent stuff, some adapter info) - Save changes to persistent set - -3) Parameter change set - - TODO - -4) Persistent queries - - TODO \ No newline at end of file diff --git a/reactos/base/services/dhcp/dhcp.rbuild b/reactos/base/services/dhcp/dhcp.rbuild deleted file mode 100644 index ffa05b78465..00000000000 --- a/reactos/base/services/dhcp/dhcp.rbuild +++ /dev/null @@ -1,30 +0,0 @@ - - - - . - include - - ntdll - ws2_32 - iphlpapi - advapi32 - oldnames - adapter.c - alloc.c - api.c - compat.c - dhclient.c - dispatch.c - hash.c - options.c - pipe.c - privsep.c - socket.c - tables.c - timer.c - util.c - dhcp.rc - - rosdhcp.h - - diff --git a/reactos/base/services/dhcp/dhcp.rc b/reactos/base/services/dhcp/dhcp.rc deleted file mode 100644 index 35e404f893e..00000000000 --- a/reactos/base/services/dhcp/dhcp.rc +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id: regsvr32.rc 12852 2005-01-06 13:58:04Z mf $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "DHCP Client Service" -#define REACTOS_STR_INTERNAL_NAME "dhcp\0" -#define REACTOS_STR_ORIGINAL_FILENAME "dhcp.exe\0" -#include diff --git a/reactos/base/services/dhcp/dhcpmain.c b/reactos/base/services/dhcp/dhcpmain.c deleted file mode 100644 index c1a1b30328e..00000000000 --- a/reactos/base/services/dhcp/dhcpmain.c +++ /dev/null @@ -1,72 +0,0 @@ -/* $Id:$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS Service - * FILE: subsys/system/dhcp - * PURPOSE: DHCP client service entry point - * PROGRAMMER: Art Yerkes (arty@users.sf.net) - * UPDATE HISTORY: - * Created 03/08/2005 - */ - -#include -#include "dhcpd.h" -#include "version.h" - -typedef struct _DHCP_API_REQUEST { - int type; - UINT flags; - LPDHCPAPI_CLASSID class_id; - DHCP_API_PARAMS_ARRAY vendor_params; - DHCP_API_PARAMS_ARRAY general_params; - LPWSTR request_id, adapter_name; -} DHCP_API_REQUEST; - -typedef struct _DHCP_MANAGED_ADAPTER { - LPWSTR adapter_name, hostname, dns_server; - UINT adapter_index; - struct sockaddr_in address, netmask; - struct interface_info *dhcp_info; -} DHCP_MANAGED_ADAPTER; - -#define DHCP_REQUESTPARAM WM_USER + 0 -#define DHCP_PARAMCHANGE WM_USER + 1 -#define DHCP_CANCELREQUEST WM_USER + 2 -#define DHCP_NOPARAMCHANGE WM_USER + 3 -#define DHCP_MANAGEADAPTER WM_USER + 4 -#define DHCP_UNMANAGEADAPTER WM_USER + 5 - -UINT DhcpEventTimer; -HANDLE DhcpServiceThread; -DWORD DhcpServiceThreadId; -LIST_ENTRY ManagedAdapters; - -LRESULT WINAPI ServiceThread( PVOID Data ) { - MSG msg; - - while( GetMessage( &msg, 0, 0, 0 ) ) { - switch( msg.message ) { - case DHCP_MANAGEADAPTER: - - break; - - case DHCP_UNMANAGEADAPTER: - break; - - case DHCP_REQUESTPARAM: - break; - - case DHCP_CANCELREQUEST: - break; - - case DHCP_PARAMCHANGE: - break; - - case DHCP_NOPARAMCHANGE: - break; - } - } -} - -int main( int argc, char **argv ) { -} diff --git a/reactos/base/services/dhcp/include/cdefs.h b/reactos/base/services/dhcp/include/cdefs.h deleted file mode 100644 index 2bc67a5251a..00000000000 --- a/reactos/base/services/dhcp/include/cdefs.h +++ /dev/null @@ -1,57 +0,0 @@ -/* cdefs.h - - Standard C definitions... */ - -/* - * Copyright (c) 1996 The Internet Software Consortium. - * All Rights Reserved. - * Copyright (c) 1995 RadioMail Corporation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of RadioMail Corporation, the Internet Software - * Consortium nor the names of its contributors may be used to endorse - * or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY RADIOMAIL CORPORATION, THE INTERNET - * SOFTWARE CONSORTIUM AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL RADIOMAIL CORPORATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software was written for RadioMail Corporation by Ted Lemon - * under a contract with Vixie Enterprises. Further modifications have - * been made for the Internet Software Consortium under a contract - * with Vixie Laboratories. - */ - -#if (defined (__GNUC__) || defined (__STDC__)) && !defined (BROKEN_ANSI) -#define PROTO(x) x -#define KandR(x) -#define ANSI_DECL(x) x -#if defined (__GNUC__) -#define INLINE inline -#else -#define INLINE -#endif /* __GNUC__ */ -#else -#define PROTO(x) () -#define KandR(x) x -#define ANSI_DECL(x) -#define INLINE -#endif /* __GNUC__ || __STDC__ */ diff --git a/reactos/base/services/dhcp/include/dhctoken.h b/reactos/base/services/dhcp/include/dhctoken.h deleted file mode 100644 index 2aeb5303af1..00000000000 --- a/reactos/base/services/dhcp/include/dhctoken.h +++ /dev/null @@ -1,136 +0,0 @@ -/* dhctoken.h - - Tokens for config file lexer and parser. */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998, 1999 - * The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define SEMI ';' -#define DOT '.' -#define COLON ':' -#define COMMA ',' -#define SLASH '/' -#define LBRACE '{' -#define RBRACE '}' - -#define FIRST_TOKEN HOST -#define HOST 256 -#define HARDWARE 257 -#define FILENAME 258 -#define FIXED_ADDR 259 -#define OPTION 260 -#define ETHERNET 261 -#define STRING 262 -#define NUMBER 263 -#define NUMBER_OR_NAME 264 -#define NAME 265 -#define TIMESTAMP 266 -#define STARTS 267 -#define ENDS 268 -#define UID 269 -#define CLASS 270 -#define LEASE 271 -#define RANGE 272 -#define PACKET 273 -#define CIADDR 274 -#define YIADDR 275 -#define SIADDR 276 -#define GIADDR 277 -#define SUBNET 278 -#define NETMASK 279 -#define DEFAULT_LEASE_TIME 280 -#define MAX_LEASE_TIME 281 -#define VENDOR_CLASS 282 -#define USER_CLASS 283 -#define SHARED_NETWORK 284 -#define SERVER_NAME 285 -#define DYNAMIC_BOOTP 286 -#define SERVER_IDENTIFIER 287 -#define DYNAMIC_BOOTP_LEASE_CUTOFF 288 -#define DYNAMIC_BOOTP_LEASE_LENGTH 289 -#define BOOT_UNKNOWN_CLIENTS 290 -#define NEXT_SERVER 291 -#define TOKEN_RING 292 -#define GROUP 293 -#define ONE_LEASE_PER_CLIENT 294 -#define GET_LEASE_HOSTNAMES 295 -#define USE_HOST_DECL_NAMES 296 -#define SEND 297 -#define CLIENT_IDENTIFIER 298 -#define REQUEST 299 -#define REQUIRE 300 -#define TIMEOUT 301 -#define RETRY 302 -#define SELECT_TIMEOUT 303 -#define SCRIPT 304 -#define INTERFACE 305 -#define RENEW 306 -#define REBIND 307 -#define EXPIRE 308 -#define UNKNOWN_CLIENTS 309 -#define ALLOW 310 -#define BOOTP 311 -#define DENY 312 -#define BOOTING 313 -#define DEFAULT 314 -#define MEDIA 315 -#define MEDIUM 316 -#define ALIAS 317 -#define REBOOT 318 -#define ABANDONED 319 -#define BACKOFF_CUTOFF 320 -#define INITIAL_INTERVAL 321 -#define NAMESERVER 322 -#define DOMAIN 323 -#define SEARCH 324 -#define SUPERSEDE 325 -#define APPEND 326 -#define PREPEND 327 -#define HOSTNAME 328 -#define CLIENT_HOSTNAME 329 -#define REJECT 330 -#define FDDI 331 -#define USE_LEASE_ADDR_FOR_DEFAULT_ROUTE 332 -#define AUTHORITATIVE 333 -#define TOKEN_NOT 334 -#define ALWAYS_REPLY_RFC1048 335 - -#define is_identifier(x) ((x) >= FIRST_TOKEN && \ - (x) != STRING && \ - (x) != NUMBER && \ - (x) != EOF) diff --git a/reactos/base/services/dhcp/include/inet.h b/reactos/base/services/dhcp/include/inet.h deleted file mode 100644 index a45f92265de..00000000000 --- a/reactos/base/services/dhcp/include/inet.h +++ /dev/null @@ -1,52 +0,0 @@ -/* inet.h - - Portable definitions for internet addresses */ - -/* - * Copyright (c) 1996 The Internet Software Consortium. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -/* An internet address of up to 128 bits. */ - -typedef struct _iaddr { - int len; - unsigned char iabuf [16]; -} iaddr; - -typedef struct _iaddrlist { - struct _iaddrlist *next; - iaddr addr; -} iaddrlist; diff --git a/reactos/base/services/dhcp/include/osdep.h b/reactos/base/services/dhcp/include/osdep.h deleted file mode 100644 index 71a985980e1..00000000000 --- a/reactos/base/services/dhcp/include/osdep.h +++ /dev/null @@ -1,294 +0,0 @@ -/* osdep.h - - Operating system dependencies... */ - -/* - * Copyright (c) 1996, 1997, 1998, 1999 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE INTERNET SOFTWARE CONSORTIUM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This software was written for the Internet Software Consortium by Ted Lemon - * under a contract with Vixie Laboratories. - */ - -#include "site.h" - -/* Porting:: - - If you add a new network API, you must add a check for it below: */ - -#if !defined (USE_SOCKETS) && \ - !defined (USE_SOCKET_SEND) && \ - !defined (USE_SOCKET_RECEIVE) && \ - !defined (USE_RAW_SOCKETS) && \ - !defined (USE_RAW_SEND) && \ - !defined (USE_SOCKET_RECEIVE) && \ - !defined (USE_BPF) && \ - !defined (USE_BPF_SEND) && \ - !defined (USE_BPF_RECEIVE) && \ - !defined (USE_LPF) && \ - !defined (USE_LPF_SEND) && \ - !defined (USE_LPF_RECEIVE) && \ - !defined (USE_NIT) && \ - !defined (USE_NIT_SEND) && \ - !defined (USE_NIT_RECEIVE) && \ - !defined (USR_DLPI_SEND) && \ - !defined (USE_DLPI_RECEIVE) -# define USE_DEFAULT_NETWORK -#endif - - -/* Porting:: - - If you add a new system configuration file, include it here: */ - -#if defined (sun) -# if defined (__svr4__) || defined (__SVR4) -# include "cf/sunos5-5.h" -# else -# include "cf/sunos4.h" -# endif -#endif - -#ifdef aix -# include "cf/aix.h" -#endif - -#ifdef bsdi -# include "cf/bsdos.h" -#endif - -#ifdef __NetBSD__ -# include "cf/netbsd.h" -#endif - -#ifdef __FreeBSD__ -# include "cf/freebsd.h" -#endif - -#if defined (__osf__) && defined (__alpha) -# include "cf/alphaosf.h" -#endif - -#ifdef ultrix -# include "cf/ultrix.h" -#endif - -#ifdef linux -# include "cf/linux.h" -#endif - -#ifdef SCO -# include "cf/sco.h" -#endif - -#if defined (hpux) || defined (__hpux) -# include "cf/hpux.h" -#endif - -#ifdef __QNX__ -# include "cf/qnx.h" -#endif - -#ifdef __CYGWIN32__ -# include "cf/cygwin32.h" -#endif - -#ifdef __APPLE__ -# include "cf/rhapsody.h" -#else -# if defined (NeXT) -# include "cf/nextstep.h" -# endif -#endif - -#if defined(IRIX) || defined(__sgi) -# include "cf/irix.h" -#endif - -#if !defined (TIME_MAX) -# define TIME_MAX 2147483647 -#endif - -/* Porting:: - - If you add a new network API, and have it set up so that it can be - used for sending or receiving, but doesn't have to be used for both, - then set up an ifdef like the ones below: */ - -#ifdef USE_SOCKETS -# define USE_SOCKET_SEND -# define USE_SOCKET_RECEIVE -#endif - -#ifdef USE_RAW_SOCKETS -# define USE_RAW_SEND -# define USE_SOCKET_RECEIVE -#endif - -#ifdef USE_BPF -# define USE_BPF_SEND -# define USE_BPF_RECEIVE -#endif - -#ifdef USE_LPF -# define USE_LPF_SEND -# define USE_LPF_RECEIVE -#endif - -#ifdef USE_NIT -# define USE_NIT_SEND -# define USE_NIT_RECEIVE -#endif - -#ifdef USE_DLPI -# define USE_DLPI_SEND -# define USE_DLPI_RECEIVE -#endif - -#ifdef USE_UPF -# define USE_UPF_SEND -# define USE_UPF_RECEIVE -#endif - -/* Porting:: - - If you add support for sending packets directly out an interface, - and your support does not do ARP or routing, you must use a fallback - mechanism to deal with packets that need to be sent to routers. - Currently, all low-level packet interfaces use BSD sockets as a - fallback. */ - -#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \ - defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || defined (USE_LPF_SEND) -# define USE_SOCKET_FALLBACK -# define USE_FALLBACK -#endif - -/* Porting:: - - If you add support for sending packets directly out an interface - and need to be able to assemble packets, add the USE_XXX_SEND - definition for your interface to the list tested below. */ - -#if defined (USE_RAW_SEND) || defined (USE_BPF_SEND) || \ - defined (USE_NIT_SEND) || defined (USE_UPF_SEND) || \ - defined (USE_DLPI_SEND) || defined (USE_LPF_SEND) -# define PACKET_ASSEMBLY -#endif - -/* Porting:: - - If you add support for receiving packets directly from an interface - and need to be able to decode raw packets, add the USE_XXX_RECEIVE - definition for your interface to the list tested below. */ - -#if defined (USE_RAW_RECEIVE) || defined (USE_BPF_SEND) || \ - defined (USE_NIT_RECEIVE) || defined (USE_UPF_RECEIVE) || \ - defined (USE_DLPI_RECEIVE) || \ - defined (USE_LPF_SEND) || \ - (defined (USE_SOCKET_SEND) && defined (SO_BINDTODEVICE)) -# define PACKET_DECODING -#endif - -/* If we don't have a DLPI packet filter, we have to filter in userland. - Probably not worth doing, actually. */ -#if defined (USE_DLPI_RECEIVE) && !defined (USE_DLPI_PFMOD) -# define USERLAND_FILTER -#endif - -/* jmp_buf is assumed to be a struct unless otherwise defined in the - system header. */ -#ifndef jbp_decl -# define jbp_decl(x) jmp_buf *x -#endif -#ifndef jref -# define jref(x) (&(x)) -#endif -#ifndef jdref -# define jdref(x) (*(x)) -#endif -#ifndef jrefproto -# define jrefproto jmp_buf * -#endif - -#ifndef BPF_FORMAT -# define BPF_FORMAT "/dev/bpf%d" -#endif - -#if defined (IFF_POINTOPOINT) && !defined (HAVE_IFF_POINTOPOINT) -# define HAVE_IFF_POINTOPOINT -#endif - -#if defined (AF_LINK) && !defined (HAVE_AF_LINK) -# define HAVE_AF_LINK -#endif - -#if defined (ARPHRD_TUNNEL) && !defined (HAVE_ARPHRD_TUNNEL) -# define HAVE_ARPHRD_TUNNEL -#endif - -#if defined (ARPHRD_LOOPBACK) && !defined (HAVE_ARPHRD_LOOPBACK) -# define HAVE_ARPHRD_LOOPBACK -#endif - -#if defined (ARPHRD_ROSE) && !defined (HAVE_ARPHRD_ROSE) -# define HAVE_ARPHRD_ROSE -#endif - -#if defined (ARPHRD_IEEE802) && !defined (HAVE_ARPHRD_IEEE802) -# define HAVE_ARPHRD_IEEE802 -#endif - -#if defined (ARPHRD_FDDI) && !defined (HAVE_ARPHRD_FDDI) -# define HAVE_ARPHRD_FDDI -#endif - -#if defined (ARPHRD_AX25) && !defined (HAVE_ARPHRD_AX25) -# define HAVE_ARPHRD_AX25 -#endif - -#if defined (ARPHRD_NETROM) && !defined (HAVE_ARPHRD_NETROM) -# define HAVE_ARPHRD_NETROM -#endif - -#if defined (ARPHRD_METRICOM) && !defined (HAVE_ARPHRD_METRICOM) -# define HAVE_ARPHRD_METRICOM -#endif - -#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE) -# define HAVE_SO_BINDTODEVICE -#endif - -#if defined (SIOCGIFHWADDR) && !defined (HAVE_SIOCGIFHWADDR) -# define HAVE_SIOCGIFHWADDR -#endif - -#if defined (AF_LINK) && !defined (HAVE_AF_LINK) -# define HAVE_AF_LINK -#endif diff --git a/reactos/base/services/dhcp/include/predec.h b/reactos/base/services/dhcp/include/predec.h deleted file mode 100644 index 59fb94b003c..00000000000 --- a/reactos/base/services/dhcp/include/predec.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -struct iaddr; -struct interface_info; diff --git a/reactos/base/services/dhcp/include/privsep.h b/reactos/base/services/dhcp/include/privsep.h deleted file mode 100644 index e1fc52d5b69..00000000000 --- a/reactos/base/services/dhcp/include/privsep.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $OpenBSD: privsep.h,v 1.2 2004/05/04 18:51:18 henning Exp $ */ - -/* - * Copyright (c) 2004 Henning Brauer - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -//#include -//#include - -struct buf { - u_char *buf; - size_t size; - size_t wpos; - size_t rpos; -}; - -enum imsg_code { - IMSG_NONE, - IMSG_SCRIPT_INIT, - IMSG_SCRIPT_WRITE_PARAMS, - IMSG_SCRIPT_GO, - IMSG_SCRIPT_GO_RET -}; - -struct imsg_hdr { - enum imsg_code code; - size_t len; -}; - -struct buf *buf_open(size_t); -int buf_add(struct buf *, void *, size_t); -int buf_close(int, struct buf *); -ssize_t buf_read(int sock, void *, size_t); diff --git a/reactos/base/services/dhcp/include/site.h b/reactos/base/services/dhcp/include/site.h deleted file mode 100644 index 30fdb703005..00000000000 --- a/reactos/base/services/dhcp/include/site.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Site-specific definitions. - - For supported systems, you shouldn't need to make any changes here. - However, you may want to, in order to deal with site-specific - differences. */ - -/* Add any site-specific definitions and inclusions here... */ - -/* #include */ -/* #define SITE_FOOBAR */ - -/* Define this if you don't want dhcpd to run as a daemon and do want - to see all its output printed to stdout instead of being logged via - syslog(). This also makes dhcpd use the dhcpd.conf in its working - directory and write the dhcpd.leases file there. */ - -/* #define DEBUG */ - -/* Define this to see what the parser is parsing. You probably don't - want to see this. */ - -/* #define DEBUG_TOKENS */ - -/* Define this to see dumps of incoming and outgoing packets. This - slows things down quite a bit... */ - -/* #define DEBUG_PACKET */ - -/* Define this if you want to see dumps of tree evaluations. The most - common reason for doing this is to watch what happens with DNS name - lookups. */ - -/* #define DEBUG_EVAL */ - -/* Define this if you want the dhcpd.pid file to go somewhere other than - the default (which varies from system to system, but is usually either - /etc or /var/run. */ - -/* #define _PATH_DHCPD_PID "/var/run/dhcpd.pid" */ - -/* Define this if you want the dhcpd.leases file (the dynamic lease database) - to go somewhere other than the default location, which is normally - /etc/dhcpd.leases. */ - -/* #define _PATH_DHCPD_DB "/etc/dhcpd.leases" */ - -/* Define this if you want the dhcpd.conf file to go somewhere other than - the default location. By default, it goes in /etc/dhcpd.conf. */ - -/* #define _PATH_DHCPD_CONF "/etc/dhcpd.conf" */ - -/* Network API definitions. You do not need to choose one of these - if - you don't choose, one will be chosen for you in your system's config - header. DON'T MESS WITH THIS UNLESS YOU KNOW WHAT YOU'RE DOING!!! */ - -/* Define this to use the standard BSD socket API. - - On many systems, the BSD socket API does not provide the ability to - send packets to the 255.255.255.255 broadcast address, which can - prevent some clients (e.g., Win95) from seeing replies. This is - not a problem on Solaris. - - In addition, the BSD socket API will not work when more than one - network interface is configured on the server. - - However, the BSD socket API is about as efficient as you can get, so if - the aforementioned problems do not matter to you, or if no other - API is supported for your system, you may want to go with it. */ - -/* #define USE_SOCKETS */ - -/* Define this to use the Sun Streams NIT API. - - The Sun Streams NIT API is only supported on SunOS 4.x releases. */ - -/* #define USE_NIT */ - -/* Define this to use the Berkeley Packet Filter API. - - The BPF API is available on all 4.4-BSD derivatives, including - NetBSD, FreeBSD and BSDI's BSD/OS. It's also available on - DEC Alpha OSF/1 in a compatibility mode supported by the Alpha OSF/1 - packetfilter interface. */ - -/* #define USE_BPF */ - -/* Define this to use the raw socket API. - - The raw socket API is provided on many BSD derivatives, and provides - a way to send out raw IP packets. It is only supported for sending - packets - packets must be received with the regular socket API. - This code is experimental - I've never gotten it to actually transmit - a packet to the 255.255.255.255 broadcast address - so use it at your - own risk. */ - -/* #define USE_RAW_SOCKETS */ - -/* Define this to change the logging facility used by dhcpd. */ - -/* #define DHCPD_LOG_FACILITY LOG_DAEMON */ diff --git a/reactos/base/services/dhcp/include/stdint.h b/reactos/base/services/dhcp/include/stdint.h deleted file mode 100644 index a45def0e663..00000000000 --- a/reactos/base/services/dhcp/include/stdint.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -typedef signed char int8_t; -typedef unsigned char u_int8_t; -typedef short int16_t; -typedef unsigned short u_int16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; - -typedef char *caddr_t; diff --git a/reactos/base/services/dhcp/include/sysconf.h b/reactos/base/services/dhcp/include/sysconf.h deleted file mode 100644 index 5feb4c75c70..00000000000 --- a/reactos/base/services/dhcp/include/sysconf.h +++ /dev/null @@ -1,52 +0,0 @@ -/* systat.h - - Definitions for systat protocol... */ - -/* - * Copyright (c) 1997 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#define SYSCONF_SOCKET "/var/run/sysconf" - -struct sysconf_header { - u_int32_t type; /* Type of status message... */ - u_int32_t length; /* Length of message. */ -}; - -/* Message types... */ -#define NETWORK_LOCATION_CHANGED 1 - diff --git a/reactos/base/services/dhcp/include/version.h b/reactos/base/services/dhcp/include/version.h deleted file mode 100644 index 303fbfa332b..00000000000 --- a/reactos/base/services/dhcp/include/version.h +++ /dev/null @@ -1,3 +0,0 @@ -/* Current version of ISC DHCP Distribution. */ - -#define DHCP_VERSION "2.0pl5" diff --git a/reactos/base/services/dhcp/memory.c b/reactos/base/services/dhcp/memory.c deleted file mode 100644 index 2752422d2c7..00000000000 --- a/reactos/base/services/dhcp/memory.c +++ /dev/null @@ -1,919 +0,0 @@ -/* memory.c - - Memory-resident database... */ - -/* - * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: memory.c,v 1.35.2.4 1999/05/27 17:47:43 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "rosdhcp.h" -#include "dhcpd.h" - -struct subnet *subnets; -struct shared_network *shared_networks; -static struct hash_table *host_hw_addr_hash; -static struct hash_table *host_uid_hash; -static struct hash_table *lease_uid_hash; -static struct hash_table *lease_ip_addr_hash; -static struct hash_table *lease_hw_addr_hash; -struct lease *dangling_leases; - -static struct hash_table *vendor_class_hash; -static struct hash_table *user_class_hash; - -void enter_host (hd) - struct host_decl *hd; -{ - struct host_decl *hp = (struct host_decl *)0; - struct host_decl *np = (struct host_decl *)0; - - hd -> n_ipaddr = (struct host_decl *)0; - - if (hd -> interface.hlen) { - if (!host_hw_addr_hash) - host_hw_addr_hash = new_hash (); - else - hp = (struct host_decl *) - hash_lookup (host_hw_addr_hash, - hd -> interface.haddr, - hd -> interface.hlen); - - /* If there isn't already a host decl matching this - address, add it to the hash table. */ - if (!hp) - add_hash (host_hw_addr_hash, - hd -> interface.haddr, hd -> interface.hlen, - (unsigned char *)hd); - } - - /* If there was already a host declaration for this hardware - address, add this one to the end of the list. */ - - if (hp) { - for (np = hp; np -> n_ipaddr; np = np -> n_ipaddr) - ; - np -> n_ipaddr = hd; - } - - - if (hd -> group -> options [DHO_DHCP_CLIENT_IDENTIFIER]) { - if (!tree_evaluate (hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER])) - return; - - /* If there's no uid hash, make one; otherwise, see if - there's already an entry in the hash for this host. */ - if (!host_uid_hash) { - host_uid_hash = new_hash (); - hp = (struct host_decl *)0; - } else - hp = (struct host_decl *) hash_lookup - (host_uid_hash, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> value, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> len); - - /* If there's already a host declaration for this - client identifier, add this one to the end of the - list. Otherwise, add it to the hash table. */ - if (hp) { - /* Don't link it in twice... */ - if (!np) { - for (np = hp; np -> n_ipaddr; - np = np -> n_ipaddr) - ; - np -> n_ipaddr = hd; - } - } else { - add_hash (host_uid_hash, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> value, - hd -> group -> options - [DHO_DHCP_CLIENT_IDENTIFIER] -> len, - (unsigned char *)hd); - } - } -} - -struct host_decl *find_hosts_by_haddr (htype, haddr, hlen) - int htype; - unsigned char *haddr; - int hlen; -{ - struct host_decl *foo; - - foo = (struct host_decl *)hash_lookup (host_hw_addr_hash, - haddr, hlen); - return foo; -} - -struct host_decl *find_hosts_by_uid (data, len) - unsigned char *data; - int len; -{ - struct host_decl *foo; - - foo = (struct host_decl *)hash_lookup (host_uid_hash, data, len); - return foo; -} - -/* More than one host_decl can be returned by find_hosts_by_haddr or - find_hosts_by_uid, and each host_decl can have multiple addresses. - Loop through the list of hosts, and then for each host, through the - list of addresses, looking for an address that's in the same shared - network as the one specified. Store the matching address through - the addr pointer, update the host pointer to point at the host_decl - that matched, and return the subnet that matched. */ - -subnet *find_host_for_network (struct host_decl **host, iaddr *addr, - shared_network *share) -{ - int i; - subnet *subnet; - iaddr ip_address; - struct host_decl *hp; - - for (hp = *host; hp; hp = hp -> n_ipaddr) { - if (!hp -> fixed_addr || !tree_evaluate (hp -> fixed_addr)) - continue; - for (i = 0; i < hp -> fixed_addr -> len; i += 4) { - ip_address.len = 4; - memcpy (ip_address.iabuf, - hp -> fixed_addr -> value + i, 4); - subnet = find_grouped_subnet (share, ip_address); - if (subnet) { - *addr = ip_address; - *host = hp; - return subnet; - } - } - } - return (struct _subnet *)0; -} - -void new_address_range (iaddr low, iaddr high, subnet *subnet, int dynamic) -{ - lease *address_range, *lp, *plp; - iaddr net; - int min, max, i; - char lowbuf [16], highbuf [16], netbuf [16]; - shared_network *share = subnet -> shared_network; - struct hostent *h; - struct in_addr ia; - - /* All subnets should have attached shared network structures. */ - if (!share) { - strcpy (netbuf, piaddr (subnet -> net)); - error ("No shared network for network %s (%s)", - netbuf, piaddr (subnet -> netmask)); - } - - /* Initialize the hash table if it hasn't been done yet. */ - if (!lease_uid_hash) - lease_uid_hash = new_hash (); - if (!lease_ip_addr_hash) - lease_ip_addr_hash = new_hash (); - if (!lease_hw_addr_hash) - lease_hw_addr_hash = new_hash (); - - /* Make sure that high and low addresses are in same subnet. */ - net = subnet_number (low, subnet -> netmask); - if (!addr_eq (net, subnet_number (high, subnet -> netmask))) { - strcpy (lowbuf, piaddr (low)); - strcpy (highbuf, piaddr (high)); - strcpy (netbuf, piaddr (subnet -> netmask)); - error ("Address range %s to %s, netmask %s spans %s!", - lowbuf, highbuf, netbuf, "multiple subnets"); - } - - /* Make sure that the addresses are on the correct subnet. */ - if (!addr_eq (net, subnet -> net)) { - strcpy (lowbuf, piaddr (low)); - strcpy (highbuf, piaddr (high)); - strcpy (netbuf, piaddr (subnet -> netmask)); - error ("Address range %s to %s not on net %s/%s!", - lowbuf, highbuf, piaddr (subnet -> net), netbuf); - } - - /* Get the high and low host addresses... */ - max = host_addr (high, subnet -> netmask); - min = host_addr (low, subnet -> netmask); - - /* Allow range to be specified high-to-low as well as low-to-high. */ - if (min > max) { - max = min; - min = host_addr (high, subnet -> netmask); - } - - /* Get a lease structure for each address in the range. */ - address_range = new_leases (max - min + 1, "new_address_range"); - if (!address_range) { - strcpy (lowbuf, piaddr (low)); - strcpy (highbuf, piaddr (high)); - error ("No memory for address range %s-%s.", lowbuf, highbuf); - } - memset (address_range, 0, (sizeof *address_range) * (max - min + 1)); - - /* Fill in the last lease if it hasn't been already... */ - if (!share -> last_lease) { - share -> last_lease = &address_range [0]; - } - - /* Fill out the lease structures with some minimal information. */ - for (i = 0; i < max - min + 1; i++) { - address_range [i].ip_addr = - ip_addr (subnet -> net, subnet -> netmask, i + min); - address_range [i].starts = - address_range [i].timestamp = MIN_TIME; - address_range [i].ends = MIN_TIME; - address_range [i].subnet = subnet; - address_range [i].shared_network = share; - address_range [i].flags = dynamic ? DYNAMIC_BOOTP_OK : 0; - - memcpy (&ia, address_range [i].ip_addr.iabuf, 4); - - if (subnet -> group -> get_lease_hostnames) { - h = gethostbyaddr ((char *)&ia, sizeof ia, AF_INET); - if (!h) - warn ("No hostname for %s", inet_ntoa (ia)); - else { - address_range [i].hostname = - malloc (strlen (h -> h_name) + 1); - if (!address_range [i].hostname) - error ("no memory for hostname %s.", - h -> h_name); - strcpy (address_range [i].hostname, - h -> h_name); - } - } - - /* Link this entry into the list. */ - address_range [i].next = share -> leases; - address_range [i].prev = (struct lease *)0; - share -> leases = &address_range [i]; - if (address_range [i].next) - address_range [i].next -> prev = share -> leases; - add_hash (lease_ip_addr_hash, - address_range [i].ip_addr.iabuf, - address_range [i].ip_addr.len, - (unsigned char *)&address_range [i]); - } - - /* Find out if any dangling leases are in range... */ - plp = (struct lease *)0; - for (lp = dangling_leases; lp; lp = lp -> next) { - iaddr lnet; - int lhost; - - lnet = subnet_number (lp -> ip_addr, subnet -> netmask); - lhost = host_addr (lp -> ip_addr, subnet -> netmask); - - /* If it's in range, fill in the real lease structure with - the dangling lease's values, and remove the lease from - the list of dangling leases. */ - if (addr_eq (lnet, subnet -> net) && - lhost >= i && lhost <= max) { - if (plp) { - plp -> next = lp -> next; - } else { - dangling_leases = lp -> next; - } - lp -> next = (struct lease *)0; - address_range [lhost - i].hostname = lp -> hostname; - address_range [lhost - i].client_hostname = - lp -> client_hostname; - supersede_lease (&address_range [lhost - i], lp, 0); - free_lease (lp, "new_address_range"); - } else - plp = lp; - } -} - -subnet *find_subnet (iaddr addr) -{ - subnet *rv; - - for (rv = subnets; rv; rv = rv -> next_subnet) { - if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) - return rv; - } - return (subnet *)0; -} - -subnet *find_grouped_subnet (shared_network *share, iaddr addr) -{ - subnet *rv; - - for (rv = share -> subnets; rv; rv = rv -> next_sibling) { - if (addr_eq (subnet_number (addr, rv -> netmask), rv -> net)) - return rv; - } - return (subnet *)0; -} - -int subnet_inner_than (struct _subnet *subnet, struct _subnet *scan, int warnp) -{ - if (addr_eq (subnet_number (subnet -> net, scan -> netmask), - scan -> net) || - addr_eq (subnet_number (scan -> net, subnet -> netmask), - subnet -> net)) { - char n1buf [16]; - int i, j; - for (i = 0; i < 32; i++) - if (subnet -> netmask.iabuf [3 - (i >> 3)] - & (1 << (i & 7))) - break; - for (j = 0; j < 32; j++) - if (scan -> netmask.iabuf [3 - (j >> 3)] & - (1 << (j & 7))) - break; - strcpy (n1buf, piaddr (subnet -> net)); - if (warnp) - warn ("%ssubnet %s/%d conflicts with subnet %s/%d", - "Warning: ", n1buf, 32 - i, - piaddr (scan -> net), 32 - j); - if (i < j) - return 1; - } - return 0; -} - -/* Enter a new subnet into the subnet list. */ - -void enter_subnet (struct _subnet *subnet) -{ - struct _subnet *scan, *prev = (struct _subnet *)0; - - /* Check for duplicates... */ - for (scan = subnets; scan; scan = scan -> next_subnet) { - /* When we find a conflict, make sure that the - subnet with the narrowest subnet mask comes - first. */ - if (subnet_inner_than (subnet, scan, 1)) { - if (prev) { - prev -> next_subnet = subnet; - } else - subnets = subnet; - subnet -> next_subnet = scan; - return; - } - prev = scan; - } - - /* XXX use the BSD radix tree code instead of a linked list. */ - subnet -> next_subnet = subnets; - subnets = subnet; -} - -/* Enter a new shared network into the shared network list. */ - -void enter_shared_network (shared_network *share) -{ - /* XXX Sort the nets into a balanced tree to make searching quicker. */ - share -> next = shared_networks; - shared_networks = share; -} - -/* Enter a lease into the system. This is called by the parser each - time it reads in a new lease. If the subnet for that lease has - already been read in (usually the case), just update that lease; - otherwise, allocate temporary storage for the lease and keep it around - until we're done reading in the config file. */ - -void enter_lease (struct _lease *lease) -{ - struct _lease *comp = find_lease_by_ip_addr (lease -> ip_addr); - - /* If we don't have a place for this lease yet, save it for - later. */ - if (!comp) { - comp = new_lease ("enter_lease"); - if (!comp) { - error ("No memory for lease %s\n", - piaddr (lease -> ip_addr)); - } - *comp = *lease; - comp -> next = dangling_leases; - comp -> prev = (struct lease *)0; - dangling_leases = comp; - } else { - /* Record the hostname information in the lease. */ - comp -> hostname = lease -> hostname; - comp -> client_hostname = lease -> client_hostname; - supersede_lease (comp, lease, 0); - } -} - -/* Replace the data in an existing lease with the data in a new lease; - adjust hash tables to suit, and insertion sort the lease into the - list of leases by expiry time so that we can always find the oldest - lease. */ - -int supersede_lease (struct _lease *comp, struct _lease *lease, int commit) -{ - int enter_uid = 0; - int enter_hwaddr = 0; - struct _lease *lp; - - /* Static leases are not currently kept in the database... */ - if (lease -> flags & STATIC_LEASE) - return 1; - - /* If the existing lease hasn't expired and has a different - unique identifier or, if it doesn't have a unique - identifier, a different hardware address, then the two - leases are in conflict. If the existing lease has a uid - and the new one doesn't, but they both have the same - hardware address, and dynamic bootp is allowed on this - lease, then we allow that, in case a dynamic BOOTP lease is - requested *after* a DHCP lease has been assigned. */ - - if (!(lease -> flags & ABANDONED_LEASE) && - comp -> ends > cur_time && - (((comp -> uid && lease -> uid) && - (comp -> uid_len != lease -> uid_len || - memcmp (comp -> uid, lease -> uid, comp -> uid_len))) || - (!comp -> uid && - ((comp -> hardware_addr.htype != - lease -> hardware_addr.htype) || - (comp -> hardware_addr.hlen != - lease -> hardware_addr.hlen) || - memcmp (comp -> hardware_addr.haddr, - lease -> hardware_addr.haddr, - comp -> hardware_addr.hlen))))) { - warn ("Lease conflict at %s", - piaddr (comp -> ip_addr)); - return 0; - } else { - /* If there's a Unique ID, dissociate it from the hash - table and free it if necessary. */ - if (comp -> uid) { - uid_hash_delete (comp); - enter_uid = 1; - if (comp -> uid != &comp -> uid_buf [0]) { - free (comp -> uid); - comp -> uid_max = 0; - comp -> uid_len = 0; - } - comp -> uid = (unsigned char *)0; - } else - enter_uid = 1; - - if (comp -> hardware_addr.htype && - ((comp -> hardware_addr.hlen != - lease -> hardware_addr.hlen) || - (comp -> hardware_addr.htype != - lease -> hardware_addr.htype) || - memcmp (comp -> hardware_addr.haddr, - lease -> hardware_addr.haddr, - comp -> hardware_addr.hlen))) { - hw_hash_delete (comp); - enter_hwaddr = 1; - } else if (!comp -> hardware_addr.htype) - enter_hwaddr = 1; - - /* Copy the data files, but not the linkages. */ - comp -> starts = lease -> starts; - if (lease -> uid) { - if (lease -> uid_len < sizeof (lease -> uid_buf)) { - memcpy (comp -> uid_buf, - lease -> uid, lease -> uid_len); - comp -> uid = &comp -> uid_buf [0]; - comp -> uid_max = sizeof comp -> uid_buf; - } else if (lease -> uid != &lease -> uid_buf [0]) { - comp -> uid = lease -> uid; - comp -> uid_max = lease -> uid_max; - lease -> uid = (unsigned char *)0; - lease -> uid_max = 0; - } else { - error ("corrupt lease uid."); /* XXX */ - } - } else { - comp -> uid = (unsigned char *)0; - comp -> uid_max = 0; - } - comp -> uid_len = lease -> uid_len; - comp -> host = lease -> host; - comp -> hardware_addr = lease -> hardware_addr; - comp -> flags = ((lease -> flags & ~PERSISTENT_FLAGS) | - (comp -> flags & ~EPHEMERAL_FLAGS)); - - /* Record the lease in the uid hash if necessary. */ - if (enter_uid && lease -> uid) { - uid_hash_add (comp); - } - - /* Record it in the hardware address hash if necessary. */ - if (enter_hwaddr && lease -> hardware_addr.htype) { - hw_hash_add (comp); - } - - /* Remove the lease from its current place in the - timeout sequence. */ - if (comp -> prev) { - comp -> prev -> next = comp -> next; - } else { - comp -> shared_network -> leases = comp -> next; - } - if (comp -> next) { - comp -> next -> prev = comp -> prev; - } - if (comp -> shared_network -> last_lease == comp) { - comp -> shared_network -> last_lease = comp -> prev; - } - - /* Find the last insertion point... */ - if (comp == comp -> shared_network -> insertion_point || - !comp -> shared_network -> insertion_point) { - lp = comp -> shared_network -> leases; - } else { - lp = comp -> shared_network -> insertion_point; - } - - if (!lp) { - /* Nothing on the list yet? Just make comp the - head of the list. */ - comp -> shared_network -> leases = comp; - comp -> shared_network -> last_lease = comp; - } else if (lp -> ends > lease -> ends) { - /* Skip down the list until we run out of list - or find a place for comp. */ - while (lp -> next && lp -> ends > lease -> ends) { - lp = lp -> next; - } - if (lp -> ends > lease -> ends) { - /* If we ran out of list, put comp - at the end. */ - lp -> next = comp; - comp -> prev = lp; - comp -> next = (struct lease *)0; - comp -> shared_network -> last_lease = comp; - } else { - /* If we didn't, put it between lp and - the previous item on the list. */ - if ((comp -> prev = lp -> prev)) - comp -> prev -> next = comp; - comp -> next = lp; - lp -> prev = comp; - } - } else { - /* Skip up the list until we run out of list - or find a place for comp. */ - while (lp -> prev && lp -> ends < lease -> ends) { - lp = lp -> prev; - } - if (lp -> ends < lease -> ends) { - /* If we ran out of list, put comp - at the beginning. */ - lp -> prev = comp; - comp -> next = lp; - comp -> prev = (struct lease *)0; - comp -> shared_network -> leases = comp; - } else { - /* If we didn't, put it between lp and - the next item on the list. */ - if ((comp -> next = lp -> next)) - comp -> next -> prev = comp; - comp -> prev = lp; - lp -> next = comp; - } - } - comp -> shared_network -> insertion_point = comp; - comp -> ends = lease -> ends; - } - - /* Return zero if we didn't commit the lease to permanent storage; - nonzero if we did. */ - return commit && write_lease (comp) && commit_leases (); -} - -/* Release the specified lease and re-hash it as appropriate. */ - -void release_lease (struct _lease *lease) -{ - struct _lease lt; - - lt = *lease; - if (lt.ends > cur_time) { - lt.ends = cur_time; - supersede_lease (lease, <, 1); - } -} - -/* Abandon the specified lease (set its timeout to infinity and its - particulars to zero, and re-hash it as appropriate. */ - -void abandon_lease (struct _lease *lease, char *message) -{ - struct _lease lt; - - lease -> flags |= ABANDONED_LEASE; - lt = *lease; - lt.ends = cur_time; - warn ("Abandoning IP address %s: %s", - piaddr (lease -> ip_addr), message); - lt.hardware_addr.htype = 0; - lt.hardware_addr.hlen = 0; - lt.uid = (unsigned char *)0; - lt.uid_len = 0; - supersede_lease (lease, <, 1); -} - -/* Locate the lease associated with a given IP address... */ - -lease *find_lease_by_ip_addr (iaddr addr) -{ - lease *lease = (struct _lease *)hash_lookup (lease_ip_addr_hash, - addr.iabuf, - addr.len); - return lease; -} - -lease *find_lease_by_uid (unsigned char *uid, int len) -{ - lease *lease = (struct lease *)hash_lookup (lease_uid_hash, - uid, len); - return lease; -} - -lease *find_lease_by_hw_addr (unsigned char *hwaddr, int hwlen) -{ - struct _lease *lease = - (struct _lease *)hash_lookup (lease_hw_addr_hash, - hwaddr, hwlen); - return lease; -} - -/* Add the specified lease to the uid hash. */ - -void uid_hash_add (lease *lease) -{ - struct _lease *head = find_lease_by_uid (lease -> uid, lease -> uid_len); - struct _lease *scan; - -#ifdef DEBUG - if (lease -> n_uid) - abort (); -#endif - - /* If it's not in the hash, just add it. */ - if (!head) - add_hash (lease_uid_hash, lease -> uid, - lease -> uid_len, (unsigned char *)lease); - else { - /* Otherwise, attach it to the end of the list. */ - for (scan = head; scan -> n_uid; scan = scan -> n_uid) -#ifdef DEBUG - if (scan == lease) - abort () -#endif - ; - scan -> n_uid = lease; - } -} - -/* Delete the specified lease from the uid hash. */ - -void uid_hash_delete (lease *lease) -{ - struct _lease *head = - find_lease_by_uid (lease -> uid, lease -> uid_len); - struct _lease *scan; - - /* If it's not in the hash, we have no work to do. */ - if (!head) { - lease -> n_uid = (struct lease *)0; - return; - } - - /* If the lease we're freeing is at the head of the list, - remove the hash table entry and add a new one with the - next lease on the list (if there is one). */ - if (head == lease) { - delete_hash_entry (lease_uid_hash, - lease -> uid, lease -> uid_len); - if (lease -> n_uid) - add_hash (lease_uid_hash, - lease -> n_uid -> uid, - lease -> n_uid -> uid_len, - (unsigned char *)(lease -> n_uid)); - } else { - /* Otherwise, look for the lease in the list of leases - attached to the hash table entry, and remove it if - we find it. */ - for (scan = head; scan -> n_uid; scan = scan -> n_uid) { - if (scan -> n_uid == lease) { - scan -> n_uid = scan -> n_uid -> n_uid; - break; - } - } - } - lease -> n_uid = (struct lease *)0; -} - -/* Add the specified lease to the hardware address hash. */ - -void hw_hash_add (lease *lease) -{ - struct _lease *head = - find_lease_by_hw_addr (lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen); - struct _lease *scan; - - /* If it's not in the hash, just add it. */ - if (!head) - add_hash (lease_hw_addr_hash, - lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen, - (unsigned char *)lease); - else { - /* Otherwise, attach it to the end of the list. */ - for (scan = head; scan -> n_hw; scan = scan -> n_hw) - ; - scan -> n_hw = lease; - } -} - -/* Delete the specified lease from the hardware address hash. */ - -void hw_hash_delete (lease *lease) -{ - struct _lease *head = - find_lease_by_hw_addr (lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen); - struct _lease *scan; - - /* If it's not in the hash, we have no work to do. */ - if (!head) { - lease -> n_hw = (struct lease *)0; - return; - } - - /* If the lease we're freeing is at the head of the list, - remove the hash table entry and add a new one with the - next lease on the list (if there is one). */ - if (head == lease) { - delete_hash_entry (lease_hw_addr_hash, - lease -> hardware_addr.haddr, - lease -> hardware_addr.hlen); - if (lease -> n_hw) - add_hash (lease_hw_addr_hash, - lease -> n_hw -> hardware_addr.haddr, - lease -> n_hw -> hardware_addr.hlen, - (unsigned char *)(lease -> n_hw)); - } else { - /* Otherwise, look for the lease in the list of leases - attached to the hash table entry, and remove it if - we find it. */ - for (scan = head; scan -> n_hw; scan = scan -> n_hw) { - if (scan -> n_hw == lease) { - scan -> n_hw = scan -> n_hw -> n_hw; - break; - } - } - } - lease -> n_hw = (struct lease *)0; -} - - -struct class *add_class (type, name) - int type; - char *name; -{ - struct class *class = new_class ("add_class"); - char *tname = (char *)malloc (strlen (name) + 1); - - if (!vendor_class_hash) - vendor_class_hash = new_hash (); - if (!user_class_hash) - user_class_hash = new_hash (); - - if (!tname || !class || !vendor_class_hash || !user_class_hash) - { - if (tname != NULL) - free(tname); - return (struct class *)0; - } - - memset (class, 0, sizeof *class); - strcpy (tname, name); - class -> name = tname; - - if (type) - add_hash (user_class_hash, - (unsigned char *)tname, strlen (tname), - (unsigned char *)class); - else - add_hash (vendor_class_hash, - (unsigned char *)tname, strlen (tname), - (unsigned char *)class); - return class; -} - -struct class *find_class (type, name, len) - int type; - unsigned char *name; - int len; -{ - struct class *class = - (struct class *)hash_lookup (type - ? user_class_hash - : vendor_class_hash, name, len); - return class; -} - -struct group *clone_group (group, caller) - struct group *group; - char *caller; -{ - struct group *g = new_group (caller); - if (!g) - error ("%s: can't allocate new group", caller); - *g = *group; - return g; -} - -/* Write all interesting leases to permanent storage. */ - -void write_leases () -{ - lease *l; - shared_network *s; - - for (s = shared_networks; s; s = (shared_network *)s -> next) { - for (l = s -> leases; l; l = l -> next) { - if (l -> hardware_addr.hlen || - l -> uid_len || - (l -> flags & ABANDONED_LEASE)) - if (!write_lease (l)) - error ("Can't rewrite lease database"); - } - } - if (!commit_leases ()) - error ("Can't commit leases to new database: %m"); -} - -void dump_subnets () -{ - struct _lease *l; - shared_network *s; - subnet *n; - - note ("Subnets:"); - for (n = subnets; n; n = n -> next_subnet) { - debug (" Subnet %s", piaddr (n -> net)); - debug (" netmask %s", - piaddr (n -> netmask)); - } - note ("Shared networks:"); - for (s = shared_networks; s; s = (shared_network *)s -> next) { - note (" %s", s -> name); - for (l = s -> leases; l; l = l -> next) { - print_lease (l); - } - if (s -> last_lease) { - debug (" Last Lease:"); - print_lease (s -> last_lease); - } - } -} diff --git a/reactos/base/services/dhcp/privsep.c b/reactos/base/services/dhcp/privsep.c deleted file mode 100644 index 7a13bfed21b..00000000000 --- a/reactos/base/services/dhcp/privsep.c +++ /dev/null @@ -1,225 +0,0 @@ -/* $OpenBSD: privsep.c,v 1.7 2004/05/10 18:34:42 deraadt Exp $ */ - -/* - * Copyright (c) 2004 Henning Brauer - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE, ABUSE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "rosdhcp.h" -#include "dhcpd.h" -#include "privsep.h" - -struct buf * -buf_open(size_t len) -{ - struct buf *buf; - - if ((buf = calloc(1, sizeof(struct buf))) == NULL) - return (NULL); - if ((buf->buf = malloc(len)) == NULL) { - free(buf); - return (NULL); - } - buf->size = len; - - return (buf); -} - -int -buf_add(struct buf *buf, void *data, size_t len) -{ - if (buf->wpos + len > buf->size) - return (-1); - - memcpy(buf->buf + buf->wpos, data, len); - buf->wpos += len; - return (0); -} - -int -buf_close(int sock, struct buf *buf) -{ - ssize_t n; - - n = write(sock, buf->buf + buf->rpos, buf->size - buf->rpos); - if (n != -1) - buf->rpos += n; - if (n == 0) { /* connection closed */ - return (-1); - } - - if (buf->rpos < buf->size) - error("short write: wanted %lu got %ld bytes", - (unsigned long)buf->size, (long)buf->rpos); - - free(buf->buf); - free(buf); - return (n); -} - -ssize_t -buf_read(int sock, void *buf, size_t nbytes) -{ - ssize_t n, r = 0; - char *p = buf; - - n = read(sock, p, nbytes); - if (n == 0) - error("connection closed"); - if (n != -1) { - r += n; - p += n; - nbytes -= n; - } - - if (n == -1) - error("buf_read: %d", WSAGetLastError()); - - if (r < nbytes) - error("short read: wanted %lu got %ld bytes", - (unsigned long)nbytes, (long)r); - - return (r); -} - -void -dispatch_imsg(int fd) -{ - struct imsg_hdr hdr; - char *medium, *reason, *filename, - *servername, *prefix; - size_t medium_len, reason_len, filename_len, - servername_len, prefix_len, totlen; - struct client_lease lease; - int ret, i, optlen; - struct buf *buf; - - buf_read(fd, &hdr, sizeof(hdr)); - - switch (hdr.code) { - case IMSG_SCRIPT_INIT: - if (hdr.len < sizeof(hdr) + sizeof(size_t)) - error("corrupted message received"); - buf_read(fd, &medium_len, sizeof(medium_len)); - if (hdr.len < medium_len + sizeof(size_t) + sizeof(hdr) - + sizeof(size_t) || medium_len == SIZE_T_MAX) - error("corrupted message received"); - if (medium_len > 0) { - if ((medium = calloc(1, medium_len + 1)) != NULL) - buf_read(fd, medium, medium_len); - } else - medium = NULL; - - buf_read(fd, &reason_len, sizeof(reason_len)); - if (hdr.len < medium_len + reason_len + sizeof(hdr) || - reason_len == SIZE_T_MAX) - error("corrupted message received"); - if (reason_len > 0) { - if ((reason = calloc(1, reason_len + 1)) != NULL) - buf_read(fd, reason, reason_len); - } else - reason = NULL; - -// priv_script_init(reason, medium); - free(reason); - free(medium); - break; - case IMSG_SCRIPT_WRITE_PARAMS: - //bzero(&lease, sizeof lease); - memset(&lease, 0, sizeof(lease)); - totlen = sizeof(hdr) + sizeof(lease) + sizeof(size_t); - if (hdr.len < totlen) - error("corrupted message received"); - buf_read(fd, &lease, sizeof(lease)); - - buf_read(fd, &filename_len, sizeof(filename_len)); - totlen += filename_len + sizeof(size_t); - if (hdr.len < totlen || filename_len == SIZE_T_MAX) - error("corrupted message received"); - if (filename_len > 0) { - if ((filename = calloc(1, filename_len + 1)) != NULL) - buf_read(fd, filename, filename_len); - } else - filename = NULL; - - buf_read(fd, &servername_len, sizeof(servername_len)); - totlen += servername_len + sizeof(size_t); - if (hdr.len < totlen || servername_len == SIZE_T_MAX) - error("corrupted message received"); - if (servername_len > 0) { - if ((servername = - calloc(1, servername_len + 1)) != NULL) - buf_read(fd, servername, servername_len); - } else - servername = NULL; - - buf_read(fd, &prefix_len, sizeof(prefix_len)); - totlen += prefix_len; - if (hdr.len < totlen || prefix_len == SIZE_T_MAX) - error("corrupted message received"); - if (prefix_len > 0) { - if ((prefix = calloc(1, prefix_len + 1)) != NULL) - buf_read(fd, prefix, prefix_len); - } else - prefix = NULL; - - for (i = 0; i < 256; i++) { - totlen += sizeof(optlen); - if (hdr.len < totlen) - error("corrupted message received"); - buf_read(fd, &optlen, sizeof(optlen)); - lease.options[i].data = NULL; - lease.options[i].len = optlen; - if (optlen > 0) { - totlen += optlen; - if (hdr.len < totlen || optlen == SIZE_T_MAX) - error("corrupted message received"); - lease.options[i].data = - calloc(1, optlen + 1); - if (lease.options[i].data != NULL) - buf_read(fd, lease.options[i].data, optlen); - } - } - lease.server_name = servername; - lease.filename = filename; - -// priv_script_write_params(prefix, &lease); - - free(servername); - free(filename); - free(prefix); - for (i = 0; i < 256; i++) - if (lease.options[i].len > 0) - free(lease.options[i].data); - break; - case IMSG_SCRIPT_GO: - if (hdr.len != sizeof(hdr)) - error("corrupted message received"); - -// ret = priv_script_go(); - - hdr.code = IMSG_SCRIPT_GO_RET; - hdr.len = sizeof(struct imsg_hdr) + sizeof(int); - buf = buf_open(hdr.len); - - if (buf != NULL) { - buf_add(buf, &hdr, sizeof(hdr)); - buf_add(buf, &ret, sizeof(ret)); - buf_close(fd, buf); - } - break; - default: - error("received unknown message, code %d", hdr.code); - } -} diff --git a/reactos/base/services/dhcp/timer.c b/reactos/base/services/dhcp/timer.c deleted file mode 100644 index ccd817188ec..00000000000 --- a/reactos/base/services/dhcp/timer.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "rosdhcp.h" - diff --git a/reactos/base/services/dhcp/adapter.c b/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c similarity index 100% rename from reactos/base/services/dhcp/adapter.c rename to reactos/dll/win32/dhcpcsvc/dhcp/adapter.c diff --git a/reactos/base/services/dhcp/alloc.c b/reactos/dll/win32/dhcpcsvc/dhcp/alloc.c similarity index 100% rename from reactos/base/services/dhcp/alloc.c rename to reactos/dll/win32/dhcpcsvc/dhcp/alloc.c diff --git a/reactos/base/services/dhcp/api.c b/reactos/dll/win32/dhcpcsvc/dhcp/api.c similarity index 98% rename from reactos/base/services/dhcp/api.c rename to reactos/dll/win32/dhcpcsvc/dhcp/api.c index 268466980b6..efa07a80a54 100644 --- a/reactos/base/services/dhcp/api.c +++ b/reactos/dll/win32/dhcpcsvc/dhcp/api.c @@ -28,6 +28,10 @@ VOID ApiUnlock() { LeaveCriticalSection( &ApiCriticalSection ); } +VOID ApiFree() { + DeleteCriticalSection( &ApiCriticalSection ); +} + /* This represents the service portion of the DHCP client API */ DWORD DSLeaseIpAddress( PipeSendFunc Send, COMM_DHCP_REQ *Req ) { diff --git a/reactos/base/services/dhcp/compat.c b/reactos/dll/win32/dhcpcsvc/dhcp/compat.c similarity index 100% rename from reactos/base/services/dhcp/compat.c rename to reactos/dll/win32/dhcpcsvc/dhcp/compat.c diff --git a/reactos/base/services/dhcp/dhclient.c b/reactos/dll/win32/dhcpcsvc/dhcp/dhclient.c similarity index 90% rename from reactos/base/services/dhcp/dhclient.c rename to reactos/dll/win32/dhcpcsvc/dhcp/dhclient.c index db263bc4ab5..a27c7b667ad 100644 --- a/reactos/base/services/dhcp/dhclient.c +++ b/reactos/dll/win32/dhcpcsvc/dhcp/dhclient.c @@ -54,10 +54,7 @@ */ #include "rosdhcp.h" -#include #include "dhcpd.h" -#include "privsep.h" -#include "debug.h" #define PERIOD 0x2e #define hyphenchar(c) ((c) == 0x2d) @@ -110,16 +107,9 @@ int check_arp( struct interface_info *ip, struct client_lease *lp ) time_t scripttime; - -static VOID CALLBACK ServiceMain(DWORD argc, LPWSTR *argv); static WCHAR ServiceName[] = L"DHCP"; -static SERVICE_TABLE_ENTRYW ServiceTable[] = -{ - {ServiceName, ServiceMain}, - {NULL, NULL} -}; -SERVICE_STATUS_HANDLE ServiceStatusHandle; +SERVICE_STATUS_HANDLE ServiceStatusHandle = 0; SERVICE_STATUS ServiceStatus; @@ -192,7 +182,7 @@ ServiceControlHandler(DWORD dwControl, } -static VOID CALLBACK +VOID NTAPI ServiceMain(DWORD argc, LPWSTR *argv) { ServiceStatusHandle = RegisterServiceCtrlHandlerExW(ServiceName, @@ -200,53 +190,49 @@ ServiceMain(DWORD argc, LPWSTR *argv) NULL); if (!ServiceStatusHandle) { + DbgPrint("DHCPCSVC: Unable to register service control handler (%x)\n", GetLastError); return; } UpdateServiceStatus(SERVICE_START_PENDING); + ApiInit(); + AdapterInit(); + + tzset(); + + memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); + sockaddr_broadcast.sin_family = AF_INET; + sockaddr_broadcast.sin_port = htons(REMOTE_PORT); + sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; + inaddr_any.s_addr = INADDR_ANY; + bootp_packet_handler = do_packet; + + if (PipeInit() == INVALID_HANDLE_VALUE) + { + DbgPrint("DHCPCSVC: PipeInit() failed!\n"); + AdapterStop(); + ApiFree(); + UpdateServiceStatus(SERVICE_STOPPED); + } + + DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); + UpdateServiceStatus(SERVICE_RUNNING); + DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); + + DbgPrint("DHCPCSVC: DHCP service is starting up\n"); + dispatch(); -} + DbgPrint("DHCPCSVC: DHCP service is shutting down\n"); -int -main(int argc, char *argv[]) -{ - ApiInit(); - AdapterInit(); - PipeInit(); + //AdapterStop(); + //ApiFree(); + /* FIXME: Close pipe and kill pipe thread */ - tzset(); - - memset(&sockaddr_broadcast, 0, sizeof(sockaddr_broadcast)); - sockaddr_broadcast.sin_family = AF_INET; - sockaddr_broadcast.sin_port = htons(REMOTE_PORT); - sockaddr_broadcast.sin_addr.s_addr = INADDR_BROADCAST; - inaddr_any.s_addr = INADDR_ANY; - - DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); - - bootp_packet_handler = do_packet; - - DH_DbgPrint(MID_TRACE,("Going into dispatch()\n")); - - StartServiceCtrlDispatcherW(ServiceTable); - - /* not reached */ - return (0); -} - -void -usage(void) -{ -// extern char *__progname; - -// fprintf(stderr, "usage: %s [-dqu] ", __progname); - fprintf(stderr, "usage: dhclient [-dqu] "); - fprintf(stderr, "[-c conffile] [-l leasefile] interface\n"); - exit(1); + UpdateServiceStatus(SERVICE_STOPPED); } /* @@ -1117,83 +1103,12 @@ void state_panic(void *ipp) { struct interface_info *ip = ipp; - struct client_lease *loop = ip->client->active; - struct client_lease *lp; - time_t cur_time; + time_t cur_time; + + time(&cur_time); note("No DHCPOFFERS received."); - time(&cur_time); - - /* We may not have an active lease, but we may have some - predefined leases that we can try. */ - if (!ip->client->active && ip->client->leases) - goto activate_next; - - /* Run through the list of leases and see if one can be used. */ - while (ip->client->active) { - if (ip->client->active->expiry > cur_time) { - note("Trying recorded lease %s", - piaddr(ip->client->active->address)); - /* Run the client script with the existing - parameters. */ - script_init("TIMEOUT", - ip->client->active->medium); - script_write_params("new_", ip->client->active); - if (ip->client->alias) - script_write_params("alias_", - ip->client->alias); - - /* If the old lease is still good and doesn't - yet need renewal, go into BOUND state and - timeout at the renewal time. */ - if (cur_time < - ip->client->active->renewal) { - ip->client->state = S_BOUND; - note("bound: renewal in %ld seconds.", - (long int)(ip->client->active->renewal - - cur_time)); - add_timeout( - ip->client->active->renewal, - state_bound, ip); - } else { - ip->client->state = S_BOUND; - note("bound: immediate renewal."); - state_bound(ip); - } - return; - } - - /* If there are no other leases, give up. */ - if (!ip->client->leases) { - ip->client->leases = ip->client->active; - ip->client->active = NULL; - break; - } - -activate_next: - /* Otherwise, put the active lease at the end of the - lease list, and try another lease.. */ - for (lp = ip->client->leases; lp->next; lp = lp->next) - ; - lp->next = ip->client->active; - if (lp->next) - lp->next->next = NULL; - ip->client->active = ip->client->leases; - ip->client->leases = ip->client->leases->next; - - /* If we already tried this lease, we've exhausted the - set of leases, so we might as well give up for - now. */ - if (ip->client->active == loop) - break; - else if (!loop) - loop = ip->client->active; - } - - /* No leases were available, or what was available didn't work, so - tell the shell script that we failed to allocate an address, - and try again later. */ note("No working leases in persistent database - sleeping.\n"); ip->client->state = S_INIT; add_timeout(cur_time + ip->client->config->retry_interval, state_init, @@ -1239,8 +1154,6 @@ send_request(void *ipp) if (ip->client->state == S_REBOOTING && !ip->client->medium && ip->client->active->medium ) { - script_init("MEDIUM", ip->client->active->medium); - /* If the medium we chose won't fly, go to INIT state. */ /* XXX Nothing for now */ @@ -1708,41 +1621,6 @@ write_client_lease(struct interface_info *ip, struct client_lease *lease, fflush(leaseFile); } -void -script_init(char *reason, struct string_list *medium) -{ - size_t len, mediumlen = 0; - struct imsg_hdr hdr; - struct buf *buf; - int errs; - - if (medium != NULL && medium->string != NULL) - mediumlen = strlen(medium->string); - - hdr.code = IMSG_SCRIPT_INIT; - hdr.len = sizeof(struct imsg_hdr) + - sizeof(size_t) + mediumlen + - sizeof(size_t) + strlen(reason); - - if ((buf = buf_open(hdr.len)) == NULL) - return; - - errs = 0; - errs += buf_add(buf, &hdr, sizeof(hdr)); - errs += buf_add(buf, &mediumlen, sizeof(mediumlen)); - if (mediumlen > 0) - errs += buf_add(buf, medium->string, mediumlen); - len = strlen(reason); - errs += buf_add(buf, &len, sizeof(len)); - errs += buf_add(buf, reason, len); - - if (errs) - error("buf_add: %d", WSAGetLastError()); - - if (buf_close(privfd, buf) == -1) - error("buf_close: %d", WSAGetLastError()); -} - void priv_script_init(struct interface_info *ip, char *reason, char *medium) { @@ -1889,58 +1767,6 @@ supersede: #endif } -void -script_write_params(char *prefix, struct client_lease *lease) -{ - size_t fn_len = 0, sn_len = 0, pr_len = 0; - struct imsg_hdr hdr; - struct buf *buf; - int errs, i; - - if (lease->filename != NULL) - fn_len = strlen(lease->filename); - if (lease->server_name != NULL) - sn_len = strlen(lease->server_name); - if (prefix != NULL) - pr_len = strlen(prefix); - - hdr.code = IMSG_SCRIPT_WRITE_PARAMS; - hdr.len = sizeof(hdr) + sizeof(struct client_lease) + - sizeof(size_t) + fn_len + sizeof(size_t) + sn_len + - sizeof(size_t) + pr_len; - - for (i = 0; i < 256; i++) - hdr.len += sizeof(int) + lease->options[i].len; - - scripttime = time(NULL); - - if ((buf = buf_open(hdr.len)) == NULL) - return; - - errs = 0; - errs += buf_add(buf, &hdr, sizeof(hdr)); - errs += buf_add(buf, lease, sizeof(struct client_lease)); - errs += buf_add(buf, &fn_len, sizeof(fn_len)); - errs += buf_add(buf, lease->filename, fn_len); - errs += buf_add(buf, &sn_len, sizeof(sn_len)); - errs += buf_add(buf, lease->server_name, sn_len); - errs += buf_add(buf, &pr_len, sizeof(pr_len)); - errs += buf_add(buf, prefix, pr_len); - - for (i = 0; i < 256; i++) { - errs += buf_add(buf, &lease->options[i].len, - sizeof(lease->options[i].len)); - errs += buf_add(buf, lease->options[i].data, - lease->options[i].len); - } - - if (errs) - error("buf_add: %d", WSAGetLastError()); - - if (buf_close(privfd, buf) == -1) - error("buf_close: %d", WSAGetLastError()); -} - int dhcp_option_ev_name(char *buf, size_t buflen, struct dhcp_option *option) { diff --git a/reactos/base/services/dhcp/dispatch.c b/reactos/dll/win32/dhcpcsvc/dhcp/dispatch.c similarity index 98% rename from reactos/base/services/dhcp/dispatch.c rename to reactos/dll/win32/dhcpcsvc/dhcp/dispatch.c index c26ead72701..b429f9517e7 100644 --- a/reactos/base/services/dhcp/dispatch.c +++ b/reactos/dll/win32/dhcpcsvc/dhcp/dispatch.c @@ -69,10 +69,8 @@ dispatch(void) time_t howlong, cur_time; struct timeval timeval; - if (!AdapterDiscover()) { - AdapterStop(); + if (!AdapterDiscover()) return; - } ApiLock(); @@ -151,7 +149,7 @@ dispatch(void) } } while (1); - ApiUnlock(); /* Not reached currently */ + ApiUnlock(); } void @@ -182,7 +180,7 @@ got_one(struct protocol *l) warning("Interface %s no longer appears valid.", ip->name); ip->dead = 1; - close(l->fd); + closesocket(l->fd); remove_protocol(l); adapter = AdapterFindInfo(ip); if (adapter) { diff --git a/reactos/base/services/dhcp/hash.c b/reactos/dll/win32/dhcpcsvc/dhcp/hash.c similarity index 100% rename from reactos/base/services/dhcp/hash.c rename to reactos/dll/win32/dhcpcsvc/dhcp/hash.c diff --git a/reactos/base/services/dhcp/options.c b/reactos/dll/win32/dhcpcsvc/dhcp/options.c similarity index 100% rename from reactos/base/services/dhcp/options.c rename to reactos/dll/win32/dhcpcsvc/dhcp/options.c diff --git a/reactos/base/services/dhcp/pipe.c b/reactos/dll/win32/dhcpcsvc/dhcp/pipe.c similarity index 100% rename from reactos/base/services/dhcp/pipe.c rename to reactos/dll/win32/dhcpcsvc/dhcp/pipe.c diff --git a/reactos/base/services/dhcp/socket.c b/reactos/dll/win32/dhcpcsvc/dhcp/socket.c similarity index 100% rename from reactos/base/services/dhcp/socket.c rename to reactos/dll/win32/dhcpcsvc/dhcp/socket.c diff --git a/reactos/base/services/dhcp/tables.c b/reactos/dll/win32/dhcpcsvc/dhcp/tables.c similarity index 100% rename from reactos/base/services/dhcp/tables.c rename to reactos/dll/win32/dhcpcsvc/dhcp/tables.c diff --git a/reactos/base/services/dhcp/tree.c b/reactos/dll/win32/dhcpcsvc/dhcp/tree.c similarity index 100% rename from reactos/base/services/dhcp/tree.c rename to reactos/dll/win32/dhcpcsvc/dhcp/tree.c diff --git a/reactos/base/services/dhcp/util.c b/reactos/dll/win32/dhcpcsvc/dhcp/util.c similarity index 100% rename from reactos/base/services/dhcp/util.c rename to reactos/dll/win32/dhcpcsvc/dhcp/util.c diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c index 0c59fb7df90..07910684993 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.c @@ -6,22 +6,63 @@ * COPYRIGHT: Copyright 2005 Art Yerkes */ -#include -#include -#include -#include +#include #define NDEBUG #include -#define DHCP_TIMEOUT 1000 +static HANDLE PipeHandle = INVALID_HANDLE_VALUE; DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version) { - *Version = 2; - return 0; + DWORD PipeMode; + + /* Wait for the pipe to be available */ + if (WaitNamedPipeW(DHCP_PIPE_NAME, NMPWAIT_USE_DEFAULT_WAIT)) + { + /* It's available, let's try to open it */ + PipeHandle = CreateFileW(DHCP_PIPE_NAME, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, + NULL); + + /* Check if we succeeded in opening the pipe */ + if (PipeHandle == INVALID_HANDLE_VALUE) + { + /* We didn't */ + return GetLastError(); + } + else + { + /* Change the pipe into message mode */ + PipeMode = PIPE_READMODE_MESSAGE; + if (!SetNamedPipeHandleState(PipeHandle, &PipeMode, NULL, NULL)) + { + /* Mode change failed */ + CloseHandle(PipeHandle); + PipeHandle = INVALID_HANDLE_VALUE; + return GetLastError(); + } + else + { + /* We're good to go */ + *Version = 2; + return NO_ERROR; + } + } + } + else + { + /* No good, we failed */ + return GetLastError(); + } } VOID APIENTRY DhcpCApiCleanup() { + CloseHandle(PipeHandle); + PipeHandle = INVALID_HANDLE_VALUE; } DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, @@ -33,12 +74,20 @@ DWORD APIENTRY DhcpQueryHWInfo( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqQueryHWInfo; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } if( !Reply.Reply ) return 0; else { @@ -55,12 +104,20 @@ DWORD APIENTRY DhcpLeaseIpAddress( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqLeaseIpAddress; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -71,12 +128,20 @@ DWORD APIENTRY DhcpReleaseIpAddressLease( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqReleaseIpAddress; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -87,12 +152,20 @@ DWORD APIENTRY DhcpRenewIpAddressLease( DWORD AdapterIndex ) { DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqRenewIpAddress; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -105,14 +178,22 @@ DWORD APIENTRY DhcpStaticRefreshParams( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqStaticRefreshParams; Req.AdapterIndex = AdapterIndex; Req.Body.StaticRefreshParams.IPAddress = Address; Req.Body.StaticRefreshParams.Netmask = Netmask; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); + if (!Result) + { + /* Pipe transaction failed */ + return 0; + } return Reply.Reply; } @@ -153,7 +234,7 @@ DhcpNotifyConfigChange(LPWSTR ServerName, DWORD SubnetMask, int DhcpAction) { - DPRINT1("DhcpNotifyConfigChange not implemented yet\n"); + DbgPrint("DHCPCSVC: DhcpNotifyConfigChange not implemented yet\n"); return 0; } @@ -192,12 +273,15 @@ DWORD APIENTRY DhcpRosGetAdapterInfo( DWORD AdapterIndex, DWORD BytesRead; BOOL Result; + ASSERT(PipeHandle != INVALID_HANDLE_VALUE); + Req.Type = DhcpReqGetAdapterInfo; Req.AdapterIndex = AdapterIndex; - Result = CallNamedPipeW - ( DHCP_PIPE_NAME, &Req, sizeof(Req), &Reply, sizeof(Reply), - &BytesRead, DHCP_TIMEOUT ); + Result = TransactNamedPipe(PipeHandle, + &Req, sizeof(Req), + &Reply, sizeof(Reply), + &BytesRead, NULL); if ( 0 != Result && 0 != Reply.Reply ) { *DhcpEnabled = Reply.GetAdapterInfo.DhcpEnabled; diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild index c2cc0a1e112..773c295b21c 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.rbuild @@ -2,8 +2,28 @@ include ntdll + msvcrt ws2_32 iphlpapi + advapi32 + oldnames + + adapter.c + alloc.c + api.c + compat.c + dhclient.c + dispatch.c + hash.c + options.c + pipe.c + socket.c + tables.c + util.c + + + rosdhcp.h + dhcpcsvc.c dhcpcsvc.rc diff --git a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec index d97b6e7f2ac..b9f95712bb4 100644 --- a/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec +++ b/reactos/dll/win32/dhcpcsvc/dhcpcsvc.spec @@ -43,5 +43,4 @@ @ stub McastRenewAddress @ stub McastRequestAddress @ stdcall DhcpRosGetAdapterInfo(long ptr ptr ptr ptr) -# The Windows DHCP client service is implemented in the DLL too -#@ stub ServiceMain +@ stdcall ServiceMain(long ptr) diff --git a/reactos/base/services/dhcp/include/debug.h b/reactos/dll/win32/dhcpcsvc/include/debug.h similarity index 100% rename from reactos/base/services/dhcp/include/debug.h rename to reactos/dll/win32/dhcpcsvc/include/debug.h diff --git a/reactos/base/services/dhcp/include/dhcp.h b/reactos/dll/win32/dhcpcsvc/include/dhcp.h similarity index 100% rename from reactos/base/services/dhcp/include/dhcp.h rename to reactos/dll/win32/dhcpcsvc/include/dhcp.h diff --git a/reactos/base/services/dhcp/include/dhcpd.h b/reactos/dll/win32/dhcpcsvc/include/dhcpd.h similarity index 100% rename from reactos/base/services/dhcp/include/dhcpd.h rename to reactos/dll/win32/dhcpcsvc/include/dhcpd.h diff --git a/reactos/base/services/dhcp/include/hash.h b/reactos/dll/win32/dhcpcsvc/include/hash.h similarity index 100% rename from reactos/base/services/dhcp/include/hash.h rename to reactos/dll/win32/dhcpcsvc/include/hash.h diff --git a/reactos/base/services/dhcp/include/rosdhcp.h b/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h similarity index 92% rename from reactos/base/services/dhcp/include/rosdhcp.h rename to reactos/dll/win32/dhcpcsvc/include/rosdhcp.h index 6b1dab6f0cc..48c67167f3e 100644 --- a/reactos/base/services/dhcp/include/rosdhcp.h +++ b/reactos/dll/win32/dhcpcsvc/include/rosdhcp.h @@ -8,11 +8,9 @@ #include #include #include -#include -#include -#include "stdint.h" -#include "predec.h" #include +#include +#include #include "debug.h" #define IFNAMSIZ MAX_INTERFACE_NAME_LEN #undef interface /* wine/objbase.h -- Grrr */ @@ -27,6 +25,10 @@ #define DHCP_DEFAULT_LEASE_TIME 43200 /* 12 hours */ #define _PATH_DHCLIENT_PID "\\systemroot\\system32\\drivers\\etc\\dhclient.pid" typedef void *VOIDPTR; +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned int u_int32_t; +typedef char *caddr_t; #ifndef _SSIZE_T_DEFINED #define _SSIZE_T_DEFINED @@ -51,6 +53,9 @@ typedef u_int32_t uintTIME; typedef void (*handler_t) PROTO ((struct packet *)); +struct iaddr; +struct interface_info; + typedef struct _DHCP_ADAPTER { LIST_ENTRY ListEntry; MIB_IFROW IfMib; @@ -74,13 +79,14 @@ typedef DWORD (*PipeSendFunc)( COMM_DHCP_REPLY *Reply ); void AdapterInit(VOID); BOOLEAN AdapterDiscover(VOID); void AdapterStop(VOID); -HANDLE PipeInit(VOID); extern PDHCP_ADAPTER AdapterGetFirst(); extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER); extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); extern PDHCP_ADAPTER AdapterFindByHardwareAddress( u_int8_t haddr[16], u_int8_t hlen ); +extern HANDLE PipeInit(); extern VOID ApiInit(); +extern VOID ApiFree(); extern VOID ApiLock(); extern VOID ApiUnlock(); extern DWORD DSQueryHWInfo( PipeSendFunc Send, COMM_DHCP_REQ *Req ); diff --git a/reactos/base/services/dhcp/include/tree.h b/reactos/dll/win32/dhcpcsvc/include/tree.h similarity index 100% rename from reactos/base/services/dhcp/include/tree.h rename to reactos/dll/win32/dhcpcsvc/include/tree.h From c7ae2ad589028a85643fa52b311e5910690a8ee6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 21 May 2010 20:17:35 +0000 Subject: [PATCH 146/151] [IPHLPAPI] - Fix some code left over from a previous attempt svn path=/trunk/; revision=47294 --- reactos/dll/win32/iphlpapi/dhcp_reactos.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/reactos/dll/win32/iphlpapi/dhcp_reactos.c b/reactos/dll/win32/iphlpapi/dhcp_reactos.c index 9e8086f3cfb..3364e3c9c7e 100644 --- a/reactos/dll/win32/iphlpapi/dhcp_reactos.c +++ b/reactos/dll/win32/iphlpapi/dhcp_reactos.c @@ -30,19 +30,15 @@ DWORD getDhcpInfoForAdapter(DWORD AdapterIndex, DWORD Status, Version = 0; Status = DhcpCApiInitialize(&Version); - if (Status == ERROR_NOT_READY) + if (Status != ERROR_SUCCESS) { - /* The DHCP server isn't running yet */ + /* We assume that the DHCP service isn't running yet */ *DhcpEnabled = FALSE; *DhcpServer = htonl(INADDR_NONE); *LeaseObtained = 0; *LeaseExpires = 0; return ERROR_SUCCESS; } - else if (Status != ERROR_SUCCESS) - { - return Status; - } Status = DhcpRosGetAdapterInfo(AdapterIndex, DhcpEnabled, DhcpServer, LeaseObtained, LeaseExpires); From 709fe1efeffe825d3a9c3dda2437a005fe515ccc Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 22 May 2010 01:05:31 +0000 Subject: [PATCH 147/151] [WIN32K / USER32] Convert the window text string from UNICODE_STRING to LARGE_STRING and fix NtUserCreateWindowEx parameters. We currently still pass UNICODE only LARGE_STRINGs, as the rest of the code in win32k expects this. Fixes display of large text windows, like the winzip license. See issue #2900 for more details. svn path=/trunk/; revision=47295 --- reactos/dll/win32/user32/windows/window.c | 94 ++++-- reactos/include/reactos/win32k/ntuser.h | 24 +- .../subsystems/win32/win32k/include/window.h | 2 +- .../subsystems/win32/win32k/ntuser/desktop.c | 3 +- .../subsystems/win32/win32k/ntuser/message.c | 4 +- .../subsystems/win32/win32k/ntuser/painting.c | 8 +- .../subsystems/win32/win32k/ntuser/window.c | 270 +++++++++++------- 7 files changed, 260 insertions(+), 145 deletions(-) diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index 2aa01a9941d..bd4541c2cd2 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -137,6 +137,34 @@ CloseWindow(HWND hWnd) return (BOOL)(hWnd); } +VOID +FORCEINLINE +RtlInitLargeString( + OUT PLARGE_STRING plstr, + LPCVOID psz, + BOOL bUnicode) +{ + if(bUnicode) + { + RtlInitLargeUnicodeString((PLARGE_UNICODE_STRING)plstr, (PWSTR)psz, 0); + } + else + { + RtlInitLargeAnsiString((PLARGE_ANSI_STRING)plstr, (PSTR)psz, 0); + } +} + +VOID +NTAPI +RtlFreeLargeString( + IN PLARGE_STRING LargeString) +{ + if (LargeString->Buffer) + { + RtlFreeHeap(GetProcessHeap(), 0, LargeString->Buffer); + RtlZeroMemory(LargeString, sizeof(LARGE_STRING)); + } +} HWND WINAPI User32CreateWindowEx(DWORD dwExStyle, @@ -153,7 +181,8 @@ User32CreateWindowEx(DWORD dwExStyle, LPVOID lpParam, BOOL Unicode) { - UNICODE_STRING WindowName; + LARGE_STRING WindowName; + LARGE_STRING lstrClassName, *plstrClassName; UNICODE_STRING ClassName; WNDCLASSEXA wceA; WNDCLASSEXW wceW; @@ -171,8 +200,7 @@ User32CreateWindowEx(DWORD dwExStyle, if (IS_ATOM(lpClassName)) { - RtlInitUnicodeString(&ClassName, NULL); - ClassName.Buffer = (LPWSTR)lpClassName; + plstrClassName = (PVOID)lpClassName; } else { @@ -180,26 +208,49 @@ User32CreateWindowEx(DWORD dwExStyle, RtlInitUnicodeString(&ClassName, (PCWSTR)lpClassName); else { - if (!RtlCreateUnicodeStringFromAsciiz(&(ClassName), (PCSZ)lpClassName)) + if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, (PCSZ)lpClassName)) { SetLastError(ERROR_OUTOFMEMORY); return (HWND)0; } } + + /* Copy it to a LARGE_STRING */ + lstrClassName.Buffer = ClassName.Buffer; + lstrClassName.Length = ClassName.Length; + lstrClassName.MaximumLength = ClassName.MaximumLength; + plstrClassName = &lstrClassName; } - if (Unicode) - RtlInitUnicodeString(&WindowName, (PCWSTR)lpWindowName); - else + /* Initialize a LARGE_STRING */ + RtlInitLargeString(&WindowName, lpWindowName, Unicode); + + // HACK: The current implementation expects the Window name to be UNICODE + if (!Unicode) { - if (!RtlCreateUnicodeStringFromAsciiz(&WindowName, (PCSZ)lpWindowName)) + NTSTATUS Status; + PSTR AnsiBuffer = WindowName.Buffer; + ULONG AnsiLength = WindowName.Length; + + WindowName.Length = 0; + WindowName.MaximumLength = AnsiLength * sizeof(WCHAR); + WindowName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + WindowName.MaximumLength); + if (!WindowName.Buffer) { - if (!IS_ATOM(lpClassName)) - { - RtlFreeUnicodeString(&ClassName); - } SetLastError(ERROR_OUTOFMEMORY); - return (HWND)0; + goto cleanup; + } + + Status = RtlMultiByteToUnicodeN(WindowName.Buffer, + WindowName.MaximumLength, + &WindowName.Length, + AnsiBuffer, + AnsiLength); + if (!NT_SUCCESS(Status)) + { + goto cleanup; } } @@ -223,8 +274,11 @@ User32CreateWindowEx(DWORD dwExStyle, } } + if (!Unicode) dwExStyle |= WS_EX_SETANSICREATOR; + Handle = NtUserCreateWindowEx(dwExStyle, - &ClassName, + plstrClassName, + NULL, &WindowName, dwStyle, x, @@ -235,23 +289,23 @@ User32CreateWindowEx(DWORD dwExStyle, hMenu, hInstance, lpParam, - SW_SHOW, - Unicode, - 0); + 0, + NULL); #if 0 DbgPrint("[window] NtUserCreateWindowEx() == %d\n", Handle); #endif - +cleanup: if(!Unicode) { - RtlFreeUnicodeString(&WindowName); - if (!IS_ATOM(lpClassName)) { RtlFreeUnicodeString(&ClassName); } + + RtlFreeLargeString(&WindowName); } + return Handle; } diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h index 53a8f6a3311..0d6d7811db7 100644 --- a/reactos/include/reactos/win32k/ntuser.h +++ b/reactos/include/reactos/win32k/ntuser.h @@ -514,7 +514,7 @@ typedef struct _WND HRGN hrgnClip; HRGN hrgnNewFrame; /* Window name. */ - UNICODE_STRING strName; + LARGE_UNICODE_STRING strName; /* Size of the extra data associated with the window. */ ULONG cbwndExtra; HWND hWndLastActive; @@ -1469,31 +1469,12 @@ NtUserCreateLocalMemHandle( DWORD Unknown2, DWORD Unknown3); -HWND -NTAPI -NtUserCreateWindowEx( - DWORD dwExStyle, - PUNICODE_STRING lpClassName, - PUNICODE_STRING lpWindowName, - DWORD dwStyle, - LONG x, - LONG y, - LONG nWidth, - LONG nHeight, - HWND hWndParent, - HMENU hMenu, - HINSTANCE hInstance, - LPVOID lpParam, - DWORD dwShowMode, - BOOL bUnicodeWindow, - DWORD dwUnknown); -#if 0 HWND NTAPI NtUserCreateWindowEx( DWORD dwExStyle, // |= 0x80000000 == Ansi used to set WNDS_ANSICREATOR PLARGE_STRING plstrClassName, - PLARGE_STRING plstrClsVesrion, + PLARGE_STRING plstrClsVersion, PLARGE_STRING plstrWindowName, DWORD dwStyle, int x, @@ -1506,7 +1487,6 @@ NtUserCreateWindowEx( LPVOID lpParam, DWORD dwFlags, PVOID acbiBuffer); -#endif HWINSTA NTAPI diff --git a/reactos/subsystems/win32/win32k/include/window.h b/reactos/subsystems/win32/win32k/include/window.h index 16098e456b1..90143244458 100644 --- a/reactos/subsystems/win32/win32k/include/window.h +++ b/reactos/subsystems/win32/win32k/include/window.h @@ -155,7 +155,7 @@ IntDefWindowProc( PWINDOW_OBJECT Window, UINT Msg, WPARAM wParam, LPARAM lParam, VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG); -PWND APIENTRY co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PUNICODE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL); +PWND APIENTRY co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PLARGE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL); WNDPROC FASTCALL IntGetWindowProc(PWND,BOOL); /* EOF */ diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index df04a4f5313..1c972f95075 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -882,7 +882,8 @@ NtUserCreateDesktop( ULONG_PTR HeapSize = 4 * 1024 * 1024; /* FIXME */ HWINSTA hWindowStation = NULL ; PUNICODE_STRING lpszDesktopName = NULL; - UNICODE_STRING ClassName, WindowName, MenuName; + UNICODE_STRING ClassName, MenuName; + LARGE_STRING WindowName; PWND pWnd = NULL; DECLARE_RETURN(HDESK); diff --git a/reactos/subsystems/win32/win32k/ntuser/message.c b/reactos/subsystems/win32/win32k/ntuser/message.c index 12744d3a14f..b626b881db4 100644 --- a/reactos/subsystems/win32/win32k/ntuser/message.c +++ b/reactos/subsystems/win32/win32k/ntuser/message.c @@ -171,7 +171,7 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Non NCCALCSIZE_PARAMS *PackedNcCalcsize; CREATESTRUCTW *UnpackedCs; CREATESTRUCTW *PackedCs; - PUNICODE_STRING WindowName; + PLARGE_STRING WindowName; PUNICODE_STRING ClassName; POOL_TYPE PoolType; UINT Size; @@ -205,7 +205,7 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Non else if (WM_CREATE == Msg || WM_NCCREATE == Msg) { UnpackedCs = (CREATESTRUCTW *) lParam; - WindowName = (PUNICODE_STRING) UnpackedCs->lpszName; + WindowName = (PLARGE_STRING) UnpackedCs->lpszName; ClassName = (PUNICODE_STRING) UnpackedCs->lpszClass; Size = sizeof(CREATESTRUCTW) + WindowName->Length + sizeof(WCHAR); if (IS_ATOM(ClassName->Buffer)) diff --git a/reactos/subsystems/win32/win32k/ntuser/painting.c b/reactos/subsystems/win32/win32k/ntuser/painting.c index ce612a5076a..0e042410757 100644 --- a/reactos/subsystems/win32/win32k/ntuser/painting.c +++ b/reactos/subsystems/win32/win32k/ntuser/painting.c @@ -1896,7 +1896,13 @@ BOOL UserDrawCaption( if (str) UserDrawCaptionText(hMemDc, str, &r, uFlags); else if (pWnd != NULL) - UserDrawCaptionText(hMemDc, &pWnd->Wnd->strName, &r, uFlags); + { + UNICODE_STRING ustr; + ustr.Buffer = pWnd->Wnd->strName.Buffer; + ustr.Length = pWnd->Wnd->strName.Length; + ustr.MaximumLength = pWnd->Wnd->strName.MaximumLength; + UserDrawCaptionText(hMemDc, &ustr, &r, uFlags); + } } if(!NtGdiBitBlt(hDc, lpRc->left, lpRc->top, diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 965b007b8b9..e3bd9bd6235 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -1660,7 +1660,7 @@ IntCalcDefPosSize(PWINDOW_OBJECT Parent, RECTL *rc, BOOL IncPos) PWND APIENTRY co_IntCreateWindowEx(DWORD dwExStyle, PUNICODE_STRING ClassName, - PUNICODE_STRING WindowName, + PLARGE_STRING WindowName, DWORD dwStyle, LONG x, LONG y, @@ -2485,106 +2485,166 @@ CLEANUP: END_CLEANUP; } -HWND APIENTRY -NtUserCreateWindowEx(DWORD dwExStyle, - PUNICODE_STRING UnsafeClassName, - PUNICODE_STRING UnsafeWindowName, - DWORD dwStyle, - LONG x, - LONG y, - LONG nWidth, - LONG nHeight, - HWND hWndParent, - HMENU hMenu, - HINSTANCE hInstance, - LPVOID lpParam, - DWORD dwShowMode, - BOOL bUnicodeWindow, - DWORD dwUnknown) +NTSTATUS +NTAPI +ProbeAndCaptureLargeString( + OUT PLARGE_STRING plstrSafe, + IN PLARGE_STRING plstrUnsafe) { - NTSTATUS Status; - UNICODE_STRING WindowName; - UNICODE_STRING ClassName; - HWND NewWindow = NULL; - PWND pNewWindow; - DECLARE_RETURN(HWND); + LARGE_STRING lstrTemp; + PVOID pvBuffer = NULL; - DPRINT("Enter NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth, nHeight); - UserEnterExclusive(); + _SEH2_TRY + { + /* Probe and copy the string */ + ProbeForRead(plstrUnsafe, sizeof(LARGE_STRING), sizeof(ULONG)); + lstrTemp = *plstrUnsafe; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Fail */ + _SEH2_YIELD(return _SEH2_GetExceptionCode();) + } + _SEH2_END - /* Get the class name (string or atom) */ - Status = MmCopyFromCaller(&ClassName, UnsafeClassName, sizeof(UNICODE_STRING)); - if (! NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( NULL); - } - if (ClassName.Length != 0) - { - Status = IntSafeCopyUnicodeStringTerminateNULL(&ClassName, UnsafeClassName); - if (! NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( NULL); - } - } - else if (! IS_ATOM(ClassName.Buffer)) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - RETURN(NULL); - } + if (lstrTemp.Length != 0) + { + /* Allocate a buffer from paged pool */ + pvBuffer = ExAllocatePoolWithTag(PagedPool, lstrTemp.Length, TAG_STRING); + if (!pvBuffer) + { + return STATUS_NO_MEMORY; + } - /* safely copy the window name */ - if (NULL != UnsafeWindowName) - { - Status = IntSafeCopyUnicodeString(&WindowName, UnsafeWindowName); - if (! NT_SUCCESS(Status)) - { - if (! IS_ATOM(ClassName.Buffer)) - { - ExFreePoolWithTag(ClassName.Buffer, TAG_STRING); - } - SetLastNtError(Status); - RETURN( NULL); - } - } - else - { - RtlInitUnicodeString(&WindowName, NULL); - } + _SEH2_TRY + { + /* Probe and copy the buffer */ + ProbeForRead(lstrTemp.Buffer, lstrTemp.Length, sizeof(WCHAR)); + RtlCopyMemory(pvBuffer, lstrTemp.Buffer, lstrTemp.Length); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Cleanup and fail */ + ExFreePool(pvBuffer); + _SEH2_YIELD(return _SEH2_GetExceptionCode();) + } + _SEH2_END + } - pNewWindow = co_IntCreateWindowEx( dwExStyle, - &ClassName, - &WindowName, - dwStyle, - x, - y, - nWidth, - nHeight, - hWndParent, - hMenu, - hInstance, - lpParam, - dwShowMode, - bUnicodeWindow); + /* Set the output string */ + plstrSafe->Buffer = pvBuffer; + plstrSafe->Length = lstrTemp.Length; + plstrSafe->MaximumLength = lstrTemp.Length; - if (pNewWindow) NewWindow = UserHMGetHandle(pNewWindow); + return STATUS_SUCCESS; +} - if (WindowName.Buffer) - { - ExFreePoolWithTag(WindowName.Buffer, TAG_STRING); - } - if (! IS_ATOM(ClassName.Buffer)) - { - ExFreePoolWithTag(ClassName.Buffer, TAG_STRING); - } +/** + * \todo Allow passing plstrClassName as ANSI. + */ +HWND +NTAPI +NtUserCreateWindowEx( + DWORD dwExStyle, + PLARGE_STRING plstrClassName, + PLARGE_STRING plstrClsVersion, + PLARGE_STRING plstrWindowName, + DWORD dwStyle, + int x, + int y, + int nWidth, + int nHeight, + HWND hWndParent, + HMENU hMenu, + HINSTANCE hInstance, + LPVOID lpParam, + DWORD dwFlags, + PVOID acbiBuffer) +{ + NTSTATUS Status; + LARGE_STRING lstrWindowName; + LARGE_STRING lstrClassName; + UNICODE_STRING ustrClassName; + HWND hwnd = NULL; + PWND pwnd; - RETURN( NewWindow); + DPRINT("Enter NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth, nHeight); + UserEnterExclusive(); -CLEANUP: - DPRINT("Leave NtUserCreateWindowEx, ret=%i\n",_ret_); + lstrWindowName.Buffer = NULL; + lstrClassName.Buffer = NULL; + + /* Check if we got a Window name */ + if (plstrWindowName) + { + /* Copy the string to kernel mode */ + Status = ProbeAndCaptureLargeString(&lstrWindowName, plstrWindowName); + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + goto leave; + } + plstrWindowName = &lstrWindowName; + } + + /* Check if the class is an atom */ + if (IS_ATOM(plstrClassName)) + { + /* It is, pass the atom in the UNICODE_STRING */ + ustrClassName.Buffer = (PVOID)plstrClassName; + ustrClassName.Length = 0; + ustrClassName.MaximumLength = 0; + } + else + { + /* It's not, capture the class name */ + Status = ProbeAndCaptureLargeString(&lstrClassName, plstrClassName); + if (!NT_SUCCESS(Status)) + { + /* Set last error, cleanup and return */ + SetLastNtError(Status); + goto cleanup; + } + + /* We pass it on as a UNICODE_STRING */ + ustrClassName.Buffer = lstrClassName.Buffer; + ustrClassName.Length = lstrClassName.Length; + ustrClassName.MaximumLength = lstrClassName.MaximumLength; + } + + /* Call the internal function */ + pwnd = co_IntCreateWindowEx(dwExStyle, + &ustrClassName, + plstrWindowName, + dwStyle, + x, + y, + nWidth, + nHeight, + hWndParent, + hMenu, + hInstance, + lpParam, + SW_SHOW, + !(dwExStyle & WS_EX_SETANSICREATOR)); + + hwnd = pwnd ? UserHMGetHandle(pwnd) : NULL; + +cleanup: + if (lstrWindowName.Buffer) + { + ExFreePoolWithTag(lstrWindowName.Buffer, TAG_STRING); + } + if (lstrClassName.Buffer) + { + ExFreePoolWithTag(lstrClassName.Buffer, TAG_STRING); + } + +leave: + DPRINT("Leave NtUserCreateWindowEx, hwnd=%i\n", hwnd); UserLeave(); - END_CLEANUP; + + return hwnd; } /* @@ -2852,6 +2912,7 @@ IntFindWindow(PWINDOW_OBJECT Parent, BOOL CheckWindowName; HWND *List, *phWnd; HWND Ret = NULL; + UNICODE_STRING CurrentWindowName; ASSERT(Parent); @@ -2879,13 +2940,20 @@ IntFindWindow(PWINDOW_OBJECT Parent, /* Do not send WM_GETTEXT messages in the kernel mode version! The user mode version however calls GetWindowText() which will send WM_GETTEXT messages to windows belonging to its processes */ - if((!CheckWindowName || !RtlCompareUnicodeString(WindowName, &(Child->Wnd->strName), TRUE)) && - (!ClassAtom || Child->Wnd->pcls->atomClassName == ClassAtom)) + if (!ClassAtom || Child->Wnd->pcls->atomClassName == ClassAtom) { - Ret = Child->hSelf; - break; + // HACK: use UNICODE_STRING instead of LARGE_STRING + CurrentWindowName.Buffer = Child->Wnd->strName.Buffer; + CurrentWindowName.Length = Child->Wnd->strName.Length; + CurrentWindowName.MaximumLength = Child->Wnd->strName.MaximumLength; + if(!CheckWindowName || + (Child->Wnd->strName.Length < 0xFFFF && + !RtlCompareUnicodeString(WindowName, &CurrentWindowName, TRUE))) + { + Ret = Child->hSelf; + break; + } } - } ExFreePool(List); } @@ -3042,6 +3110,8 @@ NtUserFindWindowEx(HWND hwndParent, /* search children */ while(*phWnd) { + UNICODE_STRING ustr; + if(!(TopLevelWindow = UserGetWindowObject(*(phWnd++)))) { continue; @@ -3050,8 +3120,12 @@ NtUserFindWindowEx(HWND hwndParent, /* Do not send WM_GETTEXT messages in the kernel mode version! The user mode version however calls GetWindowText() which will send WM_GETTEXT messages to windows belonging to its processes */ - WindowMatches = !CheckWindowName || !RtlCompareUnicodeString( - &WindowName, &TopLevelWindow->Wnd->strName, TRUE); + ustr.Buffer = TopLevelWindow->Wnd->strName.Buffer; + ustr.Length = TopLevelWindow->Wnd->strName.Length; + ustr.MaximumLength = TopLevelWindow->Wnd->strName.MaximumLength; + WindowMatches = !CheckWindowName || + (TopLevelWindow->Wnd->strName.Length < 0xFFFF && + !RtlCompareUnicodeString(&WindowName, &ustr, TRUE)); ClassMatches = (ClassAtom == (RTL_ATOM)0) || ClassAtom == TopLevelWindow->Wnd->pcls->atomClassName; From 411d63472024b7908b57001f2bfe3cb04ff74394 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 22 May 2010 02:32:28 +0000 Subject: [PATCH 148/151] [USER32] Fix uninitialized variable svn path=/trunk/; revision=47296 --- reactos/dll/win32/user32/windows/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index bd4541c2cd2..2427cd76ee0 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -186,7 +186,7 @@ User32CreateWindowEx(DWORD dwExStyle, UNICODE_STRING ClassName; WNDCLASSEXA wceA; WNDCLASSEXW wceW; - HWND Handle; + HWND Handle = NULL; #if 0 DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent); From 654ef19f705ccf3a94c8c639496f88f80d218350 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 22 May 2010 02:42:38 +0000 Subject: [PATCH 149/151] [WIN32K] Remove WS_EX_SETANSICREATOR from Ex style in co_IntCreateWindowEx svn path=/trunk/; revision=47297 --- reactos/subsystems/win32/win32k/ntuser/window.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index e3bd9bd6235..e9f64d292f4 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -1998,6 +1998,8 @@ AllocErr: else dwExStyle &= ~WS_EX_WINDOWEDGE; + dwExStyle &= ~WS_EX_SETANSICREATOR; + Wnd->style = dwStyle & ~WS_VISIBLE; /* Correct the window style. */ From 8c14d4381906ca79284c29e62a9700ea5eb47302 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 22 May 2010 10:20:56 +0000 Subject: [PATCH 150/151] [INTL] - Replace hard-coded unit strings ('Metric' and 'Imperial') by resource strings. - Add the required resource strings to all supported languages. - Translators: Please translate these strings. svn path=/trunk/; revision=47298 --- reactos/dll/cpl/intl/lang/bg-BG.rc | 2 ++ reactos/dll/cpl/intl/lang/cs-CZ.rc | 2 ++ reactos/dll/cpl/intl/lang/de-DE.rc | 2 ++ reactos/dll/cpl/intl/lang/en-US.rc | 2 ++ reactos/dll/cpl/intl/lang/es-ES.rc | 2 ++ reactos/dll/cpl/intl/lang/fr-FR.rc | 2 ++ reactos/dll/cpl/intl/lang/it-IT.rc | 2 ++ reactos/dll/cpl/intl/lang/no-NO.rc | 2 ++ reactos/dll/cpl/intl/lang/pl-PL.rc | 2 ++ reactos/dll/cpl/intl/lang/ro-RO.rc | 4 +++- reactos/dll/cpl/intl/lang/ru-RU.rc | 2 ++ reactos/dll/cpl/intl/lang/sk-SK.rc | 2 ++ reactos/dll/cpl/intl/lang/uk-UA.rc | 2 ++ reactos/dll/cpl/intl/lang/zh-CN.rc | 2 ++ reactos/dll/cpl/intl/numbers.c | 7 ++++--- reactos/dll/cpl/intl/resource.h | 2 ++ 16 files changed, 35 insertions(+), 4 deletions(-) diff --git a/reactos/dll/cpl/intl/lang/bg-BG.rc b/reactos/dll/cpl/intl/lang/bg-BG.rc index 1e6af627b8f..75d62f3391a 100644 --- a/reactos/dll/cpl/intl/lang/bg-BG.rc +++ b/reactos/dll/cpl/intl/lang/bg-BG.rc @@ -188,6 +188,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE " " IDS_SPAIN "Spanish (Spain)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/cs-CZ.rc b/reactos/dll/cpl/intl/lang/cs-CZ.rc index 4e0047868ca..c72579df513 100644 --- a/reactos/dll/cpl/intl/lang/cs-CZ.rc +++ b/reactos/dll/cpl/intl/lang/cs-CZ.rc @@ -193,6 +193,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Pizpsobit mstn nastaven" IDS_SPAIN "panltina (panlsko)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/de-DE.rc b/reactos/dll/cpl/intl/lang/de-DE.rc index 909652966c4..07c47b20238 100644 --- a/reactos/dll/cpl/intl/lang/de-DE.rc +++ b/reactos/dll/cpl/intl/lang/de-DE.rc @@ -187,6 +187,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Regionale Einstellungen bearbeiten" IDS_SPAIN "Spanisch (Spanien)" + IDS_METRIC "Metrisch" + IDS_IMPERIAL "US-Mae" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/en-US.rc b/reactos/dll/cpl/intl/lang/en-US.rc index d04ab75effe..f9abb75af08 100644 --- a/reactos/dll/cpl/intl/lang/en-US.rc +++ b/reactos/dll/cpl/intl/lang/en-US.rc @@ -188,6 +188,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Customize Regional Options" IDS_SPAIN "Spanish (Spain)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/es-ES.rc b/reactos/dll/cpl/intl/lang/es-ES.rc index e96c6c40fa4..ee4b0d02e4b 100644 --- a/reactos/dll/cpl/intl/lang/es-ES.rc +++ b/reactos/dll/cpl/intl/lang/es-ES.rc @@ -194,6 +194,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Personaliza opciones regionales" IDS_SPAIN "Espaol (Espaa)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/fr-FR.rc b/reactos/dll/cpl/intl/lang/fr-FR.rc index ffbb2a6e7e7..363e980fd9e 100644 --- a/reactos/dll/cpl/intl/lang/fr-FR.rc +++ b/reactos/dll/cpl/intl/lang/fr-FR.rc @@ -191,6 +191,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Personnaliser les options rgionales" IDS_SPAIN "Espagnol (Espagne)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/it-IT.rc b/reactos/dll/cpl/intl/lang/it-IT.rc index d4156f1aa49..46217f3ff92 100644 --- a/reactos/dll/cpl/intl/lang/it-IT.rc +++ b/reactos/dll/cpl/intl/lang/it-IT.rc @@ -190,6 +190,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Opzioni internazionali e della lingua" IDS_SPAIN "Spanish (Spain)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/no-NO.rc b/reactos/dll/cpl/intl/lang/no-NO.rc index c2d0509f817..376f1bccdac 100644 --- a/reactos/dll/cpl/intl/lang/no-NO.rc +++ b/reactos/dll/cpl/intl/lang/no-NO.rc @@ -188,6 +188,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Innstillinger for region og sprk" IDS_SPAIN "Spanisk (Spain)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/pl-PL.rc b/reactos/dll/cpl/intl/lang/pl-PL.rc index b3ec2685c5c..a80e5dba5da 100644 --- a/reactos/dll/cpl/intl/lang/pl-PL.rc +++ b/reactos/dll/cpl/intl/lang/pl-PL.rc @@ -195,6 +195,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Dostosuj Ustawienia regionalne" IDS_SPAIN "Hiszpaski (Hiszpania)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/ro-RO.rc b/reactos/dll/cpl/intl/lang/ro-RO.rc index fc13dc93114..366453baef2 100644 --- a/reactos/dll/cpl/intl/lang/ro-RO.rc +++ b/reactos/dll/cpl/intl/lang/ro-RO.rc @@ -1,4 +1,4 @@ -LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL #pragma code_page(65001) @@ -190,6 +190,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Particularizare opțiuni" IDS_SPAIN "Spaniolă (Spainia)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/ru-RU.rc b/reactos/dll/cpl/intl/lang/ru-RU.rc index e9d36439fe0..6c3b3d637c8 100644 --- a/reactos/dll/cpl/intl/lang/ru-RU.rc +++ b/reactos/dll/cpl/intl/lang/ru-RU.rc @@ -186,6 +186,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE " " IDS_SPAIN " ()" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/sk-SK.rc b/reactos/dll/cpl/intl/lang/sk-SK.rc index 8ddc3c29384..665d484a837 100644 --- a/reactos/dll/cpl/intl/lang/sk-SK.rc +++ b/reactos/dll/cpl/intl/lang/sk-SK.rc @@ -194,6 +194,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Prispsobi miestne nastavenia" IDS_SPAIN "Spanish (Spain)" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/uk-UA.rc b/reactos/dll/cpl/intl/lang/uk-UA.rc index 0b0b71fea73..4224beb675d 100644 --- a/reactos/dll/cpl/intl/lang/uk-UA.rc +++ b/reactos/dll/cpl/intl/lang/uk-UA.rc @@ -197,6 +197,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE " " IDS_SPAIN " ()" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/lang/zh-CN.rc b/reactos/dll/cpl/intl/lang/zh-CN.rc index 02cd64aed7b..1cb41817ce0 100644 --- a/reactos/dll/cpl/intl/lang/zh-CN.rc +++ b/reactos/dll/cpl/intl/lang/zh-CN.rc @@ -194,6 +194,8 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Զѡ" IDS_SPAIN " ()" + IDS_METRIC "Metric" + IDS_IMPERIAL "Imperial" END STRINGTABLE diff --git a/reactos/dll/cpl/intl/numbers.c b/reactos/dll/cpl/intl/numbers.c index 1ca113d076a..75f609bda1d 100644 --- a/reactos/dll/cpl/intl/numbers.c +++ b/reactos/dll/cpl/intl/numbers.c @@ -58,8 +58,6 @@ static LPTSTR lpLeadNumFmtSamples[MAX_LEAD_ZEROES_SAMPLES] = {_T(",7"), _T("0,7")}; static LPTSTR lpListSepSamples[MAX_LIST_SEP_SAMPLES] = {_T(";")}; -static LPTSTR lpUnitsSysSamples[MAX_UNITS_SYS_SAMPLES] = - {_T("Metric"), _T("Imperial")}; /* Init num decimal separator control box */ @@ -495,6 +493,7 @@ InitUnitsSysCB(HWND hwndDlg, LCID lcid) { TCHAR szUnitsSys[MAX_SAMPLES_STR_SIZE]; + TCHAR szUnitName[128]; INT nCBIndex; /* Get current system of units */ @@ -512,10 +511,12 @@ InitUnitsSysCB(HWND hwndDlg, /* Create list of standard system of units */ for (nCBIndex = 0; nCBIndex < MAX_UNITS_SYS_SAMPLES; nCBIndex++) { + LoadString(hApplet, IDS_METRIC + nCBIndex, szUnitName, 128); + SendMessage(GetDlgItem(hwndDlg, IDC_NUMBERSMEASSYS), CB_ADDSTRING, 0, - (LPARAM)lpUnitsSysSamples[nCBIndex]); + (LPARAM)szUnitName); } /* Set current item to value from registry */ diff --git a/reactos/dll/cpl/intl/resource.h b/reactos/dll/cpl/intl/resource.h index 8491517acce..117077573fa 100644 --- a/reactos/dll/cpl/intl/resource.h +++ b/reactos/dll/cpl/intl/resource.h @@ -74,5 +74,7 @@ #define IDS_CPLDESCRIPTION 1001 #define IDS_CUSTOMIZE_TITLE 1002 #define IDS_SPAIN 1003 +#define IDS_METRIC 1004 +#define IDS_IMPERIAL 1005 /* EOF */ From 8762a0ee20e16614b32ed52526fdcd741e0f3dcf Mon Sep 17 00:00:00 2001 From: Gabriel Ilardi Date: Sat, 22 May 2010 10:49:28 +0000 Subject: [PATCH 151/151] [INTL] Translate 'Metric' and 'Imperial' strings into Italian and Spanish. svn path=/trunk/; revision=47299 --- reactos/dll/cpl/intl/lang/es-ES.rc | 2 +- reactos/dll/cpl/intl/lang/it-IT.rc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/dll/cpl/intl/lang/es-ES.rc b/reactos/dll/cpl/intl/lang/es-ES.rc index ee4b0d02e4b..e0987242f86 100644 --- a/reactos/dll/cpl/intl/lang/es-ES.rc +++ b/reactos/dll/cpl/intl/lang/es-ES.rc @@ -194,7 +194,7 @@ STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Personaliza opciones regionales" IDS_SPAIN "Espaol (Espaa)" - IDS_METRIC "Metric" + IDS_METRIC "Mtrico" IDS_IMPERIAL "Imperial" END diff --git a/reactos/dll/cpl/intl/lang/it-IT.rc b/reactos/dll/cpl/intl/lang/it-IT.rc index 46217f3ff92..ee1513a685c 100644 --- a/reactos/dll/cpl/intl/lang/it-IT.rc +++ b/reactos/dll/cpl/intl/lang/it-IT.rc @@ -189,9 +189,9 @@ END STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Opzioni internazionali e della lingua" - IDS_SPAIN "Spanish (Spain)" - IDS_METRIC "Metric" - IDS_IMPERIAL "Imperial" + IDS_SPAIN "Spagnolo (Spagna)" + IDS_METRIC "Metrico" + IDS_IMPERIAL "Imperiale" END STRINGTABLE