Visual Studio 2010 errors

My x64 port of InpOut32
Post Reply
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Visual Studio 2010 errors

Post by joeyc »

I tried to run in debug InpoutTest.cpp from VC_test_app using Visual Studio 2010 in Windows 7x86. I got the following errors:

(K:\wdata is the project name in the K: partition.)
DEBUG OUTPUT

'wdata.exe': Loaded 'K:\wdata\Debug\wdata.exe', Symbols loaded.
'wdata.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'wdata.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'wdata.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'wdata.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'wdata.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'wdata.exe': Unloaded 'C:\Windows\System32\apphelp.dll'
The program '[3488] wdata.exe: Native' has exited with code -2 (0xfffffffe).

I think that I am probably using VS 2010 wrongly, but there are no red squiggles under any item in the listing. Please advise.
Joe.
User avatar
phil
Site Admin
Posts: 7807
Joined: Sun Apr 06, 2003 11:12 pm

Re: Visual Studio 2010 errors

Post by phil »

Where are the errors? All I can see is that it failed to load some PDB (debug databases) for some Windows DLL's - hardly an error.
Not being able to load PDB files is quite normal, unless you have downloaded all the windows DLL symbols (unlikely if your using 2010 (why so old?)) - but its not really an error, as you don't need to debug the system files.

If your going to insist on using a compiler that is over 14 years old, then I cant help much (not that I can help much anyway as Im not really into supporting inpout32 anymore - its a pretty dead project as far as I am concerned!

But at the end of the day, your program wdata.exe ran and returned -2 (I cant tell you what that means, only you will know that as you have the code for wdata.exe in front of you (I presume)?!
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Re: Visual Studio 2010 errors

Post by joeyc »

So you are saying that the program ran without error!!
(I am trying to learn both C++ and Visual Studio at the same time.)
Thank you.
P.S. I use VS2010 because I have it. VS 2019 and newer will not run under Win 7x32.
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Re: Visual Studio 2010 errors

Post by joeyc »

Also, the code InpoutTest.cpp was taken from VC_test_app which I got from your website. The file wdata is a new project name that I started with since my VS 2010 would not load your project. I just included your .cpp file in wdata. For some reason VS attaches .exe to the project name. I don't think Debug actually ran the program to completion because I heard no beeps.
User avatar
phil
Site Admin
Posts: 7807
Joined: Sun Apr 06, 2003 11:12 pm

Re: Visual Studio 2010 errors

Post by phil »

When I said it ran, I was commenting on this: The program '[3488] wdata.exe: Native' has exited with code -2 (0xfffffffe).
That means it ran and returned -2 (negative return codes are often errors, but it ran to generate that!)
You might want to put a breakpoint in the main function and step through to see where that -2 is generated (or just look through the code to find it). It might give away any obvious issues.

The beep, uses the PC speaker on the motherboard (not any fancy proper audio channels), which in more and more cases these days does not exist. Do you have one in your system?
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Re: Visual Studio 2010 errors

Post by joeyc »

I have a beep speaker on the motherboard and it gives one beep at power on.
I'm confused about the argc value. The function isn't called by anyone and argc is not initialized anywhere, so why doesn't the program fail with the argc message?
In any event, I forced the argc=3 and debugged my way down to the "if ( hInpOutDll != NULL )" statement. Apparently it was NULL, and so no beeps.
But C:\WINDOWS\SYSTEM32\DRIVERS has an inpout32.sys item, although I can't find inpout32.dll anywhere.
User avatar
phil
Site Admin
Posts: 7807
Joined: Sun Apr 06, 2003 11:12 pm

Re: Visual Studio 2010 errors

Post by phil »

InpOut32.dll is in the download binary package... It needs to be in the same folder as your EXE (or anywhere in your PATH environment), as the sample code dynamically loads this DLL using

Code: Select all

HINSTANCE hInpOutDll ;
hInpOutDll = LoadLibrary ( "InpOut32.DLL" ) ;
Is it safe to assume your C++ knowledge a little light? It would be useful to know what experience level I am targeting my comments to?

Clearly argc is defined and is an input into the main function!
argc is the count of argument elements in argv (the command line arguments) passed into the MAIN startup function by the C++ runtime as application startup. The sample program is a command line program that expects at least 2 command line arguments!

The example C++ code hase this (presume thats what your using)...

Code: Select all

int main(int argc, char* argv[])
{
	if(argc<3)
	{
		//too few command line arguments, show usage
		printf("Error : too few arguments\n\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
	} 
program.exe read 0x378
or
program.exe write 0x378 1
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Re: Visual Studio 2010 errors

Post by joeyc »

Thank you for all of your help.
As I mentioned in my second post, I am new to both C++ and Visual Studio.
The program is a function call. For now, I am trying to change it to a main program and remove the if(argc) tests and remove the read function to ease the clutter so that I can follow the code..
I want to force feed the address (0x078) and the data (e.g. 0x77) and just write. I can't provide input data for the read function but I do have a breakout box on the parallel port to see output data.
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Re: Visual Studio 2010 errors

Post by joeyc »

SUCCESS!!
I stripped out much of the code that I don't plan on using and inserted the following:
...
//
short iPort = 0x0378;
BYTE wData = 0x77;
gfpOut32(iPort, wData);
short jPort = 0x037A;
BYTE xData = 0x01;
gfpOut32(jPort, xData);
BYTE yData = 0x00;
gfpOut32(jPort, yData);
//
...
and my breakout box leds displayed 0111 0111.
Thanks again.
User avatar
phil
Site Admin
Posts: 7807
Joined: Sun Apr 06, 2003 11:12 pm

Re: Visual Studio 2010 errors

Post by phil »

Nice! Well done! We were all beginners once and that’s good! Glad you got something sensible out…. Next up (maybe) audrhino programming because then no need for parallel ports :)
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Re: Visual Studio 2010 errors

Post by joeyc »

Next up: VS created a wdata.exe in the debug folder. When I tried to run it with an elevated command prompt I got this message: "Unable to load InpOut32 DLL!". Is there a way around this?
User avatar
phil
Site Admin
Posts: 7807
Joined: Sun Apr 06, 2003 11:12 pm

Re: Visual Studio 2010 errors

Post by phil »

Is the DLL in the same folder as the EXE (or somewhere in your PATH environment)?
Are you using the 32bit DLL (with 32bit EXE - I presume you have compiled for x86 not x64?)
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
joeyc
New User
Posts: 12
Joined: Mon Oct 29, 2018 7:53 pm

Re: Visual Studio 2010 errors

Post by joeyc »

Ouch! InpOut32.dll was in the wdata file but not in its debug file.
After a quick copy...works great.
Thanks.
Post Reply