| 1 | /* $Id: misc.cpp,v 1.1 1999-05-24 20:19:56 ktk Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * PE2LX ascii to unicode conversion
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 10 | *
|
|---|
| 11 | */
|
|---|
| 12 | #define INCL_DOSFILEMGR /* File Manager values */
|
|---|
| 13 | #define INCL_DOSERRORS /* DOS Error values */
|
|---|
| 14 | #define INCL_DOSPROCESS /* DOS Process values */
|
|---|
| 15 | #define INCL_DOSMISC /* DOS Miscellanous values */
|
|---|
| 16 | #define INCL_WIN
|
|---|
| 17 | #include <os2.h>
|
|---|
| 18 | #include <stdio.h>
|
|---|
| 19 | #include <string.h>
|
|---|
| 20 | #include <stdlib.h>
|
|---|
| 21 | #include <iostream.h>
|
|---|
| 22 | #include <string.h>
|
|---|
| 23 | #include "pefile.h"
|
|---|
| 24 | #include "lx.h"
|
|---|
| 25 | #include "misc.h"
|
|---|
| 26 | #include <versionos2.h> /*PLF Wed 98-03-18 01:47:26*/
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | //******************************************************************************
|
|---|
| 30 | //******************************************************************************
|
|---|
| 31 | char *UnicodeToAscii(int length, WCHAR *NameString)
|
|---|
| 32 | {
|
|---|
| 33 | static char asciistring[256];
|
|---|
| 34 | int i;
|
|---|
| 35 |
|
|---|
| 36 | if(length >= 255) length = 255;
|
|---|
| 37 | for(i=0;i<length;i++) {
|
|---|
| 38 | asciistring[i] = NameString[i] & 0xFF;
|
|---|
| 39 | }
|
|---|
| 40 | asciistring[length] = 0;
|
|---|
| 41 | return(asciistring);
|
|---|
| 42 | }
|
|---|
| 43 | //******************************************************************************
|
|---|
| 44 | //******************************************************************************
|
|---|
| 45 | int UniStrlen(WCHAR *wstring)
|
|---|
| 46 | {
|
|---|
| 47 | int i = 0;
|
|---|
| 48 |
|
|---|
| 49 | while(wstring[i] != 0) i++;
|
|---|
| 50 | return(i);
|
|---|
| 51 | }
|
|---|
| 52 | //******************************************************************************
|
|---|
| 53 | //******************************************************************************
|
|---|
| 54 | char *UnicodeToAscii(WCHAR *wstring)
|
|---|
| 55 | {
|
|---|
| 56 | static char astring[512];
|
|---|
| 57 | int i;
|
|---|
| 58 |
|
|---|
| 59 | memset(astring, 0, sizeof(astring));
|
|---|
| 60 |
|
|---|
| 61 | for(i=0;i<=UniStrlen(wstring);i++) { //including 0 terminator
|
|---|
| 62 | astring[i] = (UCHAR)wstring[i];
|
|---|
| 63 | }
|
|---|
| 64 | return(astring);
|
|---|
| 65 | }
|
|---|
| 66 | //******************************************************************************
|
|---|
| 67 | //******************************************************************************
|
|---|
| 68 | void UpCase(char *mixedcase)
|
|---|
| 69 | {
|
|---|
| 70 | int i;
|
|---|
| 71 |
|
|---|
| 72 | for(i=0;i<strlen(mixedcase);i++) {
|
|---|
| 73 | if(mixedcase[i] >= 'a' && mixedcase[i] <= 'z') {
|
|---|
| 74 | mixedcase[i] += 'A' - 'a';
|
|---|
| 75 | }
|
|---|
| 76 | }
|
|---|
| 77 | }
|
|---|
| 78 | //******************************************************************************
|
|---|
| 79 | //******************************************************************************
|
|---|