How to delete IE addressbar history on Vista/Win7? - c++

First, here is a picture of what I see
http://img713.imageshack.us/img713/4797/iedrop.png
I need an solution to clear addressbar dropdawn, but not using ClearMyTracksByProcess or IE dialogs. I need to delete only a specific URL and all his traces.
I deleted manually all traces of that URL in:
Users\\AppData\Local\Microsoft\Windows\Temporary Internet Files*
Users\\AppData\Local\Microsoft\Windows\History*
Users\\Recent*
also that URL can be found in:
4) Users\\AppData\Local\Microsoft\Internet Explorer\Recovery\High
Now I made an BootTime program that searches for 8 and 16 bit charsets string in all my system disc files. URL wasn't found anywhere, but after logging and starting IE, the URL is still there. I suspect this is related to 4), but can't understand how.

Finally I found solution.
HRESULT CreateCatalogManager(ISearchCatalogManager **ppSearchCatalogManager)
{
*ppSearchCatalogManager = NULL;
ISearchManager *pSearchManager;
HRESULT hr = CoCreateInstance(CLSID_CSearchManager, NULL, CLSCTX_SERVER, IID_PPV_ARGS(&pSearchManager));
if (SUCCEEDED(hr))
{
hr = pSearchManager->GetCatalog(L"SystemIndex", ppSearchCatalogManager);
pSearchManager->Release();
}
return hr;
}
{
ISearchCatalogManager *pCatalogManager;
HRESULT hr = CreateCatalogManager(&pCatalogManager);
if (SUCCEEDED(hr))
{
pCatalogManager->Reset();
pCatalogManager->Release();
}
}

