Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8651549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:05:58+00:00 2026-06-12T14:05:58+00:00

I’m writing a program, which creates Windows service. So I need two .exe files

  • 0

I’m writing a program, which creates Windows service. So I need two .exe files – one for program, creating service and another for service itself. But I want to combine these two files into one. I have the following idea – open .exe file, which I want to pack (service application) in text editor and then copy its contents to some string. Then I need to create an empty .exe file in required directory and write the string to this file. But I suppose that’s not a good idea. What is the best way to solve my problem?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:05:59+00:00Added an answer on June 12, 2026 at 2:05 pm

    For fun I wrote a “launcher” program that uses your method. It works, I tested it with zoomin.exe as the payload.

    Once you’ve created the launcher executable, open both it and the payload file (zoomin.exe in my case) in Notepad++, and copy (using the Edit | Paste Special | Copy Binary Content and Paste Binary Content menu options).

    You can find whereabouts in the launcher file the payload goes by searching in Notepad++ for “File Goes Here” and “End”.

    Note, I do not recommend this in any way, it’s fiddly, error-prone and can break easily with different compiler settings. The way I have solved this in the past is, as already commented, to add the payload as a resource, which is much more maintainable.

    #include <stdio.h>
    
    #define SIZE_OF_ZOOMIN_EXE 11264
    char buffer[SIZE_OF_ZOOMIN_EXE] = "File Goes Here";
    char end_of_buffer[] = "End";
    
    int main()
    {
        FILE *fp = fopen("myzoomin.exe", "wb");
        fwrite(buffer, sizeof(buffer), 1, fp);
        fclose(fp);
        return 0;
    }
    

    Here’s an main() function for a self-installing service I wrote in C++ . In addition, the program allows the service to be run interactively.

    int main( int argc, char *argv[] ) 
    { 
        SERVICE_TABLE_ENTRY   DispatchTable[] = 
        { 
            { SERVICE_NAME,      Eng3ServiceStart      }, 
            { NULL,              NULL          } 
        }; 
    
        try {
            if (argc >= 2) {
                if (argc >= 3)
                    if (!(logfile = fopen(argv[2], "a")))
                        logfile = stdout;
    
                if (0 == _stricmp(argv[1], "install")) {
                    DeleteEng3Service(); // ignore return value -- don't care if error
                    return CreateEng3Service();
                }
                else if (0 == _stricmp(argv[1], "uninstall"))
                    return DeleteEng3Service() ;
    
            } 
    
            // not installing or uninstalling, start the service,
            // passing it all the command-line arguments.
            if (!StartServiceCtrlDispatcher( DispatchTable ) ) {
                if (GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
                    fprintf(logfile, "Failed to connect to service. Starting in console mode.\n");
                    return svcmain(argc, argv);
                }
                throw sys_ex();
            }
    
        } catch (exception& ex ) {
            fprintf(logfile, ex.what());
        }
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
In my XML file chapters tag has more chapter tag.i need to display chapters
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.