Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manipulasi REGEDIT menggunakan bahsa C++
#5
(03-10-2012, 07:47 AM)gakperlukperluwong Wrote: slam kenal smwx para master,,
sya newbie, pngen buat program sperti berikut,,,

Code:
#include <iostream> #include <cstring> #include <windows.h> #include <cstdlib> using namespace std; HKEY hkey; LONG lresult; void information() { cout << "ganti path" << endl << endl << "Example " << endl << "ganti C:\picture.jpg" << endl; } int main(int argc, char* argv[]) { unsigned int len = strlen(argv[1]); char *szpath = (char *) malloc(len+1); if (szpath != NULL) { strcpy(szpath, argv[1]); } if (argc == 2) { lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "ControlPanel\\Dekstop", 0, KEY_ALL_ACCESS, &hkey); if(lresult == ERROR_SUCCESS) { lresult = RegSetValueEx((HKEY)hkey, "Wallpaper", 0, REG_SZ, (BYTE *) szpath, strlen(argv[1])); if(lresult == ERROR_SUCCESS) { cout << "succes" << endl; } } else { return false; } } else { information(); } RegCloseKey(hkey); system("pause"); return 0; }
pada saat sya compile source code di atas tidak muncul apa2 mlah kluar pringatan stop working ganti.exe ,,,
tyz pada saat sya debug muncul peringatan An acces violation(segmentation fault) rased in your program

tlong pencerahannya para master,,,

terima kasih,,,
Garing

kalau fungsinya untuk mengedit registry, cba aj script berikut, mungkin bsa membantu,,
Code:
#include <iostream> #include <windows.h> #include <cstring> using namespace std; int main() { LONG lresult; HKEY hkey; unsigned long len; char *lpdata = (char *)malloc(len+1); len = strlen(lpdata); cout << "Masukkan file JPG ="; cin >> lpdata; lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_ALL_ACCESS, &hkey); if(lresult == ERROR_SUCCESS) { cout << "Registry berhasil dibuka" << endl; if(RegDeleteValue(hkey, "Wallpaper") == ERROR_SUCCESS) { cout << "data berhasil di hapus"<< endl; } if(RegSetValueEx(hkey, "Wallpaper", 0, REG_SZ, (LPBYTE) lpdata, strlen(lpdata)+1) == ERROR_SUCCESS) { cout << "Penamabahan data berhasil" << endl; } } system("pause"); return 0; }
ane ud coba ud berhasil, tp law untuk di WIN7 yang regeditnya di proteksi ane gtw berhasil apa g soalnya ane blm nyoba,,,
BingungBingungBingung
Reply


Messages In This Thread
RE: Manipulasi REGEDIT menggunakan bahsa C++ - by the_zakies - 03-22-2012, 07:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [ask] output menu menggunakan while dan for, masuk dulu om dari nubi nubito-cyber404 6 77 05-02-2012, 04:20 PM
Last Post: areg_noid
  Simple Encryption menggunakan XOR RieqyNS13 3 90 04-24-2012, 04:08 AM
Last Post: spy

Forum Jump:


Users browsing this thread: 1 Guest(s)