Jump to content
Guest

[C#]Problema File.OpenRead

Recommended Posts

Posted

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...

Posted (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 by gigiRoman
Posted (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 by Guest
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...