Note that there are some explanatory texts on larger screens.

plurals
  1. POAddMonitor 183 error
    text
    copied!<p>There is a simple code:</p> <pre><code>[DllImport("winspool.Drv", EntryPoint = "AddMonitorA", SetLastError = true, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] private static extern bool AddMonitor([MarshalAs(UnmanagedType.LPStr)] string Name, Int32 Level, [In, MarshalAs(UnmanagedType.LPStruct)] MONITOR_INFO_2 mi2); public static int MonitorInstaller(out string errorMessage) { int ret = 0; byte* pMonitor = GetBytePtr(Globals.PortMonitorName); errorMessage = null; ret = IsMonitorInstalled(pMonitor, false); Loger.WriteLog("IsMonitorInstaled: {0}", ret); if (ret != 0) { Loger.WriteLog("Test_point_01"); errorMessage = "Monitor is already installed."; return 1; } bool delRes = DeleteMonitor(null, null, Globals.PortMonitorName); Loger.WriteLog("Delete result: {0}", delRes); MONITOR_INFO_2 mi2 = new MONITOR_INFO_2(); mi2.pName = Globals.PortMonitorName; mi2.pEnvironment = "Windows NT x86"; mi2.pDLLName = Globals.MonitorFile; Loger.WriteLog("mi2 data:"); Loger.WriteLog("pName: {0}", mi2.pName); Loger.WriteLog("pDLLName: {0}", mi2.pDLLName); bool bRet = AddMonitor(null, 2, mi2); Loger.WriteLog("AddMonitor result: {0}", bRet); if (!bRet) { int errorCode = Marshal.GetLastWin32Error(); Loger.WriteLog("AddMonitor erro: {0}", errorCode); errorMessage = new Win32Exception(errorCode).Message; return errorCode; } return 0; } </code></pre> <p>The AddMonitor function allways sets 183 errorcode: Cannot create a file when that file already exists. But there are no such monitor. Give me any ideas for it. P.S. Application running with administator account, there is no antivirus on the test virtual mashine and the windows firewall is off.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload