regadd in c or c++

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
You're passing two C strings to a function that expects only one.
Last edited on
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
gives an error
program too big to fit in memory
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
will try right now
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
#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
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 '/'.
hi helios

still not work
Topic archived. No new replies allowed.