~ubuntu-wine/ubuntu/lucid/wine1.2/wine1.2+winepulse

« back to all changes in this revision

Viewing changes to dlls/ntdll/thread.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-02-02 11:15:03 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100202111503-w4ayji21ei1ginjr
Tags: 1.1.37-0ubuntu1
* New upstream release
  - A number of fixes in AVI file support.
  - Several MSXML improvements.
  - A few MSI fixes.
  - Various bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
    void                           *entry_arg;
58
58
};
59
59
 
 
60
static PEB *peb;
60
61
static PEB_LDR_DATA ldr;
61
62
static RTL_USER_PROCESS_PARAMETERS params;  /* default parameters if no parent */
62
63
static WCHAR current_dir[MAX_NT_PATH_LENGTH];
183
184
}
184
185
 
185
186
/***********************************************************************
186
 
 *           get_global_flag
187
 
 *
188
 
 * This is called before the process heap is created,
189
 
 * but after the connection to the server is established.
190
 
 * No windows heap allocation is permitted.
191
 
 */
192
 
static DWORD get_global_flag(void)
193
 
{
194
 
    static const WCHAR sessionman_keyW[] = {'M','a','c','h','i','n','e','\\',
195
 
                                            'S','y','s','t','e','m','\\',
196
 
                                            'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
197
 
                                            'C','o','n','t','r','o','l','\\',
198
 
                                            'S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r',0};
199
 
    static const WCHAR global_flagW[] = {'G','l','o','b','a','l','F','l','a','g',0};
200
 
    OBJECT_ATTRIBUTES attr;
201
 
    UNICODE_STRING nameW, valueW;
202
 
    HANDLE hkey;
203
 
    char tmp[32];
204
 
    DWORD count;
205
 
    KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)tmp;
206
 
    NTSTATUS status;
207
 
 
208
 
    attr.Length = sizeof(attr);
209
 
    attr.RootDirectory = 0;
210
 
    attr.ObjectName = &nameW;
211
 
    attr.Attributes = 0;
212
 
    attr.SecurityDescriptor = NULL;
213
 
    attr.SecurityQualityOfService = NULL;
214
 
    RtlInitUnicodeString( &nameW, sessionman_keyW );
215
 
 
216
 
    status = NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr );
217
 
    if (status != STATUS_SUCCESS)
218
 
        return 0;
219
 
 
220
 
    RtlInitUnicodeString( &valueW, global_flagW );
221
 
    status = NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count );
222
 
    if (status != STATUS_SUCCESS)
223
 
        return 0;
224
 
 
225
 
    /* Some documents say this can be a string, so handle either type */
226
 
    if (info->Type == REG_DWORD)
227
 
        return *(DWORD *)info->Data;
228
 
    if (info->Type == REG_SZ)
229
 
        return strtol((char *)info->Data, NULL, 16);
230
 
    return 0;
231
 
}
232
 
 
233
 
/***********************************************************************
234
187
 *           thread_init
235
188
 *
236
189
 * Setup the initial thread.
239
192
 */
240
193
HANDLE thread_init(void)
241
194
{
242
 
    PEB *peb;
243
195
    TEB *teb;
244
196
    void *addr;
245
197
    SIZE_T size, info_size;
310
262
    server_init_process();
311
263
    info_size = server_init_thread( peb );
312
264
 
313
 
    /* retrieve the global flags settings from the registry */
314
 
    peb->NtGlobalFlag = get_global_flag();
315
 
 
316
265
    /* create the process heap */
317
266
    if (!(peb->ProcessHeap = RtlCreateHeap( HEAP_GROWABLE, NULL, 0, 0, NULL, NULL )))
318
267
    {
573
522
}
574
523
 
575
524
 
 
525
/******************************************************************************
 
526
 *              RtlGetNtGlobalFlags   (NTDLL.@)
 
527
 */
 
528
ULONG WINAPI RtlGetNtGlobalFlags(void)
 
529
{
 
530
    if (!peb) return 0;  /* init not done yet */
 
531
    return peb->NtGlobalFlag;
 
532
}
 
533
 
 
534
 
576
535
/***********************************************************************
577
536
 *              NtOpenThread   (NTDLL.@)
578
537
 *              ZwOpenThread   (NTDLL.@)