Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

profile.c File Reference

#include "precomp.h"

Go to the source code of this file.

Classes

struct  tagFASTREGMAP
struct  tagPROFILEUSERNAME

Defines

#define PROOT_CPANEL   0
#define PROOT_ACCESS   1
#define PROOT_CURRENTM   2
#define PROOT_CURRENTU   3
#define PROOT_CONTROL   4
#define PROOT_SERVICES   5
#define PROOT_KEYBOARD   6

Typedefs

typedef tagFASTREGMAP FASTREGMAP
typedef tagFASTREGMAPPFASTREGMAP
typedef tagPROFILEUSERNAME PROFILEUSERNAME
typedef tagPROFILEUSERNAMEPPROFILEUSERNAME

Functions

void InitPreviousUserString (void)
PUNICODE_STRING CreateProfileUserName (TL *ptl)
void FreeProfileUserName (PUNICODE_STRING pProfileUserName, TL *ptl)
HANDLE RemoteOpenCacheKeyEx (UINT idSection, ACCESS_MASK amRequest)
HANDLE OpenCacheKeyEx (PUNICODE_STRING pMapName OPTIONAL, UINT idSection, ACCESS_MASK amRequest, PDWORD pdwPolicyFlags)
BOOL CheckDesktopPolicy (PUNICODE_STRING pProfileUserName OPTIONAL, PCWSTR lpKeyName)
BOOL CheckDesktopPolicyChange (PUNICODE_STRING pProfileUserName OPTIONAL)
DWORD FastGetProfileDwordW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, DWORD dwDefault)
DWORD FastGetProfileKeysW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpDefault, LPWSTR *lpReturnedString)
DWORD FastGetProfileStringW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD cchBuf)
UINT FastGetProfileIntW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, UINT nDefault)
BOOL FastWriteProfileStringW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPCWSTR lpString)
int FastGetProfileIntFromID (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT idKey, int def)
DWORD FastGetProfileStringFromIDW (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT idKey, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD cch)
BOOL FastWriteProfileValue (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, UINT uType, LPBYTE lpStruct, UINT cbSizeStruct)
DWORD FastGetProfileValue (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, LPCWSTR lpKeyName, LPBYTE lpDefault, LPBYTE lpReturn, UINT cbSizeReturn)
BOOL FastGetProfileIntsW (PUNICODE_STRING pProfileUserName OPTIONAL, PPROFINTINFO ppii)
BOOL FastUpdateWinIni (PUNICODE_STRING pProfileUserName OPTIONAL, UINT idSection, UINT wKeyNameId, LPWSTR lpszValue)

Variables

CONST PCWSTR aFastRegRoot []
CONST FASTREGMAP aFastRegMap [PMAP_LAST+1]
DWORD gdwPolicyFlags = POLICY_ALL
WCHAR PreviousUserStringBuf [256]
UNICODE_STRING PreviousUserString = {0, sizeof PreviousUserStringBuf, PreviousUserStringBuf}
LUID luidPrevious
CONST WCHAR wszDefaultUser [] = L"\\Registry\\User\\.Default"
UNICODE_STRING DefaultUserString = {sizeof wszDefaultUser - sizeof(WCHAR), sizeof wszDefaultUser, (WCHAR *)wszDefaultUser}


Define Documentation

#define PROOT_ACCESS   1
 

Definition at line 30 of file w32/ntuser/kernel/profile.c.

#define PROOT_CONTROL   4
 

Definition at line 33 of file w32/ntuser/kernel/profile.c.

#define PROOT_CPANEL   0
 

Definition at line 29 of file w32/ntuser/kernel/profile.c.

#define PROOT_CURRENTM   2
 

Definition at line 31 of file w32/ntuser/kernel/profile.c.

#define PROOT_CURRENTU   3
 

Definition at line 32 of file w32/ntuser/kernel/profile.c.

#define PROOT_KEYBOARD   6
 

Definition at line 35 of file w32/ntuser/kernel/profile.c.

#define PROOT_SERVICES   5
 

Definition at line 34 of file w32/ntuser/kernel/profile.c.


Typedef Documentation

typedef struct tagFASTREGMAP FASTREGMAP
 

typedef struct tagFASTREGMAP * PFASTREGMAP
 

typedef struct tagPROFILEUSERNAME * PPROFILEUSERNAME
 

Referenced by CreateProfileUserName().

typedef struct tagPROFILEUSERNAME PROFILEUSERNAME
 


Function Documentation

BOOL CheckDesktopPolicy PUNICODE_STRING pProfileUserName  OPTIONAL,
PCWSTR  lpKeyName
 

Definition at line 426 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, DWORD, FALSE, gdwPolicyFlags, GetCurrentProcessId, gpidLogon, hModuleWin, IS_PTR, NT_ERROR, NTSTATUS(), NULL, OpenCacheKeyEx(), PMAP_DESKTOP, POLICY_MACHINE, POLICY_USER, PTR_TO_ID, RtlInitUnicodeString(), ServerLoadString, Status, and TRUE.

Referenced by xxxSystemParametersInfo().

00430 { 00431 WCHAR szKey[80]; 00432 HANDLE hKey; 00433 DWORD cbSize; 00434 NTSTATUS Status; 00435 UNICODE_STRING UnicodeString; 00436 KEY_VALUE_BASIC_INFORMATION KeyInfo; 00437 DWORD dwPolicyFlags = gdwPolicyFlags & (POLICY_MACHINE | POLICY_USER); 00438 00439 /* 00440 * If there is no policy or the caller is winlogon, let it go. 00441 */ 00442 if (!dwPolicyFlags || GetCurrentProcessId() == gpidLogon) { 00443 return FALSE; 00444 } 00445 00446 /* 00447 * Convert the ID to a string if we need to. 00448 */ 00449 if (!IS_PTR(lpKeyName)) { 00450 ServerLoadString(hModuleWin, PTR_TO_ID(lpKeyName), szKey, ARRAY_SIZE(szKey)); 00451 lpKeyName = szKey; 00452 } 00453 00454 TryAgain: 00455 00456 /* 00457 * Try to open a key. 00458 */ 00459 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00460 PMAP_DESKTOP, 00461 KEY_READ, 00462 &dwPolicyFlags)) == NULL) { 00463 return FALSE; 00464 } 00465 00466 /* 00467 * See if the value exists. 00468 */ 00469 RtlInitUnicodeString(&UnicodeString, lpKeyName); 00470 Status = ZwQueryValueKey(hKey, 00471 &UnicodeString, 00472 KeyValueBasicInformation, 00473 &KeyInfo, 00474 sizeof(KeyInfo), 00475 &cbSize); 00476 00477 ZwClose(hKey); 00478 00479 if (!NT_ERROR(Status)) { 00480 return TRUE; 00481 } else if (dwPolicyFlags) { 00482 goto TryAgain; 00483 } else { 00484 return FALSE; 00485 } 00486 }

