summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/windows/winfile.h
blob: 82cbc886ed16815bf71c7d3c973db00284cdce8e (plain) (blame)
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
43
44
45
46
47
48
//============================================================
//
//  winfile.h - File access functions
//
//============================================================
#ifndef __WINFILE__
#define __WINFILE__

#include <winsock2.h>
#include "osdcore.h"

//============================================================
//  ENUM DEFINITIONS
//============================================================
enum
{
	WINFILE_FILE = 0,
	WINFILE_SOCKET
};

//============================================================
//  TYPE DEFINITIONS
//============================================================

struct _osd_file
{
	HANDLE		handle;
	SOCKET		socket;
	int			type;
	TCHAR		filename[1];
};

//============================================================
//  PROTOTYPES
//============================================================

bool win_init_sockets();
void win_cleanup_sockets();

bool win_check_socket_path(const char *path);
file_error win_open_socket(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize);
file_error win_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual);
file_error win_write_socket(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual);
file_error win_close_socket(osd_file *file);

file_error win_error_to_mame_file_error(DWORD error);

#endif //__WINFILE__