Dos Error 87 Invalid Parameter
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this system error codes site About Us Learn more about Stack Overflow the company Business Learn more
Windows Error Codes Lookup
about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss error_invalid_parameter Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up OpenProcess error 87 createprocess invalid parameter up vote 1 down vote favorite I'm trying to write a program which executes make.exe from MinGW distribution in the current directory and makes use of its STDOUT data and exit code. I have a handle to process STDOUT where I fetch data from, created with CreatePipe. When I get an ERROR_HANDLE_EOF on that pipe I assume the process has exited and
Error 404
try to get its exit code: if(session->pid == 0) return; HANDLE hp = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_TERMINATE, TRUE, session->pid); if(hp == NULL) { printf("OpenProcess(%i) failed, error: %i\n", session->pid, (int)GetLastError()); return; } My code works on all other MinGW utilities I tested (like pwd, ls, etc.), I get the STDOUT and the exit code with no problem. But when I try it on make, the above code displays the following message: "OpenProcess(2032) failed, error: 87" I googled for error code 87, and it says "Invalid parameter". I don't see what could be invalid about a positive process id like 2032. Any ideas? winapi makefile getlasterror openprocess share|improve this question asked Feb 14 '11 at 1:14 user389419 12817 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted You should use the handle from CreateProcess instead of using OpenProcess on the PID. OpenProcess only works if the process object still exists. By the time you call OpenProcess if the process object is gone - the result is a call with invalid parameter. The success you got with other utilities is either due to a race condition (which may fail
360 games PC games hex to decimal Windows games Windows phone games Entertainment All Entertainment Movies & TV Music Business & Education Business Students & educators Developers Sale Sale Find a store Gift cards Products Software & services Windows Office Free downloads & security Internet http://stackoverflow.com/questions/4988082/openprocess-error-87-invalid-parameter Explorer Microsoft Edge Skype OneNote OneDrive Microsoft Health MSN Bing Microsoft Groove Microsoft Movies & TV Devices & Xbox All Microsoft devices Microsoft Surface All Windows PCs & tablets PC accessories Xbox & games Microsoft Lumia All https://support.microsoft.com/en-us/kb/840797 Windows phones Microsoft HoloLens For business Cloud Platform Microsoft Azure Microsoft Dynamics Windows for business Office for business Skype for business Surface for business Enterprise solutions Small business solutions Find a solutions provider Volume Licensing For developers & IT pros Develop Windows apps Microsoft Azure MSDN TechNet Visual Studio For students & educators Office for students OneNote in classroom Shop PCs & tablets perfect for students Microsoft in Education Support Sign in Cart Cart Javascript is disabled Please enable javascript and refresh the page Cookies are disabled Please enable cookies and refresh the page CV: {{ getCv() }} English (United States) Terms of use Privacy & cookies Trademarks © 2016 Microsoft
Studio 2015 products Visual Studio Team Services Visual Studio Code Visual Studio Dev Essentials Office Office Word/Excel/PowerPoint Microsoft Graph Outlook OneDrive/Sharepoint Skype Services Store Cortana Bing Application Insights Languages & platforms Xamarin ASP.NET https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx C++ TypeScript .NET - VB, C#, F# Server Windows Server SQL Server BizTalk Server SharePoint Dynamics Programs & communities Students Startups Forums MSDN Subscriber downloads Sign in Search Microsoft Search Windows Dev Center Windows Dev Center Explore What’s new for Windows 10 Intro to Universal Windows Platform Coding challenges Develop for accessibility Build for enterprise Windows Store opportunities Docs Windows apps Get started Design and UI error codes Develop API reference Publish Monetize Promote Games Get started UI design Develop Publish Desktop Get started Design Develop API reference Test and deploy Compatibility Windows IoT Microsoft Edge Windows Holographic Downloads Samples Support Why Windows Dashboard Explore What’s new for Windows 10 Intro to Universal Windows Platform Coding challenges Develop for accessibility Build for enterprise Windows Store opportunities Docs Windows apps Get started Design and UI Develop dos error 87 API reference Publish Monetize Promote Games Get started UI design Develop Publish Desktop Get started Design Develop API reference Test and deploy Compatibility Windows IoT Microsoft Edge Windows Holographic Downloads Samples Support Why Windows Dashboard Error Handling Error Handling Reference System Error Codes System Error Codes System Error Codes (0-499) System Error Codes (0-499) System Error Codes (0-499) System Error Codes (0-499) System Error Codes (500-999) System Error Codes (1000-1299) System Error Codes (1300-1699) System Error Codes (1700-3999) System Error Codes (4000-5999) System Error Codes (6000-8199) System Error Codes (8200-8999) System Error Codes (9000-11999) System Error Codes (12000-15999) TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. System Error Codes (0-499) Note The information on this page is intended to be used by programmers so that the software they write can better deal with errors. If you are an end-user that is experiencing difficulty with an application you are installing or running, contact customer support for the software that is displaying the error message. To obtain support for a Microsoft product, go to http://support.microsoft.com. The System Error Code