Page 1 of 1

debug cmd.exe build only

Posted: Fri Dec 31, 2010 12:55 am
by HansH
is it possible to debug a single cmd.exe build under win32 xp

I did a make cmd only, just to test the compatabilty of the generated cmd.exe.
Because I found some strange effects on some of my .cmd files, I was wondering if there was a
simple way to see the TRACE() output lines in the sources from the cmd.exe

Re: debug cmd.exe build only

Posted: Sat Jan 01, 2011 6:04 pm
by HansH
Never mind. I have got it working.

I used the cmd source files to create a new project, and adapted some sourcecode to get it working in vc++
I now have a 130kb cmd.exe which is working correctly in windows xp

It is very interesting to see how everything works.
I have done lots of tests, and so far I can see it is workng 100% correctly.

I have made some small adaptions, making tracelogging work dynamic, and loading/executing a batch file from memory, avoiding filelocks and fileread actions during execution.

Thx

Re: debug cmd.exe build only

Posted: Sat Jan 01, 2011 6:57 pm
by EmuandCo
Source might be interesting for us ... :roll:

Re: debug cmd.exe build only

Posted: Sat Jan 01, 2011 7:46 pm
by vicmarcal
HansH wrote:

It is very interesting to see how everything works.
I have done lots of tests, and so far I can see it is workng 100% correctly.

Thx
Of course, Goplat made a cool job and cmd.exe was my first area here in Ros.i made a couple fixes with several commands :)

Yeah please create s bugreport and add your enhancements :)

Re: debug cmd.exe build only

Posted: Sat Jan 01, 2011 11:34 pm
by HansH
Perhaps some info first, to see if it is interesting for you:

Because I made a seperate project in vc++, I could define an alternate definition for TRACE()
Just pointed it to a custom trace function which default does nothing.
if inside the cmd.exe a certain environment var is set, the trace function starts to output the TRACE info until the environment var is unset again.
No idea if this is possible within the reactos environment.

The other thing I did, is to load the full batch file into memory.
The current way is to open a file and keep it open during processing and use SetFilePointer to navigate.
With an internal call, the file is again opened
My change is to add some vars in the bc structure and to read the batchfile into memory and to add some logic into the batch function
to prevent that the same filename is reread again, So that way no file is kept opened or locked.
The downside it costs you memory.

So if this is interesting, i will post the enhancements/changes as a bugreport tomorrow.

great source....learned a lot again :)

Hans

Re: debug cmd.exe build only

Posted: Sun Jan 02, 2011 1:56 am
by Davy Bartoloni
it would be nice :)

Re: debug cmd.exe build only

Posted: Sun Jan 02, 2011 4:14 pm
by HansH
Ok,

bugreport 5806 : dynamic TRACE output to cmd console
bugreport 5807 : Replace FILE IO with Memory IO for batchfiles.

Re: debug cmd.exe build only

Posted: Mon Jan 03, 2011 1:49 am
by Haos
The files you attached are not the proper patches. Please checkout a ReactOS trunk source tree and introduce the changes there. Then please make sure it compiles and works correctly. Finaly, please create a DIFF file for reach bugreport/feature and attach it to bugzilla, to the reports you have already opened.

Re: debug cmd.exe build only

Posted: Mon Jan 03, 2011 9:54 am
by HansH
Aahh, mist that one ....

Patches are now attached, diff are done against the trunk