Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1, Create new .h file
- Copy the folling
- ```
- //Command pipe
- DWORD WINAPI COMMANDPIPE(PVOID lvpParameter)
- {
- HANDLE hPipe;
- char buffer[1024];
- DWORD dwRead;
- hPipe = CreateNamedPipe(TEXT("\\\\.\\pipe\\LunarCommands"),
- PIPE_ACCESS_DUPLEX | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
- PIPE_WAIT,
- 1,
- 1024 * 16,
- 1024 * 16,
- NMPWAIT_USE_DEFAULT_WAIT,
- NULL);
- while (hPipe != INVALID_HANDLE_VALUE)
- {
- if (ConnectNamedPipe(hPipe, NULL) != FALSE)
- {
- while (ReadFile(hPipe, buffer, sizeof(buffer) - 1, &dwRead, NULL) != FALSE)
- {
- buffer[dwRead] = '\0';
- try {
- Commands(buffer);
- }
- catch (std::exception e) {
- MessageBox(NULL, L"ERROR");
- }
- catch (...) {
- MessageBox(NULL, L"ERROR");
- }
- }
- }
- DisconnectNamedPipe(hPipe);
- }
- }
- //ENV pipe
- DWORD WINAPI COMMANDPIPE(PVOID lvpParameter)
- {
- HANDLE hPipe;
- char buffer[1024];
- DWORD dwRead;
- hPipe = CreateNamedPipe(TEXT("\\\\.\\pipe\\LunarLuaCEnv"),
- PIPE_ACCESS_DUPLEX | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE,
- PIPE_WAIT,
- 1,
- 1024 * 16,
- 1024 * 16,
- NMPWAIT_USE_DEFAULT_WAIT,
- NULL);
- while (hPipe != INVALID_HANDLE_VALUE)
- {
- if (ConnectNamedPipe(hPipe, NULL) != FALSE)
- {
- while (ReadFile(hPipe, buffer, sizeof(buffer) - 1, &dwRead, NULL) != FALSE)
- {
- buffer[dwRead] = '\0';
- try {
- Commands(buffer);
- }
- catch (std::exception e) {
- MessageBox(NULL, L"ERROR");
- }
- catch (...) {
- MessageBox(NULL, L"ERROR");
- }
- }
- }
- DisconnectNamedPipe(hPipe);
- }
- }
- ```
- Go into Main.h and after it does Init, put this:
- ```
- MessageBox(NULL, L"Loaded! You May Now Use Lunar");
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement