// 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;' ) ); } */ }