I know this seems far out, but do you it could just be my computer?
Printable View
I know this seems far out, but do you it could just be my computer?
Could be your computer, or perhaps the graphics drivers in your machine.
Another possibility is if you are not using the same language as others, that there is some bug in the language implementation. If you have another computer that you could try on, perhaps that would help.
I also think there is some flag to turn off the "yellow info box", perhaps you can do that and work around the problem?
--
Mats
It is totally my computer! I just tried it on my parent's computer and it worked just fine!
>> I also think there is some flag to turn off the "yellow info box", perhaps you can do that and work around the problem?
I've already looked and I didn't find anything. I'll check again.
Have you made any registry changes for the .pc file extension?
[Edit]Look in your registry under HKEY_CLASSES_ROOT\.pc anything there?[/Edit]
gg
The key .pc is there, but there's nothing in it.
In regedit, with the ".pc" key selected, is there any data for the "(Default)" key?
gg
No, not at all. It's data is "(value not set)"
You could try deleting that .pc key - although having it there didn't cause me any problems.
Another easy thing you can do get a Dr. Watson dump of the crash. Do the following (assuming XP):
gg
- Start->Run->sysdm.cpl, "Advanced" tab, "Error Reporting" button, Enable error reporting for Programs ("Choose Programs" button, All programs)
- Start->Run->drwtsn32.exe, Check "Create Crash Dump File". Set an easily accesable log file path as well. If there is already a drwtsn32.log in the log file path, then delete it.
- Reproduce the crash. Attach drwtsn32.log to this thread.
Well, it does crash for me - after I created a pc file.
May-be you could show the full source code?
gg, I'll do that then. Somthing I do know is that the actuall crash occures in shell32.dll.
>> May-be you could show the full source code?
Well, you already have the DoOpenDialog(), so I'll just show you my window's callback. I don't see how anything else could be of use.
Code:LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
{
windows = 0;
CreateChild(hwnd, "EDIT", NULL, TEXTAREA_STYLE | 8, 0, 0, 0, 280, 380);
CreateChild(hwnd, "EDIT", NULL, TEXTAREA_STYLE | ES_READONLY, 0, 320, 0, 280, 400);
CreateChild(hwnd, "EDIT", "KEY", ES_AUTOHSCROLL | 8, WS_EX_STATICEDGE, 0, 380, 280, 20);
CreateChild(hwnd, "BUTTON", "E\r\nN\r\nC", BS_MULTILINE, 0, 280, 0, 40, 80);
CreateChild(hwnd, "BUTTON", "D\r\nE\r\nC", BS_MULTILINE, 0, 280, 80, 40, 80);
CreateChild(hwnd, "BUTTON", "L\r\nO\r\nA\r\nD", BS_MULTILINE, 0, 280, 160, 40, 80);
CreateChild(hwnd, "BUTTON", "S\r\nA\r\nV\r\nE", BS_MULTILINE, 0, 280, 240, 40, 80);
CreateChild(hwnd, "BUTTON", "I\r\nN\r\nF\r\nO", BS_MULTILINE, 0, 280, 320, 40, 80);
CreateChild(hwnd, "STATIC", WAIT_TEXT, SS_CENTER, WS_EX_STATICEDGE, 500, 175, 200, 50);
ShowWindow(window[8], SW_HIDE);
return 0;
}
case WM_COMMAND:
{
if(LOWORD(wParam) == 5003 || LOWORD(wParam) == 5004) // encrypt or dectrypt button
{
int keysize = GetWindowTextLength(window[2]);
char *keybuff = new char[keysize];
GetWindowText(window[2], keybuff, keysize);
int bdw = GetWindowTextLength(window[0]);
char *buff = new char[bdw];
GetWindowText(window[0], buff, bdw + 1);
if(LOWORD(wParam) == 5003) Encrypt(hwnd, buff, bdw, keybuff, keysize); // encrypt button
else Decrypt(hwnd, buff, bdw, keybuff, keysize); // dectrypt button
SetWindowText(window[1], buff);
delete [] keybuff;
delete [] buff;
SetFocus(window[1]);
}
else if(LOWORD(wParam) == 5005) // load file button
{
char szfilename[401];
if(!DoOpenDialog(hwnd, szfilename, 400)) return 0;
char *buff = OpenCryption(hwnd, szfilename);
if(!buff) {
MessageBox(hwnd, BAD_OPEN_TEXT, MB_TITLE, MB_ICONWARNING);
return 0; }
SetWindowText(window[0], buff);
delete [] buff;
SetFocus(window[0]);
}
else if(LOWORD(wParam) == 5006) // save file button
{
int ll, lt, nbdw = GetWindowTextLength(window[1]) + 1;
char *buff = new char[nbdw];
if(!buff) {
MessageBox(hwnd, "There is possibly not enough memory.", MB_TITLE, MB_ICONWARNING);
return 0; }
GetWindowText(window[1], buff, nbdw);
DWORD bdw = DWORD(nbdw);
if(!ncafilter(buff, bdw)) {
MessageBox(hwnd, ERR_SAVE_TEXT, MB_TITLE, MB_ICONWARNING);
return 0; }
if(bdw < 2) {
MessageBox(hwnd, NO_SAVE_TEXT, MB_TITLE, MB_ICONWARNING);
return 0; }
for(ll = 0; ll < bdw; ll++)
buff[ll] = getnca(buff[ll]);
char szfilename[401];
if(!DoSaveDialog(hwnd, szfilename, 400)) return 0;
if(!SaveCryption(hwnd, szfilename, buff, bdw))
MessageBox(hwnd, BAD_SAVE_TEXT, MB_TITLE, MB_ICONWARNING);
else
MessageBox(hwnd, SAVE_TEXT, PROGRAM_NAME, MB_ICONINFORMATION);
delete [] buff;
SetFocus(window[0]);
}
else if(LOWORD(wParam) == 5007) // information button
{
MessageBox(hwnd, INFO_TEXT, PROGRAM_NAME, MB_ICONINFORMATION);
}
return 0;
}
case WM_DESTROY:
{
int a;
for(a = 0; a < windows; a++)
DestroyWindow(window[a]);
PostQuitMessage(0);
bRunning = FALSE;
return 0;
}
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return TRUE;
}
On a side note, don't we agree that
...is a coding style to avoid? It's easier to read if you just placed down the bracket:Code:if(!buff) {
MessageBox(hwnd, BAD_OPEN_TEXT, MB_TITLE, MB_ICONWARNING);
return 0; }
You also seem to mixing several styles within the project? Hmmm. Is that such a good idea?Code:if(!buff) {
MessageBox(hwnd, BAD_OPEN_TEXT, MB_TITLE, MB_ICONWARNING);
return 0;
}
Not 100% sure, but your keybuff doesn't seem to have room for the terminating '\0'.Code:int keysize = GetWindowTextLength(window[2]);
char *keybuff = new char[keysize];
GetWindowText(window[2], keybuff, keysize);
It is quite possible that you are doing bad things to memory here and may-be in other places, so your application runs in the undefined behaviour.
Anon is correct. GetWindowTextLength returns the length of the string. It doesn't return the terminating '\0'.
You allocate bdw characters, yet specify the max size (including the '\0') as bdw + 1, 1 more than you allocated.Code:GetWindowText(window[0], buff, bdw + 1);
There's probably more.
Btw, MSDN refers to '\0' as NULL character. As far as I understand, this is wrong?
It's technically a NUL character, but who's counting?