Созданная запись реестра, например:
Код: Выделить всё
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\MyApp- ProviderGuid в разделе MyApp
- A EventMessageFile в разделе Myapp, указывающий на %SystemRoot% \System32\mscoree.dll
Код: Выделить всё
if (!SourceExists)
{
// When debugging, it never went in here because
// I've already created the source in the registry
if (!EventLog.SourceExists(Source))
{
EventLog.CreateEventSource(new EventSourceCreationData("MyApp", "Application"));
SourceExists = true;
}
}
using (EventLog eventLog = new EventLog())
{
eventLog.Log = "Application";
eventLog.Source = "MyApp";
// the following line will throw Unknown error (0xe06d7363)
eventLog.WriteEntry("Hello world", EventLogEntryType.Information, 1000);
}
Что еще мне не хватает?
PS: Если я тоже использую Приложение в качестве источника, то это будет работать, но я хочу иметь возможность войти в систему как MyApp, а не как Приложение.
Подробнее здесь: https://stackoverflow.com/questions/783 ... is-defined
Мобильная версия