Created
January 7, 2015 15:49
-
-
Save pfmoore/db6f7718885a49e8918f 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
from cffi import FFI | |
ffi = FFI() | |
ffi.cdef(''' | |
HANDLE FindFirstVolume(LPTSTR lpszVolumeName, DWORD cchBufferLength); | |
BOOL FindVolumeClose(HANDLE hFindVolume); | |
''') | |
lib = ffi.verify(''' | |
/* Note - need UNICODE here as ffi won't auto-detect if we need it */ | |
#define UNICODE | |
#include <windows.h> | |
''', libraries=["kernel32"]) | |
LEN = 10000 | |
buf = ffi.new("TCHAR[]", LEN) | |
h = FindFirstVolume(buf, LEN) | |
print(ffi.string(buf)) | |
FindVolumeClose(h) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment