Oct 26th, 2001, 04:57 PM
#1
Thread Starter
PowerPoster
My program is not working on Win2K
I started creating this program when I was running Windows 98. I was working fine, but when I run it on Windows 2000 now, it gives me that "illegal operation" error message at the start, and then it terminates.
This program is not done yet because I just worked on it for some time and then just left it away.
If you can run it on windows 98 properly then please post a reply, and if you can't run it on Windows 2000 then also post the reply about that.
Attached Files
Oct 27th, 2001, 03:54 AM
#2
So Unbanned
I have win2k don't work, sorry.
Oct 27th, 2001, 06:15 AM
#3
What about doing a debug run from the start to exactly locate the eror? I don't have Win2k, so I can't do it myself.
All the buzzt
CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Oct 27th, 2001, 11:15 AM
#4
Hey dude... in the function SetDialogsSettings() you are doing copying "Yes" into buffer?
well buffer isnt allocated... atleast in the source that you posted...
I dont think it would have been working on Win98 either....
I have XP... so we can make sure this thing works on this too...
Oct 27th, 2001, 11:27 AM
#5
Alright...
I think the probably is in your registry functions... You aren't allocating any of your character arrays.
Oct 27th, 2001, 11:30 AM
#6
Oct 27th, 2001, 01:16 PM
#7
Thread Starter
PowerPoster
Did you change anything to make in work? I think there might be some problem working with the registry. Win2K may be accessing the registry different way than Windows 98.
Oct 27th, 2001, 02:36 PM
#8
yah I did make some changes...
Did you take a look at the SetDialogsSettings() function?
You are using strcpy() with an invalid pointer. That isn't a Win2K thing.
That is the first place it crashes
Oct 27th, 2001, 02:39 PM
#9
Thread Starter
PowerPoster
PHP Code:
BOOL SetDialogsSettings ()
{
HKEY regkey ;
char * buffer ;
//------------Option DialogBox Settings--------------------------
RegCreateKeyEx ( HKEY_CURRENT_USER , "software\\Mughal\\EasyRun\\OptionDlg" , 0 , NULL , 0 , KEY_WRITE , NULL , & regkey , NULL );
//Is AutoComplete?
strcpy ( buffer , "Yes" );
RegSetValueEx ( regkey , "AUTOCOMPLETE" , 0 , REG_SZ , ( LPBYTE ) buffer , strlen ( buffer ));
//Is sorting enabled in combobox?
strcpy ( buffer , "Yes" );
RegSetValueEx ( regkey , "SORT" , 0 , REG_SZ , ( LPBYTE ) buffer , strlen ( buffer ));
//Load at startup?
strcpy ( buffer , "No" );
RegSetValueEx ( regkey , "LOADATSTARTUP" , 0 , REG_SZ , ( LPBYTE ) buffer , strlen ( buffer ));
//Make a sound when something is run using "EasyRun"?
strcpy ( buffer , "Yes" );
RegSetValueEx ( regkey , "MAKESOUND" , 0 , REG_SZ , ( LPBYTE ) buffer , strlen ( buffer ));
//Do what when something is opened using "EasyRun"?
strcpy ( buffer , "Nothing" );
RegSetValueEx ( regkey , "ONOPEN" , 0 , REG_SZ , ( LPBYTE ) buffer , strlen ( buffer ));
RegCloseKey ( regkey );
return TRUE ;
}
So, do I need to allocate some memory for "buffer"?
Oct 27th, 2001, 02:42 PM
#10
Yes
i changed your declaration of buffer to
Code:
char buffer[4] = "";
You should also get in the habit of initializing all your variables... I noticed a lot of that.
That fixes everything in that function
Oct 27th, 2001, 02:46 PM
#11
oh wait... i didn't see the
Code:
strcpy ( buffer, "Nothing" );
change it to char buffer[8] = "";
Oct 27th, 2001, 02:49 PM
#12
Thread Starter
PowerPoster
Yah, I noticed that and changed it after.
But I am still getting the other error message whenever I run my program.
Here is the code that it gives the error on:
PHP Code:
if( MakeFirstReg () == 1 )
{
SetDialogsSettings ();
}
else
{
MessageBox ( NULL , "Second.. time" , "D" , MB_OK );
}
Oct 27th, 2001, 02:54 PM
#13
Go through all your registry functions and make sure you are allocating space for all your buffers
Oct 27th, 2001, 02:56 PM
#14
Thread Starter
PowerPoster
Yah, I'll do it...
I forgot lots of code from this project because I stopped working on it some months ago...that is why, I am having problems with it now.
Oct 27th, 2001, 03:42 PM
#15
after i fixed all that stuff it worked fine.
as far as i know that is.
Oct 27th, 2001, 03:44 PM
#16
Thread Starter
PowerPoster
Originally posted by amac
after i fixed all that stuff it worked fine.
as far as i know that is.
Is this code also working for you:
PHP Code:
if( MakeFirstReg () == 1 )
{
SetDialogsSettings ();
}
else
{
MessageBox ( NULL , "Second.. time" , "D" , MB_OK );
}
If yes, then you are probably not running Windows 2000 or later.
Oct 27th, 2001, 03:52 PM
#17
Are you trying to tell me I dont know what am running?
And yes it works. And yes I do know what I am running... because I just installed it about 4 or 5 days ago... It's Windows XP.
Oct 27th, 2001, 03:54 PM
#18
Thread Starter
PowerPoster
Originally posted by amac
Are you trying to tell me I dont know what am running?
Sounds rude but I did not mean that.
----
If you can run it properly then I have some problem with my OS or the way my OS accesses the registry for my program.
Oct 27th, 2001, 04:00 PM
#19
Sounds rude but I did not mean that.
Dont worry about it.
I dont know what to say... do you have a Win2000 machine?
Are you building on that machine? Because the source code that you posted with the changes I made... works.
It doesnt crash... nothing.
Maybe you could try building on that machine. Or if you can trace threw it on that machine.
Oct 27th, 2001, 04:07 PM
#20
Try running this...
this is the exe I built
Oct 27th, 2001, 04:20 PM
#21
Thread Starter
PowerPoster
It is working fine now..
I will check my code again.
Oct 27th, 2001, 04:32 PM
#22
let me know when you find out
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width