Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/krb5/src/windows/leashdll/winerr.c
34914 views
1
/* WINERR.C
2
3
Jason Hunter
4
8/2/94
5
DCNS/IS MIT
6
7
8
Contains the error functions for leash and kerberos. Prints out keen windows
9
error messages in english.
10
11
*/
12
13
#include <stdio.h>
14
15
// Private Include files
16
#include "leashdll.h"
17
#include <leashwin.h>
18
19
// Global Variables.
20
static long lsh_errno;
21
static char *err_context; /* error context */
22
extern int (*Lcom_err)(LPSTR,long,LPSTR,...);
23
extern LPSTR (*Lerror_message)(long);
24
extern LPSTR (*Lerror_table_name)(long);
25
26
#ifdef WIN16
27
#define UNDERSCORE "_"
28
#else
29
#define UNDERSCORE
30
#endif
31
32
HWND GetRootParent (HWND Child)
33
{
34
HWND Last;
35
while (Child)
36
{
37
Last = Child;
38
Child = GetParent (Child);
39
}
40
return Last;
41
}
42
43
44
LPSTR err_describe(LPSTR buf, long code)
45
{
46
LPSTR cp, com_err_msg;
47
int offset;
48
long table_num;
49
char *etype;
50
51
offset = (int) (code & 255);
52
table_num = code - offset;
53
com_err_msg = Lerror_message(code);
54
55
lstrcpy(buf, com_err_msg);
56
return buf;
57
58
59
////Is this needed at all after the return above?
60
cp = buf;
61
if(com_err_msg != buf)
62
lstrcpy(buf, com_err_msg);
63
cp = buf + lstrlen(buf);
64
*cp++ = '\n';
65
etype = Lerror_table_name(table_num);
66
wsprintf((LPSTR) cp, (LPSTR) "(%s error %d"
67
#ifdef DEBUG_COM_ERR
68
" (absolute error %ld)"
69
#endif
70
")", etype, offset
71
//")\nPress F1 for help on this error.", etype, offset
72
#ifdef DEBUG_COM_ERR
73
, code
74
#endif
75
);
76
77
return (LPSTR)buf;
78
}
79
80