Vidalia  0.3.1
Typedefs | Functions
win32.cpp File Reference
#include "win32.h"
#include <QDir>
#include <QLibrary>
#include <QtDebug>
#include <tlhelp32.h>
#include <shlobj.h>

Go to the source code of this file.

Typedefs

typedef HANDLE(WINAPI * CreateToolhelp32Snapshot_fn) (DWORD, DWORD)
 
typedef BOOL(WINAPI * Process32First_fn) (HANDLE, LPPROCESSENTRY32)
 
typedef BOOL(WINAPI * Process32Next_fn) (HANDLE, LPPROCESSENTRY32)
 

Functions

QString win32_get_folder_location (int folder, QString defaultPath)
 
QString win32_program_files_folder ()
 
QString win32_app_data_folder ()
 
QString win32_registry_get_key_value (QString keyLocation, QString keyName)
 
void win32_registry_set_key_value (QString keyLocation, QString keyName, QString keyValue)
 
void win32_registry_remove_key (QString keyLocation, QString keyName)
 
BOOL CALLBACK quitWindowCallback (HWND hwnd, LPARAM targetPID)
 
void win32_end_process_by_pid (DWORD pid)
 
void win32_end_process_by_filename (QString filename)
 
QHash< qint64, QString > win32_process_list ()
 

Typedef Documentation

§ CreateToolhelp32Snapshot_fn

typedef HANDLE(WINAPI * CreateToolhelp32Snapshot_fn) (DWORD, DWORD)

Definition at line 36 of file win32.cpp.

§ Process32First_fn

typedef BOOL(WINAPI * Process32First_fn) (HANDLE, LPPROCESSENTRY32)

Definition at line 37 of file win32.cpp.

§ Process32Next_fn

typedef BOOL(WINAPI * Process32Next_fn) (HANDLE, LPPROCESSENTRY32)

Definition at line 38 of file win32.cpp.

Function Documentation

§ quitWindowCallback()

BOOL CALLBACK quitWindowCallback ( HWND  hwnd,
LPARAM  targetPID 
)

Callback for EnumThreadWindows which sends the WM_QUIT message

Definition at line 167 of file win32.cpp.

Referenced by win32_end_process_by_pid().

§ win32_app_data_folder()

QString win32_app_data_folder ( )

Gets the location of the user's APPDATA% folder.

Definition at line 86 of file win32.cpp.

References win32_get_folder_location().

Referenced by Vidalia::defaultDataDirectory(), and expand_filename().

§ win32_end_process_by_filename()

void win32_end_process_by_filename ( QString  filename)

Close all processes started from the specified filename. Sends WM_QUIT to all top-level windows. Filename should be given in lowercase, and comparison is case insensitive. Note: the MSDN documentation for WM_QUIT states that the message should not be sent by PostMessage(). However, sending WM_CLOSE leaves Firefox running, whereas WM_QUIT seems to work.

Definition at line 203 of file win32.cpp.

References i(), win32_end_process_by_pid(), and win32_process_list().

§ win32_end_process_by_pid()

void win32_end_process_by_pid ( DWORD  pid)

Close process with the specified PID. Sends WM_QUIT to all top-level windows.

Definition at line 184 of file win32.cpp.

References quitWindowCallback().

Referenced by win32_end_process_by_filename().

§ win32_get_folder_location()

QString win32_get_folder_location ( int  folder,
QString  defaultPath 
)

Finds the location of the "special" Windows folder using the given CSIDL value. If the folder cannot be found, the given default path is used.

Definition at line 44 of file win32.cpp.

Referenced by win32_app_data_folder(), and win32_program_files_folder().

§ win32_process_list()

QHash<qint64, QString> win32_process_list ( )

Returns a list of all currently active processes, including their pid and exe filename.

Definition at line 228 of file win32.cpp.

Referenced by is_process_running(), and win32_end_process_by_filename().

§ win32_program_files_folder()

QString win32_program_files_folder ( )

Gets the location of the user's PROGRAMFILES% folder.

Definition at line 78 of file win32.cpp.

References win32_get_folder_location().

Referenced by expand_filename(), and TorSettings::TorSettings().

§ win32_registry_get_key_value()

QString win32_registry_get_key_value ( QString  keyLocation,
QString  keyName 
)

Returns the value in keyName at keyLocation. Returns an empty QString if the keyName doesn't exist

Definition at line 95 of file win32.cpp.

Referenced by VidaliaSettings::runVidaliaOnBoot().

§ win32_registry_remove_key()

void win32_registry_remove_key ( QString  keyLocation,
QString  keyName 
)

Removes the key from the registry if it exists

Definition at line 146 of file win32.cpp.

Referenced by VidaliaSettings::setRunVidaliaOnBoot().

§ win32_registry_set_key_value()

void win32_registry_set_key_value ( QString  keyLocation,
QString  keyName,
QString  keyValue 
)

Creates and/or sets the key to the specified value

Definition at line 119 of file win32.cpp.

Referenced by VidaliaSettings::setRunVidaliaOnBoot().