BOOL CheckDesktopPolicyChange PUNICODE_STRING pProfileUserName  OPTIONAL  ) 
 

Definition at line 499 of file w32/ntuser/kernel/profile.c.

References BOOL, DWORD, FALSE, gdwPolicyFlags, OpenCacheKeyEx(), PMAP_DESKTOP, POLICY_MACHINE, POLICY_USER, and TRUE.

Referenced by xxxUpdatePerUserSystemParameters().

00502 { 00503 static LARGE_INTEGER LastMachineWriteTime; 00504 static LARGE_INTEGER LastUserWriteTime; 00505 KEY_BASIC_INFORMATION KeyInfo; 00506 BOOL bPolicyChanged = FALSE; 00507 HANDLE hKey; 00508 DWORD cbSize; 00509 DWORD dwPolicyFlags; 00510 00511 /* 00512 * Check if machine policy has changed since last time we checked. 00513 */ 00514 dwPolicyFlags = POLICY_MACHINE; 00515 KeyInfo.LastWriteTime.QuadPart = 0; 00516 hKey = OpenCacheKeyEx(pProfileUserName, 00517 PMAP_DESKTOP, 00518 KEY_READ, 00519 &dwPolicyFlags); 00520 if (hKey) { 00521 ZwQueryKey(hKey, 00522 KeyValueBasicInformation, 00523 &KeyInfo, 00524 sizeof(KeyInfo), 00525 &cbSize); 00526 ZwClose(hKey); 00527 gdwPolicyFlags |= POLICY_MACHINE; 00528 } else { 00529 gdwPolicyFlags &= ~POLICY_MACHINE; 00530 } 00531 if (LastMachineWriteTime.QuadPart != KeyInfo.LastWriteTime.QuadPart) { 00532 LastMachineWriteTime.QuadPart = KeyInfo.LastWriteTime.QuadPart; 00533 bPolicyChanged = TRUE; 00534 } 00535 00536 /* 00537 * Check if user policy has changed since last time we checked. 00538 */ 00539 dwPolicyFlags = POLICY_USER; 00540 KeyInfo.LastWriteTime.QuadPart = 0; 00541 hKey = OpenCacheKeyEx(pProfileUserName, 00542 PMAP_DESKTOP, 00543 KEY_READ, 00544 &dwPolicyFlags); 00545 if (hKey) { 00546 ZwQueryKey(hKey, 00547 KeyValueBasicInformation, 00548 &KeyInfo, 00549 sizeof(KeyInfo), 00550 &cbSize); 00551 ZwClose(hKey); 00552 gdwPolicyFlags |= POLICY_USER; 00553 } else { 00554 gdwPolicyFlags &= ~POLICY_USER; 00555 } 00556 if (LastUserWriteTime.QuadPart != KeyInfo.LastWriteTime.QuadPart) { 00557 LastUserWriteTime.QuadPart = KeyInfo.LastWriteTime.QuadPart; 00558 bPolicyChanged = TRUE; 00559 } 00560 00561 return bPolicyChanged; 00562 }

PUNICODE_STRING CreateProfileUserName TL ptl  ) 
 

Definition at line 151 of file w32/ntuser/kernel/profile.c.

References tagPROFILEUSERNAME::awcName, CheckCritIn, InitPreviousUserString(), tagPROFILEUSERNAME::NameString, NULL, PPROFILEUSERNAME, PreviousUserString, PtiCurrent, RtlCopyUnicodeString(), and ThreadLockPool.

Referenced by InitUserScreen(), NtUserSetSysColors(), PrepareForLogoff(), xxxDesktopWndProc(), xxxInitWindowStation(), xxxResetDisplayDevice(), xxxSetIMEShowStatus(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

00152 { 00153 PPROFILEUSERNAME pMapName; 00154 00155 CheckCritIn(); 00156 00157 pMapName = UserAllocPoolWithQuota(sizeof (PROFILEUSERNAME), TAG_PROFILEUSERNAME); 00158 if (!pMapName) { 00159 RIPMSG0(RIP_WARNING, "CreateProfileUserName: Allocation failed"); 00160 return NULL; 00161 } 00162 00163 ThreadLockPool(PtiCurrent(), pMapName, ptl); 00164 pMapName->NameString.Length = 0; 00165 pMapName->NameString.MaximumLength = sizeof (pMapName->awcName); 00166 pMapName->NameString.Buffer = pMapName->awcName; 00167 00168 InitPreviousUserString(); 00169 00170 RtlCopyUnicodeString(&pMapName->NameString, &PreviousUserString); 00171 return &(pMapName->NameString); 00172 }

DWORD FastGetProfileDwordW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
DWORD  dwDefault
 

Definition at line 575 of file w32/ntuser/kernel/profile.c.

References BYTE, DWORD, gbRemoteSession, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, RemoteOpenCacheKeyEx(), RtlInitUnicodeString(), and Status.

Referenced by IsIMMEnabledSystem(), OpenMultiplePortDevice(), SetDebugHotKeys(), Win32UserInitialize(), and xxxUpdatePerUserSystemParameters().

00580 { 00581 HANDLE hKey; 00582 DWORD cbSize; 00583 DWORD dwRet; 00584 LONG Status; 00585 UNICODE_STRING UnicodeString; 00586 BYTE Buf[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD)]; 00587 00588 UserAssert(idSection <= PMAP_LAST); 00589 00590 if (gbRemoteSession) { 00591 00592 hKey = RemoteOpenCacheKeyEx(idSection, KEY_READ); 00593 if (hKey != NULL) { 00594 goto Override; 00595 } 00596 } 00597 00598 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00599 idSection, 00600 KEY_READ, 00601 NULL)) == NULL) { 00602 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 00603 return dwDefault; 00604 } 00605 00606 Override: 00607 00608 RtlInitUnicodeString(&UnicodeString, lpKeyName); 00609 Status = ZwQueryValueKey(hKey, 00610 &UnicodeString, 00611 KeyValuePartialInformation, 00612 (PKEY_VALUE_PARTIAL_INFORMATION)Buf, 00613 sizeof(Buf), 00614 &cbSize); 00615 00616 dwRet = dwDefault; 00617 00618 if (NT_SUCCESS(Status)) { 00619 00620 dwRet = *((PDWORD)((PKEY_VALUE_PARTIAL_INFORMATION)Buf)->Data); 00621 00622 } else if (Status != STATUS_OBJECT_NAME_NOT_FOUND) { 00623 00624 RIPMSG1(RIP_WARNING, 00625 "FastGetProfileDwordW: ObjectName not found: %ws", 00626 lpKeyName); 00627 } 00628 00629 ZwClose(hKey); 00630 00631 return dwRet; 00632 }

