Example #1
0
static void test_start_trace(void)
{
    const char sessionname[] = "wine";
    const char filepath[] = "wine.etl";
    const char filepath2[] = "eniw.etl";
    EVENT_TRACE_PROPERTIES *properties;
    TRACEHANDLE handle;
    LONG buffersize;
    LONG ret;

    buffersize = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname) + sizeof(filepath);
    properties = (EVENT_TRACE_PROPERTIES *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buffersize);
    properties->Wnode.BufferSize = buffersize;
    properties->Wnode.Flags = WNODE_FLAG_TRACED_GUID;
    properties->LogFileMode = EVENT_TRACE_FILE_MODE_NONE;
    properties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES);
    properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname);
    strcpy((char *)properties + properties->LogFileNameOffset, filepath);

    properties->Wnode.BufferSize = 0;
    ret = StartTraceA(&handle, sessionname, properties);
    todo_wine
    ok(ret == ERROR_BAD_LENGTH ||
       ret == ERROR_INVALID_PARAMETER, /* XP and 2k3 */
       "Expected ERROR_BAD_LENGTH, got %d\n", ret);
    properties->Wnode.BufferSize = buffersize;

    ret = StartTraceA(&handle, "this name is too long", properties);
    todo_wine
    ok(ret == ERROR_BAD_LENGTH, "Expected ERROR_BAD_LENGTH, got %d\n", ret);

    ret = StartTraceA(&handle, sessionname, NULL);
    todo_wine
    ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);

    ret = StartTraceA(NULL, sessionname, properties);
    todo_wine
    ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);

    properties->LogFileNameOffset = 1;
    ret = StartTraceA(&handle, sessionname, properties);
    todo_wine
    ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
    properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname);

    properties->LoggerNameOffset = 1;
    ret = StartTraceA(&handle, sessionname, properties);
    todo_wine
    ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
    properties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES);

    properties->LogFileMode = EVENT_TRACE_FILE_MODE_SEQUENTIAL | EVENT_TRACE_FILE_MODE_CIRCULAR;
    ret = StartTraceA(&handle, sessionname, properties);
    todo_wine
    ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
    properties->LogFileMode = EVENT_TRACE_FILE_MODE_NONE;
    /* XP creates a file we can't delete, so change the filepath to something else */
    strcpy((char *)properties + properties->LogFileNameOffset, filepath2);

    properties->Wnode.Guid = SystemTraceControlGuid;
    ret = StartTraceA(&handle, sessionname, properties);
    todo_wine
    ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret);
    memset(&properties->Wnode.Guid, 0, sizeof(properties->Wnode.Guid));

    properties->LogFileNameOffset = 0;
    ret = StartTraceA(&handle, sessionname, properties);
    todo_wine
    ok(ret == ERROR_BAD_PATHNAME, "Expected ERROR_BAD_PATHNAME, got %d\n", ret);
    properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname);

    ret = StartTraceA(&handle, sessionname, properties);
    if (ret == ERROR_ACCESS_DENIED)
    {
        skip("need admin rights\n");
        goto done;
    }
    ok(ret == ERROR_SUCCESS, "Expected success, got %d\n", ret);

    ret = StartTraceA(&handle, sessionname, properties);
    todo_wine
    ok(ret == ERROR_ALREADY_EXISTS ||
       ret == ERROR_SHARING_VIOLATION, /* 2k3 */
       "Expected ERROR_ALREADY_EXISTS, got %d\n", ret);

    /* clean up */
    ControlTraceA(handle, sessionname, properties, EVENT_TRACE_CONTROL_STOP);
done:
    HeapFree(GetProcessHeap(), 0, properties);
    DeleteFileA(filepath);
}
Example #2
0
/******************************************************************************
 * FlushTraceA [ADVAPI32.@]
 */
