информационная безопасность
без паники и всерьез
 подробно о проектеRambler's Top100
Где водятся OGRыВсе любят медСтрашный баг в Windows
BugTraq.Ru
Русский BugTraq
 Анализ криптографических сетевых... 
 Модель надежности двухузлового... 
 Специальные марковские модели надежности... 
 Microsoft Authenticator прекращает... 
 Очередное исследование 19 миллиардов... 
 Оптимизация ввода-вывода как инструмент... 
главная обзор RSN блог библиотека закон бред форум dnet о проекте
bugtraq.ru / форум / programming
Имя Пароль
если вы видите этот текст, отключите в настройках форума использование JavaScript
ФОРУМ
все доски
FAQ
IRC
новые сообщения
site updates
guestbook
beginners
sysadmin
programming
operating systems
theory
web building
software
hardware
networking
law
hacking
gadgets
job
dnet
humor
miscellaneous
scrap
регистрация





Легенда:
  новое сообщение
  закрытая нитка
  новое сообщение
  в закрытой нитке
  старое сообщение
[Win32] From MSDN... 14.03.02 10:51  Число просмотров: 1024
Автор: Bender Статус: Незарегистрированный пользователь
<"чистая" ссылка>
1. + - пожалуйста отредактирую свою мессагу, а то читать не удобно, всю форму перекашивает :(
2. Это мне не подходит, тут сам процесс юзера обращается к сервису и передаёт ему нежный хэндл. Мой сервис должен действовать самостоятельно, не зависимо от юзера.
<programming>
[Win32] Привелегии сервиса юзать OpenWindowStation?... 22.02.02 11:11  
Автор: Bender Статус: Незарегистрированный пользователь
Отредактировано 22.02.02 11:36  Количество правок: 2
<"чистая" ссылка>
Какие нужны права/привелегии чтобы из сервиса(NT) юзать OpenWindowStation?

Суть такая, запускаю сервис от имени аккаунта (НЕ Local System), на попытку сделать OpenWindowStation на WrkSta0 (дефолтный) получаю ошибку N 5 - Access Denied. Хотя в MSDN не написано, что OpenWindowStation можно делать ТОЛЬКО под аккаунтом SYSTEM (Local System). Кто-нибудь уже с эти сталкивался? Как побороть?
[Win32] From MSDN... 22.02.02 21:56  
Автор: + <Mikhail> Статус: Elderman
<"чистая" ссылка>
> Какие нужны права/привелегии чтобы из сервиса(NT) юзать
> OpenWindowStation?
>
> Суть такая, запускаю сервис от имени аккаунта (НЕ Local
> System), на попытку сделать OpenWindowStation на WrkSta0
> (дефолтный) получаю ошибку N 5 - Access Denied. Хотя в MSDN
> не написано, что OpenWindowStation можно делать ТОЛЬКО под
> аккаунтом SYSTEM (Local System). Кто-нибудь уже с эти
> сталкивался? Как побороть?
Interacting with the User in a Service
For a noninteractive service application to interact with the user, it must open the user's window station ("WinSta0") and desktop ("Default"). By default, only the logged-on user and service applications running in the LocalSystem account are granted access to the user's window station and desktop. This means that services running in other accounts must either impersonate the user when opening the interactive window station and desktop, or have access granted to those accounts by the user.

For compatibility with versions of Windows NT/Windows 2000 that support multiple users and/or multiple desktops per user, the user's window station and desktop names should not be hard-coded. Client applications should pass the names of their window station and desktop to the service as part of the request to the service.

This code sample displays a message on the user's desktop in response to an RPC request from one of the user's applications. Note that a global variable dwGuiThreadId in this example is also used in the logoff handling example. If the thread that displays the message box terminates after it is done with the message box, it is not necessary to save and restore the thread's desktop. It is necessary to restore the process's window station.

DWORD dwGuiThreadId = 0; 
 
int 
UserMessageBox( 
    RPC_BINDING_HANDLE h, 
    LPSTR lpszWindowStation, 
    LPSTR lpszDesktop, 
    LPSTR lpszText, 
    LPSTR lpszTitle, 
    UINT fuStyle) 
{ 
    DWORD dwThreadId; 
    HWINSTA hwinstaSave; 
    HDESK hdeskSave; 
    HWINSTA hwinstaUser; 
    HDESK hdeskUser; 
    int result; 
 
    // Ensure connection to service window station and desktop, and 
    // save their handles. 

    GetDesktopWindow(); 
    hwinstaSave = GetProcessWindowStation(); 
    dwThreadId = GetCurrentThreadId(); 
    hdeskSave = GetThreadDesktop(dwThreadId); 
 
    // Impersonate the client and connect to the User's 
    // window station and desktop. 

    RpcImpersonateClient(h); 
    hwinstaUser = OpenWindowStation(lpszWindowStation, FALSE, MAXIMUM_ALLOWED); 
    if (hwinstaUser == NULL) 
    { 
        RpcRevertToSelf(); 
        return 0; 
    } 
    SetProcessWindowStation(hwinstaUser); 
    hdeskUser = OpenDesktop(lpszDesktop, 0, FALSE, MAXIMUM_ALLOWED); 
    RpcRevertToSelf(); 
    if (hdeskUser == NULL) 
    { 
        SetProcessWindowStation(hwinstaSave); 
        CloseWindowStation(hwinstaUser); 
        return 0; 
    } 
    SetThreadDesktop(hdeskUser); 
 
    // Display message box. 

    dwGuiThreadId = dwThreadId; 
    result = MessageBox(NULL, lpszText, lpszTitle, fuStyle); 
    dwGuiThreadId = 0; 
 
    // Restore window station and desktop. 

    SetThreadDesktop(hdeskSave); 
    SetProcessWindowStation(hwinstaSave); 
    CloseDesktop(hdeskUser); 
    CloseWindowStation(hwinstaUser); 
 
    return result; 
} 

---
[Win32] From MSDN... 14.03.02 10:51  
Автор: Bender Статус: Незарегистрированный пользователь
<"чистая" ссылка>
1. + - пожалуйста отредактирую свою мессагу, а то читать не удобно, всю форму перекашивает :(
2. Это мне не подходит, тут сам процесс юзера обращается к сервису и передаёт ему нежный хэндл. Мой сервис должен действовать самостоятельно, не зависимо от юзера.
1




Rambler's Top100
Рейтинг@Mail.ru


  Copyright © 2001-2025 Dmitry Leonov   Page build time: 0 s   Design: Vadim Derkach