int FastGetProfileIntFromID PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
UINT  idKey,
int  def
 

Definition at line 1031 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, FastGetProfileIntW(), gpsi, hModuleWin, MultDiv, PMAP_LAST, and ServerLoadString.

Referenced by LW_LoadProfileInitData(), MetricGetID(), and xxxUpdatePerUserSystemParameters().

01036 { 01037 int result; 01038 WCHAR szKey[80]; 01039 01040 01041 UserAssert(idSection <= PMAP_LAST); 01042 01043 ServerLoadString(hModuleWin, idKey, szKey, ARRAY_SIZE(szKey)); 01044 01045 result = FastGetProfileIntW(pProfileUserName,idSection, szKey, def); 01046 01047 /* 01048 * If you change the below list of STR_* make sure you make a 01049 * corresponding change in SetWindowMetricInt (rare.c) 01050 */ 01051 switch (idKey) { 01052 case STR_BORDERWIDTH: 01053 case STR_SCROLLWIDTH: 01054 case STR_SCROLLHEIGHT: 01055 case STR_CAPTIONWIDTH: 01056 case STR_CAPTIONHEIGHT: 01057 case STR_SMCAPTIONWIDTH: 01058 case STR_SMCAPTIONHEIGHT: 01059 case STR_MENUWIDTH: 01060 case STR_MENUHEIGHT: 01061 case STR_ICONHORZSPACING: 01062 case STR_ICONVERTSPACING: 01063 case STR_MINWIDTH: 01064 case STR_MINHORZGAP: 01065 case STR_MINVERTGAP: 01066 /* 01067 * Convert any registry values stored in TWIPS back to pixels 01068 */ 01069 if (result < 0) 01070 result = MultDiv(-result, gpsi->dmLogPixels, 72 * 20); 01071 break; 01072 } 01073 01074 return result; 01075 }

BOOL FastGetProfileIntsW PUNICODE_STRING pProfileUserName  OPTIONAL,
PPROFINTINFO  ppii
 

Definition at line 1290 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, FastGetProfileIntW(), hModuleWin, tagPROFINTINFO::idSection, tagPROFINTINFO::lpKeyName, tagPROFINTINFO::nDefault, PPROFINTINFO, PTR_TO_ID, tagPROFINTINFO::puResult, ServerLoadString, and TRUE.

Referenced by xxxSetDeskWallpaper(), and xxxUpdatePerUserSystemParameters().

01293 { 01294 WCHAR szKey[40]; 01295 01296 while (ppii->idSection != 0) { 01297 01298 ServerLoadString(hModuleWin, 01299 PTR_TO_ID(ppii->lpKeyName), 01300 szKey, 01301 ARRAY_SIZE(szKey)); 01302 01303 *ppii->puResult = FastGetProfileIntW(pProfileUserName, 01304 ppii->idSection, 01305 szKey, 01306 ppii->nDefault 01307 ); 01308 ppii++; 01309 } 01310 01311 return TRUE; 01312 }

UINT FastGetProfileIntW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
UINT  nDefault
 

Definition at line 945 of file w32/ntuser/kernel/profile.c.

References FastGetProfileStringW(), NULL, PMAP_LAST, RtlInitUnicodeString(), RtlUnicodeStringToInteger(), and UINT.

Referenced by FastGetProfileIntFromID(), FastGetProfileIntsW(), GetKbdLangSwitch(), UpdatePerUserKeyboardIndicators(), xxxUpdatePerUserAccessPackSettings(), and xxxUpdatePerUserSystemParameters().

00950 { 00951 WCHAR ValueBuf[40]; 00952 UNICODE_STRING Value; 00953 UINT ReturnValue; 00954 00955 UserAssert(idSection <= PMAP_LAST); 00956 00957 if (!FastGetProfileStringW(pProfileUserName, 00958 idSection, 00959 lpKeyName, 00960 NULL, 00961 ValueBuf, 00962 sizeof(ValueBuf) / sizeof(WCHAR) 00963 )) { 00964 00965 return nDefault; 00966 } 00967 00968 /* 00969 * Convert string to int. 00970 */ 00971 RtlInitUnicodeString(&Value, ValueBuf); 00972 RtlUnicodeStringToInteger(&Value, 10, &ReturnValue); 00973 00974 return ReturnValue; 00975 }

DWORD FastGetProfileKeysW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpDefault,
LPWSTR *  lpReturnedString
 

Definition at line 642 of file w32/ntuser/kernel/profile.c.

References Buffer, DWORD, L, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, Status, and TRUE.

Referenced by bEnumerateRegistryFonts().

