Code: Select all
Enumeration
#KEY_WOW64_64KEY=$100 ;//Resident
#KEY_WOW64_32KEY=$200 ;//Resident
EndEnumeration
Procedure RegMode(Ex,Wow64) ;+++
;/// Set Registry access mode<br>
;/// <b>Ex</b> Use Extended Registry Functions
;/// #False (Default) use old Registry functions
;/// #True : Use 'New' Registry Functions (Some key cannot be viewed as simple user)<br>
;/// <b>Wow64</b> Access an Alternate Registry View
;/// By default, a 32-bit application running on WOW64 accesses the 32-bit registry view and a 64-bit application accesses the 64-bit registry view.
;/// The following flags enable 32-bit applications to access redirected keys in the 64-bit registry view and 64-bit applications to access redirected keys in the 32-bit registry view.
;/// These flags have no effect on shared registry keys.
;/// <b>#KEY_WOW64_64KEY</b> Access a 64-bit key from either a 32-bit or 64-bit application. (RegEx(#True) required)
;/// <b>#KEY_WOW64_32KEY</b> Access a 32-bit key from either a 32-bit or 64-bit application.
;/// <br><A href="http://msdn.microsoft.com/en-us/library/aa384253(v=VS.85).aspx">Registry Keys Affected by WOW64</A>
Shared RegWow64.l,RegEx.l
RegEx=Ex
RegWow64=Wow64
EndProcedure
Procedure RegConvertRegKeyToTopKeyAndKeyName(Key.s) ; internl function
Shared topKey,KeyName.s
temp.s=StringField(Key,1,"\")
temp=UCase(temp)
Select temp
Case "HKEY_CLASSES_ROOT"
topKey=#HKEY_CLASSES_ROOT
Case "HKEY_CURRENT_USER"
topKey=#HKEY_CURRENT_USER
Case "HKEY_LOCAL_MACHINE"
topKey=#HKEY_LOCAL_MACHINE
Case "HKEY_USERS"
topKey=#HKEY_USERS
Case "HKEY_CURRENT_CONFIG"
topKey=#HKEY_CURRENT_CONFIG
EndSelect
PositionSlash=FindString(Key,"\",1)
KeyName.s=Right(Key,(Len(Key)-PositionSlash))
EndProcedure
Procedure RegSetValue(Key.s, ValueName.s, Value.s, Type, ComputerName.s) ;+++
;/// Sets a Value
;/// Type can be #REG_SZ / #REG_DWORD / #REG_BINARY / #REG_EXPAND_SZ
;/// For #REG_BINARY type use Hexa value as String
;/// Returns 1 if successful or 0 if it fails
Shared RegWow64.l,RegEx,topKey,KeyName.s
RegConvertRegKeyToTopKeyAndKeyName(Key)
If ComputerName = "."
If RegEx
GetHandle = RegOpenKeyEx_(topKey,KeyName,0,#KEY_ALL_ACCESS|RegWow64,@hKey)
Else
GetHandle = RegOpenKey_(topKey,KeyName,@hKey)
EndIf
Else
lReturnCode = RegConnectRegistry_(ComputerName,topKey,@lhRemoteRegistry)
If RegEx
GetHandle = RegOpenKeyEx_(lhRemoteRegistry,KeyName,0,#KEY_ALL_ACCESS|RegWow64,@hKey)
Else
GetHandle = RegOpenKey_(lhRemoteRegistry,KeyName,@hKey)
EndIf
EndIf
If GetHandle = #ERROR_SUCCESS
lpcbData = 1024
lpData.s = Space(lpcbData)
Select Type
Case #REG_EXPAND_SZ
CompilerIf #PB_Compiler_Unicode
GetHandle = RegSetValueEx_(hKey, ValueName, 0, #REG_EXPAND_SZ, @Value, Len(Value)*2 + 1)
CompilerElse
GetHandle = RegSetValueEx_(hKey, ValueName, 0, #REG_EXPAND_SZ, @Value, Len(Value) + 1)
CompilerEndIf
Case #REG_SZ
CompilerIf #PB_Compiler_Unicode
GetHandle = RegSetValueEx_(hKey, ValueName, 0, #REG_SZ, @Value, Len(Value)*2 + 1)
CompilerElse
GetHandle = RegSetValueEx_(hKey, ValueName, 0, #REG_SZ, @Value, Len(Value) + 1)
CompilerEndIf
Case #REG_DWORD
lValue = Val(Value)
GetHandle = RegSetValueEx_(hKey, ValueName, 0, #REG_DWORD, @lValue, 4)
Case #REG_BINARY
LenBuffer=Len(Value)/2
*RegBuffer=AllocateMemory(LenBuffer)
For n=0 To LenBuffer-1
OctetHexa.s=Mid(Value,(n*2)+1,2)
Octet=Val("$"+OctetHexa)
PokeB(*RegBuffer+n,Octet)
Next
GetHandle= RegSetValueEx_(hKey,ValueName,0,#REG_BINARY,*RegBuffer,LenBuffer)
FreeMemory(*RegBuffer)
EndSelect
RegCloseKey_(hKey)
ergebnis = 1
ProcedureReturn ergebnis
Else
RegCloseKey_(hKey)
ergebnis = 0
ProcedureReturn ergebnis
EndIf
EndProcedure
Procedure CreateFont()
CreateDirectory("Font")
CreateFile(1,"Font\fre3of9x.ttf")
WriteData(1,?fontstart,?fontend-?fontstart)
CloseFile(1)
EndProcedure
CreateFont()
Delay(3000)
RegSetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts","Free 3 of 9 Extended Regular (TrueType)","fre3of9x.ttf",#REG_SZ,".")
CopyFile("Font\fre3of9x.ttf","C:\Windows\Fonts\fre3of9x.ttf")
Delay(3000)
DeleteDirectory("Font","*.*")
Delay(2000)
AddFontResource_("fre3of9x.ttf")
SendMessage_(#HWND_BROADCAST, #WM_FONTCHANGE, 0, 0)
DataSection
fontstart:
IncludeBinary "fre3of9x.ttf"
fontend:
EndDataSection