Search Results

Search found 1 results on 1 pages for 'user1686388'.

Page 1/1 | 1 

  • Error_No_Token by adding printer driver (c#)

    - by user1686388
    I'm trying to add printer drivers using the windows API function AddPrinterDriver. The Win32 error 1008 (An attempt was made to reference a token that does not exist.) was always generated. My code is shown as following [DllImport("Winspool.drv")] static extern bool AddPrinterDriver(string Name, Int32 Level, [in] ref DRIVER_INFO_3 DriverInfo); [StructLayout(LayoutKind.Sequential)] public struct DRIVER_INFO_3 { public Int32 cVersion; public string Name; public string Environment; public string DriverPath; public string DataFile; public string ConfigFile; public string HelpFile; public string DependentFiles; public string MonitorName; public string DefaultDataType; } //....................... DRIVER_INFO_3 di = new DRIVER_INFO_3(); //...................... AddPrinterDriver(Environment.MachineName, 3, ref di); I have also tried to get a token by "ImpersonateSelf" before adding the printer driver. But the error 1008 insists. Does anyone have an idea? best regards.

    Read the article

1