sysres.c 3.05 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2 3 4 5 6
/*
 * System resources loading
 *
 * Copyright 1995 Alexandre Julliard
 */

7 8
#include "winbase.h"
#include "wine/winbase16.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
9 10 11
#include "global.h"
#include "options.h"
#include "resource.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
12
#include "wrc_rsc.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
13

Alexandre Julliard's avatar
Alexandre Julliard committed
14 15 16 17 18 19 20
extern const wrc_resource32_t * const sysres_En_ResTable[];
extern const wrc_resource32_t * const sysres_Es_ResTable[];
extern const wrc_resource32_t * const sysres_De_ResTable[];
extern const wrc_resource32_t * const sysres_No_ResTable[];
extern const wrc_resource32_t * const sysres_Fr_ResTable[];
extern const wrc_resource32_t * const sysres_Fi_ResTable[];
extern const wrc_resource32_t * const sysres_Da_ResTable[];
21
extern const wrc_resource32_t * const sysres_Cs_ResTable[];
Alexandre Julliard's avatar
Alexandre Julliard committed
22 23 24 25 26
extern const wrc_resource32_t * const sysres_Eo_ResTable[];
extern const wrc_resource32_t * const sysres_It_ResTable[];
extern const wrc_resource32_t * const sysres_Ko_ResTable[];
extern const wrc_resource32_t * const sysres_Hu_ResTable[];
extern const wrc_resource32_t * const sysres_Pl_ResTable[];
27 28
extern const wrc_resource32_t * const sysres_Pt_ResTable[];
extern const wrc_resource32_t * const sysres_Sv_ResTable[];
Alexandre Julliard's avatar
Alexandre Julliard committed
29
extern const wrc_resource32_t * const sysres_Ca_ResTable[];
30
extern const wrc_resource32_t * const sysres_Nl_ResTable[];
31
extern const wrc_resource32_t * const sysres_Ru_ResTable[];
32
extern const wrc_resource32_t * const sysres_Wa_ResTable[];
Alexandre Julliard's avatar
Alexandre Julliard committed
33

Alexandre Julliard's avatar
Alexandre Julliard committed
34
static const wrc_resource32_t * const * SYSRES_Resources[] =
Alexandre Julliard's avatar
Alexandre Julliard committed
35
{
Alexandre Julliard's avatar
Alexandre Julliard committed
36 37 38 39 40 41 42
    sysres_En_ResTable,  /* LANG_En */
    sysres_Es_ResTable,  /* LANG_Es */
    sysres_De_ResTable,  /* LANG_De */
    sysres_No_ResTable,  /* LANG_No */
    sysres_Fr_ResTable,  /* LANG_Fr */
    sysres_Fi_ResTable,  /* LANG_Fi */
    sysres_Da_ResTable,  /* LANG_Da */
43
    sysres_Cs_ResTable,  /* LANG_Cs */
Alexandre Julliard's avatar
Alexandre Julliard committed
44 45 46 47 48
    sysres_Eo_ResTable,  /* LANG_Eo */
    sysres_It_ResTable,  /* LANG_It */
    sysres_Ko_ResTable,  /* LANG_Ko */
    sysres_Hu_ResTable,  /* LANG_Hu */
    sysres_Pl_ResTable,  /* LANG_Pl */
49 50
    sysres_Pt_ResTable,  /* LANG_Pt */
    sysres_Sv_ResTable,  /* LANG_Sv */
51
    sysres_Ca_ResTable,  /* LANG_Ca */
52
    sysres_Nl_ResTable,  /* LANG_Nl */
53 54
    sysres_Ru_ResTable,  /* LANG_Ru */
    sysres_Wa_ResTable   /* LANG_Wa */
Alexandre Julliard's avatar
Alexandre Julliard committed
55 56 57
};


Alexandre Julliard's avatar
Alexandre Julliard committed
58 59 60 61 62 63 64
/***********************************************************************
 *           SYSRES_GetResourcePtr
 *
 * Return a pointer to a system resource.
 */
LPCVOID SYSRES_GetResPtr( SYSTEM_RESOURCE id )
{
Alexandre Julliard's avatar
Alexandre Julliard committed
65
    return SYSRES_Resources[Options.language][id]->data;
Alexandre Julliard's avatar
Alexandre Julliard committed
66 67 68
}


Alexandre Julliard's avatar
Alexandre Julliard committed
69 70 71 72 73
/***********************************************************************
 *           SYSRES_LoadResource
 *
 * Create a global memory block for a system resource.
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
74
HGLOBAL16 SYSRES_LoadResource( SYSTEM_RESOURCE id )
Alexandre Julliard's avatar
Alexandre Julliard committed
75
{
Alexandre Julliard's avatar
Alexandre Julliard committed
76
    const wrc_resource32_t *resPtr;
Alexandre Julliard's avatar
Alexandre Julliard committed
77 78

    resPtr = SYSRES_Resources[Options.language][id];
Alexandre Julliard's avatar
Alexandre Julliard committed
79
    return GLOBAL_CreateBlock( GMEM_FIXED, resPtr->data, resPtr->datasize,
80
			       GetCurrentPDB16(), FALSE, FALSE, TRUE, NULL );
Alexandre Julliard's avatar
Alexandre Julliard committed
81 82 83 84 85 86 87 88
}


/***********************************************************************
 *           SYSRES_FreeResource
 *
 * Free a global memory block for a system resource.
 */
Alexandre Julliard's avatar
Alexandre Julliard committed
89
void SYSRES_FreeResource( HGLOBAL16 handle )
Alexandre Julliard's avatar
Alexandre Julliard committed
90 91 92
{
    GLOBAL_FreeBlock( handle );
}