]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/random/windows/windows.factor
Updating code to use with-out-parameters
[factor.git] / basis / random / windows / windows.factor
index 72b908a32fcfefd3b3bed953080d18418ffb539e..f6918eb8f8197ab7ed011bf5e19245f7dc171e2f 100644 (file)
@@ -16,24 +16,22 @@ M: windows-crypto-context dispose ( tuple -- )
 
 CONSTANT: factor-crypto-container "FactorCryptoContainer"
 
-:: (acquire-crypto-context) ( provider type flags -- handle ret )
-    HCRYPTPROV <c-object> :> handle
-    handle
-    factor-crypto-container
-    provider
-    type
-    flags
-    CryptAcquireContextW handle swap ;
+:: (acquire-crypto-context) ( provider type flags -- handle )
+    { HCRYPTPROV } [
+        factor-crypto-container
+        provider
+        type
+        flags
+        CryptAcquireContextW
+    ] [ ] with-out-parameters ;
 
 : acquire-crypto-context ( provider type -- handle )
     CRYPT_MACHINE_KEYSET
     (acquire-crypto-context)
-    0 = [
+    swap 0 = [
         GetLastError NTE_BAD_KEYSET =
         [ drop f ] [ win32-error-string throw ] if
-    ] [
-        *void*
-    ] if ;
+    ] when ;
 
 : create-crypto-context ( provider type -- handle )
     flags{ CRYPT_MACHINE_KEYSET CRYPT_NEWKEYSET }