1 | /*
|
---|
2 | *
|
---|
3 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
4 | *
|
---|
5 | */
|
---|
6 | /*
|
---|
7 | * Win32 Network apis
|
---|
8 | *
|
---|
9 | * Copyright 1998 Peter Fitzsimmons
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #define INCL_DOSEXCEPTIONS
|
---|
13 | #define INCL_DOSMEMMGR
|
---|
14 | #include <os2.h>
|
---|
15 | #include <pmwsock.h>
|
---|
16 | #include <stdlib.h>
|
---|
17 | #include <stdio.h>
|
---|
18 | #include <string.h>
|
---|
19 | #include "misc.h"
|
---|
20 | #include "unicode.h"
|
---|
21 |
|
---|
22 | //******************************************************************************
|
---|
23 | //******************************************************************************
|
---|
24 | BOOL WIN32API GetComputerNameA(LPSTR name, LPDWORD size)
|
---|
25 | {
|
---|
26 | #if 1 /*PLF Wed 98-03-18 23:38:28*/
|
---|
27 | //*plf removing need for wsock32 call.
|
---|
28 | // This should be done with UPM anyway.
|
---|
29 | return FALSE;
|
---|
30 | #else
|
---|
31 | if (-1==gethostname(name,*size))
|
---|
32 | return FALSE;
|
---|
33 |
|
---|
34 | *size = strlen(name);
|
---|
35 | return TRUE;
|
---|
36 | #endif
|
---|
37 | }
|
---|
38 | //******************************************************************************
|
---|
39 | //******************************************************************************
|
---|
40 | BOOL WIN32API GetComputerNameW(LPSTR name, LPDWORD size)
|
---|
41 | {
|
---|
42 | #if 1 /*PLF Wed 98-03-18 23:38:28*/
|
---|
43 | //*plf removing need for wsock32 call.
|
---|
44 | // This should be done with UPM anyway.
|
---|
45 | return FALSE;
|
---|
46 | #else
|
---|
47 | if (-1==OS2gethostname(name,*size))
|
---|
48 | return FALSE;
|
---|
49 | @@@PH do unicode conversion
|
---|
50 |
|
---|
51 | *size = strlen(name);
|
---|
52 | return TRUE;
|
---|
53 | #endif
|
---|
54 | }
|
---|
55 | //******************************************************************************
|
---|
56 | //******************************************************************************
|
---|
57 | BOOL WIN32API GetComputerName32W(LPWSTR name, LPDWORD size)
|
---|
58 | {
|
---|
59 | LPSTR nameA = (LPSTR)malloc(*size);
|
---|
60 | BOOL ret = GetComputerNameA(nameA,size);
|
---|
61 |
|
---|
62 | if (ret)
|
---|
63 | AsciiToUnicode(nameA, name);
|
---|
64 |
|
---|
65 | free(nameA);
|
---|
66 | /* FIXME : size correct? */
|
---|
67 | return ret;
|
---|
68 | }
|
---|
69 | //******************************************************************************
|
---|
70 | //******************************************************************************
|
---|
71 |
|
---|