在 Windows 中强制使用高 PID

发布于 2024-10-04 13:15:25 字数 405 浏览 0 评论 0原文

我们目前正在测试旧的 VB6 应用程序的错误修复,该程序的初始版本将获取 PID 并将其存储在 int 中,然后将其写入数据库。直到您的应用程序被分配的 PID 高于 32768 为止,这种方法都可以正常工作,在这种情况下,您会发生溢出并且应用程序终止。

我们通过将所有内容更改为 long 而不是 int 来修复此问题。但现在我们测试有问题。我们只在生产环境中很少看到这个问题(但当它发生时会产生毁灭性的影响),而在测试中却从未看到过。我试图通过生成大量程序来引发高 PID,但我从未设法让它超过 PID 25000。

我确实找到了一个名为 HighPid 的工具(http://winprogger.com/?p=29),但遗憾的是它似乎没有兑现它的承诺。那么,是否有人有类似(但有效)的工具,或者其他一些技巧来在 Windows 服务器上强制使用高 PID?

We are currently testing a bugfix for an old VB6 application, the initial version of the program would get the PID and store it in an int, and then write it to the database. This works fine until your application gets assigned a PID higher than 32768, in which case you get overflow and the application dies.

We fixed this by changing everything to long, instead of int. but now we have a problem testing. We only see this problem rarely in our production environments (but with devastating effect when it occurs), and never in testing. I've tried to provoke a high PID by spawning a ton of programs, but I never managed to get it past PID 25000.

I did find a tool called HighPid (http://winprogger.com/?p=29) but sadly it doesn't seem to deliver on it's promises. So does anyone out there have a similar (but working) tool, or some other trick to force a high PID on a windows server?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

相思碎 2024-10-11 13:15:25

启动32767虚拟进程真的轻量级吗? ;-)
100kb*32k = 3.2Gb,因此 RAM 不应限制您。

Launch 32767 dummy really light-weight processes? ;-)
100kb*32k = 3.2Gb, so RAM should not limit you.

著墨染雨君画夕 2024-10-11 13:15:25

您可以从不同的角度看待它,并检测检索进程 ID 的函数,例如(伪代码):

function GetPID()
{
    // ... retrieve process id

    #if DEBUG
      return pid + 32000;
    #else
      return pid;
    #endif
}

You could look at it from a different perspective and instrument the function that retrieves the process id, something like (pseudocode):

function GetPID()
{
    // ... retrieve process id

    #if DEBUG
      return pid + 32000;
    #else
      return pid;
    #endif
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文