Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ package-lock.json
# *.exe
temp
guest_server/winboat_guest_server.exe
guest_server/winboat_guest_server.zip
guest_server/winboat_guest_server.zip
rdp_exec/rdp_exec.exe
2 changes: 2 additions & 0 deletions build-rdp-exec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd rdp_exec
GOOS=windows GOARCH=amd64 go build -o rdp_exec.exe -ldflags="-H windowsgui"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"scripts": {
"dev": "node scripts/dev-server.ts",
"build-guest-server": "bash build-guest-server.sh",
"build:linux-gs": "bash build-guest-server.sh && node scripts/build.ts && electron-builder --linux"
"build-rdp-exec": "bash build-rdp-exec.sh",
"build:linux-gs": "bash build-guest-server.sh && bash build-rdp-exec.sh && node scripts/build.ts && electron-builder --linux"
},
"repository": "https://github.com/TibixDev/winboat",
"author": {
Expand Down
3 changes: 3 additions & 0 deletions rdp_exec/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module rdp-exec

go 1.24.8
53 changes: 53 additions & 0 deletions rdp_exec/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package main

import (
"flag"
"os"
"strings"
"syscall"
"unsafe"
)

var (
cmd = flag.String("cmd", "", "Command to run")
dummy = flag.String("dummy", "", "Dummy info")
)

func main() {
flag.Parse()

if *cmd == "" || *dummy == "" {
os.Exit(1)
}

args := strings.Fields(*cmd)

if len(args) == 0 {
os.Exit(1)
}

commandLine := syscall.StringToUTF16Ptr(*cmd)
workingDir := syscall.StringToUTF16Ptr(`C:\Windows\System32`)

var startupInfo syscall.StartupInfo
var processInfo syscall.ProcessInformation

startupInfo.Cb = uint32(unsafe.Sizeof(startupInfo))

syscall.CreateProcess(
nil,
commandLine,
nil, // Default process security attributes
nil, // Default thread security attributes
false, // Inherit handles
0, // Creation flags
nil, // Use parent's environment
workingDir,
&startupInfo,
&processInfo,
)

syscall.WaitForSingleObject(processInfo.Process, syscall.INFINITE)
syscall.CloseHandle(processInfo.Process)
syscall.CloseHandle(processInfo.Thread)
}
13 changes: 13 additions & 0 deletions src/renderer/lib/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ export class InstallManager {
? path.join(process.resourcesPath, 'guest_server') // For packaged app
: path.join(remote.app.getAppPath(), '..', '..', 'guest_server'); // For dev mode

const rdpExecPath = remote.app.isPackaged
? path.join(process.resourcesPath, 'rdp_exec') // For packaged app
: path.join(remote.app.getAppPath(), '..', '..', 'rdp_exec'); // For dev mode

logger.info(`Guest server source path: ${appPath}`);

// Check if the source directory exists
Expand Down Expand Up @@ -231,6 +235,15 @@ export class InstallManager {
const destPath = path.join(oemPath, entry);
copyRecursive(srcPath, destPath);
});
fs.readdirSync(rdpExecPath).forEach(entry => {
const srcPath = path.join(rdpExecPath, entry);
const rdpExecOemPath = path.join(oemPath, "rdp_exec")
if (!fs.existsSync(rdpExecOemPath)) {
fs.mkdirSync(rdpExecOemPath);
}
const destPath = path.join(rdpExecOemPath, entry);
copyRecursive(srcPath, destPath);
});
logger.info("OEM assets created successfully");
} catch (error) {
logger.error(`Failed to copy OEM assets: ${error}`);
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/lib/winboat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const { promisify }: typeof import('util') = require('util');
const { exec }: typeof import('child_process') = require('child_process');
const remote: typeof import('@electron/remote') = require('@electron/remote');
const FormData: typeof import('form-data') = require('form-data');
const crypto: typeof import('crypto') = require('crypto');

const execAsync = promisify(exec);
const USAGE_PATH = path.join(WINBOAT_DIR, 'appUsage.json');
Expand Down Expand Up @@ -677,7 +678,7 @@ export class Winboat {
/scale-desktop:${this.#wbConfig?.config.scaleDesktop ?? 100}\
${combinedArgs}\
/wm-class:"winboat-${cleanAppName}"\
/app:program:"${app.Path}",name:"${cleanAppName}" &`;
/app:program:"C:\\OEM\\rdp_exec\\rdp_exec.exe",cmd:"-cmd \\\"${app.Path}\\\" -dummy ${crypto.randomUUID().toString()}",name:"${cleanAppName}" &`;

if (app.Path == InternalApps.WINDOWS_DESKTOP) {
cmd = `${freeRDPBin} /u:"${username}"\
Expand Down