Created
April 16, 2015 08:29
-
-
Save takikawa/c7c4757814df19ed3d67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require ffi/unsafe) | |
(define open-process | |
(get-ffi-obj "OpenProcess" | |
#f | |
(_fun _int _bool _int -> _pointer))) | |
(define get-process-affinity-mask | |
(get-ffi-obj "GetProcessAffinityMask" | |
#f | |
(_fun _pointer | |
(p-mask : (_ptr o _long)) | |
(s-mask : (_ptr o _long)) | |
-> (err : _int) | |
-> (values p-mask s-mask err)))) | |
(define set-process-affinity-mask | |
(get-ffi-obj "SetProcessAffinityMask" | |
#f | |
(_fun _pointer _long -> _int))) | |
(define get-last-error | |
(get-ffi-obj "GetLastError" | |
#f | |
(_fun -> _int))) | |
(require mzlib/os) | |
(get-process-affinity-mask (open-process #x0400 #f 4840)) | |
(set-process-affinity-mask (open-process #x0200 #f 4840) 4) | |
(get-process-affinity-mask (open-process #x0400 #f 4840)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment