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