29 "HKEY_CURRENT_CONFIG",
57 string reg_key_and_remainder =
59 space_pos = reg_key_and_remainder.find(
' ' );
61 string reg_key_name = reg_key_and_remainder.substr( 0, space_pos );
105 out <<
"%" << minibuf;
123 if(
i !=
in.end() ) {
126 if(
i !=
in.end() ) {
148 for(
i = 0;
i < llen;
i++ ) {
150 (
data[
i] & 0xff) <<
" ";
156 for(
i = 0;
i < llen;
i++ ) {
157 if(
i <
len &&
i < llen &&
197 DWORD max_subkey_len;
199 DWORD max_value_name_len;
202 char *value_name_buf;
222 value_name_buf =
new char [max_value_name_len+1];
223 value_buf =
new char [max_value_len+1];
224 key_name_buf =
new char [max_subkey_len+1];
226 ending_slash =
key_name.rfind(
'/' );
228 up_level =
key_name.substr( 0, ending_slash );
230 text_out <<
"HTTP/1.0 200 OK\r\n" 231 <<
"Content-Type: text/html\r\n" 233 <<
"<html><head><title>Registry Key `" 235 <<
"'</title></head><body>\r\n" 236 <<
"<h1>Registry Key `" <<
key_name <<
"'</h1>\r\n" 237 <<
"<a href='/" <<
urlenc(up_level)
238 <<
"'>(Up one level)</a><p>\r\n" 239 <<
"<h2>Subkeys:</h2><table border='1'>\r\n";
244 for( which_index = 0; which_index < num_sub_keys; which_index++ ) {
245 key_name_size = max_subkey_len+1;
255 <<
urlenc(
string(key_name_buf,key_name_size)) <<
"'>" 256 <<
string(key_name_buf,key_name_size)
257 <<
"</a></td></tr>\r\n";
260 text_out <<
"</table><h2>Values:</h2><table border='1'>\r\n";
262 DWORD value_name_size;
263 DWORD value_data_size;
266 for( which_index = 0; which_index < num_values; which_index++ ) {
267 value_name_size = max_value_name_len+1;
268 value_data_size = max_value_len+1;
279 text_out <<
"<tr><td><b>" <<
string(value_name_buf,value_name_size)
285 text_out <<
"</ul></body></html>\r\n";
287 delete [] key_name_buf;
288 delete [] value_name_buf;
296 text_out <<
"HTTP/1.0 404 Not Found\r\n" 297 <<
"Content-Type: text/html\r\n" 299 <<
"<html><head><title>Can't find registry key `" 301 <<
"'</title></head><body>\r\n" 302 <<
"<H1>Can't find registry key `" 305 <<
"The registry key doesn't exist in the local registry.\r\n" 306 <<
"</body></html>\r\n";
315 text_out <<
"HTTP/1.0 200 OK\r\n" 316 <<
"Content-Type: text/html\r\n" 318 <<
"<html><head><title>Registry Browser</title></head>\r\n" 320 <<
"<H1>Registry Browser</H1>" 321 <<
"You can use this interface to browse the registry." 322 <<
"You will be presented with one registry key at a time and " 323 <<
"the decendents.\r\n" 324 <<
"<h2>Root Level</h2>\r\n" 325 <<
"Subkeys:<ul>\r\n";
333 text_out <<
"</ul></body></html>\r\n";
340 bool is_predefined_key =
true;
346 size_t slash = reg_key.find(
'/' );
347 string reg_initial =
"";
350 reg_initial = reg_key;
352 reg_initial = reg_key.substr( 0, slash );
361 if( hRegKey != 0 && reg_initial != reg_key ) {
362 size_t start_of_reg_path = reg_initial.size() + 1;
363 string reg_path = reg_key.substr( start_of_reg_path,
364 reg_key.size() - start_of_reg_path );
366 string reg_open_path = reg_path;
368 slash = reg_open_path.find(
'/' );
369 string reg_single_key = reg_open_path;
372 reg_single_key = reg_open_path.substr( 0, slash );
373 reg_open_path = reg_open_path.substr( slash+1,
374 reg_open_path.size() );
377 HKEY oldKey = hRegKey;
381 if(
RegOpenKey( hRegKey, reg_single_key.c_str(), &hRegKey ) !=
387 is_predefined_key =
false;
439 fd_set pollin,pollout,pollerr;
442 int port_to_listen = 80;
443 unsigned int active_fds = 0;
446 if(
string(
"-p" ) ==
argv[
i] ) {
461 active_fds = listen_socket + 1;
466 if(
i->second->ShouldDie() ) {
476 if(
i->first > active_fds ) active_fds =
i->first + 1;
478 if(
i->second->WantPollout() )
FD_SET(
i->first,&pollout);
481 FD_SET(listen_socket,&pollin);
483 active_fds =
select( active_fds, &pollin, &pollout, &pollerr,
NULL );
485 if( active_fds > 0 ) {
486 if(
FD_ISSET(listen_socket,&pollin) ) {
504 }
else i->second->RecvData(
string(
inbuf, rv ) );
507 i->second->OkToSend();
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
void process_valid_request(HKEY open_reg_key, string key_name)
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
string bindump(const char *data, int len)
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
string present_value(DWORD type, const char *data, DWORD len)
#define HKEY_CURRENT_USER
INT WSAAPI WSACleanup(VOID)
void process_invalid_request(string reg_key)
_STLP_PRIV _Setfill_Manip< _CharT > _STLP_CALL setfill(_CharT __c)
pair< _T1, _T2 > _STLP_CALL make_pair(_T1 __x, _T2 __y)
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
#define HKEY_CURRENT_CONFIG
static const char hex[16]
#define sprintf(buf, format,...)
GLenum GLuint GLenum GLsizei const GLchar * buf
LONG WINAPI RegCloseKey(HKEY hKey)
#define FD_ISSET(fd, set)
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
pair< iterator, bool > insert(const value_type &__x)
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
void erase(iterator __pos)
INT WSAAPI WSAGetLastError(VOID)
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
void process_request(string reg_key)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum const GLvoid * addr
string dump_one_line(const char *data, int llen, int len, int addr)
const char * root_entries[]
void RecvData(string input)
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
WDF_CHILD_LIST_ITERATOR iterator
SOCKET make_listening_socket(int port)
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setw(int __n)
const HKEY root_handles[]
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
int main(int argc, char **argv)
#define HKEY_CLASSES_ROOT
GLuint GLuint GLsizei GLenum type
enum RequestHandler::_RHState RHState
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
static struct sockaddr_in sa
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
#define HKEY_LOCAL_MACHINE
void process_root_request()