~siretart/ubuntu/raring/virtualbox-ose/bug.1101867

« back to all changes in this revision

Viewing changes to src/VBox/Runtime/r3/win/ldrNative-win.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: ldrNative-win.cpp $ */
 
1
/* $Id: ldrNative-win.cpp 35183 2010-12-16 13:59:44Z vboxsync $ */
2
2
/** @file
3
3
 * IPRT - Binary Image Loader, Win32 native.
4
4
 */
35
35
#include <iprt/path.h>
36
36
#include <iprt/err.h>
37
37
#include <iprt/alloca.h>
 
38
#include <iprt/string.h>
38
39
#include "internal/ldr.h"
39
40
 
40
41
 
41
 
int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle)
 
42
int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, PRTERRINFO pErrInfo)
42
43
{
43
44
    Assert(sizeof(*phHandle) >= sizeof(HMODULE));
 
45
    AssertReturn(fFlags == 0, VERR_INVALID_PARAMETER);
44
46
 
45
47
    /*
46
48
     * Do we need to add an extension?
50
52
        size_t cch = strlen(pszFilename);
51
53
        char *psz = (char *)alloca(cch + sizeof(".DLL"));
52
54
        if (!psz)
53
 
            return VERR_NO_MEMORY;
 
55
            return RTErrInfoSet(pErrInfo, VERR_NO_MEMORY, "alloca failed");
54
56
        memcpy(psz, pszFilename, cch);
55
57
        memcpy(psz + cch, ".DLL", sizeof(".DLL"));
56
58
        pszFilename = psz;
66
68
        return VINF_SUCCESS;
67
69
    }
68
70
 
69
 
    return RTErrConvertFromWin32(GetLastError());
 
71
    /*
 
72
     * Try figure why it failed to load.
 
73
     */
 
74
    DWORD dwErr = GetLastError();
 
75
    int   rc    = RTErrConvertFromWin32(dwErr);
 
76
    return RTErrInfoSetF(pErrInfo, rc, "GetLastError=%u", dwErr);
70
77
}
71
78
 
72
79