HN-Community
Manipulasi REGEDIT menggunakan bahsa C++ - Printable Version

+- HN-Community (https://hacker-newbie.org)
+-- Forum: Miscellaneous (https://hacker-newbie.org/forum-86.html)
+--- Forum: Coding/Programing (https://hacker-newbie.org/forum-19.html)
+---- Forum: C & C++ (https://hacker-newbie.org/forum-77.html)
+---- Thread: Manipulasi REGEDIT menggunakan bahsa C++ (/thread-12851.html)



Manipulasi REGEDIT menggunakan bahsa C++ - gakperlukperluwong - 03-10-2012

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


RE: Manipulasi REGEDIT menggunakan bahsa C++ - mydisha - 03-10-2012

wah ane ketipu judul threadnya Ngakak

ente pake windows apa ? appnya di run as administrator ga ?


RE: Manipulasi REGEDIT menggunakan bahsa C++ - gakperlukperluwong - 03-10-2012

(03-10-2012, 01:41 PM)mydisha Wrote: wah ane ketipu judul threadnya Ngakak

ente pake windows apa ? appnya di run as administrator ga ?

Ngakak
hahahaha,,,
maf y mydisha, ane minta bntuanya,,,

pkek windows 7, compilernya DEVC++,,,
wduch sya g mngerti ttg mksudnya appnya di run as administrator i2 gmna, soalnya bru belajar C++,,,

oh y di program i2kan sya mnipulasi regeditnya bwt gnti background, tp ad masalah lagi seandainya program i2 sudah bsa berjlan,,,
mslah pertma regeditx d win7 i2kan di beri hak akses yang g smw user bsa mnipulasinya jd law bleh mnta jg scriptnya bwt manipulasi hak acsess pada regeditnya y?,,,

oh y tlong jg sekalian tutorial tentang masalah kpan kita menggunakan LPBYTE, BYTE, DWORD, LPDWORD, dll ,,
maf y law pertnyaan sya terlalu banyak soalnya mklum sya hnya seorang newbie yang ingin banget bsa,,,

terima kasih banget,,,


RE: Manipulasi REGEDIT menggunakan bahsa C++ - the_zakies - 03-11-2012

(03-10-2012, 04:51 PM)gakperlukperluwong Wrote:
(03-10-2012, 01:41 PM)mydisha Wrote: wah ane ketipu judul threadnya Ngakak

ente pake windows apa ? appnya di run as administrator ga ?

Ngakak
hahahaha,,,
maf y mydisha, ane minta bntuanya,,,

pkek windows 7, compilernya DEVC++,,,
wduch sya g mngerti ttg mksudnya appnya di run as administrator i2 gmna, soalnya bru belajar C++,,,

oh y di program i2kan sya mnipulasi regeditnya bwt gnti background, tp ad masalah lagi seandainya program i2 sudah bsa berjlan,,,
mslah pertma regeditx d win7 i2kan di beri hak akses yang g smw user bsa mnipulasinya jd law bleh mnta jg scriptnya bwt manipulasi hak acsess pada regeditnya y?,,,

oh y tlong jg sekalian tutorial tentang masalah kpan kita menggunakan LPBYTE, BYTE, DWORD, LPDWORD, dll ,,
maf y law pertnyaan sya terlalu banyak soalnya mklum sya hnya seorang newbie yang ingin banget bsa,,,

terima kasih banget,,,

wah asyik nie,,,
ikt nyimak aja,,,,


RE: Manipulasi REGEDIT menggunakan bahsa C++ - the_zakies - 03-22-2012

(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