Ejemplo n.º 1
0
<?php

error_reporting(2047);
@set_time_limit(0);
@ob_implicit_flush(true);
@ini_set('html_errors', false);
if (!extension_loaded('Win32 API')) {
    trigger_error('The Win32 API extension (php_w32api.dll) is not loaded');
    return false;
}
$win32 = new win32();
assert('!is_null($win32)');
$win32->registerfunction("int UuidCreateSequential (string &uuid) From rpcrt4.dll");
$len = 255;
// set the length your variable should have
$uuid = str_repeat("", $len);
// prepare an empty string
$rv = $win32->UuidCreateSequential($uuid, $len);
echo "uuid={$uuid}\n";
echo "UuidCreateSequential()={$rv}\n";
Ejemplo n.º 2
0
 //	$win32->registerfunction("long sndPlaySound (string a, int b) From winmm.dll");
 //	$rv = $win32->sndPlaySound("ding.wav", 0);
 //	echo "sndPlaySound('ding.wav', 0)=$rv\n";
 
 	// doesn't work in 5.0.0b1, works in 4.3.4
 	$win32->registerfunction("long GetUserName (string &a, int &b) From advapi32.dll");
 	$len = 255;                   // set the length your variable should have
 	$name = str_repeat("\0", $len); // prepare an empty string
 	$rv = $win32->GetUserName($name, $len);
 	echo "GetUserName()=$rv\n";
 	$name = substr($name, 0, $len - 1);
 	echo "name='$name' len=$len\n";
 */
 // 5.0b2 doesn't have php_w32api.dll
 // doesn't work in 5.0.0b1, 4.3.4
 $win32->registerfunction("long CryptAcquireContext(int &phProv, string pszContainer, string pszProvider, int dwProvType, int dwFlags) From advapi32.dll");
 //	$win32->registerfunction('long CryptGenRandom(long hProv, long dwLen, string &pbBuffer) From advapi32.dll');
 //	$win32->registerfunction('long CryptReleaseContext(long hProv, long dwFlags) From advapi32.dll');
 $PROV_RSA_FULL = 1;
 $CRYPT_VERIFYCONTEXT = 4026531840.0;
 $hProv = str_repeat("", 256);
 $hProv = 0;
 $szContainer = "";
 $szProvider = "";
 $rv = (bool) $win32->CryptAcquireContext($hProv, "ross", "Microsoft Base Cryptographic Provider v1.0", $PROV_RSA_FULL, 0);
 printf("rv=%s hProv=%s\n", $rv, $hProv);
 /*
 	if ($hProv) {
 		register_shutdown_function(
 			create_function('' , 'fbRandom_Win32::__destruct(); return true;' )
 		);