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

Last change on this file since 97 was 97, checked in by phaller, 26 years ago

Add: added cvs variable $Id$ to source files.

File size: 2.3 KB
Line 
1/* $Id: misc.cpp,v 1.3 1999-06-10 17:08:54 phaller 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//******************************************************************************
31char *UnicodeToAscii(int length, WCHAR *NameString)
32{
33static char asciistring[256];
34int 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//******************************************************************************
45int UniStrlen(WCHAR *wstring)
46{
47 int i = 0;
48
49 while(wstring[i] != 0) i++;
50 return(i);
51}
52//******************************************************************************
53//******************************************************************************
54char *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//******************************************************************************
68void 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//******************************************************************************
Note: See TracBrowser for help on using the repository browser.