目前測試在要進行存取時,先呼叫LogonUser()
之後就可以用所輸入的使用者帳號來存取網路磁碟了。
存取完後需使用CloseHandle()來關閉Token並釋放記憶體即可。
dwLogonType設成 LOGON32_LOGON_INTERACTIVE或是LOGON32_LOGON_NEW_CREDENTIALS則都可以。
只是網路磁碟的路徑要使用UNC路徑才行,不然還是一樣會找不到路徑。
mapping過的路徑目前測試結果是service是一定讀不到檔案,原因則目前不明。
如有需讀取mapping路徑內之資料,請參考[Win]Mapping Disk的紀錄位置
PS.如有需要讓呼叫的執行檔也有同樣的權時,dwLogonType需設成LOGON32_LOGON_INTERACTIVE;dwLogonProvider則要設為LOGON32_PROVIDER_DEFAULT。
之後再使用 CreateProcessAsUser()來執行執行檔即可。需傳入的Token則為先前使用LogonUser()所取得的token。
Subscribe to:
Post Comments (Atom)
Build docker image from multiple build contexts
Build docker image from multiple build contexts ...
-
參考資料: Input Input Manager 測試手把 :PS Analog gamepad Script語言:C# Unity 版本:3.4 Unity提供了3種輸入裝置可以使用,鍵盤、滑鼠、以及遊戲手把。 ...
-
Markdown becomes the most popular documenting language in any technical documentation nowadays. The benefit of using Markdown is getting for...
No comments:
Post a Comment