xsl
xsl

Reputation: 17426

.NET hardware access problems when not logged in as administrator

I had to integrate a native library that communicates with a webcam in a .NET application. So I wrote a wrapper library with PInvoke calls and linked it to the main program:

driver.dll (c++) + driver.wrapper.dll (.net 3.5) + Application (.net 3.5)

The problem is, that this only works when logged in as local administrator (strangely enough it doesn't even work when run with administrator privileges). I don't get any specific error messages here, the driver library just returns 0 instead of 1.

When the native library is directly linked to the application, however

driver.dll (c++) + Application (c++)

it works well as administrator and as user. The operating system is Windows 7. What could be the reason for such a behavior and how can I solve this problem?

Edit: Problem was caused by the used library. Solved now.

Upvotes: 4

Views: 120

Answers (2)

xsl
xsl

Reputation: 17426

The problem was caused by the used library and is no longer relevant.

Upvotes: 1

Ismail
Ismail

Reputation: 644

One solution can be editing app.manifest

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">

        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
</security>
  </trustInfo>

This will always run your application as Administrator.

Upvotes: 3

Related Questions