|
At least you have options... 
|
|
|
|
|
hello
i am trying to write a program that counts the no. of records in a file by placing the get pointer at the end of file and using tellg() function to get the pointer position and dividing the no. of bytes with the size of one record to get the no. of total records
but when i write
file.seekg(0,ios::end);
and then inquire the position of get pointer
file.tellg();
the result that i am getting is -1.
please tell me what am i doing wrong?
|
|
|
|
|
|
Is seekg() succeeding?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Does that error mean the stack has become unbalanced?
I get that error immediately after it returns from a call to VirtualProtect().
I have identical code in another program that does not cause this error, and I can't figure out the difference between the two programs.
What exactly does that error mean is going on?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I'd guess the stack has been corrupted (buffer overrun in a stack based variable, for example).
Steve
|
|
|
|
|
Thanks, your clue led me to the solution. I was attempting to remove the execute privilege from a page of memory that was currently executing!
So instead of PAGE_WRITECOPY, I changed it to PAGE_EXECUTE_WRITECOPY, and all is well.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
hi all,
i want to set values to CPageSetupDialog,before open this dialog
like: paper size,sorce,orientation and margin.
how can i do this thanks.
thanks.
|
|
|
|
|
|
what field use to set source value?
|
|
|
|
|
I gave you a link to the documentation, you need to go and study it to decide which items you are interested in.
Use the best guess
|
|
|
|
|
may be this help u...
u may have dialog class like,
CPageSetupDialog abc;
abc.papersize = 10;
abc.sorce = "ACC";
abc.margin = 44;
if(abc.DoModal() == IKOK)
{
}else
{
}
|
|
|
|
|
Coder Block wrote: CPageSetupDialog abc;
abc.papersize = 10;
abc.sorce = "ACC";
abc.margin = 44;
if(abc.DoModal() == IKOK)
{
}else
{
}
gives error
error C2039: 'margin' : is not a member of 'CPageSetupDialog'
error C2039: 'papersize' : is not a member of 'CPageSetupDialog'
error C2039: 'sorce' : is not a member of 'CPageSetupDialog'
|
|
|
|
|
Read the docs, PLEASE!
abc.m_psd.ptPaperSize = 10;
abc.m_psd.rtMargin = 44;
...
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
As usual declare all this in .h file of CPageSetupDialog..
|
|
|
|
|
I need to debug a program for which I do not have the source code.
I want to place a breakpoint at the CreateFile() Win32 API.
I have told Visual Studio to load the symbols for KernelBase.dll and Kernel32.dll .
Now how can I tell the Disassembly View to take me to the location of CreateFile()?
Thanks in advance.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Visual Studio is not the right tool for reverse engineering. Use IDA Pro or OllyDbg. IDA Pro is damn expensive while OllyDbg is free. A lot of reverse engineering guys use these.
|
|
|
|
|
Thanks, I'll look into both of those.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I'd use WinDing, set up a symbol server and place a breakpoint directly on CreateFile. No need for disassembling.
Steve
|
|
|
|
|
Is WingDing a tool? My Google foo is not working.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
WinDbg. Look up "debugging tools for windows".
Steve
|
|
|
|
|
Sorry about the "WingDing". Auto correction got me.
Steve
|
|
|
|
|
Using WinDbg try these two commands:
bp kernel32!CreateFileA
bp kernel32!CreateFileW
Steve
|
|
|
|
|
Thanks, I didn't realize it was so easy with WinDbg.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Take a look at Microsofts public symbol server. You can download symbols for all their code from it, and set breakpoints and so on.
You can speciyf these sylbols in VS and when it tries to load downloads them automatically. I use windbg though so I cant help you much more than that, and I work in the kernel, but if you choose to do the same this is a usefull command:
bp nt!ntcreatefile "dt nt!_UNICODE_STRING poi(poi(@esp+0xc)+0x8)"
It sets a break point on createfile (this is what CreateFile maps to in the kernel) and displays the file being opened (This is 32 bit, if it was 64 the parameter would be in a register not on the stack).
SO any user mode acces to creatfile you can break on and have a wander arond the stack and see whats doing what.
--edit--
Or as the poster above says, set the bp in the usermode dll.
I can deffinitely recomend using windbg, it is a hell of a debugger, everyone in microsoft uses it, VS is a toy in comparison.
==============================
Nothing to say.
|
|
|
|