简体   繁体   English

在Windows中强制使用高PID

[英]Forcing a high PID in windows

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. 我们目前正在测试旧VB6应用程序的错误修正,该程序的初始版本将获取PID并将其存储在int中,然后将其写入数据库。 This works fine until your application gets assigned a PID higher than 32768, in which case you get overflow and the application dies. 在向应用程序分配的PID大于32768之前,这种方法可以正常工作,在这种情况下,您会溢出并且应用程序死亡。

We fixed this by changing everything to long, instead of int. 我们通过将所有内容更改为long而不是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. 我试图通过产生大量程序来激发高PID,但是我从未设法使其超过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. 我确实找到了一个称为HighPid(http://winprogger.com/?p=29)的工具,但可惜的是它似乎没有兑现承诺。 So does anyone out there have a similar (but working) tool, or some other trick to force a high PID on a windows server? 那么,有没有人有类似的(但有效的)工具,或其他一些技巧来在Windows服务器上强制使用高PID?

Launch 32767 dummy really light-weight processes? 启动32767假人真的很轻巧吗? ;-) 100kb*32k = 3.2Gb, so RAM should not limit you. ;-) 100kb * 32k = 3.2Gb,因此RAM不应限制您。

You could look at it from a different perspective and instrument the function that retrieves the process id, something like (pseudocode): 您可以从不同的角度看待它,并检测检索进程ID的函数,例如(伪代码):

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM