C + + implementation of Youku potato to video advertising method _c language

Source: Internet
Author: User
Tags lstat

This article describes the C + + implementation of Youku potatoes to video advertising methods. Share to everyone for your reference. The specific analysis is as follows:

Before writing a tool, not easy to use I do not know, I am using a very good, compile the environment VC6.0, the principle is to change the host file, but also changed other places, you can look at the source code, temporarily support xp,win7 did not write, codes may be messy, interested friends can change their own.

guanggaoDlg.cpp:implementation file Win32_find_data findfiledata; void Cguanggaodlg::onbutton1 () {//Shielding function CopyFile ("c:\\windows\\system32\\drivers\\etc\\hosts", "c:\\windows\\ 
    System32\\drivers\\etc\\bak.hosts ", TRUE); TCHAR Lujing[max_path] = "C:\\Documents and settings\\administrator\\application Data\\macromedia\\flash Player\\# 
    Sharedobjects\\ "; TCHAR Lujing2[max_path] = "C:\\Documents and settings\\administrator\\application Data\\macromedia\\flash Player\\# 
    Sharedobjects\\ "; 
    TCHAR Youku[max_path] = "\\static.youku.com"; 
    TCHAR Tudou[max_path] = "\\js.tudouui.com"; HANDLE hfist = FindFirstFile ("C:\\Documents and Settings\\administrator\\application Data\\macromedia\\flash Player\\ 
    #SharedObjects \\* ", &findfiledata); 
    FindNextFile (Hfist, &findfiledata); 
    FindNextFile (Hfist, &findfiledata); 
    strcat (Lujing,findfiledata.cfilename); 
    strcat (Lujing2,findfiledata.cfilename); 
   LPSTR dedaoquanlujing = strcat (Lujing,youku); LPSTR dedaoquanlujing2 = strcat (Lujing2,tudou); 
    Shfileopstruct filecaoz; 
    ZeroMemory (&filecaoz,sizeof (filecaoz)); 
    Filecaoz.wfunc = Fo_delete; Filecaoz.fflags = fof_noconfirmation| 
    fof_simpleprogress; 
    Filecaoz.hnamemappings = NULL; 
    Filecaoz.hwnd = NULL; 
    Filecaoz.lpszprogresstitle = NULL; 
    Filecaoz.pfrom = dedaoquanlujing; 
    SHFileOperation (&filecaoz); 
    Shfileopstruct filecaoz2; 
    ZeroMemory (&filecaoz2,sizeof (FILECAOZ2)); 
    Filecaoz.wfunc = Fo_delete; Filecaoz.fflags = fof_noconfirmation| 
    fof_simpleprogress; 
    Filecaoz.hnamemappings = NULL; 
    Filecaoz.hwnd = NULL; 
    Filecaoz.lpszprogresstitle = NULL; 
    Filecaoz.pfrom = dedaoquanlujing2; 
    SHFileOperation (&FILECAOZ2); 
    SetFileAttributes (dedaoquanlujing,0); 
    DeleteFile (dedaoquanlujing); 
    DeleteFile (DEDAOQUANLUJING2); HANDLE Wenjian = CreateFile (dedaoquanlujing,generic_write| generic_read,file_share_read| file_share_write| File_share_delete,nUll,create_always,file_attribute_normal,null); HANDLE wenjian2 = CreateFile (dedaoquanlujing2,generic_write| generic_read,file_share_read| file_share_write| 
    File_share_delete,null,create_always,file_attribute_normal,null); 
    SetFileAttributes (dedaoquanlujing,0); 
    SetFileAttributes (dedaoquanlujing2,0); 
    CloseHandle (hfist); 
    CloseHandle (Wenjian); 
  CloseHandle (WENJIAN2); 
    HOST setfileattributes ("C:\\windows\\system32\\drivers\\etc\\hosts", 0); HANDLE wenjianjubing = CreateFile ("c:\\windows\\system32\\drivers\\etc\\hosts", generic_write| generic_read,file_share_read| file_share_write| 
    File_share_delete,null,create_always,file_attribute_normal,null); 
    Go Youku DWORD sizebuff = 0; 
    Char a1[] = {"#youku \ r \ n}"}; 
    Char a2[] = {"127.0.0.1 atm.youku.com\r\n"}; 
    Char a3[] = {"127.0.0.1 fvid.atm.youku.com\r\n"}; 
    Char a4[] = {"127.0.0.1 html.atm.youku.com\r\n"}; 
    Char a5[] = {"127.0.0.1 valb.atm.youku.com\r\n"}; Char a6[] = {"127.0.0.1 valf. atm.youku.com\r\n "}; 
    Char a7[] = {"127.0.0.1 valo.atm.youku.com\r\n"}; 
    Char a8[] = {"127.0.0.1 valp.atm.youku.com\r\n"}; 
    Char a9[] = {"127.0.0.1 lstat.youku.com\r\n"}; 
    Char a10[] = {"127.0.0.1 speed.lstat.youku.com\r\n"}; 
    Char a11[] = {"127.0.0.1 urchin.lstat.youku.com\r\n"}; 
    Char a12[] = {"127.0.0.1 stat.youku.com\r\n"}; 
    Char a13[] = {"127.0.0.1 valc.atm.youku.com\r\n"}; 
    Char a14[] = {"127.0.0.1 vid.atm.youku.com\r\n"}; 
    Char a15[] = {"127.0.0.1 walp.atm.youku.com\r\n"}; 
    Char a16[] = {"127.0.0.1 static.lstat.youku.com\r\n"}; 
    WriteFile (wenjianjubing,a1,sizeof (A1) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a2,sizeof (A2) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a3,sizeof (A3) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a4,sizeof (A4) -1,&sizebuff,null); 
    WriteFile (Wenjianjubing,a5,sizeof (A5) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a6,sizeof (A6) -1,&sizebuff,null); WriteFile (WenjianJubing,a7,sizeof (A7) -1,&sizebuff,null); 
    WriteFile (Wenjianjubing,a8,sizeof (A8) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a9,sizeof (A9) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a10,sizeof (A10) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a11,sizeof (A11) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a12,sizeof (A12) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a13,sizeof (A13) -1,&sizebuff,null); 
    WriteFile (Wenjianjubing,a14,sizeof (A14) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,a15,sizeof (A15) -1,&sizebuff,null); 
  WriteFile (wenjianjubing,a16,sizeof (A16) -1,&sizebuff,null); 
    Go Potato char b0[] = {"#tudou \ r \ n}"}; 
    Char b1[]={"127.0.0.1 adextensioncontrol.tudou.com\r\n"}; 
    Char b2[]={"127.0.0.1 iwstat.tudou.com\r\n"}; 
    Char b3[]={"127.0.0.1 nstat.tudou.com\r\n"}; 
    Char b4[]={"127.0.0.1 stats.tudou.com\r\n"}; 
    Char b5[]={"127.0.0.1 *.p2v.tudou.com*\r\n"}; Char b6[]={"127.0.0.1 at-img1.tdimg.Com\r\n "}; 
    Char b7[]={"127.0.0.1 at-img2.tdimg.com\r\n"}; 
    Char b8[]={"127.0.0.1 at-img3.tdimg.com\r\n"}; 
    Char b9[]={"127.0.0.1 adplay.tudou.com\r\n"}; 
    Char b10[]={"127.0.0.1 adcontrol.tudou.com\r\n"}; 
    Char b11[]={"127.0.0.1 stat.tudou.com\r\n"}; 
    WriteFile (wenjianjubing,b0,sizeof (B0) -1,&sizebuff,null); 
    WriteFile (Wenjianjubing,b1,sizeof (B1) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,b2,sizeof (B2) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,b3,sizeof (b3) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,b4,sizeof (B4) -1,&sizebuff,null); 
    WriteFile (Wenjianjubing,b5,sizeof (B5) -1,&sizebuff,null); 
    WriteFile (Wenjianjubing,b6,sizeof (B6) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,b7,sizeof (B7) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,b8,sizeof (B8) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,b9,sizeof (B9) -1,&sizebuff,null); 
WriteFile (wenjianjubing,b10,sizeof (B10) -1,&sizebuff,null);    WriteFile (wenjianjubing,b11,sizeof (B11) -1,&sizebuff,null); 
  WriteFile (wenjianjubing,a15,sizeof (A15) -1,&sizebuff,null); 
    Go cool 6 char c0[] = {"#ku6 \ r \ n}"}; 
    Char c1[]={"127.0.0.1 1.allyes.com.cn\r\n"}; 
    Char c2[]={"127.0.0.1 analytics.ku6.com\r\n"}; 
    Char c3[]={"127.0.0.1 gug.ku6cdn.com\r\n"}; 
    Char c4[]={"127.0.0.1 ku6.allyes.com\r\n"}; 
    Char c5[]={"127.0.0.1 ku6afp.allyes.com\r\n"}; 
    Char c6[]={"127.0.0.1 pq.stat.ku6.com\r\n"}; 
    Char c7[]={"127.0.0.1st.vq.ku6.cn\r\n"}; 
    Char c8[]={"127.0.0.1 stat0.888.ku6.com\r\n"}; 
    Char c9[]={"127.0.0.1 stat1.888.ku6.com\r\n"}; 
    Char c10[]={"127.0.0.1 stat2.888.ku6.com\r\n"}; 
    Char c11[]={"127.0.0.1 stat3.888.ku6.com\r\n"}; 
    Char c12[]={"127.0.0.1 static.ku6.com\r\n"}; 
    Char c13[]={"127.0.0.1 v0.stat.ku6.com\r\n"}; 
    Char c14[]={"127.0.0.1 v1.stat.ku6.com\r\n"}; 
    Char c15[]={"127.0.0.1 v2.stat.ku6.com\r\n"}; 
    Char c16[]={"127.0.0.1 v3.stat.ku6.com\r\n"}; WritefiLe (wenjianjubing,c0,sizeof (C0) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c1,sizeof (C1) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c2,sizeof (C2) -1,&sizebuff,null); 
    WriteFile (Wenjianjubing,c3,sizeof (C3) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c4,sizeof (C4) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c5,sizeof (C5) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c6,sizeof (C6) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c7,sizeof (C7) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c8,sizeof (C8) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c9,sizeof (C9) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c10,sizeof (C10) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c11,sizeof (C11) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c12,sizeof (C12) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c13,sizeof (C13) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,c14,sizeof (C14) -1,&sizebuff,null); WritefiLe (wenjianjubing,c15,sizeof (C15) -1,&sizebuff,null); 
  WriteFile (wenjianjubing,c16,sizeof (C16) -1,&sizebuff,null); 
    Go to Odd art advertisement char d0[] = {"#qiyi \ r \ n"}; 
    Char d1[]={"127.0.0.1 afp.qiyi.com\r\n"}; 
    Char d2[]={"127.0.0.1 focusbaiduafp.allyes.com\r\n"}; 
    WriteFile (wenjianjubing,d0,sizeof (D0) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,d1,sizeof (D1) -1,&sizebuff,null); 
  WriteFile (wenjianjubing,d2,sizeof (D2) -1,&sizebuff,null); 
    Sina Video char e0[] = {"#sina \ r \ n}"}; 
    Char e3[]={"127.0.0.1 dcads.sina.com.cn\r\n"}; 
    WriteFile (wenjianjubing,e0,sizeof (E0) -1,&sizebuff,null); 
  WriteFile (Wenjianjubing,e3,sizeof (E3) -1,&sizebuff,null); 
    Go PPTV char f0[] = {"#pptv \ r \ n}"}; 
    Char f4[]={"127.0.0.1 pp2.pptv.com\r\n"}; 
    WriteFile (wenjianjubing,f0,sizeof (F0) -1,&sizebuff,null); 
  WriteFile (wenjianjubing,f4,sizeof (f4) -1,&sizebuff,null); 
    Sohu Char g0[] = {"#sohu \ r \ n}"}; Char g5[]={"127.0.0.1images.sohu.Com\r\n "}; 
    WriteFile (wenjianjubing,g0,sizeof (G0) -1,&sizebuff,null); 
  WriteFile (Wenjianjubing,g5,sizeof (G5) -1,&sizebuff,null); 
    Le view char h0[] = {"#leshi \ r \ n}"}; 
    Char h6[]={"127.0.0.1 pro.letv.com\r\n"}; 
    WriteFile (wenjianjubing,h0,sizeof (H0) -1,&sizebuff,null); 
  WriteFile (Wenjianjubing,h6,sizeof (h6) -1,&sizebuff,null); 
    Thunderbolt look char j0[] = {"#xunlei \ r \ n}"}; 
    Char j1[]={"127.0.0.1 mcfg.sandai.net\r\n"}; 
    Char j2[]={"127.0.0.1 biz5.sandai.net\r\n"}; 
    Char j3[]={"127.0.0.1 server1.adpolestar.net\r\n"}; 
    Char j4[]={"127.0.0.1 advstat.xunlei.com\r\n"}; 
    Char j5[]={"127.0.0.1 mpv.sandai.net\r\n"}; 
    WriteFile (wenjianjubing,j0,sizeof (j0) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,j1,sizeof (J1) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,j2,sizeof (J2) -1,&sizebuff,null); 
    WriteFile (wenjianjubing,j3,sizeof (J3) -1,&sizebuff,null); 
  WriteFile (wenjianjubing,j3,sizeof (J3) -1,&sizebuff,null); //qq char qq1[]={"#qq \ r \ n"}; 
  Char qq2[]={"127.0.0.1 adslvfile.qq.com\r\n"}; 
  Char qq3[]={"127.0.0.1 adsfile.qq.com\r\n"}; 
  WriteFile (wenjianjubing,qq1,sizeof (QQ1) -1,&sizebuff,null); 
  WriteFile (wenjianjubing,qq2,sizeof (QQ2) -1,&sizebuff,null); 
    BOOL bwite = WriteFile (wenjianjubing,qq3,sizeof (QQ3) -1,&sizebuff,null); 
      if (bwite!= 0) {AfxMessageBox ("Shield successful!"); 
      SetFileAttributes ("C:\\windows\\system32\\drivers\\etc\\hosts", 1); 
      System ("Echo y|cacls c:\\windows\\system32\\drivers\\etc\\hosts/g everyone:r"); 
    Return 
      else {AfxMessageBox ("already masked!"); 
    Return } void Cguanggaodlg::onbutton2 () {//restore TCHAR Lujing[max_path] = "C:\\Documents and Settings\\administ 
    Rator\\application data\\macromedia\\flash player\\ #SharedObjects \ "; TCHAR Lujing2[max_path] = "C:\\Documents and settings\\administrator\\application Data\\macromedia\\flash Player\\# 
    Sharedobjects\\ "; TCHAR mingche2[MAX_PATH] = "\\static.youku.com"; 
    TCHAR Tudou[max_path] = "\\js.tudouui.com"; HANDLE hFist2 = FindFirstFile ("C:\\Documents and Settings\\administrator\\application Data\\macromedia\\flash Player\ 
    \ #SharedObjects \\* ", &findfiledata); 
    FindNextFile (HFist2, &findfiledata); 
    FindNextFile (HFist2, &findfiledata); 
    strcat (Lujing,findfiledata.cfilename); 
    strcat (Lujing2,findfiledata.cfilename); 
    LPSTR dedaoquanlujing = strcat (lujing,mingche2); 
    LPSTR dedaoquanlujing2 = strcat (Lujing2,tudou); 
    DeleteFile (dedaoquanlujing); 
    DeleteFile (DEDAOQUANLUJING2); 
    CloseHandle (HFIST2); 
    System ("Echo y|cacls c:\\windows\\system32\\drivers\\etc\\hosts/g everyone:f"); 
    SetFileAttributes ("C:\\windows\\system32\\drivers\\etc\\hosts", 0); BOOL bcpy = CopyFile ("c:\\windows\\system32\\drivers\\etc\\bak.hosts", "c:\\windows\\system32\\drivers\\etc\\hosts 
    ", FALSE); 
      if (bcpy!= 0) {AfxMessageBox ("restore successful!"); 
    Return 
    }else {AfxMessageBox ("Restore failed!"); 
    Return } void Cguanggaodlg::onbutton3 () {//Youku Test ShellExecute (NULL, "open", "http://www.youku.com", Null,null, 
  SW_SHOWNORMAL); }

I hope this article will help you with your C + + programming.

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.