Guest Posted April 28, 2018 Report Posted April 28, 2018 Salut, Folosesc File.OpenRead ca sa preiau un fisier si sa il fac FileStream, ca sa ii pot calcula MD5. Problema este ca primesc eroare la fisiere de genul: Could not find file 'C:\Windows\System32\spoolsv.exe'. Could not find file 'C:\Windows\System32\spoolsv.exe'. Could not find file 'C:\Windows\system32\taskhost.exe'. Could not find file 'C:\Windows\system32\taskhost.exe'. Could not find file 'C:\Windows\System32\VBoxTray.exe'. Could not find file 'C:\Windows\System32\VBoxTray.exe'. Could not find file 'C:\Windows\system32\csrss.exe'. Could not find file 'C:\Windows\system32\csrss.exe'. Could not find file 'C:\Windows\system32\winlogon.exe'. Could not find file 'C:\Windows\system32\winlogon.exe'. Could not find file 'C:\Windows\system32\AUDIODG.EXE'. Could not find file 'C:\Windows\system32\AUDIODG.EXE'. Could not find file 'C:\Windows\system32\lsm.exe'. Aplicatia mea cere drepturi de administrator si dialogul UAC apare, dar vad ca tot imi da eroare pentru fisiere din system32... Imi puteti spune ce as putea face sa trec de problema asta? Am cautat pe stackoverflow si toti zic ca nu am drepturi suficiente, dar eu cer administrator... Quote
gigiRoman Posted April 28, 2018 Report Posted April 28, 2018 (edited) Ii dai run as admin la visual studio la pornire? Sau cacaturile astea? https://stackoverflow.com/questions/2818179/how-do-i-force-my-net-application-to-run-as-administrator <requestedExecutionLevel level="asInvoker" uiAccess="false" /> OR <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> OR <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> Si mai era chestia asta de adaugai un 21 la shortcut si facea treaba: https://stackoverflow.com/questions/2818179/how-do-i-force-my-net-application-to-run-as-administrator Bafta! Edited April 28, 2018 by gigiRoman Quote
Guest Posted April 29, 2018 Report Posted April 29, 2018 (edited) 14 hours ago, gigiRoman said: Ii dai run as admin la visual studio la pornire? Sau cacaturile astea? https://stackoverflow.com/questions/2818179/how-do-i-force-my-net-application-to-run-as-administrator <requestedExecutionLevel level="asInvoker" uiAccess="false" /> OR <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> OR <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> Si mai era chestia asta de adaugai un 21 la shortcut si facea treaba: https://stackoverflow.com/questions/2818179/how-do-i-force-my-net-application-to-run-as-administrator Bafta! Da, VS ruleaza as admin, si in manifest am asta <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> Care cica e cu drepturi maxime... Edit: Aparent e o problema daca aplicatia e pe 32bit sau pe 64 cu File.OpenRead. Am debifat "Prefer 32bit" din build si acum nu mai am problema. Edited April 29, 2018 by Guest Quote
Erase Posted April 29, 2018 Report Posted April 29, 2018 Formatul este irelevant. Pentru a citi un fisier nu ai nevoie de acces de administrator. Quote
Guest Posted April 29, 2018 Report Posted April 29, 2018 10 minutes ago, Erase said: Formatul este irelevant. Pentru a citi un fisier nu ai nevoie de acces de administrator. Am debifat "Prefer 32bit" la Build si acum merge. Quote
Erase Posted April 29, 2018 Report Posted April 29, 2018 (edited) NetFramework iti returneaza exceptia FileNotFound atunci cand accesezi un path invalid si UnauthorizedAccess cand nu ai drepturi suficiente pentru actiunea respectiva.http://blogs.microsoft.co.il/sasha/2012/04/04/what-anycpu-really-means-as-of-net-45-and-visual-studio-11/ Referitor la raspunsul tau, path-ul nu se schimba setand CorFlags. Edited April 29, 2018 by Erase Quote