ULONG WINAPI FlushTraceA ( TRACEHANDLE hSession, LPCSTR SessionName, PEVENT_TRACE_PROPERTIES Properties )
{
    return ControlTraceA( hSession, SessionName, Properties, EVENT_TRACE_CONTROL_FLUSH );
}
Example #3
0
// address: 0x1310109b
void _start(__size32 param1, __size32 param2, short param3, short param4, char param5, unsigned char param6) {
    char al; 		// r8
    short ax; 		// r0
    unsigned char dl; 		// r10
    short dx; 		// r2
    __size32 eax; 		// r24
    void *eax_1; 		// r24{29}
    __size32 eax_2; 		// r24{175}
    unsigned char *eax_3; 		// r24{450}
    unsigned char *eax_4; 		// r24{342}
    __size32 ebp; 		// r29
    __size32 ebx; 		// r27
    __size32 ebx_1; 		// r27{231}
    int ebx_2; 		// r27{424}
    int ecx; 		// r25
    unsigned int ecx_2; 		// r25{101}
    int edx; 		// r26
    void *edx_1; 		// r26
    __size32 esi; 		// r30
    int esp; 		// r28
    union { void * x89; unsigned int x90; } local10; 		// m[esp - 820]
    __size32 local11; 		// m[esp - 816]
    __size32 *local12; 		// m[esp - 812]
    __size8 *local14; 		// m[esp - 804]
    __size32 local15; 		// m[esp - 28]
    int local16; 		// m[esp - 0x2388]
    unsigned int local17; 		// m[esp - 828]
    void *local18; 		// m[esp - 0x2390]
    union { void * x143; int x144; } local19; 		// m[esp - 36]
    int local20; 		// m[esp - 804]
    void *local21; 		// m[esp - 808]
    int local22; 		// m[esp - 812]
    unsigned char *local23; 		// m[esp - 12]
    __size32 local24; 		// m[esp - 0x2384]
    void *local25; 		// m[esp - 612]
    unsigned int local26; 		// m[esp - 8]
    int local27; 		// m[esp - 24]
    unsigned int local71; 		// m[esp - 8]{602}
    unsigned char *local74; 		// eax_4{570}
    union { void * x145; unsigned int x146; } local75; 		// local14{608}
    union { void * x147; unsigned int x148; } local76; 		// local12{610}
    unsigned char *local77; 		// eax_3{585}
    union { int x97; void * x98; } local78; 		// edx{587}
    unsigned int local79; 		// local26{618}
    __size32 *local9; 		// m[esp - 824]

    AddAccessDeniedAce();
    eax_1 = SafeArrayGetUBound();
    BuildExplicitAccessWithNameA();
    BaseInitAppcompatCacheSupport();
    eax = *(eax_1 - 0x6cf5e057);
    ax = proc1(&eax, esp - 572, 4, &param2, 0, &24, param3, param4, param5, param6); /* Warning: also results in dx, al */
    SetErrorMode();
    BaseInitAppcompatCacheSupport();
    ecx_2 = *(eax_1 - 0x6cf5e053);
    ax = proc1(&ecx_2, (esp - 604), 4, &param2, 4, &24, ax, dx, al, (unsigned char) esp - 604); /* Warning: also results in dx, al, dl */
    ecx = *(eax_1 - 0x6cf5e04f);
    BaseDumpAppcompatCache();
    ax = proc1(&ecx, esp - 28, 4, &param2, 8, &24, ax, dx, al, dl); /* Warning: also results in dx, al, dl */
    eax_2 = GetModuleHandleA();
    AdjustTokenGroups();
    ControlTraceA();
    BuildTrusteeWithObjectsAndNameA();
    ebx_1 = *(eax_1 - 0x6cf5e04b);
    ax = proc1(&ebx_1, esp - 40, 4, &param2, 12, &24, ax, dx, al, dl); /* Warning: also results in dx, al */
    local15 = ebx_1 + eax_2;
    ebx = *(eax_1 - 0x6cf5e047);
    local16 = ebx;
    local9 = esp - 0x2388;
    ax = proc1(&ebx, (esp - 0x2398), 4, &param2, 16, &24, ax, dx, al, (unsigned char) eax_1 - 0x6cf5e047); /* Warning: also results in dx, al */
    local18 = 20;
    local19 = eax_1 - 0x6cf5e043;
    dl = (unsigned char) ecx;
    local20 = 64;
    local21 = 0x3000;
    esi = ecx * 8 + ecx_2 + 12;
    local22 = esi + eax;
    local11 = 0;
    eax_4 = VirtualAlloc(0, esi + eax, 0x3000, 64); /* Warning: also results in edx */
    local74 = eax_4;
    local75 = local20;
    local76 = local22;
    ecx = ebx_1 + eax_2 + ecx * 8 + 12;
    local23 = ecx;
    local24 = ecx * 8 + 12;
    local25 = ecx * 8 + 12;
    local26 = 0;
    local27 = 0;
    for(;;) {
        eax_4 = local74;
        local71 = local26;
        local14 = local75;
        local12 = local76;
        local77 = eax_4;
        local78 = edx;
        local79 = local71;
        if (local25 != local16) {
            goto L0;
        }
        local26 = local71 + 1;
        local79 = local26;
        if (local26 == ecx) {
            ebx = eax_4 - ecx * 8 - 12;
            esi = proc1(eax_4, ebx, ecx_2, &param1, ecx * 8 + 12, &24, ax, dx, al, dl); /* Warning: also results in ax, dx, al, dl, edx */
            (*eax_4 + 0xf50)(local18, local16, local24, pc, eax_4 + ecx_2, eax_4, eax, ecx_2, esp - 564, esp, (esp + 4), (esp + 4), 0x9c000, 0, 0xc000000, 0x10c0, 0x90000000, 272, 0xb200000, 0, 392, 0, 0, 0x4400, 0x80000000, 0x78000000, 0, 0, 0xbc0, (esp + 4), 0x10000, 0xe00000, 0, 0x800, 0, 0x28c0000, 0x900, 0x2800000, 0x4a00000, 0x2600, 0, eax_4 + 0xf50, eax_4 + 0xf50, local25, eax_4, ecx_2, eax_2 + 0x1000, eax_1 - 0x6cf5e057, eax, param1, 24, 67, 28, -75, -19, ecx * 8 + 12, esp, local19, eax_2, local15, local27, ecx, param2, local23, local71 + 1, ebp, ax, dx, al, dl, eax_4 + ecx_2, eax_4, edx, eax, esp - 4, esi, eax_4 + 0xf50, ADDFLAGS32(eax_4, ecx_2, eax_4 + ecx_2), ADDFLAGS32(eax_4, ecx_2, eax_4 + ecx_2), ADDFLAGS32(eax_4, ecx_2, eax_4 + ecx_2));
            return;
        }
        ecx = *local19;
        ebx = esp - local18 - 28;
        ax = proc1(&ecx, ebx, 4, &param2, local18, &24, ax, dx, al, (unsigned char) esp - 28); /* Warning: also results in dx, al */
        local15 = ecx + eax_2;
        local18 += 4;
        local19 += 4;
        ebx_2 = *local19;
        local16 = ebx_2;
        local14 = esp - 564;
        local21 = local18;
        local12 = esp - 16;
        local11 = 4;
        ebx = esp - local18 - 0x2388;
        local10 = ebx;
        local9 = esp - 0x2388;
        eax_3 = proc1(&ebx_2, ebx, 4, &param2, local18, &24, ax, dx, al, (unsigned char) esp - 0x2388); /* Warning: also results in ax, dx, al */
        local77 = eax_3;
        edx_1 = local18 + 4;
        local18 += 4;
        local19 += 4;
        local25 = 0;
        local23 = ecx + eax_2;
        local78 = edx_1;
L0:
        eax_3 = local77;
        edx = local78;
        local26 = local79;
        ebx = eax_4 + local27;
        dl = *local23;
        edx = edx >> 8 & 0xffffff | (dl);
        *(unsigned char*)ebx = dl;
        local23++;
        local27++;
        local25++;
        local24++;
        local74 = eax_3;
        local75 = local14;
        local76 = local12;
    }
}