Address bar urls are stored in the TypedUrls registry key. See this project which claims to enum and delete them (I haven't tested it).
The History items in the dropdown are stored in the Url History database. Use IUrlHistoryStg::DeleteUrl().

Related

MkParseDisplayName returns invalid syntax

I'm struggling with something that should be simple, I want to create a moniker with a specific display name (e.g. "MyApplicationMnk")
I need this moniker to bind it to an EXE application registered in the Windows registry as LOCAL SERVER type to register it in the Running Object Table (aka. ROT)
the COM function MkParseDisplayName returns invalid syntax error, the only source I found that mentioned a solution to this issue doesn't work with me.
The code is as simple as the following
IMoniker* appmnk;
HRESULT hr;
CComPtr<IBindCtx> bct;
DWORD wctx = 0;
ULONG ulng = 0L;
CreateBindCtx(wctx, &bct);
OLECHAR dspnm = (wchar_t)"MyApplicationMnk";
LPCOLESTR dspnmptr = &dspnm;
hr = MkParseDisplayName(bct, dspnmptr, &ulng, &appmnk); // returns invalid syntax
.
.
//some code
.
.
appmnk->Release();
I've tried to insert the value directly like this
hr = MkParseDisplayName(bct, OLESTR("MyApplicationMnk"), &ulng, &appmnk);
and with the above-mentioned proposed solution like this
hr = MkParseDisplayName(bct, (wchar_t *)(_bstr_t)(char *)"MyApplicationMnk", &ulng, &appmnk);
I don't know what's wrong!, all the supplied types match what's said in the documentation.
Any help will be definitely appreciated.

rootElement->FindFirst(...) fails to find element seen by Inspect

I'm trying to locate a list item contained within the Services window (Start->Run->Services.msc) on Windows. The list item is named "Arc Service" and is easily found using Inspect, but my code fails to locate it. This being a relatively simple case, I feel I must be doing something wrong.
The code in question is:
VARIANT arcServiceNameVariant;
VariantInit(&arcServiceNameVariant);
arcServiceNameVariant.vt = VT_BSTR;
arcServiceNameVariant.bstrVal = L"Arc Service";
CComPtr<IUIAutomationCondition> arcServiceNameCondition;
hr = g_pAutomation->CreatePropertyCondition(UIA_NamePropertyId, arcServiceNameVariant, &arcServiceNameCondition.p);
if(SUCCEEDED(hr)) {
CComPtr<IUIAutomationElement> arcServiceElement;
hr = rootElement->FindFirst(TreeScope_Descendants, arcServiceNameCondition, &arcServiceElement.p);
if(SUCCEEDED(hr)) {
if(arcServiceElement.p) {
logInfo(L"Arc Service element found!");
}
} else {
logInfo(L"FindFirst failed!");
}
} else {
logInfo(L"Failed to create property condition!");
}
The "Arc Service element found!" branch is never entered.
Here are the details from Inspect describing the element:
Any assistance would be greatly appreciated. Thanks!
Quizzically it turns out that running my UIA client as Administrator sees the component, but running as the logged in user does not. For now I can elevate my process, but I'll continue to research the issue for a more detailed explanation.

How do I use the WIC API to read/write custom EXIF data?

I have gone through the documentation at:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee719799(v=vs.85).aspx
As context, I am trying to encode in the JPEG-XR format and I want to emulate GDI+'s SetPropertyItem, GetPropertyItem functionality.
I basically have 3 questions:
If I want to add a custom property to the exif header what is the correct query path?
Can I use a custom ID, say {ushort=1111} to identify it and how do I verify if an ID is already defined?
Is this the same as the id field of GdiPlus::PropertyItem?
For example, is the following valid:
PROPVARIANT value;
value.vt = VT_LPWSTR;
value.pwszVal= L"Metadata Test";
hr = piFrameQWriter->SetMetadataByName(L"/ifd/exif/{ushort=1111}");
This code block succeeds, but when I try to read back the same metadata using:
IWICMetadataQueryReader *pQueryReader = NULL;
if(SUCCEEDED(hr))
{
hr = piFrame->GetMetadataQueryReader(&pQueryReader);
}
if (SUCCEEDED(hr))
{
PROPVARIANT value;
hr = pQueryReader->GetMetadataByName(L"/ifd/exif/{ushort=1111}", &value);
}
This returns E_INVALIDARG error.
I'd appreciate some help in understanding how this works. I feel like I have not understood the documentation correctly.
Thank you.

Password Expiry Date using c++?

i want to display the password expiry dialogbox using c++ win32 API...
i done it using System.directoryservice namespace...
But now i need in Win32 API..
Any functions there for get password expiry date?
Thanks in advance
You can use the following function to get the password expiration date:
HRESULT GetPasswordExpirationDate(LPTSTR lpszPathName, LPSYSTEMTIME lpExpirationDate)
{
HRESULT hr;
IADsUser *pUser;
hr = ADsGetObject(lpszPathName, IID_IADsUser, (void**) &pUser);
if(SUCCEEDED(hr))
{
DATE expirationDate;
hr = pUser->get_PasswordExpirationDate(&expirationDate);
if (SUCCEEDED(hr))
VariantTimeToSystemTime(expirationDate, lpExpirationDate);
pUser->Release();
}
return hr;
}
Where lpszPathNameis a LDAP or WinNT path and lpExpirationDate is a pointer to SYSTEMTIME structure.
Note, that you must include Windows.h, Iads.h and Adshlp.h and link with ADSIid.Lib and ActiveDS.Lib to get it work.
Example usage:
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
SYSTEMTIME expirationDate;
HRESULT hr = GetPasswordExpirationDate(_T("WinNT://ComputerName/UserName,user"),
&expirationDate);
if (SUCCEEDED(hr))
{
//TODO: do whatever you want with the expirationDate here
}
CoUninitialize();
You may want to use one of the following API calls to retrieve current user and computer/domain names: GetUserName, GetComputerName GetUserNameEx, NetWkstaUserGetInfo
If you need to retrieve password expiration dates for multiple domain users, it might be better to use ADsBuildEnumerator instead of ADsGetObject (see example on MSDN).

MAPI_E_NOT_FOUND on OpenMsgStore

I'm trying to open the MessageStore of a user using MAPI. The weird thing is, when I run this a console application, while I'm logged with the user, everything works fine.
But when I run this as a Windows Service I get MAPI_E_NOT_FOUND when trying to open the MessageStore.
I already configured the service to run as the user.
MapiLogonEx seems to work fine and GetMsgStoreTables also gives me the correct results (I verfied that the EntryID of the MessageStore is correct).
Here's my code:
LPMAPITABLE pStoresTbl = NULL;
m_lpMAPISession->GetMsgStoresTable(0, &pStoresTbl);
// Query Collumns
LPSPropTagArray pTags = NULL;
LPSRowSet pRows = NULL;
pStoresTbl->SeekRow(BOOKMARK_BEGINNING,0,NULL);
pStoresTbl->QueryRows(
LONG_MAX,
NULL,
&pRows);
LPSBinary lpEntryID = NULL;
ULONG iprops;
for (iprops = 0; iprops < pRows->aRow[0].cValues; iprops++)
{
SPropValue sProp = pRows->aRow[0].lpProps[iprops];
if (PROP_ID(sProp.ulPropTag) == PROP_ID(PR_ENTRYID))
{
lpEntryID = &sProp.Value.bin;
break;
}
}
lpMDB = NULL;
HRESULT hres = m_lpMAPISession->OpenMsgStore(NULL,
lpEntryID->cb,
(LPENTRYID) lpEntryID->lpb,
NULL,
MDB_NO_DIALOG |
MDB_NO_MAIL | // spooler not notified of our presence
MDB_TEMPORARY | // message store not added to MAPI profile
MAPI_BEST_ACCESS,
&lpMDB);
Is that an Exchange profile? Are you sure you are opening the primary mailbox rather than the PF store?
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Do you pass in the MAPI_NT_SERVICE flag in the MAPIINIT_0 structure when calling MAPIInitialize? I've never not passed it in when running in a service, so I'm not exactly sure what happens if you don't. The MSDN docs say it is required.
MAPI_NT_SERVICE
The caller is
running as a Windows service. Callers
that are not running as a Windows
service should not set this flag;
callers that are running as a service
must set this flag.