00647 { 00648 HANDLE hKey; 00649 DWORD cchSize; 00650 DWORD cchKey; 00651 LONG Status; 00652 WCHAR Buffer[256 + 6]; 00653 PKEY_VALUE_BASIC_INFORMATION pKeyInfo; 00654 ULONG iValue; 00655 LPWSTR lpTmp; 00656 LPWSTR lpKeys = NULL; 00657 DWORD dwPoolSize; 00658 00659 UserAssert(idSection <= PMAP_LAST); 00660 00661 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00662 idSection, 00663 KEY_READ, 00664 NULL)) == NULL) { 00665 RIPMSG0(RIP_WARNING | RIP_NONAME, ""); 00666 goto DefExit; 00667 } 00668 00669 pKeyInfo = (PKEY_VALUE_BASIC_INFORMATION)Buffer; 00670 cchSize = 0; 00671 *lpReturnedString = NULL; 00672 iValue = 0; 00673 00674 while (TRUE) { 00675 00676 #if DBG 00677 wcscpy(Buffer + 256, L"DON'T"); 00678 #endif 00679 Status = ZwEnumerateValueKey(hKey, 00680 iValue, 00681 KeyValueBasicInformation, 00682 pKeyInfo, 00683 sizeof(Buffer), 00684 &cchKey); 00685 00686 UserAssert(_wcsicmp(Buffer + 256, L"DON'T") == 0); 00687 00688 if (Status == STATUS_NO_MORE_ENTRIES) { 00689 00690 break; 00691 00692 } else if (!NT_SUCCESS(Status)) { 00693 00694 if (lpKeys) { 00695 UserFreePool(lpKeys); 00696 lpKeys = NULL; 00697 } 00698 goto DefExit; 00699 } 00700 00701 UserAssert(pKeyInfo->NameLength * sizeof(WCHAR) <= 00702 sizeof(Buffer) - sizeof(KEY_VALUE_BASIC_INFORMATION)); 00703 00704 UserAssert(cchKey <= sizeof(Buffer)); 00705 00706 /* 00707 * A key was found. Allocate space for it. Note that 00708 * NameLength is in bytes. 00709 */ 00710 cchKey = cchSize; 00711 cchSize += pKeyInfo->NameLength + sizeof(WCHAR); 00712 00713 if (lpKeys == NULL) { 00714 00715 dwPoolSize = cchSize + sizeof(WCHAR); 00716 lpKeys = UserAllocPoolWithQuota(dwPoolSize, TAG_PROFILE); 00717 00718 } else { 00719 00720 lpTmp = lpKeys; 00721 lpKeys = UserReAllocPoolWithQuota(lpTmp, 00722 dwPoolSize, 00723 cchSize + sizeof(WCHAR), 00724 TAG_PROFILE); 00725 00726 /* 00727 * Free the original buffer if the allocation fails 00728 */ 00729 if (lpKeys == NULL) { 00730 UserFreePool(lpTmp); 00731 } 00732 dwPoolSize = cchSize + sizeof(WCHAR); 00733 } 00734 00735 /* 00736 * Check for out of memory. 00737 */ 00738 if (lpKeys == NULL) 00739 goto DefExit; 00740 00741 /* 00742 * NULL terminate the string and append it to 00743 * the key list. 00744 */ 00745 UserAssert(pKeyInfo->NameLength < sizeof(Buffer) - sizeof(KEY_VALUE_BASIC_INFORMATION)); 00746 00747 RtlCopyMemory(&lpKeys[cchKey / sizeof(WCHAR)], pKeyInfo->Name, pKeyInfo->NameLength); 00748 lpKeys[(cchKey + pKeyInfo->NameLength) / sizeof(WCHAR)] = 0; 00749 00750 iValue++; 00751 } 00752 00753 /* 00754 * If no keys were found, return the default. 00755 */ 00756 if (iValue == 0) { 00757 00758 DefExit: 00759 00760 cchSize = wcslen(lpDefault)+1; 00761 lpKeys = UserAllocPoolWithQuota((cchSize+1) * sizeof(WCHAR), TAG_PROFILE); 00762 00763 if (lpKeys) 00764 wcscpy(lpKeys, lpDefault); 00765 else 00766 cchSize = 0; 00767 00768 } else { 00769 00770 /* 00771 * Turn the byte count into a char count. 00772 */ 00773 cchSize /= sizeof(WCHAR); 00774 } 00775 00776 /* 00777 * Make sure hKey is closed. 00778 */ 00779 if (hKey) 00780 ZwClose(hKey); 00781 00782 /* 00783 * Append the ending NULL. 00784 */ 00785 if (lpKeys) 00786 lpKeys[cchSize] = 0; 00787 00788 *lpReturnedString = lpKeys; 00789 00790 return cchSize; 00791 }

DWORD FastGetProfileStringFromIDW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
UINT  idKey,
LPCWSTR  lpDefault,
LPWSTR  lpReturnedString,
DWORD  cch
 

Definition at line 1086 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, DWORD, FastGetProfileStringW(), hModuleWin, PMAP_LAST, and ServerLoadString.

Referenced by GetDeskWallpaperName(), LW_LoadResources(), xxxODI_ColorInit(), xxxSetDeskPattern(), xxxSystemParametersInfo(), xxxUpdateSystemCursorsFromRegistry(), and xxxUpdateSystemIconsFromRegistry().

01093 { 01094 WCHAR szKey[80]; 01095 01096 UserAssert(idSection <= PMAP_LAST); 01097 01098 ServerLoadString(hModuleWin, idKey, szKey, ARRAY_SIZE(szKey)); 01099 01100 return FastGetProfileStringW(pProfileUserName, 01101 idSection, 01102 szKey, 01103 lpDefault, 01104 lpReturnedString, 01105 cch 01106 ); 01107 }

DWORD FastGetProfileStringW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
LPCWSTR  lpDefault,
LPWSTR  lpReturnedString,
DWORD  cchBuf
 

Definition at line 806 of file w32/ntuser/kernel/profile.c.

References BOOL, DWORD, FALSE, gbRemoteSession, gdwPolicyFlags, gpidLogon, L, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, PsGetCurrentProcess, RemoteOpenCacheKeyEx(), RtlInitUnicodeString(), Status, and TRUE.

Referenced by bEnumerateRegistryFonts(), FastGetProfileIntW(), FastGetProfileStringFromIDW(), InitCreateUserSubsystem(), OpenMultiplePortDevice(), SetAppCompatFlags(), SetAppImeCompatFlags(), and xxxUpdatePerUserAccessPackSettings().

00813 { 00814 HANDLE hKey = NULL; 00815 DWORD cbSize; 00816 LONG Status; 00817 UNICODE_STRING UnicodeString; 00818 PKEY_VALUE_PARTIAL_INFORMATION pKeyInfo; 00819 BOOL bRemoteOverride = FALSE; 00820 DWORD dwPolicyFlags = gdwPolicyFlags; 00821 00822 00823 UserAssert(idSection <= PMAP_LAST); 00824 UserAssert(lpKeyName != NULL); 00825 00826 if (gbRemoteSession) { 00827 hKey = RemoteOpenCacheKeyEx(idSection, KEY_READ); 00828 if (hKey != NULL) { 00829 bRemoteOverride = TRUE; 00830 goto Override; 00831 } 00832 } 00833 00834 TryAgain: 00835 if ((hKey = OpenCacheKeyEx(pProfileUserName, 00836 idSection, 00837 KEY_READ, 00838 &dwPolicyFlags)) == NULL) { 00839 00840 #if DBG 00841 if (PsGetCurrentProcess()->UniqueProcessId != gpidLogon) { 00842 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 00843 } 00844 #endif 00845 goto DefExit; 00846 } 00847 00848 Override: 00849 00850 cbSize = (cchBuf * sizeof(WCHAR)) + 00851 FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); 00852 00853 if ((pKeyInfo = UserAllocPoolWithQuota(cbSize, TAG_PROFILE)) == NULL) 00854 goto DefExit; 00855 00856 RtlInitUnicodeString(&UnicodeString, lpKeyName); 00857 Status = ZwQueryValueKey(hKey, 00858 &UnicodeString, 00859 KeyValuePartialInformation, 00860 pKeyInfo, 00861 cbSize, 00862 &cbSize); 00863 00864 if (Status == STATUS_BUFFER_OVERFLOW) { 00865 RIPMSG0(RIP_WARNING, "FastGetProfileStringW: Buffer overflow"); 00866 Status = STATUS_SUCCESS; 00867 } 00868 00869 UserAssert(NT_SUCCESS(Status) || (Status == STATUS_OBJECT_NAME_NOT_FOUND)); 00870 00871 if (NT_SUCCESS(Status)) { 00872 00873 if (pKeyInfo->DataLength >= sizeof(WCHAR)) { 00874 00875 ((LPWSTR)(pKeyInfo->Data))[cchBuf - 1] = L'\0'; 00876 wcscpy(lpReturnedString, (LPWSTR)pKeyInfo->Data); 00877 00878 } else { 00879 /* 00880 * Appears to be a bug with empty strings - only first 00881 * byte is set to NULL. (SAS) 00882 */ 00883 lpReturnedString[0] = TEXT('\0'); 00884 } 00885 00886 cchBuf = pKeyInfo->DataLength; 00887 00888 UserFreePool(pKeyInfo); 00889 00890 ZwClose(hKey); 00891 00892 /* 00893 * data length includes terminating zero [bodind] 00894 */ 00895 return (cchBuf / sizeof(WCHAR)); 00896 00897 } else if (bRemoteOverride) { 00898 bRemoteOverride = FALSE; 00899 UserFreePool(pKeyInfo); 00900 ZwClose(hKey); 00901 hKey = NULL; 00902 goto TryAgain; 00903 00904 } else if (dwPolicyFlags) { 00905 UserFreePool(pKeyInfo); 00906 ZwClose(hKey); 00907 goto TryAgain; 00908 } 00909 00910 UserFreePool(pKeyInfo); 00911 00912 DefExit: 00913 00914 /* 00915 * Make sure the key is closed. 00916 */ 00917 if (hKey) 00918 ZwClose(hKey); 00919 00920 /* 00921 * wcscopy copies terminating zero, but the length returned by 00922 * wcslen does not, so add 1 to be consistent with success 00923 * return [bodind] 00924 */ 00925 if (lpDefault != NULL) { 00926 cchBuf = wcslen(lpDefault) + 1; 00927 RtlCopyMemory(lpReturnedString, lpDefault, cchBuf * sizeof(WCHAR)); 00928 return cchBuf; 00929 } 00930 00931 return 0; 00932 }

DWORD FastGetProfileValue PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
LPBYTE  lpDefault,
LPBYTE  lpReturn,
UINT  cbSizeReturn
 

Definition at line 1173 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, DWORD, gbRemoteSession, hModuleWin, IS_PTR, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, PTR_TO_ID, RemoteOpenCacheKeyEx(), RtlInitUnicodeString(), ServerLoadString, SERVERSTRINGMAXSIZE, Status, and UINT.

Referenced by CreateFontFromWinIni(), CreateSetupNameArray(), InitScancodeMap(), LoadCPUserPreferences(), SetAppCompatFlags(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

01180 { 01181 HANDLE hKey; 01182 UINT cbSize; 01183 LONG Status; 01184 UNICODE_STRING UnicodeString; 01185 PKEY_VALUE_PARTIAL_INFORMATION pKeyInfo; 01186 WCHAR szKey[SERVERSTRINGMAXSIZE]; 01187 KEY_VALUE_PARTIAL_INFORMATION KeyInfo; 01188 01189 UserAssert(idSection <= PMAP_LAST); 01190 01191 if (!IS_PTR(lpKeyName)) { 01192 *szKey = (WCHAR)0; 01193 ServerLoadString(hModuleWin, PTR_TO_ID(lpKeyName), szKey, ARRAY_SIZE(szKey)); 01194 UserAssert(*szKey != (WCHAR)0); 01195 lpKeyName = szKey; 01196 } 01197 01198 if (gbRemoteSession) { 01199 hKey = RemoteOpenCacheKeyEx(idSection, KEY_READ); 01200 if (hKey != NULL) { 01201 goto Override; 01202 } 01203 } 01204 01205 if ((hKey = OpenCacheKeyEx(pProfileUserName, 01206 idSection, 01207 KEY_READ, 01208 NULL)) == NULL) { 01209 // if hi-word of lpKeName is 0, it is a resource number not a string 01210 01211 if (!IS_PTR(lpKeyName)) 01212 RIPMSG1(RIP_WARNING, "FastGetProfileValue: Failed to open cache-key (%08x)", lpKeyName); 01213 else 01214 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 01215 01216 goto DefExit; 01217 } 01218 01219 Override: 01220 01221 if (cbSizeReturn == 0) { 01222 cbSize = sizeof(KeyInfo); 01223 pKeyInfo = &KeyInfo; 01224 } else { 01225 cbSize = cbSizeReturn + FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); 01226 if ((pKeyInfo = UserAllocPoolWithQuota(cbSize, TAG_PROFILE)) == NULL) { 01227 goto DefExit; 01228 } 01229 } 01230 01231 RtlInitUnicodeString(&UnicodeString, lpKeyName); 01232 01233 Status = ZwQueryValueKey(hKey, 01234 &UnicodeString, 01235 KeyValuePartialInformation, 01236 pKeyInfo, 01237 cbSize, 01238 &cbSize); 01239 01240 if (NT_SUCCESS(Status)) { 01241 01242 UserAssert(cbSizeReturn >= pKeyInfo->DataLength); 01243 01244 cbSize = pKeyInfo->DataLength; 01245 RtlCopyMemory(lpReturn, pKeyInfo->Data, cbSize); 01246 01247 if (cbSizeReturn != 0) { 01248 UserFreePool(pKeyInfo); 01249 } 01250 ZwClose(hKey); 01251 01252 return cbSize; 01253 } else if ((Status == STATUS_BUFFER_OVERFLOW) && (cbSizeReturn == 0)) { 01254 ZwClose(hKey); 01255 return pKeyInfo->DataLength; 01256 } 01257 01258 #if DBG 01259 if (Status != STATUS_OBJECT_NAME_NOT_FOUND) { 01260 RIPMSG3 (RIP_WARNING, "FastGetProfileValue: ZwQueryValueKey Failed. Status:%#lx idSection:%#lx KeyName:%s", 01261 Status, idSection, UnicodeString.Buffer); 01262 } 01263 #endif 01264 01265 if (cbSizeReturn != 0) { 01266 UserFreePool(pKeyInfo); 01267 } 01268 01269 DefExit: 01270 01271 if (hKey) 01272 ZwClose(hKey); 01273 01274 if (lpDefault) { 01275 RtlMoveMemory(lpReturn, lpDefault, cbSizeReturn); 01276 return cbSizeReturn; 01277 } 01278 01279 return 0; 01280 }

BOOL FastUpdateWinIni PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
UINT  wKeyNameId,
LPWSTR  lpszValue
 

Definition at line 1323 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, FALSE, FastWriteProfileStringW(), hModuleWin, PMAP_LAST, and ServerLoadString.

Referenced by xxxSystemParametersInfo().

01328 { 01329 WCHAR szKeyName[40]; 01330 BOOL bResult = FALSE; 01331 01332 UserAssert(idSection <= PMAP_LAST); 01333 01334 ServerLoadString(hModuleWin, 01335 wKeyNameId, 01336 szKeyName, 01337 ARRAY_SIZE(szKeyName)); 01338 01339 bResult = FastWriteProfileStringW(pProfileUserName, 01340 idSection, szKeyName, lpszValue); 01341 01342 return bResult; 01343 }

BOOL FastWriteProfileStringW PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
LPCWSTR  lpString
 

Definition at line 988 of file w32/ntuser/kernel/profile.c.

References BOOL, FALSE, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, RtlInitUnicodeString(), and Status.

Referenced by FastUpdateWinIni(), RegisterPerUserKeyboardIndicators(), SetFilterKeys(), SetMouseKeys(), SetSoundSentry(), UpdateWinIniInt(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

00993 { 00994 HANDLE hKey; 00995 LONG Status; 00996 UNICODE_STRING UnicodeString; 00997 00998 UserAssert(idSection <= PMAP_LAST); 00999 01000 if ((hKey = OpenCacheKeyEx(pProfileUserName, 01001 idSection, 01002 KEY_WRITE, 01003 NULL)) == NULL) { 01004 RIPMSG1(RIP_WARNING | RIP_NONAME, "%ws", lpKeyName); 01005 return FALSE; 01006 } 01007 01008 RtlInitUnicodeString(&UnicodeString, lpKeyName); 01009 Status = ZwSetValueKey(hKey, 01010 &UnicodeString, 01011 0, 01012 REG_SZ, 01013 (PVOID)lpString, 01014 (wcslen(lpString) + 1) * sizeof(WCHAR)); 01015 01016 ZwClose(hKey); 01017 01018 return (NT_SUCCESS(Status)); 01019 }

BOOL FastWriteProfileValue PUNICODE_STRING pProfileUserName  OPTIONAL,
UINT  idSection,
LPCWSTR  lpKeyName,
UINT  uType,
LPBYTE  lpStruct,
UINT  cbSizeStruct
 

Definition at line 1115 of file w32/ntuser/kernel/profile.c.

References ARRAY_SIZE, BOOL, FALSE, hModuleWin, IS_PTR, NT_SUCCESS, NULL, OpenCacheKeyEx(), PMAP_LAST, PTR_TO_ID, RtlInitUnicodeString(), ServerLoadString, SERVERSTRINGMAXSIZE, and Status.

Referenced by SetWindowMetricFont(), and xxxSystemParametersInfo().

01122 { 01123 HANDLE hKey; 01124 LONG Status; 01125 UNICODE_STRING UnicodeString; 01126 WCHAR szKey[SERVERSTRINGMAXSIZE]; 01127 01128 UserAssert(idSection <= PMAP_LAST); 01129 01130 if (!IS_PTR(lpKeyName)) { 01131 *szKey = (WCHAR)0; 01132 ServerLoadString(hModuleWin, PTR_TO_ID(lpKeyName), szKey, ARRAY_SIZE(szKey)); 01133 UserAssert(*szKey != (WCHAR)0); 01134 lpKeyName = szKey; 01135 } 01136 01137 if ((hKey = OpenCacheKeyEx(pProfileUserName, 01138 idSection, 01139 KEY_WRITE, 01140 NULL)) == NULL) { 01141 RIPMSG1(RIP_WARNING, "FastWriteProfileValue: Failed to open cache-key (%ws)", lpKeyName); 01142 return FALSE; 01143 } 01144 01145 RtlInitUnicodeString(&UnicodeString, lpKeyName); 01146 01147 Status = ZwSetValueKey(hKey, 01148 &UnicodeString, 01149 0, 01150 uType, 01151 lpStruct, 01152 cbSizeStruct); 01153 ZwClose(hKey); 01154 01155 #if DBG 01156 if (!NT_SUCCESS(Status)) { 01157 RIPMSG3 (RIP_WARNING, "FastWriteProfileValue: ZwSetValueKey Failed. Status:%#lx idSection:%#lx KeyName:%s", 01158 Status, idSection, UnicodeString.Buffer); 01159 } 01160 #endif 01161 01162 return (NT_SUCCESS(Status)); 01163 }

void FreeProfileUserName PUNICODE_STRING  pProfileUserName,
TL ptl
 

Definition at line 174 of file w32/ntuser/kernel/profile.c.

References CheckCritIn, PtiCurrent, and ThreadUnlockAndFreePool.

Referenced by InitUserScreen(), NtUserSetSysColors(), PrepareForLogoff(), xxxDesktopWndProc(), xxxInitWindowStation(), xxxResetDisplayDevice(), xxxSetIMEShowStatus(), xxxSystemParametersInfo(), and xxxUpdatePerUserSystemParameters().

00174 { 00175 UNREFERENCED_PARAMETER(ptl); 00176 CheckCritIn(); 00177 if (pProfileUserName) { 00178 ThreadUnlockAndFreePool(PtiCurrent(), ptl); 00179 } 00180 }

void InitPreviousUserString void   ) 
 

Definition at line 103 of file w32/ntuser/kernel/profile.c.

References CheckCritIn, DefaultUserString, GetProcessLuid(), L, luidPrevious, luidSystem, NT_SUCCESS, NULL, PreviousUserString, PreviousUserStringBuf, RtlAppendUnicodeToString(), RtlCopyUnicodeString(), RtlEqualLuid(), RtlFormatCurrentUserKeyPath(), and RtlFreeUnicodeString().

Referenced by CreateProfileUserName(), and OpenCacheKeyEx().

00103 { 00104 UNICODE_STRING UserString; 00105 LUID luidCaller; 00106 00107 CheckCritIn(); 00108 00109 /* 00110 * Speed hack, check if luid of this process == system or previous to 00111 * save work. 00112 */ 00113 if (NT_SUCCESS(GetProcessLuid(NULL, &luidCaller))) { 00114 00115 if (RtlEqualLuid(&luidCaller, &luidPrevious)) { 00116 return; // same as last time - no work. 00117 } 00118 luidPrevious = luidCaller; 00119 00120 if (RtlEqualLuid(&luidCaller, &luidSystem)) 00121 goto DefaultUser; 00122 00123 } else { 00124 luidPrevious = RtlConvertLongToLuid(0); 00125 } 00126 00127 /* 00128 * Set up current user registry base string. 00129 */ 00130 if (!NT_SUCCESS(RtlFormatCurrentUserKeyPath(&UserString))) { 00131 00132 DefaultUser: 00133 00134 RtlCopyUnicodeString(&PreviousUserString, &DefaultUserString); 00135 00136 } else { 00137 UserAssert(sizeof(PreviousUserStringBuf) >= UserString.Length + 4); 00138 RtlCopyUnicodeString(&PreviousUserString, &UserString); 00139 RtlFreeUnicodeString(&UserString); 00140 } 00141 00142 RtlAppendUnicodeToString(&PreviousUserString, L"\\"); 00143 00144 }

HANDLE OpenCacheKeyEx PUNICODE_STRING pMapName  OPTIONAL,
UINT  idSection,
ACCESS_MASK  amRequest,
PDWORD  pdwPolicyFlags
 

Definition at line 263 of file w32/ntuser/kernel/profile.c.

References AccessCheckObject(), aFastRegMap, aFastRegRoot, CheckCritIn, DWORD, gpepCSRSS, gpepInit, gpidLogon, tagFASTREGMAP::idRoot, InitPreviousUserString(), KernelMode, KeyMapping, L, NT_SUCCESS, NTSTATUS(), NULL, ObDereferenceObject, ObReferenceObjectByHandle(), PMAP_DESKTOP, PMAP_LAST, POLICY_ALL, POLICY_MACHINE, POLICY_NONE, POLICY_USER, PreviousUserString, PsGetCurrentProcess, RtlAppendUnicodeStringToString(), RtlAppendUnicodeToString(), Status, and UserMode.

00269 { 00270 OBJECT_ATTRIBUTES OA; 00271 WCHAR UnicodeStringBuf[256]; 00272 UNICODE_STRING UnicodeString; 00273 LONG Status; 00274 HANDLE hKey = NULL; 00275 PEPROCESS peCurrent = PsGetCurrentProcess(); 00276 DWORD dwPolicyFlags; 00277 00278 CheckCritIn(); 00279 00280 UserAssert(idSection <= PMAP_LAST); 00281 00282 /* 00283 * If we're opening the desktop key for read access, we should be checking 00284 * for relevant policy. 00285 */ 00286 if (idSection == PMAP_DESKTOP && amRequest == KEY_READ && pdwPolicyFlags) { 00287 UserAssert(!(*pdwPolicyFlags & ~POLICY_ALL)); 00288 dwPolicyFlags = *pdwPolicyFlags; 00289 } else { 00290 dwPolicyFlags = POLICY_NONE; 00291 } 00292 00293 TryAgain: 00294 00295 UnicodeString.Length = 0; 00296 UnicodeString.MaximumLength = sizeof(UnicodeStringBuf); 00297 UnicodeString.Buffer = UnicodeStringBuf; 00298 00299 00300 if (dwPolicyFlags & POLICY_MACHINE) { 00301 dwPolicyFlags &= ~POLICY_MACHINE; 00302 RtlAppendUnicodeToString(&UnicodeString, 00303 L"\\Registry\\Machine\\"); 00304 RtlAppendUnicodeToString(&UnicodeString, 00305 L"Software\\Policies\\Microsoft\\Windows\\"); 00306 } else { 00307 if (aFastRegRoot[aFastRegMap[idSection].idRoot][0] == L'M') { 00308 RtlAppendUnicodeToString(&UnicodeString, L"\\Registry\\Machine\\"); 00309 } else { 00310 if (!pMapName) { 00311 InitPreviousUserString(); 00312 RtlAppendUnicodeStringToString( 00313 &UnicodeString, 00314 &PreviousUserString); 00315 } else { 00316 RtlAppendUnicodeStringToString( 00317 &UnicodeString, 00318 pMapName); 00319 } 00320 } 00321 if (dwPolicyFlags & POLICY_USER) { 00322 dwPolicyFlags &= ~POLICY_USER; 00323 RtlAppendUnicodeToString(&UnicodeString, 00324 L"Software\\Policies\\Microsoft\\Windows\\"); 00325 } else { 00326 dwPolicyFlags &= ~POLICY_NONE; 00327 } 00328 00329 } 00330 00331 RtlAppendUnicodeToString(&UnicodeString, 00332 (PWSTR)&aFastRegRoot[aFastRegMap[idSection].idRoot][1]); 00333 00334 RtlAppendUnicodeToString(&UnicodeString, 00335 (PWSTR)aFastRegMap[idSection].szSection); 00336 00337 00338 /* 00339 * Open the key for kernel mode access 00340 */ 00341 InitializeObjectAttributes(&OA, 00342 &UnicodeString, 00343 OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE, 00344 NULL, 00345 NULL); 00346 00347 Status = ZwOpenKey(&hKey, amRequest, &OA); 00348 00349 if ( 00350 (amRequest == KEY_READ) || /* 00351 * We must be able to read 00352 * our registry settings. 00353 */ 00354 (peCurrent == gpepCSRSS) || 00355 (peCurrent == gpepInit) 00356 ) { 00357 00358 } else { 00359 /* 00360 * Now check if the user has access to the key 00361 */ 00362 00363 if (NT_SUCCESS(Status)) { 00364 PVOID pKey; 00365 NTSTATUS Status2; 00366 Status2 = ObReferenceObjectByHandle(hKey, 00367 amRequest, 00368 NULL, 00369 KernelMode, 00370 &pKey, 00371 NULL); 00372 00373 if (NT_SUCCESS(Status2)) { 00374 if (!AccessCheckObject(pKey, amRequest, UserMode, &KeyMapping)) { 00375 ZwClose(hKey); 00376 Status = STATUS_ACCESS_DENIED; 00377 } 00378 ObDereferenceObject(pKey); 00379 } else { 00380 ZwClose(hKey); 00381 Status = STATUS_ACCESS_DENIED; 00382 } 00383 } 00384 00385 } 00386 00387 #if DBG 00388 if (!NT_SUCCESS(Status)) { 00389 UnicodeStringBuf[UnicodeString.Length / 2] = 0; 00390 00391 if (PsGetCurrentProcess()->UniqueProcessId != gpidLogon) { 00392 RIPMSG1(RIP_WARNING | RIP_THERESMORE, "OpenCacheKeyEx failed with Status = %lx key:", Status); 00393 RIPMSG1(RIP_WARNING | RIP_THERESMORE | RIP_NONAME | RIP_NONEWLINE, " %ws\\", UnicodeStringBuf); 00394 } 00395 } 00396 #endif DBG 00397 00398 /* 00399 * If we didn't succeed and we're not down to bottom of policy chain, try again. 00400 */ 00401 if (!NT_SUCCESS(Status) && dwPolicyFlags) { 00402 goto TryAgain; 00403 } 00404 00405 /* 00406 * Update policy level 00407 */ 00408 if (pdwPolicyFlags) { 00409 *pdwPolicyFlags = dwPolicyFlags; 00410 } 00411 00412 return (NT_SUCCESS(Status) ? hKey : NULL); 00413 }

HANDLE RemoteOpenCacheKeyEx UINT  idSection,
ACCESS_MASK  amRequest
 

Definition at line 188 of file w32/ntuser/kernel/profile.c.

References aFastRegMap, aFastRegRoot, CheckCritIn, gbRemoteSession, gstrBaseWinStationName, tagFASTREGMAP::idRoot, L, NT_SUCCESS, NULL, PMAP_LAST, RtlAppendUnicodeToString(), Status, and TRUE.

Referenced by FastGetProfileDwordW(), FastGetProfileStringW(), and FastGetProfileValue().

00191 { 00192 OBJECT_ATTRIBUTES OA; 00193 WCHAR UnicodeStringBuf[512]; 00194 UNICODE_STRING UnicodeString; 00195 LONG Status; 00196 HANDLE hKey; 00197 00198 CheckCritIn(); 00199 00200 UserAssert(gbRemoteSession == TRUE); 00201 00202 if (aFastRegRoot[aFastRegMap[idSection].idRoot][0] == L'M') 00203 return NULL; 00204 00205 if (gstrBaseWinStationName[0] == 0) 00206 return NULL; 00207 00208 if (amRequest != KEY_READ) 00209 return NULL; 00210 00211 UserAssert(idSection <= PMAP_LAST); 00212 UnicodeString.Length = 0; 00213 UnicodeString.MaximumLength = sizeof(UnicodeStringBuf); 00214 UnicodeString.Buffer = UnicodeStringBuf; 00215 00216 RtlAppendUnicodeToString(&UnicodeString, L"\\Registry\\Machine\\"); 00217 RtlAppendUnicodeToString(&UnicodeString, WINSTATION_REG_NAME); 00218 00219 RtlAppendUnicodeToString(&UnicodeString, L"\\"); 00220 RtlAppendUnicodeToString(&UnicodeString, gstrBaseWinStationName); 00221 RtlAppendUnicodeToString(&UnicodeString, L"\\"); 00222 RtlAppendUnicodeToString(&UnicodeString, WIN_USEROVERRIDE); 00223 RtlAppendUnicodeToString(&UnicodeString, L"\\"); 00224 00225 Status = RtlAppendUnicodeToString(&UnicodeString, 00226 (PWSTR)(&aFastRegRoot[aFastRegMap[idSection].idRoot][1])); 00227 UserAssert(NT_SUCCESS(Status)); 00228 00229 Status = RtlAppendUnicodeToString(&UnicodeString, 00230 (PWSTR)(aFastRegMap[idSection].szSection)); 00231 UserAssert(NT_SUCCESS(Status)); 00232 00233 /* 00234 * Open the key for kernel mode access 00235 */ 00236 InitializeObjectAttributes(&OA, 00237 &UnicodeString, 00238 OBJ_CASE_INSENSITIVE, 00239 NULL, 00240 NULL); 00241 00242 Status = ZwOpenKey(&hKey, amRequest, &OA); 00243 00244 return (NT_SUCCESS(Status) ? hKey : NULL); 00245 }


Variable Documentation

CONST FASTREGMAP aFastRegMap[PMAP_LAST+1]
 

Definition at line 52 of file w32/ntuser/kernel/profile.c.

Referenced by OpenCacheKeyEx(), and RemoteOpenCacheKeyEx().

CONST PCWSTR aFastRegRoot[]
 

Initial value:

{ L"UControl Panel\\", L"UControl Panel\\Accessibility\\", L"MSoftware\\Microsoft\\Windows NT\\CurrentVersion\\", L"USoftware\\Microsoft\\Windows NT\\CurrentVersion\\", L"MSystem\\CurrentControlSet\\Control\\", L"MSystem\\CurrentControlSet\\Services\\", L"UKeyboard Layout\\", }

Definition at line 42 of file w32/ntuser/kernel/profile.c.

Referenced by OpenCacheKeyEx(), and RemoteOpenCacheKeyEx().

UNICODE_STRING DefaultUserString = {sizeof wszDefaultUser - sizeof(WCHAR), sizeof wszDefaultUser, (WCHAR *)wszDefaultUser}
 

Definition at line 101 of file w32/ntuser/kernel/profile.c.

Referenced by InitPreviousUserString().

DWORD gdwPolicyFlags = POLICY_ALL
 

Definition at line 95 of file w32/ntuser/kernel/profile.c.

Referenced by CheckDesktopPolicy(), CheckDesktopPolicyChange(), and FastGetProfileStringW().

LUID luidPrevious
 

Definition at line 98 of file w32/ntuser/kernel/profile.c.

Referenced by InitPreviousUserString().

UNICODE_STRING PreviousUserString = {0, sizeof PreviousUserStringBuf, PreviousUserStringBuf}
 

Definition at line 97 of file w32/ntuser/kernel/profile.c.

Referenced by CreateProfileUserName(), InitPreviousUserString(), and OpenCacheKeyEx().

WCHAR PreviousUserStringBuf[256]
 

Definition at line 96 of file w32/ntuser/kernel/profile.c.

Referenced by InitPreviousUserString().

CONST WCHAR wszDefaultUser[] = L"\\Registry\\User\\.Default"
 

Definition at line 100 of file w32/ntuser/kernel/profile.c.


Generated on Sat May 15 19:45:20 2004 for test by doxygen 1.3.7