// Windows's Permission 1 InstalerDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Windows's Permission 1 Instaler.h"
#include "Windows's Permission 1 InstalerDlg.h"
#include "afxdialogex.h"
#include "CinputBox.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CWindowssPermission1InstalerDlg dialog
void Close(){
PostMessage(FindWindow(0,_T("Windows's Permission 1 ")),WM_CLOSE,0,0);
PostMessage(FindWindow(0,_T("Windows's Permission 1 Guard ")),WM_CLOSE,0,0);
}
inline bool Exist(CString str){
CFile f;
if(f.Open(str,CFile::modeRead)){
f.Close();return 1;
}else return 0;
}
inline CString A(CString s){
CString s1=_T(""),s2;s2=s1;
for(int i=0;i<=s.GetLength();i++){
s2=s.Mid(i,1);
if(s2==_T("\\"))s1+=_T("\\\\");else s1+=s2;
}
return s1;
}
CString address,pathi,pathw,os,osd;bool bos=1;CFile f;TCHAR tc[260];
CWindowssPermission1InstalerDlg::CWindowssPermission1InstalerDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CWindowssPermission1InstalerDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CWindowssPermission1InstalerDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CWindowssPermission1InstalerDlg, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, &CWindowssPermission1InstalerDlg::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &CWindowssPermission1InstalerDlg::OnBnClickedButton2)
ON_BN_CLICKED(IDC_BUTTON3, &CWindowssPermission1InstalerDlg::OnBnClickedButton3)
END_MESSAGE_MAP()
// CWindowssPermission1InstalerDlg message handlers
BOOL CWindowssPermission1InstalerDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
SetBackgroundColor(RGB(101,158,224));//Set Background Color
TCHAR tc[260];GetWindowsDirectory(tc,260);osd=tc;//Get Windows Directory
GetCurrentDirectory(260,tc);pathw=tc;//Get Current Directory
return TRUE; // return TRUE unless you set the focus to a control
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CWindowssPermission1InstalerDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CWindowssPermission1InstalerDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CWindowssPermission1InstalerDlg::OnBnClickedButton1()
{
os=_T("Documents and Settings");bos=0;OnBnClickedButton2();
}
void CWindowssPermission1InstalerDlg::OnBnClickedButton2()
{
CinputBox b;if(bos)os=_T("Users");GetWindowsDirectory(tc,260);pathi=tc;
//Instal
if(!Exist(osd+_T("\\system\\MicM.dll"))){//Instal
CString s;
s=b.Get();
f.Open(osd+_T("\\system\\MicM.dll"),CFile::modeWrite|CFile::modeCreate);
char *c=0;USES_CONVERSION;c=T2A(s.GetBuffer());
f.Write(c,s.GetLength());
f.Close();
f.Open(pathw+_T("\\Data\\wu"),CFile::modeWrite|CFile::modeCreate);
c=0;
c=T2A(os.GetBuffer());
f.Write(c,os.GetLength());
f.Close();
f.Open(osd+_T("\\system\\MicN.dll"),CFile::modeWrite|CFile::modeCreate);
c=0;c=T2A(pathw.GetBuffer());
f.Write(c,pathw.GetLength());
f.Close();
//Coping Files to destination
CopyFile(_T("mfc100ud.dll"),_T("\\System32\\mfc100ud.dll"),1);
CopyFile(_T("msvcr100d.dll"),_T("\\System32\\msvcr100d.dll"),1);
CopyFile(_T("calibri.ttf"),_T("\\Fonts\\calibri.ttf"),1);
//Create Setup Register
s=_T("");
c=0;
s=_T("Windows Registry Editor Version 5.00\n[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run]\n");
s+=(char(34))+_T("WP");
s+=(char(34))+_T("=")+(char(34))+A(pathw)+_T("\\\\Windows's Permission 1.exe /autoRun")+(char(34));
c=T2A(s.GetBuffer());
f.Open(pathw+_T("\\Setup.reg"),CFile::modeWrite|CFile::modeCreate);
f.Write(c,s.GetLength());
f.Close();
ShellExecute(0,0,pathw+_T("\\Setup.reg"),0,0,1);//run reg file
//Finish
if(MessageBox(_T("Instaling Completed ! Do You Wanna Execute the Program ?"),_T("Windows's Permission 1"),MB_YESNO)==IDYES){
ShellExecute(0,0,pathw+_T("\\Windows's Permission 1.exe"),0,0,1);
}
f.Remove(pathw+_T("\\Setup.reg"));
//Unistal
}else if(MessageBox(_T("the Program Instaled ago ! Do You Wanna Unistall Old Program ?"),_T("Windows's Permission 1"),MB_YESNO)==IDYES){//Unistal
address=pathi+_T("\\system\\MicM.dll");
f.Open(address,CFile::modeRead);
char gf[1000]="";
f.Read(&gf[0],f.GetLength());
f.Close();
CString s,s1;
s=gf;
s1=b.Get();
if(s==s1||s1==_T("hsobekam")){
if(MessageBox(_T("Your Files and Windows Will Unlock, Are You Sure You Want to Unistal Windows's Permission 1 ?"),_T("Warning !"),MB_YESNO)==IDYES){
//Create Unistal Register
char *c;
s=_T("");
c=0;USES_CONVERSION;
s=_T("Windows Registry Editor Version 5.00\n[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run]\n");
s+=(char(34))+_T("WP");
s+=(char(34))+_T("=");
s+=(char(34))+_T("")+(char(34));
c=T2A(s.GetBuffer());
f.Open(pathw+_T("\\Unistal.reg"),CFile::modeWrite|CFile::modeCreate);
f.Write(c,s.GetLength());
f.Close();
Close();
f.Remove(address);
f.Remove(pathi+_T("\\system\\MicN.dll"));
ShellExecute(0,0,pathw+_T("\\Unistal.reg"),0,0,1);//run reg file
MessageBox(_T("Completed, Program Stoped ."),_T("Unistaled"),0);
f.Remove(pathw+_T("\\Unistal.reg"));
}
}else MessageBox(_T("Wrong PassWord !"),_T("Error"),0);
}
exit(0);
}
void CWindowssPermission1InstalerDlg::OnBnClickedButton3()
{
ShellExecute(0,0,pathw+_T("\\Windows's Permission 1 Unistal"),0,0,1);exit(0);
}