[WIN32K] - Formating... No code changes.

svn path=/trunk/; revision=54160
This commit is contained in:
Rafal Harabien 2011-10-16 12:26:22 +00:00
parent 7ab2968d8e
commit 1a70d9f223
2 changed files with 526 additions and 533 deletions

View file

@ -143,13 +143,6 @@ RawInputThreadMain()
ByteOffset.QuadPart = (LONGLONG)0;
WaitTimeout.QuadPart = (LONGLONG)(-10000000);
/*do
{
KEVENT Event;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Status = KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &WaitTimeout);
} while (!NT_SUCCESS(Status));*/
ptiRawInput = PsGetCurrentThreadWin32Thread();
ptiRawInput->TIF_flags |= TIF_SYSTEMTHREAD;
TRACE("Raw Input Thread 0x%x\n", ptiRawInput);

View file

@ -43,7 +43,7 @@ static NTSTATUS APIENTRY ReadRegistryValue( PUNICODE_STRING KeyName,
InitializeObjectAttributes(&KeyAttributes, KeyName, OBJ_CASE_INSENSITIVE,
NULL, NULL);
Status = ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
if( !NT_SUCCESS(Status) )
if (!NT_SUCCESS(Status))
{
return Status;
}
@ -53,18 +53,18 @@ static NTSTATUS APIENTRY ReadRegistryValue( PUNICODE_STRING KeyName,
0,
&ResLength);
if( Status != STATUS_BUFFER_TOO_SMALL )
if (Status != STATUS_BUFFER_TOO_SMALL)
{
NtClose(KeyHandle);
return Status;
}
ResLength += sizeof( *KeyValuePartialInfo );
ResLength += sizeof(*KeyValuePartialInfo);
KeyValuePartialInfo =
ExAllocatePoolWithTag(PagedPool, ResLength, TAG_STRING);
Length = ResLength;
if( !KeyValuePartialInfo )
if (!KeyValuePartialInfo)
{
NtClose(KeyHandle);
return STATUS_NO_MEMORY;
@ -77,7 +77,7 @@ static NTSTATUS APIENTRY ReadRegistryValue( PUNICODE_STRING KeyName,
Length,
&ResLength);
if( !NT_SUCCESS(Status) )
if (!NT_SUCCESS(Status))
{
NtClose(KeyHandle);
ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
@ -89,7 +89,7 @@ static NTSTATUS APIENTRY ReadRegistryValue( PUNICODE_STRING KeyName,
KeyValuePartialInfo->DataLength,
TAG_STRING);
if(!ReturnBuffer)
if (!ReturnBuffer)
{
NtClose(KeyHandle);
ExFreePoolWithTag(KeyValuePartialInfo, TAG_STRING);
@ -124,14 +124,14 @@ static BOOL UserLoadKbdDll(WCHAR *wsKLID,
L"CurrentControlSet\\Control\\Keyboard Layouts\\";
RtlInitUnicodeString(&klid, wsKLID);
RtlInitUnicodeString(&LayoutValueName,L"Layout File");
RtlInitUnicodeString(&LayoutValueName, L"Layout File");
RtlInitUnicodeString(&LayoutKeyName, KeyNameBuffer);
LayoutKeyName.MaximumLength = sizeof(KeyNameBuffer);
RtlAppendUnicodeStringToString(&LayoutKeyName, &klid);
Status = ReadRegistryValue(&LayoutKeyName, &LayoutValueName, &LayoutFile);
if(!NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{
TRACE("Can't get layout filename for %wZ. (%08lx)\n", klid, Status);
return FALSE;
@ -146,14 +146,14 @@ static BOOL UserLoadKbdDll(WCHAR *wsKLID,
*phModule = EngLoadImage(FullLayoutPath.Buffer);
if(*phModule)
if (*phModule)
{
TRACE("Loaded %wZ\n", &FullLayoutPath);
RtlInitAnsiString( &kbdProcedureName, "KbdLayerDescriptor" );
layerDescGetFn = EngFindImageProcAddress(*phModule, "KbdLayerDescriptor");
if(layerDescGetFn)
if (layerDescGetFn)
{
*pKbdTables = layerDescGetFn();
}
@ -162,7 +162,7 @@ static BOOL UserLoadKbdDll(WCHAR *wsKLID,
ERR("Error: %wZ has no KbdLayerDescriptor()\n", &FullLayoutPath);
}
if(!layerDescGetFn || !*pKbdTables)
if (!layerDescGetFn || !*pKbdTables)
{
ERR("Failed to load the keyboard layout.\n");
EngUnloadImage(*phModule);
@ -177,21 +177,21 @@ static BOOL UserLoadKbdDll(WCHAR *wsKLID,
PVSC_VK pVscVk = (*pKbdTables)->pVSCtoVK_E0;
DbgPrint("Kbd layout: fLocaleFlags %x bMaxVSCtoVK %x\n", (*pKbdTables)->fLocaleFlags, (*pKbdTables)->bMaxVSCtoVK);
DbgPrint("wMaxModBits %x\n", (*pKbdTables)->pCharModifiers->wMaxModBits);
while(pVkToBit->Vk)
while (pVkToBit->Vk)
{
DbgPrint("VkToBit %x -> %x\n", pVkToBit->Vk, pVkToBit->ModBits);
++pVkToBit;
}
for(i = 0; i <= (*pKbdTables)->pCharModifiers->wMaxModBits; ++i)
for (i = 0; i <= (*pKbdTables)->pCharModifiers->wMaxModBits; ++i)
DbgPrint("ModNumber %x -> %x\n", i, (*pKbdTables)->pCharModifiers->ModNumber[i]);
while(pVkToWchTbl->pVkToWchars)
while (pVkToWchTbl->pVkToWchars)
{
PVK_TO_WCHARS1 pVkToWch = pVkToWchTbl->pVkToWchars;
DbgPrint("pVkToWchTbl nModifications %x cbSize %x\n", pVkToWchTbl->nModifications, pVkToWchTbl->cbSize);
while(pVkToWch->VirtualKey)
while (pVkToWch->VirtualKey)
{
DbgPrint("pVkToWch VirtualKey %x Attributes %x wc { ", pVkToWch->VirtualKey, pVkToWch->Attributes);
for(i = 0; i < pVkToWchTbl->nModifications; ++i)
for (i = 0; i < pVkToWchTbl->nModifications; ++i)
DbgPrint("%x ", pVkToWch->wch[i]);
DbgPrint("}\n");
pVkToWch = (PVK_TO_WCHARS1)(((PBYTE)pVkToWch) + pVkToWchTbl->cbSize);
@ -199,11 +199,11 @@ static BOOL UserLoadKbdDll(WCHAR *wsKLID,
++pVkToWchTbl;
}
DbgPrint("pusVSCtoVK: { ");
for(i = 0; i < (*pKbdTables)->bMaxVSCtoVK; ++i)
for (i = 0; i < (*pKbdTables)->bMaxVSCtoVK; ++i)
DbgPrint("%x -> %x, ", i, (*pKbdTables)->pusVSCtoVK[i]);
DbgPrint("}\n");
DbgPrint("pVSCtoVK_E0: { ");
while(pVscVk->Vsc)
while (pVscVk->Vsc)
{
DbgPrint("%x -> %x, ", pVscVk->Vsc, pVscVk->Vk);
++pVscVk;
@ -211,7 +211,7 @@ static BOOL UserLoadKbdDll(WCHAR *wsKLID,
DbgPrint("}\n");
pVscVk = (*pKbdTables)->pVSCtoVK_E1;
DbgPrint("pVSCtoVK_E1: { ");
while(pVscVk->Vsc)
while (pVscVk->Vsc)
{
DbgPrint("%x -> %x, ", pVscVk->Vsc, pVscVk->Vk);
++pVscVk;
@ -238,7 +238,7 @@ static PKBL UserLoadDllAndCreateKbl(DWORD LocaleId)
NewKbl = ExAllocatePoolWithTag(PagedPool, sizeof(KBL), USERTAG_KBDLAYOUT);
if(!NewKbl)
if (!NewKbl)
{
ERR("%s: Can't allocate memory!\n", __FUNCTION__);
return NULL;
@ -246,7 +246,7 @@ static PKBL UserLoadDllAndCreateKbl(DWORD LocaleId)
swprintf(NewKbl->Name, L"%08lx", LocaleId);
if(!UserLoadKbdDll(NewKbl->Name, &NewKbl->hModule, &NewKbl->KBTables))
if (!UserLoadKbdDll(NewKbl->Name, &NewKbl->hModule, &NewKbl->KBTables))
{
TRACE("%s: failed to load %x dll!\n", __FUNCTION__, LocaleId);
ExFreePoolWithTag(NewKbl, USERTAG_KBDLAYOUT);
@ -288,12 +288,12 @@ BOOL UserInitDefaultKeyboardLayout()
TRACE("DefaultLocale = %08lx\n", LocaleId);
}
if(!NT_SUCCESS(Status) || !(KBLList = UserLoadDllAndCreateKbl(LocaleId)))
if (!NT_SUCCESS(Status) || !(KBLList = UserLoadDllAndCreateKbl(LocaleId)))
{
ERR("Trying to load US Keyboard Layout.\n");
LocaleId = 0x409;
if(!(KBLList = UserLoadDllAndCreateKbl(LocaleId)))
if (!(KBLList = UserLoadDllAndCreateKbl(LocaleId)))
{
ERR("Failed to load any Keyboard Layout\n");
return FALSE;
@ -325,7 +325,7 @@ PKBL W32kGetDefaultKeyLayout(VOID)
// Get the path to HKEY_CURRENT_USER
Status = RtlFormatCurrentUserKeyPath(&CurrentUserPath);
if( NT_SUCCESS(Status) )
if (NT_SUCCESS(Status))
{
FullKeyboardLayoutPath.Buffer = wszBuffer;
FullKeyboardLayoutPath.MaximumLength = sizeof(wszBuffer);
@ -335,7 +335,7 @@ PKBL W32kGetDefaultKeyLayout(VOID)
InitializeObjectAttributes(&KeyAttributes, &CurrentUserPath, OBJ_CASE_INSENSITIVE, NULL, NULL);
Status = ZwOpenKey(&KeyHandle, KEY_READ, &KeyAttributes);
if(Status == STATUS_OBJECT_NAME_NOT_FOUND)
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
{
// It is not available, so read it from HKEY_USERS\.DEFAULT
FullKeyboardLayoutPath.Length = sizeof(szDefaultUserPath) - sizeof(UNICODE_NULL);
@ -353,14 +353,14 @@ PKBL W32kGetDefaultKeyLayout(VOID)
Status = RtlAppendUnicodeToString(&FullKeyboardLayoutPath, szKeyboardLayoutPath);
if( NT_SUCCESS(Status) )
if (NT_SUCCESS(Status))
{
// Return the first keyboard layout listed there
RtlInitUnicodeString(&LayoutValueName, L"1");
Status = ReadRegistryValue(&FullKeyboardLayoutPath, &LayoutValueName, &LayoutLocaleIdString);
if( NT_SUCCESS(Status) )
if (NT_SUCCESS(Status))
{
RtlUnicodeStringToInteger(&LayoutLocaleIdString, 16, &LayoutLocaleId);
ExFreePoolWithTag(LayoutLocaleIdString.Buffer, TAG_STRING);
@ -374,7 +374,7 @@ PKBL W32kGetDefaultKeyLayout(VOID)
else
ERR("RtlFormatCurrentUserKeyPath failed! (%08lx)\n", Status);
if(!LayoutLocaleId)
if (!LayoutLocaleId)
{
ERR("Assuming default locale for the keyboard layout (0x409 - US)\n");
LayoutLocaleId = 0x409;
@ -383,18 +383,18 @@ PKBL W32kGetDefaultKeyLayout(VOID)
pKbl = KBLList;
do
{
if(pKbl->klid == LayoutLocaleId)
if (pKbl->klid == LayoutLocaleId)
{
return pKbl;
}
pKbl = (PKBL) pKbl->List.Flink;
} while(pKbl != KBLList);
} while (pKbl != KBLList);
TRACE("Loading new default keyboard layout.\n");
pKbl = UserLoadDllAndCreateKbl(LayoutLocaleId);
if(!pKbl)
if (!pKbl)
{
TRACE("Failed to load %x!!! Returning any availableKL.\n", LayoutLocaleId);
return KBLList;
@ -409,9 +409,9 @@ PKBL UserHklToKbl(HKL hKl)
PKBL pKbl = KBLList;
do
{
if(pKbl->hkl == hKl) return pKbl;
if (pKbl->hkl == hKl) return pKbl;
pKbl = (PKBL) pKbl->List.Flink;
} while(pKbl != KBLList);
} while (pKbl != KBLList);
return NULL;
}
@ -421,13 +421,13 @@ BOOL UserUnloadKbl(PKBL pKbl)
/* According to msdn, UnloadKeyboardLayout can fail
if the keyboard layout identifier was preloaded. */
if(pKbl->Flags & KBL_PRELOAD)
if (pKbl->Flags & KBL_PRELOAD)
{
ERR("Attempted to unload preloaded keyboard layout.\n");
return FALSE;
}
if(pKbl->RefCount > 0)
if (pKbl->RefCount > 0)
{
/* Layout is used by other threads.
Mark it as unloaded and don't do anything else. */
@ -453,13 +453,13 @@ static PKBL co_UserActivateKbl(PTHREADINFO w32Thread, PKBL pKbl, UINT Flags)
w32Thread->KeyboardLayout = pKbl;
pKbl->RefCount++;
if(Flags & KLF_SETFORPROCESS)
if (Flags & KLF_SETFORPROCESS)
{
//FIXME
}
if(Prev->Flags & KBL_UNLOAD && Prev->RefCount == 0)
if (Prev->Flags & KBL_UNLOAD && Prev->RefCount == 0)
{
UserUnloadKbl(Prev);
}
@ -484,14 +484,14 @@ UserGetKeyboardLayout(
PTHREADINFO W32Thread;
HKL Ret;
if(!dwThreadId)
if (!dwThreadId)
{
W32Thread = PsGetCurrentThreadWin32Thread();
return W32Thread->KeyboardLayout->hkl;
}
Status = PsLookupThreadByThreadId((HANDLE)(DWORD_PTR)dwThreadId, &Thread);
if(!NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{
EngSetLastError(ERROR_INVALID_PARAMETER);
return NULL;
@ -515,13 +515,13 @@ NtUserGetKeyboardLayoutList(
UserEnterShared();
pKbl = KBLList;
if(nItems == 0)
if (nItems == 0)
{
do
{
Ret++;
pKbl = (PKBL) pKbl->List.Flink;
} while(pKbl != KBLList);
} while (pKbl != KBLList);
}
else
{
@ -529,14 +529,14 @@ NtUserGetKeyboardLayoutList(
{
ProbeForWrite(pHklBuff, nItems*sizeof(HKL), 4);
while(Ret < nItems)
while (Ret < nItems)
{
if(!(pKbl->Flags & KBL_UNLOAD))
if (!(pKbl->Flags & KBL_UNLOAD))
{
pHklBuff[Ret] = pKbl->hkl;
Ret++;
pKbl = (PKBL) pKbl->List.Flink;
if(pKbl == KBLList) break;
if (pKbl == KBLList) break;
}
}
@ -604,7 +604,7 @@ NtUserLoadKeyboardLayoutEx(
Cur = KBLList;
do
{
if(Cur->klid == dwKLID)
if (Cur->klid == dwKLID)
{
pKbl = Cur;
pKbl->Flags &= ~KBL_UNLOAD;
@ -612,14 +612,14 @@ NtUserLoadKeyboardLayoutEx(
}
Cur = (PKBL) Cur->List.Flink;
} while(Cur != KBLList);
} while (Cur != KBLList);
//It wasn't, so load it.
if(!pKbl)
if (!pKbl)
{
pKbl = UserLoadDllAndCreateKbl(dwKLID);
if(!pKbl)
if (!pKbl)
{
goto the_end;
}
@ -627,9 +627,9 @@ NtUserLoadKeyboardLayoutEx(
InsertTailList(&KBLList->List, &pKbl->List);
}
if(Flags & KLF_REORDER) KBLList = pKbl;
if (Flags & KLF_REORDER) KBLList = pKbl;
if(Flags & KLF_ACTIVATE)
if (Flags & KLF_ACTIVATE)
{
co_UserActivateKbl(PsGetCurrentThreadWin32Thread(), pKbl, Flags);
}
@ -659,17 +659,17 @@ NtUserActivateKeyboardLayout(
pWThread = PsGetCurrentThreadWin32Thread();
if(pWThread->KeyboardLayout->hkl == hKl)
if (pWThread->KeyboardLayout->hkl == hKl)
{
Ret = hKl;
goto the_end;
}
if(hKl == (HKL)HKL_NEXT)
if (hKl == (HKL)HKL_NEXT)
{
pKbl = (PKBL)pWThread->KeyboardLayout->List.Flink;
}
else if(hKl == (HKL)HKL_PREV)
else if (hKl == (HKL)HKL_PREV)
{
pKbl = (PKBL)pWThread->KeyboardLayout->List.Blink;
}
@ -677,12 +677,12 @@ NtUserActivateKeyboardLayout(
//FIXME: KLF_RESET, KLF_SHIFTLOCK
if(pKbl)
if (pKbl)
{
if(Flags & KLF_REORDER)
if (Flags & KLF_REORDER)
KBLList = pKbl;
if(pKbl == pWThread->KeyboardLayout)
if (pKbl == pWThread->KeyboardLayout)
{
Ret = pKbl->hkl;
}
@ -694,7 +694,7 @@ NtUserActivateKeyboardLayout(
}
else
{
ERR("%s: Invalid HKL %x!\n", __FUNCTION__, hKl);
ERR("Invalid HKL %x!\n", hKl);
}
the_end:
@ -712,13 +712,13 @@ NtUserUnloadKeyboardLayout(
UserEnterExclusive();
if((pKbl = UserHklToKbl(hKl)))
if ((pKbl = UserHklToKbl(hKl)))
{
Ret = UserUnloadKbl(pKbl);
}
else
{
ERR("%s: Invalid HKL %x!\n", __FUNCTION__, hKl);
ERR("Invalid HKL %x!\n", hKl);
}
UserLeave();