ReadFile using winapi with pinvoke (image a physical disk)
i'm trying read files powershell using winapi (createfile, readfile, closehandle). of course there exist easier ways read files, ultimetaly want read physical disk, that's why. familiar api's , have done many times in other script language. i'm learning powershell.. anyways, believe problem in creation of structure readfile put content. i've put getlasterror in there return code 5 (access denied). other api's seem work fine. appreciated. code; $pinvoke = add-type -name pinvoke21 -passthru -memberdefinition @' [dllimport("kernel32.dll", charset = charset.auto, callingconvention = callingconvention.stdcall, setlasterror = true)] public static extern intptr createfile( string lpfilename, uint dwdesiredaccess, uint dwsharemode, intptr securityattributes, uint dwcreationdisposition, uint dwflagsandattributes ); [dllimport("kernel32.dll", setlasterror = true)]...