Files
harbour-core/harbour/contrib/hbwin/tests/testreg.prg
Pavel Tsarenko bcd00a0fe6 2012-05-18 18:15 UTC+0300 Pavel Tsarenko (tpe2 at mail.ru)
* contrib/hbwin/win_reg.prg
  * contrib/hbwin/tests/test_reg.prg
    * added nRegSam (access mask) parameter into functions: win_regRead,
      win_regWrite, win_regGet, win_regDelete, win_regQuery, win_regSet.
      This parameter can be used in win32 applications, running under
      win64 systems for access to 32-bit or 64-bit registry.
2012-05-18 15:17:30 +00:00

49 lines
1.3 KiB
Plaintext

/*
* $Id$
*/
#include "hbwin.ch"
#define KEY_WOW64_64KEY 0x0100
#define KEY_WOW64_32KEY 0x0200
PROCEDURE Main()
LOCAL tmp
? win_regWrite( "HKCU\_TEST\mydword", 0x11223344, WIN_REG_DWORD )
? hb_numtohex( win_regRead( "HKCU\_TEST\mydword" ) )
? win_regWrite( "HKCU\_TEST\myqword", 0x1122334455667788, WIN_REG_QWORD )
? hb_numtohex( win_regRead( "HKCU\_TEST\myqword" ) )
Inkey( 0 )
? win_regDelete( "HKCU\_TEST\teszt" )
? win_regDelete( "HKCU\_TEST\" )
? ">" + win_GetCommandLineParam() + "<"
? ">" + wapi_GetCommandLine() + "<"
/* old API */
? ">" + hb_ValToStr( win_regGet( WIN_HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper" ) ) + "<"
/* new API */
? ">" + hb_ValToStr( win_regRead( "HKCU\Environment\PATH" ) ) + "<"
? ">" + hb_ValToStr( tmp := win_regRead( "HKCU\Control Panel\Desktop\Wallpaper" ) ) + "<"
? ">" + hb_ValToStr( win_regRead( "" ) ) + "<"
? win_regWrite( "HKCU\Control Panel\Desktop\Wallpaper", "harbour.bmp" )
? win_regRead( "HKCU\Control Panel\Desktop\Wallpaper" )
Inkey( 0 )
? win_regWrite( "HKCU\Control Panel\Desktop\Wallpaper", tmp )
? win_regRead( "HKLM\SOFTWARE\7-Zip\Path" )
IF hb_OSis64bit()
? win_regRead( "HKLM\SOFTWARE\7-Zip\Path",, KEY_WOW64_32KEY )
? win_regRead( "HKLM\SOFTWARE\7-Zip\Path",, KEY_WOW64_64KEY )
ENDIF
RETURN