summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/windows/os.h
blob: 931f4991c24e61f79757d47f82218a08d8399d95 (plain)
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
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// The following function allows one to dynamically
// resolve DLL function names.
// The arguments are strings.
void *get_proc_addr(void *library, void *name);

extern void *VirtualAlloc;
extern void *LoadLibraryEx;
extern void *GetProcAddress;
extern void *GetLastError;

#define goargs windows_goargs
void windows_goargs(void);

// Get start address of symbol data in memory.
void *get_symdat_addr(void);

// Call a Windows function with stdcall conventions.
void *stdcall_raw(void *fn, ...);

// Call a Windows function with stdcall conventions,
// and switch to os stack during the call.
void *stdcall(void *fn, int32 count, ...);

// Call stdcall Windows function StdcallParams.fn
// with params StdcallParams.args,
// followed immediately by GetLastError call.
// Both return values are returned in StdcallParams.r and
// StdcallParams.err. Will use os stack during the call.
typedef struct StdcallParams StdcallParams;
struct StdcallParams
{
	void	*fn;
	uintptr args[9];
	uintptr	r;
	uintptr	err;
};
void call_syscall(void *args);
void syscall(StdcallParams *p);