1 : /*
2 : * Copyright (c) 2014 The Native Client Authors. All rights reserved.
3 : * Use of this source code is governed by a BSD-style license that can be
4 : * found in the LICENSE file.
5 : */
6 :
7 : #include <windows.h>
8 :
9 : #include "native_client/src/shared/platform/nacl_error.h"
10 :
11 0 : int NaClGetLastErrorString(char* buffer, size_t length) {
12 0 : DWORD error = GetLastError();
13 : return FormatMessageA(
14 : FORMAT_MESSAGE_FROM_SYSTEM |
15 : FORMAT_MESSAGE_IGNORE_INSERTS,
16 : NULL,
17 : error,
18 : MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
19 : buffer,
20 : (DWORD) ((64 * 1024 < length) ? 64 * 1024 : length),
21 0 : NULL) ? 0 : -1;
22 0 : }
|