I'd like some opinions before I submit this to the UDF forum.
code:
Break On CLS
If CheckAccess(,"System\CurrentControlSet\Services\LanmanServer\Parameters","qs") = 0
"User has Query and Set Value permissions." ?
Else
"User cannot write to this key." ?
Endif
;Q = KEY_QUERY_VALUE
;S = KEY_SET_VALUE
;C = KEY_CREATE_SUB_KEY
;E = KEY_ENUMERATE_SUB_KEYS
;N = KEY_NOTIFY
;L = KEY_CREATE_LINK
;D = DELETE
;R = READ_CONTROL
;W = WRITE_DAC
;O = WRITE_OWNER
Function CheckAccess(Optional $Key, $Path, Optional $Access, Optional $strComputer)
Select
Case $Key = "HKEY_CLASSES_ROOT" $Key = &80000000
Case $Key = "HKEY_CURRENT_USER" $Key = &80000001
Case $Key = "HKEY_LOCAL_MACHINE" $Key = &80000002
Case $Key = "HKEY_USERS" $Key = &80000003
Case $Key = "HKEY_CURRENT_CONFIG" $Key = &80000005
Case $Key = "HKEY_DYN_DATA" $Key = &80000006
Case 1 $Key = &80000002
EndSelect
If instr($Access, "Q") $Perms = $Perms + &1 Endif
If instr($Access, "S") $Perms = $Perms + &2 Endif
If instr($Access, "C") $Perms = $Perms + &4 Endif
If instr($Access, "E") $Perms = $Perms + &8 Endif
If instr($Access, "N") $Perms = $Perms + &10 Endif
If instr($Access, "L") $Perms = $Perms + &20 Endif
If instr($Access, "D") $Perms = $Perms + &10000 Endif
If instr($Access, "R") $Perms = $Perms + &20000 Endif
If instr($Access, "W") $Perms = $Perms + &40000 Endif
If instr($Access, "O") $Perms = $Perms + &80000 Endif
If $strComputer = "" $strComputer = "." Endif
$objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $strComputer + "\root\default:StdRegProv")
$CheckAccess = $objRegistry.CheckAccess($Key, $Path, $Perms)
EndFunction