dungsivn
16th January 2008, 23:41
I created a small application to use the library:
// Test is a simple widget for testing
Test::Test( QWidget* parent): QWidget(parent)
{
setupUi(this);
QByteArray buffer;
QLibrary mylib("kernel32);
typedef int (*GetLocalInfo)( int Locale, int LcType, char* l, int chData);
GetLocaleInfor myFunc = (GetLocaleInfo)mylib.resolve("GetLocaleInfoA");
if(myFunc(0x400, 0x1003, Buffer.data(), 99) !=0)
{
int v1= 1;
float b2= 2.0;
QString str = "Hi everyone";
QMessageBox::information(0, "Hello","Hello");
//...
}
After the line "QString str = "Hi everyone";", the pointer "this" would be changed the address, I don't know why? If I replace QString by another Object( QTextEdit, QLineEdit...),
it also changed "this" pointer. After the application changed the address, it display a warnining means that .exe was modified... and stop.
Could you tell me that way not to change the address?
Thanks!
// Test is a simple widget for testing
Test::Test( QWidget* parent): QWidget(parent)
{
setupUi(this);
QByteArray buffer;
QLibrary mylib("kernel32);
typedef int (*GetLocalInfo)( int Locale, int LcType, char* l, int chData);
GetLocaleInfor myFunc = (GetLocaleInfo)mylib.resolve("GetLocaleInfoA");
if(myFunc(0x400, 0x1003, Buffer.data(), 99) !=0)
{
int v1= 1;
float b2= 2.0;
QString str = "Hi everyone";
QMessageBox::information(0, "Hello","Hello");
//...
}
After the line "QString str = "Hi everyone";", the pointer "this" would be changed the address, I don't know why? If I replace QString by another Object( QTextEdit, QLineEdit...),
it also changed "this" pointer. After the application changed the address, it display a warnining means that .exe was modified... and stop.
Could you tell me that way not to change the address?
Thanks!