Tag: win32exception

“Win32Exception没有足够的存储空间来处理此命令”作为Windows服务运行时出错

有时我得到错误 Win32Exception没有足够的存储空间来处理此命令 申请运行一个月左右后。 这对应于系统错误 ERROR_NOT_ENOUGH_MEMORY (8) 通常,它作为Windows服务运行,并且更改其登录的用户仍然会发生错误。 但是,如果我通过双击它来运行应用程序,它可以正常工作。 它可以再次作为Windows服务运行的唯一方法是重新启动服务器。 该错误出现在应用程序写入的日志中。 完整的错误是: System.ComponentModel.Win32Exception: Not enough storage is available to process this command at System.Windows.Forms.NativeWindow.WindowClass.RegisterClass() at System.Windows.Forms.NativeWindow.WindowClass.Create(String className, Int32 classStyle) at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.Application.MarshalingControl..ctor() at System.Windows.Forms.Application.ThreadContext.get_MarshalingControl() at System.Windows.Forms.WindowsFormsSynchronizationContext..ctor() at System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded() at System.Windows.Forms.Control..ctor(Boolean autoInstallSyncContext) at System.Windows.Forms.ScrollableControl..ctor() at System.Windows.Forms.ContainerControl..ctor() at System.Windows.Forms.Form..ctor() at LicensingModule.LicenseKeyValidator..ctor(String Name, String Path) […]

使用AvalonDock 2.0时未处理的’System.ComponentModel.Win32Exception’

我正在使用AvalonDock 2.0 ,当我打开一个dock容器时,在调试模式下应用程序崩溃(它在没有调试的情况下运行时工作正常)。 我得到以下exception: WindowsBase.dll中出现未处理的“System.ComponentModel.Win32Exception”类型exception 附加信息:操作成功完成 我遇到了这个答案 ,建议取消选中“例外设置”中的框。 有线的事情是它第一次使用它。 但它不再存在了。 我试过其他机器也不行。 任何有关如何解决此问题的建议。 Avalon代码(第5行引发的exception) protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == Win32Helper.WM_WINDOWPOSCHANGING) { if (_internalHost_ContentRendered) { // the below line throw the exception Win32Helper.SetWindowPos(_internalHwndSource.Handle, Win32Helper.HWND_TOP, 0, 0, 0, 0, Win32Helper.SetWindowPosFlags.IgnoreMove | Win32Helper.SetWindowPosFlags.IgnoreResize); } } return […]

.Net Core 2.0 Process.Start抛出“指定的可执行文件不是此OS平台的有效应用程序”

我需要使用与用户Windows上关联的这两种文件类型的任何可执行文件自动执行.reg文件和.msi文件。 .NET Core 2.0 Process.Start(string fileName)docs说:“文件名不需要表示可执行文件。它可以是任何扩展名已与系统上安装的应用程序相关联的文件类型。” 然而 using(var proc = Process.Start(@”C:\Users\user2\Desktop\XXXX.reg”)) { } //.msi also 给我 System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform. at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start() at System.Diagnostics.Process.Start(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start(String fileName) 使用ErrorCode和HResult -2147467259,以及NativeErrorCode 193。 相同的代码在.Net Framework 3.5或4控制台应用程序中起作用。 我不能指定精确的exe文件路径作为方法的参数,因为用户的环境是变体(包括Windows版本)并且不受我的控制。 这也是为什么我需要将程序移植到.Net Core,尝试使其作为SCD控制台应用程序工作,以便不需要安装特定的.Net Framework或.NET Core版本。 Visual Studio调试运行和发布为win-x86 SCD时都会抛出exception。 […]

抛出Win32Exception

我最近编写了很多涉及与Win32 API互操作的代码,并开始想知道什么是处理由Windows API函数调用引起的本机(非托管)错误的最佳方法。 目前,对本机函数的调用如下所示: // NativeFunction returns true when successful and false when an error // occurred. When an error occurs, the MSDN docs usually tell you that the // error code can be discovered by calling GetLastError (as long as the // SetLastError flag has been set in the DllImport attribute). // Marshal.GetLastWin32Error is […]

启动进程时System.ComponentModel.Win32Exception – 找不到文件,但文件存在

我正在尝试为自动启动创建一个经理。 它应该读取XML文件,然后以自定义延迟启动我的程序。 例如: Realtek Audio Manager C:\Program Files\Realtek\Audio\HDA\RtkNGUI64.exe 5 这将在5秒后运行指定的进程( C:\Program Files\…\RtkNGUI64.exe -s )。 现在,三个程序无法启动,给我一个System.ComponentModel.Win32Exception :“Das System kann die angegebene Datei nicht finden。” (“系统无法找到指定的文件。”) 但是XML被正确解析,我想要启动的文件位于我在XML文件中指定的位置。 问题只涉及这三个文件: Intel HotkeysCmd – C:\ Windows \ System32 \ hkcmd.exe 英特尔GFX托盘 – C:\ Windows \ System32 \ igfxtray.exe 英特尔持久性 – C:\ Windows \ System32 \ igfxpers.exe 我认为问题来自文件的位置:它们都位于C:\ Windows \ System32中,而所有其他工作程序都位于外部(C:\ […]

System.ComponentModel.Win32Exception:操作成功完成

我有时会在运行Windows Forms应用程序时遇到此exception: System.ComponentModel.Win32Exception: The operation completed successfully at System.Drawing.BufferedGraphicsContext.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) at System.Drawing.BufferedGraphicsContext.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) at System.Drawing.BufferedGraphicsContext.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) at System.Drawing.BufferedGraphicsContext.AllocBufferInTempManager(Graphics targetGraphics, IntPtr targetDC, Rectangle targetRectangle) at System.Drawing.BufferedGraphicsContext.Allocate(IntPtr targetDC, Rectangle targetRectangle) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at […]

获取进程路径时访问被拒绝

我试图通过pid获取进程路径,但我得到Win32Exception(访问ID被拒绝)。 代码如下所示: string path = Process.GetProcessById(pid).MainModule.FileName 我已经尝试使用OpenProcess和GetModuleFileNameEx但是OpenProcess返回0.我甚至尝试根据C#启用SeDebugPrivilege – 如何启用SeDebugPrivilege但它没有帮助。 上面的代码适用于大多数进程,但抛出SynTPHelper.exe(Synaptics Pointing Device Helper)的错误。应用程序在与我的代码相同的用户名下运行。 两者,我的应用程序和进程都以64位运行。 是否可以在不以管理员身份运行我的应用程序的情况下检索路径? 编辑 即使我没有以管理员身份运行它,任务管理器也可以“打开文件位置”。

Win32Exception没有足够的存储空间来处理此命令

通过我为MaxTo自动崩溃收集,我收到了以下崩溃报告: V8.12.0.0 – System.ComponentModel.Win32Exception – :Void UpdateLayered():0 Version: MaxTo8.12.0.0 Exception: System.ComponentModel.Win32Exception Error message: Not enough storage is available to process this command Stack trace: at System.Windows.Forms.Form.UpdateLayered() at System.Windows.Forms.Form.OnHandleCreated(EventArgs e) at System.Windows.Forms.Control.WmCreate(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmCreate(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at MaxTo.MainForm.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& […]