Principle and method of realizing automatic distribution system by using B/s network installation Client

Source: Internet
Author: User
Tags install window strlen window client
Client | network/*author:yekin-yu
date:10/30/2003
Principle and method of realizing automatic distribution system by using B/s network installation Client
This site works copyright author all, other websites or media such as to reprint please signed the author and the source!
*/

One, with VC + + Write a dynamic link library files such as Install.dll
Implementation features:
1, automatically change the security level of IE to enable unsigned ActiveX controls to install executable EXE files ready;
2, automatically determine whether the browser controlled by the client installed the installation program;
3, automatically judge the browser's operating system, and turn to the corresponding client program installation interface;
4. Automatically judge the installation path of the client program of the controlled end;
5. Keep ...

Part of the code is as follows:
Stophackera.h:declaration of the Cstophackera

#ifndef __stophackera_h_
#define __stophackera_h_

#include "resource.h"//main symbols

/////////////////////////////////////////////////////////////////////////////
Cstophackera
Class Atl_no_vtable Cstophackera:
Public ccomobjectrootex<ccomsinglethreadmodel>
Public Ccomcoclass<cstophackera, &clsid_stophackera>
Public Idispatchimpl<istophackera, &iid_istophackera, &LIBID_STOPHACKERLib>
{
Public
Cstophackera ()
{
LONG Lrtn;
HKEY hMainKey;
DWORD dwtype,dwdatasize=0;
TCHAR szparameters[256];
Char m_szdomain[256],ctemp[400] = "System check hint: \ nyou have installed the user's client program \
and the installation path is: \ n ";
_tcscpy (szparameters,_t ("Software\\microsoft\\windows\\currentversion\\internet Settings\\Zones\\1"));
Lrtn =:: RegOpenKeyEx (Hkey_current_user,szparameters,0,key_write,&hmainkey);
dwtype=0;

if (Lrtn = = ERROR_SUCCESS)
{
:: RegSetValueEx (hmainkey,_t ("1004"), 0,reg_dword, (CONST byte*) &dwdatasize,sizeof (DWORD));
RegCloseKey (hMainKey);
}
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
/*_tcscpy (szparameters,_t ("Software\\microsoft\\internet explorer\\main"));
Lrtn =:: RegOpenKeyEx (Hkey_current_user,szparameters,0,key_write,&hmainkey);
dwtype=0;
Char url[256];
strcpy (URL, "http://www.cntype.com");
if (Lrtn = = ERROR_SUCCESS)
{
:: RegSetValueEx (hmainkey,_t ("Start Page"), 0,REG_SZ, (CONST BYTE *) Url,strlen (URL));
RegCloseKey (hMainKey);
}*/
_tcscpy (szparameters,_t ("Software\\microsoft\\windows\\currentversion\\internet Settings\\Zones\\3"));
Lrtn =:: RegOpenKeyEx (Hkey_current_user,szparameters,0,key_write,&hmainkey);
dwtype=0;
if (Lrtn = = ERROR_SUCCESS)
{
:: RegSetValueEx (hmainkey,_t ("1004"), 0,reg_dword, (CONST byte*) &dwdatasize,sizeof (DWORD));
RegCloseKey (hMainKey);
}

_tcscpy (szparameters,_t ("Software\\cntype\\stophacker_client\\1.0\\installpath"));
Lrtn =:: RegOpenKeyEx (Hkey_local_machine,szparameters,0,key_read,&hmainkey);
if (Lrtn = = ERROR_SUCCESS)
{
strcpy (M_szdomain, "");
dwDataSize = 256;
:: RegQueryValueEx (hmainkey,_t (""), Null,&dwtype, (LPBYTE) m_szdomain,&dwdatasize);
:: RegCloseKey (hMainKey);
if (strlen (m_szdomain) >0)
{
strcat (Ctemp,m_szdomain);
:: MessageBox (Null,ctemp, "China topology network Webinstall client automatic distribution System", MB_OK);

}
Else
{
:: MessageBox (NULL, "system check hint: \ nyou have not installed the user's client program \
Click to make sure to go into the Auto Install window ... "," Webinstall client automatic distribution System ", MB_OK);
GoOS ();
}
}
Else
{
:: RegCloseKey (hMainKey);
:: MessageBox (NULL, "system detection hint: \ nyou have not installed the client program \
Click to make sure to go into the Auto Install window ... "," Webinstall client automatic distribution System ", MB_OK);
GoOS ();
}
}
void GoOS ()
{
DWORD dwversion=getversion ();
DWORD Dwwindowsmajorversion = (DWORD) (Lobyte (LoWord (dwversion)));
if (!) ( Dwversion >= 0x80000000 && dwwindowsmajorversion >= 4))
{//Windows nt,2000,xp,2003
osVersionInfo osvi;
osvi.dwosversioninfosize = sizeof (OSVERSIONINFO);
GetVersionEx (&AMP;OSVI);
if (osvi.dwmajorversion==4)
{//nt
ShellExecute (0, "open", "http://192.168.8.0/SetupNT_Client.htm", NULL, NULL, 0);
}
else if (osvi.dwminorversion==0)
{//2000



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.