Archive: Win98 and sysadmin check


Win98 and sysadmin check
This code works in 2000 and XP but fails in Windows 98

System::Call "kernel32::GetModuleHandle(t 'shell32.dll') i .s"
System::Call "kernel32::GetProcAddress(i s, i 680) i .r0"
System::Call "::$0() i .r0"


;continued
; So, is the the user the admin or not ?
strcmp $0 1 admin notAdmin


from msdn:
Minimum DLL Version shell32.dll version 5.0 or later
Minimum operating systems Windows 2000

anyway, there is no such thing as admin on Win9x, just skip the whole check on 95/98/ME


UserInfo plugin code about Win9x :)

if (GetVersion() & 0x80000000) // Not NT
{
group = "Admin";
}

Another home grown way I used - important thing is not admin group but if I can write registry (and Program files)

;Hand made admin checkout
Function .onInit
WriteRegStr HKLM "${REG_UNINST}" "TestString" "Some text"
IfErrors 0 cleanValue
MessageBox MB_OK "This application must be installed by an administrator.$\nClick 'OK' to terminate the installation."
Abort
cleanValue:
DeleteRegValue HKLM "${REG_UNINST}" "TestString"
FunctionEnd


many many thanks Takhir and Anders :)
I am in my 6th week of PC system stuff as I come from the Mac world
It is a totally different universe and this list has really helped to demystify all the new jargon
For those who are following the thread, I changed DeleteRegValue to DeleteRegKey to trash the 'test' key as to leave no trace


I had in mind to use this node for uninstall settings, but you are right - user can cancel installation, so key deletion is better.