Dec 16, 2009 at 2:21pm UTC
whats wrong in the below program
1 2 3 4 5 6 7 8 9 10
#include <stdio.h>
#include <dos.h>
#include <dir.h>
#include <process.h>
int found,drive_no;char buff[128];
void main (void )
{
system ("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa" " \/f \/v limitblankpassworduse \/t reg_dword \/d 00000000" );
}
Last edited on Dec 17, 2009 at 4:16am UTC
Dec 16, 2009 at 3:04pm UTC
You're passing two C strings to a function that expects only one.
Last edited on Dec 16, 2009 at 3:05pm UTC
Dec 16, 2009 at 3:20pm UTC
1 2 3 4 5 6 7 8 9
#include <stdio.h>
#include <dos.h>
#include <dir.h>
#include <process.h>
void main (void )
{
system ("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa" " \/f \/v limitblankpassworduse \/t reg_dword \/d 00000000" );
}
is this correct.
when i run it it gives an error as too big for memory
Last edited on Dec 17, 2009 at 4:16am UTC
Dec 16, 2009 at 3:23pm UTC
gives an error
program too big to fit in memory
Dec 16, 2009 at 3:33pm UTC
The problem is in the system function.
Change it to:
system("reg add HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa \/f \/v limitblankpassworduse \/t reg_dword \/d 00000000" );
Last edited on Dec 16, 2009 at 3:33pm UTC
Dec 16, 2009 at 3:43pm UTC
still gives error as program too big to fit in memory
but if i add another line before that system(echo testing);
echo is executed fine but on next line error as program too big to fit in memory
Dec 16, 2009 at 3:47pm UTC
#include <stdio.h>
#include <dos.h>
#include <dir.h>
#include <process.h>
#include <mem.h>
#include <memory.h>
void main (void)
{
system("echo on");
system("echo hello bijay swain");
system("REG ADD HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Lsa \/f \/v limitblankpassworduse \/t reg_dword \/d 00000000");
}
tried this
echo works well but reg add doesn't work
Dec 16, 2009 at 3:53pm UTC
That's known as string literal concatenation.
"this is " "a single string"
I'm not familiar with reg, but it's possible that the compiler is misinterpreting the meaning of '\/', which isn't a valid escape sequence. Try changing it to '/'.