The R Project SVN R

Rev

Rev 84952 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 84952 Rev 90103
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
-
 
3
 *  Copyright (C) 1997-2026 The R Core Team
3
 *  Copyright (C) 1995-1996 Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1995-1996 Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1997-2023 The R Core Team
-
 
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 128... Line 128...
128
    return(f);
128
    return(f);
129
}
129
}
130
 
130
 
131
static void R_getDLLError(char *buf, int len)
131
static void R_getDLLError(char *buf, int len)
132
{
132
{
133
    LPSTR lpMsgBuf, p;
133
    LPSTR lpMsgBuf;
134
    char *q;
-
 
135
    FormatMessage(
134
    FormatMessage(
136
	FORMAT_MESSAGE_ALLOCATE_BUFFER |
135
	FORMAT_MESSAGE_ALLOCATE_BUFFER |
137
	FORMAT_MESSAGE_FROM_SYSTEM |
136
	FORMAT_MESSAGE_FROM_SYSTEM |
138
	FORMAT_MESSAGE_IGNORE_INSERTS,
137
	FORMAT_MESSAGE_IGNORE_INSERTS,
139
	NULL,
138
	NULL,
Line 142... Line 141...
142
	(LPSTR) &lpMsgBuf,
141
	(LPSTR) &lpMsgBuf,
143
	0,
142
	0,
144
	NULL
143
	NULL
145
	);
144
	);
146
    strcpy(buf, "LoadLibrary failure:  ");
145
    strcpy(buf, "LoadLibrary failure:  ");
-
 
146
    char
147
    q = buf + strlen(buf);
147
	*q = buf + strlen(buf),
-
 
148
	*e = buf + len - 1;
148
    /* It seems that Win 7 returns error messages with CRLF terminators */
149
    /* It seems that Win 7 returns error messages with CRLF terminators */
149
    for (p = lpMsgBuf; *p; p++) if (*p != '\r') *q++ = *p;
150
    for (LPSTR p = lpMsgBuf; *p && q < e; p++) if (*p != '\r') *q++ = *p;
150
    LocalFree(lpMsgBuf);
151
    LocalFree(lpMsgBuf);
-
 
152
    *e = '\0';
151
}
153
}
152
 
154
 
153
/* Retuns the number of bytes (excluding the terminator) needed in buf.
155
/* Returns the number of bytes (excluding the terminator) needed in buf.
154
   When bufsize is at least that + 1, buf contains the result
156
   When bufsize is at least that + 1, buf contains the result
155
   with terminator. */
157
   with terminator. */
156
static size_t
158
static size_t
157
GetFullDLLPath(SEXP call, char *buf, size_t bufsize, const char *path)
159
GetFullDLLPath(SEXP call, char *buf, size_t bufsize, const char *path)
158
{
160
{