Esempio n. 1
0
static BOOL InitOpenFileName(HWND hWnd, OPENFILENAME* pofn)
{
    FILTERPAIR FilterPairs[3];
    static TCHAR Filter[1024];

    memset(pofn, 0, sizeof(OPENFILENAME));
    pofn->lStructSize = sizeof(OPENFILENAME);
    pofn->hwndOwner = hWnd;
    pofn->hInstance = hInst;

    /* create filter string */
    FilterPairs[0].DisplayID = IDS_FLT_REGFILES;
    FilterPairs[0].FilterID = IDS_FLT_REGFILES_FLT;
    FilterPairs[1].DisplayID = IDS_FLT_REGEDIT4;
    FilterPairs[1].FilterID = IDS_FLT_REGEDIT4_FLT;
    FilterPairs[2].DisplayID = IDS_FLT_ALLFILES;
    FilterPairs[2].FilterID = IDS_FLT_ALLFILES_FLT;
    BuildFilterStrings(Filter, FilterPairs, sizeof(FilterPairs) / sizeof(FILTERPAIR));

    pofn->lpstrFilter = Filter;
    pofn->lpstrFile = FileNameBuffer;
    pofn->nMaxFile = _MAX_PATH;
    pofn->lpstrFileTitle = FileTitleBuffer;
    pofn->nMaxFileTitle = _MAX_PATH;
    pofn->Flags = OFN_HIDEREADONLY;
    pofn->lpstrDefExt = TEXT("reg");
    return TRUE;
}
Esempio n. 2
0
static BOOL LoadHive(HWND hWnd)
{
    OPENFILENAME ofn;
    WCHAR Caption[128];
    LPCWSTR pszKeyPath;
    WCHAR xPath[LOADHIVE_KEYNAMELENGTH];
    HKEY hRootKey;
    WCHAR Filter[1024];
    FILTERPAIR filter;
    /* get the item key to load the hive in */
    pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
    /* initialize the "open file" dialog */
    InitOpenFileName(hWnd, &ofn);
    /* build the "All Files" filter up */
    filter.DisplayID = IDS_FLT_ALLFILES;
    filter.FilterID = IDS_FLT_ALLFILES_FLT;
    BuildFilterStrings(Filter, &filter, 1);
    ofn.lpstrFilter = Filter;
    /* load and set the caption and flags for dialog */
    LoadStringW(hInst, IDS_LOAD_HIVE, Caption, COUNT_OF(Caption));
    ofn.lpstrTitle = Caption;
    ofn.Flags |= OFN_ENABLESIZING;
    /*    ofn.lCustData = ;*/
    /* now load the hive */
    if (GetOpenFileName(&ofn))
    {
        if (DialogBoxParamW(hInst, MAKEINTRESOURCEW(IDD_LOADHIVE), hWnd,
                            &LoadHive_KeyNameInHookProc, (LPARAM)xPath))
        {
            LONG regLoadResult;

            /* Enable the 'restore' privilege, load the hive, disable the privilege */
            EnablePrivilege(SE_RESTORE_NAME, NULL, TRUE);
            regLoadResult = RegLoadKeyW(hRootKey, xPath, ofn.lpstrFile);
            EnablePrivilege(SE_RESTORE_NAME, NULL, FALSE);

            if(regLoadResult == ERROR_SUCCESS)
            {
                /* refresh tree and list views */
                RefreshTreeView(g_pChildWnd->hTreeWnd);
                pszKeyPath = GetItemPath(g_pChildWnd->hTreeWnd, 0, &hRootKey);
                RefreshListView(g_pChildWnd->hListWnd, hRootKey, pszKeyPath);
            }
            else
            {
                ErrorMessageBox(hWnd, Caption, regLoadResult);
                return FALSE;
            }
        }
    }
    else
    {
        CheckCommDlgError(hWnd);
    }
    return TRUE;
}
Esempio n. 3
0
/// <summary>
/// Initializes the parameters of the request from a set of pre-parsed parameters
/// (ie, from an HTTP GET request)
/// </summary>
/// <param name="requestParams">Input
/// This contains all the parameters of the request.
/// </param>
/// <returns>
/// nothing
/// </returns>
WfsGetFeatureParams::WfsGetFeatureParams(MgOgcWfsServer& oServer/*MgHttpRequestParam* params*/)
:   m_maxFeatures(-1)
,   m_filterStrings(new MgStringCollection())
,   m_featureTypeList(new MgStringCollection())
,   m_pNamespaces(new MgXmlNamespaceManager())
{

    // Get the required properties
    STRING propertyNames = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsPropertyName);
    m_requiredPropertiesList = GetParenthesisedList(propertyNames);

    // Get the requested feature types
    STRING featureTypes = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsTypeName);
    if(featureTypes.length() > 0)
    {
        m_featureTypeList = MgStringCollection::ParseCollection(featureTypes, L",");
    }
    else
    {
        m_featureTypeList = NULL;
    }

    // Get the requested feature IDs
    STRING featureIds = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsFeatureId);

    // Get the requested filter
    STRING filters = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsFilter);

    // Get the requested bounding box
    STRING bbox = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsBbox);

    // Build the filter strings from the feature IDs, filters or bounding box
    BuildFilterStrings(filters, featureIds, bbox);

    // Get the requested SRS value
    m_srs = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsSrsName);
    if(m_srs.empty())
    {
        m_srs = GetSRSFromBbox(bbox);
    }

    // Get the SRS in WKT form
    STRING srsWkt;
    if(!m_srs.empty())
    {
        MgWmsMapUtil::SrsToWktMapping(oServer,m_srs,srsWkt);
        if(!srsWkt.empty())
        {
            m_srs = srsWkt;
        }
    }

    // Get the maximum number of features to return
    string maxFeaturesParam = MgUtil::WideCharToMultiByte(GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsMaxFeatures));
    if(maxFeaturesParam.length() > 0)
    {
        m_maxFeatures = atoi(maxFeaturesParam.c_str());
    }
    else
    {
        // Return all features by default
        m_maxFeatures = -1;
    }

    // Get the requested output format
    m_outputFormat = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsOutputFormat);

    // Get the wfs version
    m_version = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsVersion);

    // Get the sortby property name
    m_sortCriteria = GetRequestParameter(oServer,MgHttpResourceStrings::reqWfsSortBy);

}