The winuae log gives the name of the pipe
Code: Select all
IPC: Named Pipe '\\.\pipe\WinUAE' open
Code: Select all
EVT <event name> <state value>
Code: Select all
IPC: Named Pipe '\\.\pipe\WinUAE' open
Code: Select all
EVT <event name> <state value>
Code: Select all
FileOpen("\\.\pipe\WinUAE", "w").Write("EVT <event name> <state value>")
Code: Select all
import sys, os
from win32file import *
# try to open WinUAE pipe, or exit
try:
up = CreateFile(r'\\.\pipe\WinUAE', GENERIC_READ | GENERIC_WRITE, 0, None, OPEN_EXISTING, 0, None)
except:
print "Can't open WinUAE pipe."
sys.exit(-1)
# join all command line args (except scriptname)
args = " ".join(sys.argv[1:]) + "\0"
# write args to WinUAE pipe
WriteFile(up, args)
# output return code
print ReadFile(up, 4096)[1]
# close handle
CloseHandle(up)
Code: Select all
up := FileOpen("\\.\pipe\WinUAE", "rw")
up.Write("EVT <event name> <state value>")
response := up.Read(4096)
up.Close()
MsgBox % response
Code: Select all
; up = CreateFile(r'\\.\pipe\WinUAE', GENERIC_READ | GENERIC_WRITE, 0, None, OPEN_EXISTING, 0, None)
hup := DllCall("CreateFile", "str", "\\.\pipe\WinUAE", "int", 0x80000000 | 0x40000000
, "int", 0, "ptr", 0, "int", 0x3, "int", 0, "ptr", 0, "ptr")
if (hup = -1)
throw "Can't open WinUAE pipe."
up := FileOpen(hup, "h")
Code: Select all
up.Write("ipc_config")
MsgBox % up.ReadLine() ; 200
CallNamedPipe function
Connects to a message-type pipe (and waits if an instance of the pipe is not available), writes to and reads from the pipe, and then closes the pipe.
Code: Select all
MsgBox % WinUAE("ipc_config")
WinUAE(command) {
VarSetCapacity(result, 4096)
if !DllCall("CallNamedPipe", "str", "\\.\pipe\WinUAE"
, "astr", command, "int", StrPut(command, "cp0")
, "ptr", &result, "int", 4096
, "uint*", bytesRead, "uint", 1)
throw Exception("CallNamedPipe failed with error " A_LastError)
return RegExReplace(StrGet(&result, bytesRead, "cp0"), "\R$")
}
Code: Select all
WinUAE(command) {
if A_IsUnicode
command := Chr(0xFEFF) command ; UTF-16 BOM
VarSetCapacity(result, 4096, 0)
if !DllCall("CallNamedPipe", "str", "\\.\pipe\WinUAE"
, "str", command, "int", (StrLen(command)+1)*(A_IsUnicode?2:1)
, "str", result, "int", 4096
, "uint*", bytesRead, "uint", 1)
throw Exception("CallNamedPipe failed with error " A_LastError)
return RegExReplace(result, "\R$")
}
Code: Select all
outlen = _tcsclen ((TCHAR*)ipc->outbuf) + sizeof (TCHAR);
Code: Select all
outlen = (_tcsclen ((TCHAR*)ipc->outbuf) + 1) * sizeof (TCHAR);