summaryrefslogtreecommitdiff
path: root/src/inc/assemblyusagelogmanager.h
blob: 5fae606f56daad989f322eef99ea2f0b912e011d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//

#ifndef ASSEMBLY_USAGE_LOG_MANAGER_H
#define ASSEMBLY_USAGE_LOG_MANAGER_H

#include "assemblyusagelog.h"
#include "daccess.h"

class AssemblyUsageLogManager
{
public:

    class Config
    {
    public:
        LPCWSTR wszLogDir;
        unsigned int cLogBufferSize;
#ifdef FEATURE_APPX
        unsigned int uiLogRefreshInterval;
#endif
    };

    enum GENERATE_LOG_FLAGS
    {
        GENERATE_LOG_FLAGS_NONE = 0,
    };

    // we depend on static PODs being initialized to 0 which is why ASSEMBLY_USAGE_LOG_FLAGS_NONE is 0
    enum ASSEMBLY_USAGE_LOG_FLAGS : DWORD
    {
        ASSEMBLY_USAGE_LOG_FLAGS_NONE = 0,
        ASSEMBLY_USAGE_LOG_FLAGS_INITTED = 1,
        ASSEMBLY_USAGE_LOG_FLAGS_APPLOCALNGENDISABLED = 2,
    };
                                                                                                                                    
    static HRESULT Init(const Config *pConfig);
    static HRESULT GenerateLog(GENERATE_LOG_FLAGS flags);
    static HRESULT GetUsageLogForContext(LPCWSTR binder, LPCWSTR binderParameter, IAssemblyUsageLog **ppUsageLog);
    static HRESULT RegisterBinderWithUsageLog(UINT_PTR binderId, IAssemblyUsageLog *pUsageLog);
    static HRESULT UnRegisterBinderFromUsageLog(UINT_PTR binderId);
    static IAssemblyUsageLog *GetUsageLogForBinder(UINT_PTR binderId);
    static ASSEMBLY_USAGE_LOG_FLAGS GetUsageLogFlags();
    static HRESULT SetUsageLogFlag(ASSEMBLY_USAGE_LOG_FLAGS flag, BOOL);

private:
    SVAL_DECL(ASSEMBLY_USAGE_LOG_FLAGS, s_UsageLogFlags);
};

#endif /*  ASSEMBLY_USAGE_LOG_MANAGER_H */