|
int _cdecl main(int argc, char *argv[])
{
OutputDebugString("Hello World");
}
When I compile and debug with Target = Win32 I get:
Hello World
(plus a lot of 'instlsp.exe': Loaded 'C:\WINDOWS\SysWOW64\....dll', Cannot find or open the PDB file)
When I compile and debug with Target = x64 I get nothing
It runs but the output is filtered somewhat.
I tried this
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter]
"DEFAULT"=dword:0000000f
And also 0xFFFFFFFF
No success even after reboot.
I feel like I am stuck in chapter 1 of the Kernighan and Ritchie C book.
I am using Visual C++ Express under Windows XP Pro x64
Is this just a bad day?
Going to the zoo now. Perhaps the monkeys will have a clue, I should take a couple of typewriters with me.
|
|
|
|
|
Pascal Ganaye wrote: Going to the zoo now. Perhaps the monkeys will have a clue,
Sorry, but I have no clue.
Seriously though, I'm on Windows 7 x64 and it works just right for me. Which platform are you on?
It's time for a new sig. Seriously.
|
|
|
|
|
Hi
I am developing a application
knowing the size of downloaded data from the net
for a month for a PC.
How to do this?
|
|
|
|
|
You need to be more specific. What 'data'? Where is it stored? Is it part of your application?
If you have a more intelligent router connecting you to the Internet then you could use SNMP to pull statistics from the router.
Sorry but while you are so vague it is impossible to advise further.
P.S. this is more a general IT question.
Alan
|
|
|
|
|
|
I tried compiling my application in 64bit, during compilation I got errors. Cause my application uses UNICODE, does 64bit lack UNICODE support???
|
|
|
|
|
Fareed Rizkalla wrote: Cause my application uses UNICODE
The sentence is not clear.
Do you mean "because I'm using Unicode strings" or "because it seems the UNICODE preprocessor symbol is not defined"?
In the second case, just look in the compiler options if the Unicode support is activated ad if UNICODE and _UNICODE are in the defines symbol specifications.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
It would help if you showed the relevant lines of code and the exact error messages produced by the compiler.
It's time for a new signature.
|
|
|
|
|
I am stuck actually, im trying to write a md5 / blowfish function
im not sure if i am correctly converting the MD5[16] buffer into a unsigned long[4]
this doesnt really make too much sense too me
typedef struct _tag2Long {
unsigned long _1;
unsigned long _2;
unsigned long _3;
unsigned long _4;
} _2LONG;
void SignBuffer(unsigned char *pbzKey, unsigned char *pbzBuffer,
unsigned int iSize, unsigned long pSignature[4])
{
MD5_CTX md5;
BLOWFISH_CTX bf;
MD5Init(&md5);
MD5Update(&md5, pbzBuffer, iSize);
MD5Final(&md5);
_2LONG *tl = (_2LONG*) md5.digest;
printf("BLE 1\t\t %x %x %x %x\n", tl->_1, tl->_2, tl->_3, tl->_4);
Blowfish_Init(&bf, pbzKey, 16);
Blowfish_Encrypt(&bf, &tl->_1, &tl->_2);
Blowfish_Encrypt(&bf, &tl->_3, &tl->_4);
pSignature[0] = tl->_1;
pSignature[1] = tl->_2;
pSignature[2] = tl->_3;
pSignature[3] = tl->_4;
printf("BLE 2\t\t %x %x %x %x\n", pSignature[0], pSignature[1],
pSignature[2], pSignature[3]);
}
bool VerifyBuffer(unsigned char *pbzKey, unsigned char *pSignature,
unsigned int iSize, unsigned long pBuffer[4])
{
BLOWFISH_CTX bf;
MD5_CTX md5;
bool bResult = false;
printf("BLD 1\t\t %x %x %x %x\n", pBuffer[0], pBuffer[1],
pBuffer[2], pBuffer[3]);
Blowfish_Init(&bf, pbzKey, 16);
Blowfish_Decrypt(&bf, &pBuffer[0], &pBuffer[1]);
Blowfish_Decrypt(&bf, &pBuffer[2], &pBuffer[3]);
printf("BLD 2\t\t %x %x %x %x\n", pBuffer[0], pBuffer[1],
pBuffer[2], pBuffer[3]);
MD5Init(&md5);
MD5Update(&md5, pSignature, iSize);
MD5Final(&md5);
_2LONG *tl = (_2LONG*) md5.digest;
if (tl->_1 == pBuffer[0] && tl->_2 == pBuffer[1] &&
tl->_3 == pBuffer[2] && tl->_4 == pBuffer[4])
bResult = true;
return bResult;
}
void main(void)
{
unsigned char bszBuffer[2] = {'A', 'B'};
unsigned long ulSig[4];
SignBuffer((unsigned char*)"key", bszBuffer, 2, ulSig);
printf("\n");
if (VerifyBuffer((unsigned char*)"key", bszBuffer, 2, ulSig))
printf("\nok");
else printf("\nerr");
}
and this is the output of them
BLE 1 b0c66fb8 733df651 4c2d26de a9a0e334
BLE 2 f12b0ed9 782fae18 a87960ac f37b342e
BLD 1 f12b0ed9 782fae18 a87960ac f37b342e
BLD 2 dc95818a 65685d43 8d7d54b9 8827b217
err
modified on Friday, July 16, 2010 3:32 PM
|
|
|
|
|
the conversion looks fine.
but doesn't Blowfish use 64-bit (8-byte) blocks ?
so this Blowfish_Encrypt(&bf, &tl->_1, &tl->_2); will encrypt the 8 bytes starting at tl->_1 ? since _1 is only four bytes, it's going to run over into _2.
so, you're doing BF(_1 + _2) -> _2 + _3.
or maybe not. i don't know what Blowfish_Encrypt looks like.
|
|
|
|
|
|
ah, ok. it's expecting 2 32-bit parts. i thought the params were input and output.
|
|
|
|
|
do you happen to know how i can fix it? i am lost
|
|
|
|
|
you're doing this, right:
Sign:
Sig = BFE(MD5(data))
Verify:
X = BFD(Sig)
Sig2 = MD5(Sig)
Compare:
X == Sig2 ?
but shouldn't that bold line be Sig2 = MD5(data) ? the MD5 of the signature doesn't get you anything.
|
|
|
|
|
i fixed it, thank you very much for your help, i noticed
if (tl->_1 == pBuffer[0] && tl->_2 == pBuffer[1] &&
tl->_3 == pBuffer[2] && tl->_4 == pBuffer[4])
bResult = true;
pBuffer[4] should of been pBuffer[3] i was going out of range of the array which didnt exist
here is the updated code
int _ustrlen(unsigned char *pbz)
{
const unsigned char *ptr;
for (ptr = pbz; *ptr; ++ptr);
return (ptr - pbz);
}
void SignBuffer(unsigned char *pbzKey, unsigned char *pbzBuffer,
unsigned int iSize, unsigned long *pSignature)
{
MD5_CTX md5, md5key;
BLOWFISH_CTX bf;
MD5Init(&md5);
MD5Update(&md5, pbzBuffer, iSize);
MD5Final(&md5);
_2LONG *tl = (_2LONG*) md5.digest;
printf("BLE 1\t\t %x %x %x %x\n", tl->_1, tl->_2, tl->_3, tl->_4);
MD5Init(&md5key);
MD5Update(&md5key, pbzKey, _ustrlen(pbzKey));
MD5Final(&md5key);
Blowfish_Init(&bf, md5key.digest, 16);
Blowfish_Encrypt(&bf, &tl->_1, &tl->_2);
Blowfish_Encrypt(&bf, &tl->_3, &tl->_4);
pSignature[0] = tl->_1;
pSignature[1] = tl->_2;
pSignature[2] = tl->_3;
pSignature[3] = tl->_4;
printf("BLE 2\t\t %x %x %x %x\n", pSignature[0], pSignature[1],
pSignature[2], pSignature[3]);
}
bool VerifyBuffer(unsigned char *pbzKey, unsigned char *pSignature,
unsigned int iSize, unsigned long *pBuffer)
{
BLOWFISH_CTX bf;
MD5_CTX md5, md5key;
bool bResult = false;
printf("BLD 1\t\t %x %x %x %x\n", pBuffer[0], pBuffer[1],
pBuffer[2], pBuffer[3]);
MD5Init(&md5key);
MD5Update(&md5key, pbzKey, _ustrlen(pbzKey));
MD5Final(&md5key);
Blowfish_Init(&bf, md5key.digest, 16);
Blowfish_Decrypt(&bf, &pBuffer[0], &pBuffer[1]);
Blowfish_Decrypt(&bf, &pBuffer[2], &pBuffer[3]);
printf("BLD 2\t\t %x %x %x %x\n", pBuffer[0], pBuffer[1],
pBuffer[2], pBuffer[3]);
MD5Init(&md5);
MD5Update(&md5, pSignature, iSize);
MD5Final(&md5);
_2LONG *tl = (_2LONG*) md5.digest;
printf("BLD 3\t\t %x %x %x %x\n", tl->_1, tl->_2, tl->_3, tl->_4);
if (tl->_1 == pBuffer[0] && tl->_2 == pBuffer[1] &&
tl->_3 == pBuffer[2] && tl->_4 == pBuffer[3])
bResult = true;
return bResult;
}
void main(void)
{
unsigned char bszBuffer[2] = {'A', 'B'};
unsigned long ulSig[4];
SignBuffer((unsigned char*)"key", bszBuffer, 2, ulSig);
printf("\n");
if (VerifyBuffer((unsigned char*)"key", bszBuffer, 2, ulSig))
printf("\nok");
else printf("\nerr");
}
I had made _ustrlen because i got tired of using casting for (unsigned char*), unless there is a different way?
|
|
|
|
|
Hello!
It might only be me but it is not obvious (to me) where you are trying to do this conversion you are talking about, you should at least highlight the part of interest in your code so people who want to help don't have to study your whole program trying to grasp the way you think.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
BLE 2 f12b0ed9 782fae18 a87960ac f37b342e
is passed into VerifyBuffer, but when it is decrypted it doesnt match BLE 1 b0c66fb8 733df651 4c2d26de a9a0e334 when i pass a MD5 comparision from unsigned char *pSignature
hope that makes sense? it seems to lose data some how, not sure
|
|
|
|
|
Hi:
I am new to FIX. I am using quickfix engine in c++ to create a initiator. The host is saying that they cannot see username and password in tag 553 or 554, that is why logon is not happening. I have gone through all documentation of QuickFix and also several other examples of it but could not find any solution. The following is the settings file parameters:
If anyone has worked on QuickFix in c++, I would really appreciate if someone can help me?
tradeclient.cfg
-----------------------
<br />
#default settings for sessions<br />
[DEFAULT]<br />
ConnectionType=initiator<br />
LogonTimeout=30<br />
ReconnectInterval=30<br />
ResetOnLogon=Y<br />
<br />
<br />
#INET Session<br />
[SESSION]<br />
BeginString=FIX.4.2<br />
SenderCompID=XXX<br />
SenderSubID=1<br />
TargetCompID=XXX<br />
StartDay=sunday<br />
EndDay=friday<br />
StartTime=07:00:00<br />
EndTime=21:00:00<br />
HeartBtInt=30<br />
CheckLatency=Y<br />
MaxLatency=240<br />
SocketConnectPort=XXX<br />
SocketConnectHost=XXXXX<br />
EncryptMethod=0<br />
UserName=XXX<br />
Password=XXXX<br />
#SessionQualifier=INET<br />
UseDataDictionary=Y<br />
DataDictionary=C:\Users\asarkar\Financial Programs\QuickFix\quickfix\spec\FIX42.xml<br />
FileStorePath=C:\Users\asarkar\Documents\Visual Studio 2010\Projects\FIX_TradeClient\Debug\<br />
|
|
|
|
|
from distant memory, no, you cant do it like that ...
what you need to to is handle an Admin callback/message, and if that message is a logon message, you do a
some_message.setField(new Username("*****"));
some_message.setField(new Password("*****"));
thats as much as I remember - I did a quick google, and somewhere I found for the java version that was roughly the same
'g'
|
|
|
|
|
Hi. I am sure this has been asked a few times but i cant find any clear code for this. i am using the curl classes to download data from a HTTP server, is there any ready code for requesting HTML and that the function returns that? (Not through a callback function)?
Thanks
|
|
|
|
|
Not sure what cURL classes you're using as there's plenty kicking around but if you're using the easy interface: curl_easy_getinfo with a code of CURLINFO_RESPONSE_CODE will give you the response code for a given transfer. Or zero if the headers haven't been recieved yet.
Cheers,
Ash
|
|
|
|
|
Through some standards an experience, I tried to put this Magic Packet application together.
However it doesn't wake up the machine, nor does the Wake On LAN tutorial on CP succeed in accomplishing the same task.
#include <winsock2.h>
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
void main()
{
char MAC[13];
cout << "Enter MAC Address for Machine to wake up:" << endl;
cin >> MAC;
cout << "Waking up..." << endl;
char L = (char)255;
cout << L << endl;
WSADATA WS2Info;
if (!WSAStartup(MAKEWORD(2,2), &WS2Info))
{
SOCKET MagicPacket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (MagicPacket != INVALID_SOCKET)
{
hostent *ResolveHost;
char* HostAddress = "";
ResolveHost = gethostbyname(HostAddress);
SOCKADDR_IN Host;
Host.sin_family = AF_INET;
Host.sin_port = 0;
Host.sin_addr.s_addr = *((unsigned long*)ResolveHost->h_addr);
short MACconv[6];
memset(MACconv, '\0', 6);
bool FirstDigit = true;
int Pos = 0;
for ( int i = 0; i < 12; i++)
{
switch(MAC[i])
{
case '0':
if (FirstDigit)
{
MACconv[Pos] = 00000000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000000 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '1':
if (FirstDigit)
{
MACconv[Pos] = 00010000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000001 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '2':
if (FirstDigit)
{
MACconv[Pos] = 00100000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000010 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '3':
if (FirstDigit)
{
MACconv[Pos] = 00110000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000011 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '4':
if (FirstDigit)
{
MACconv[Pos] = 01000000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000100 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '5':
if (FirstDigit)
{
MACconv[Pos] = 00010000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000001 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '6':
if (FirstDigit)
{
MACconv[Pos] = 01100000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000110 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '7':
if (FirstDigit)
{
MACconv[Pos] = 01110000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00000111 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '8':
if (FirstDigit)
{
MACconv[Pos] = 10000000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001000 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case '9':
if (FirstDigit)
{
MACconv[Pos] = 10010000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001001 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case 'A':
if (FirstDigit)
{
MACconv[Pos] = 10100000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001010 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case 'B':
if (FirstDigit)
{
MACconv[Pos] = 10110000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001011 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case 'C':
if (FirstDigit)
{
MACconv[Pos] = 11000000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001100 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case 'D':
if (FirstDigit)
{
MACconv[Pos] = 11010000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001101 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case 'E':
if (FirstDigit)
{
MACconv[Pos] = 11100000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001110 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
case 'F':
if (FirstDigit)
{
MACconv[Pos] = 11110000 | MACconv[Pos];
FirstDigit = false;
}
else
{
MACconv[Pos] = 00001111 | MACconv[Pos];
FirstDigit = true;
Pos += 1;
}
break;
}
}
short WakeUpMsg[103];
memset(WakeUpMsg, '\0', 103);
memset(WakeUpMsg, 255, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
sendto(MagicPacket, (char*)WakeUpMsg, 128, 0, (SOCKADDR *)&Host, sizeof(Host));
}
}
}
Code Free for Non Commercial Use!
|
|
|
|
|
Fareed Rizkalla wrote: memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
memcpy(WakeUpMsg, MACconv, 6);
All these lines are repeatedly copying the first 6 bytes of MACconv to the first 6 bytes of WakeUpMsg ; you need to use some form of index or offset to fill the packet correctly.
It's time for a new signature.
|
|
|
|
|
Hi All,
1) I want to send some data to a C# Application which has WPF controls (like text box) in it.
2) I also want to read the data from the WPF control (text box) to the VC++ application.
I tried using SendMessage API, but I don’t know how to get the textbox handle.
I found UI Automation is one solution for this but I found examples for C# only. I couldn't find any examples on UI Automation for VC++.
Please provide me some input on this.
Thanks,
Joseph
|
|
|
|
|
Joseph82 wrote: I tried using SendMessage API, but I don’t know how to get the textbox handle.
WPF controls don't have handles only window has a handle.If you would like to use SendMessage API you should consider using windows forms controls combined with WindowsFormsHost.See here how http://msdn.microsoft.com/en-us/library/ms742875.aspx[^]
Using automation is more difficult, but there's lots of samples just point "MFC automation samples" in google.
Life is a stage and we are all actors!
|
|
|
|
|