|
The function is like this :
int __cdecl _vsnprintf(char *Dest, size_t Count, const char *Format, va_list Args)
{
int v4; // edi@1
char *v6; // esi@1
char v7; // sf@2
FILE v8; // [sp+8h] [bp-20h]@1
v6 = Dest;
v8._cnt = Count;
v8._flag = 66;
v8._base = Dest;
v8._ptr = Dest;
v4 = sub_10078E3D(&v8, Format, Args);
if ( v6 )
{
v7 = v8._cnt-- < 1;
if ( v7 )
_flsbuf(0, &v8);
else
*v8._ptr = 0;
}
return v4;
}
I want to hook it like this i change the return address to mynes because i dont wanna change any bytes thnx for the helper
|
|
|
|
|
Hi ,
I hope this is the correct forum to post the message.
I am using RtlInitUnicodeString(UNICODE_STRING , WCHAR_T);
But i get access violation error when i am trying to execute the exe.
Could any one help me with the problem.
|
|
|
|
|
Could you please post the code snippet?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
UNICODE_STRING str;
WCHAR_T WBuf[2];
WBuf[0] =L"1";
WBuf[1] =L"\0";
RtlInitUnicodeString(&str ,WBuf );
Actually when i am debugging the control comes here and then it is throwing an exception.
So i think the problem is here.
|
|
|
|
|
gayatri.neelema wrote: WBuf[0] =L"1";
WBuf[1] =L"\0";
How is this compiling? Try:
WBuf[0] = L'1';
WBuf[1] = L'\0';
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
gayatri.neelema wrote: But i get access violation error...
Are you sure that RtlInitUnicodeString() is causing it?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Is this working?
#define TEST L"\\test"
UNICODE_STRING str;
RtlInitUnicodeString(&str, TEST);
|
|
|
|
|
i have the following code, it compiles without error,
but how can i extract this into a global CString that i can use later for ie in an messagebox or something? i've tried several names in the code but i cant get a hold of them..
//the code
string FixedModuleVersion()
{
char file_name[ MAX_PATH ];
GetModuleFileName( ::GetModuleHandle( NULL ), file_name, MAX_PATH );
DWORD dwDummyHandle;
DWORD len = GetFileVersionInfoSize( file_name, &dwDummyHandle );
vector<byte> buf( len );
::GetFileVersionInfo( file_name, 0, len, buf.begin() );
unsigned int ver_length;
LPVOID lpvi;
::VerQueryValue( buf.begin(),
"\\",
&lpvi,
&ver_length );
VS_FIXEDFILEINFO fileInfo;
fileInfo = *(VS_FIXEDFILEINFO*)lpvi;
stringstream s;
s <<HIWORD(fileInfo.dwFileVersionMS) <<"."
<<LOWORD(fileInfo.dwFileVersionMS) <<"."
<<HIWORD(fileInfo.dwFileVersionLS) <<"."
<<LOWORD(fileInfo.dwFileVersionLS);
return s.str();
}
//
// This routine will extract the version string from the
// string version resource in the RC file for the current module.
// Note that you must add version.lib to your project to
// link to the Win32 versioning API calls. The actual call
// VerQueryValue() uses a value of 040904B0 for the language
// and character set. This value is equivalent to English
// language text encoded using Unicode.
//
string StringModuleVersion()
{
char file_name[ MAX_PATH ];
GetModuleFileName( ::GetModuleHandle( NULL ), file_name, MAX_PATH );
DWORD dwDummyHandle;
DWORD len = GetFileVersionInfoSize( file_name, &dwDummyHandle );
vector<byte> buf( len );
::GetFileVersionInfo( file_name, 0, len, buf.begin() );
char *version;
unsigned int ver_length;
::VerQueryValue( buf.begin(),
"\\StringFileInfo\\040904B0\\FileVersion",
(void **) &version,
&ver_length );
return string( version, ver_length );
}
//end - now how to get hold of something to use?
|
|
|
|
|
|
never mind i got it working
thx
|
|
|
|
|
VC++,how to expnding certain node in tree control(not using TVN_ITEMEXPANDING)?
I just know the path in tree control I want to expand.
|
|
|
|
|
If you have the handle of the item you want to expand you can call CTreeCtrl::Expand. Something like this:
pTreeCtrl->Expand(hItem, TVE_EXPAND);
P.S. When I first read your post I thought you were just looking for a way to expand a node programmatically, but I've just realised there is more to it and the above reply is probably not much use - because TVE_EXPAND generates a TVN_ITEMEXPANDING message.
What problem is the TVN_ITEMEXPANDING message causing you?
Best Regards
Cliff
modified on Sunday, August 17, 2008 7:36 AM
|
|
|
|
|
Hi,guys,I did a test on a macro function code, and compiled it in VC6.0,
but the compiler reported an error:
"D:\vc project\testmacro.c(7) : error C2105: '--' needs l-value"
Would someone explain why line 7 reports an error ,but line 6 doesnt't?
3x!
Source code is as follows:
#include "stdio.h"
#define ABSOLUTE(a) (((a) > 0) ? (a) : (-a)) /* Get absolute value */
void main()
{
int a = -1;
int c = ABSOLUTE(1);
int b = ABSOLUTE(-1);
}
|
|
|
|
|
Make it
#define ABSOLUTE(a) (a > 0 ? a : -1*a)
by the way there is already a macro defined as "ABSOLUTE"
in wingdi.h
Md. Humayuon Kabir Hemoo
|
|
|
|
|
quite.
never forget to use parenthesis everywhere within the macro definition...
|
|
|
|
|
Try using this
<code>#define ABSOLUTE(a) (((a) > 0) ?(a) : -(a))</code>
Do more work
Make more mistakes
Learn more things
|
|
|
|
|
What you have to understand about macro is that they are simply a 'text replacement': the precompiler will replace occurances of ABSOLUTE in your code by the macro definition, before the compilation. So, it means that ABSOLUTE(-1) will be replaced by:
(((-1) < 0) ? (-1) : (--1))
As you can see, the --1 is not valid. This doesn't happen for line 6 because it will be replaced by:
(((1) < 0) ? (1) : (-1))
which is valid.
|
|
|
|
|
Cool, that's absolutely right!
Thank you for your explanations, and other guys also.
|
|
|
|
|
I have been reading all day long on how to open external programs, i've been told several times to do this
#include ^stdlib.h^ or #include ^windows.h^
system("...");
when I try to do the #include, it fails on build, if I try the system only, it fails on build.
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {system("C:\\Program Files\\America's Army\\System\\Armyops.exe");}
That is what i am trying to do.
I've tried searching on here but I can't come up with the right word sets to to actually find it.
Note: ^ is the great then and less then signs that don't show up in text.
|
|
|
|
|
Try here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Didn't help much, went all 14 pages, couldn't find nothing useful
|
|
|
|
|
David was saying that you have to post in that forum, not in the C++ forum (it seems you are doing managed C++).
|
|
|
|
|
C# Beginner Nick wrote: ...went all 14 pages...
And posted what?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Besides posting on the wrong board as mentioned...
You're using managed code so why not use the .NET framework
instead of old CRT functions?
Maybe something like Process::Start()[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I have a Module that mainly runs in the Background (i.e. Minimized). It's main function is to monitor the contents of a file somewhere on the network, and display some data relating to it. While the Module runs minimised, I have No Need to read the Data, because they cannot be displayed in the first place. When the module is restored, I need it to 'Waken Up', and kick the monitoring process into motion. How do I detect the Window State/StateChange from within my app. BTW My App is Dialog Based.
Regards
Bram van Kampen
|
|
|
|