source: trunk/src/pe2lx/misc.cpp@ 46

Last change on this file since 46 was 46, checked in by sandervl, 26 years ago

* empty log message *

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