Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e0deb0c6
Commit
e0deb0c6
authored
Aug 19, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced remaining calls to PROFILE_GetWineIniString/Bool by direct
registry accesses.
parent
7c3ab331
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
318 additions
and
238 deletions
+318
-238
computername.c
dlls/kernel/computername.c
+39
-8
config
documentation/samples/config
+1
-1
directory.c
files/directory.c
+46
-12
dos_fs.c
files/dos_fs.c
+73
-9
drive.c
files/drive.c
+0
-0
file.c
files/file.c
+43
-3
profile.c
files/profile.c
+0
-127
file.h
include/file.h
+0
-3
registry.c
misc/registry.c
+23
-8
ioports.c
msdos/ioports.c
+93
-67
No files found.
dlls/kernel/computername.c
View file @
e0deb0c6
...
...
@@ -40,14 +40,9 @@
#include "wine/exception.h"
#include "excpt.h"
#include "wine/debug.h"
#include "file.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
computername
);
/* Wine config options */
static
const
WCHAR
NetworkW
[]
=
{
'N'
,
'e'
,
't'
,
'w'
,
'o'
,
'r'
,
'k'
,
0
};
static
const
WCHAR
UseDNSW
[]
=
{
'U'
,
's'
,
'e'
,
'D'
,
'n'
,
's'
,
'C'
,
'o'
,
'm'
,
'p'
,
'u'
,
't'
,
'e'
,
'r'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
/* Registry key and value names */
static
const
WCHAR
ComputerW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
...
...
@@ -59,6 +54,8 @@ static const WCHAR ComputerNameW[] = {'C','o','m','p','u','t','e','r','N','a','m
static
const
char
default_ComputerName
[]
=
"WINE"
;
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
/* filter for page-fault exceptions */
static
WINE_EXCEPTION_FILTER
(
page_fault
)
{
...
...
@@ -189,6 +186,41 @@ inline static void _init_attr ( OBJECT_ATTRIBUTES *attr, UNICODE_STRING *name )
attr
->
SecurityQualityOfService
=
NULL
;
}
/***********************************************************************
* get_use_dns_option
*/
static
BOOL
get_use_dns_option
(
void
)
{
static
const
WCHAR
NetworkW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'N'
,
'e'
,
't'
,
'w'
,
'o'
,
'r'
,
'k'
,
0
};
static
const
WCHAR
UseDNSW
[]
=
{
'U'
,
's'
,
'e'
,
'D'
,
'n'
,
's'
,
'C'
,
'o'
,
'm'
,
'p'
,
'u'
,
't'
,
'e'
,
'r'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
char
tmp
[
80
];
HKEY
hkey
;
DWORD
dummy
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
BOOL
ret
=
TRUE
;
_init_attr
(
&
attr
,
&
nameW
);
RtlInitUnicodeString
(
&
nameW
,
NetworkW
);
if
(
!
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
))
{
RtlInitUnicodeString
(
&
nameW
,
UseDNSW
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
WCHAR
*
str
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
ret
=
IS_OPTION_TRUE
(
str
[
0
]
);
}
NtClose
(
hkey
);
}
return
ret
;
}
/***********************************************************************
* COMPUTERNAME_Init (INTERNAL)
*/
...
...
@@ -216,8 +248,7 @@ void COMPUTERNAME_Init (void)
st
=
NtQueryValueKey
(
hsubkey
,
&
nameW
,
KeyValuePartialInformation
,
buf
,
len
,
&
len
);
if
(
st
==
STATUS_OBJECT_NAME_NOT_FOUND
||
(
st
==
STATUS_SUCCESS
&&
PROFILE_GetWineIniBool
(
NetworkW
,
UseDNSW
,
1
)
)
)
if
(
st
==
STATUS_OBJECT_NAME_NOT_FOUND
||
(
st
==
STATUS_SUCCESS
&&
get_use_dns_option
()))
{
char
hbuf
[
256
];
int
hlen
=
sizeof
(
hbuf
);
...
...
@@ -539,7 +570,7 @@ BOOL WINAPI SetComputerNameW( LPCWSTR lpComputerName )
int
i
;
NTSTATUS
st
=
STATUS_INTERNAL_ERROR
;
if
(
PROFILE_GetWineIniBool
(
NetworkW
,
UseDNSW
,
1
)
)
if
(
get_use_dns_option
()
)
{
/* This check isn't necessary, but may help debugging problems. */
WARN
(
"Disabled by Wine Configuration.
\n
"
);
...
...
documentation/samples/config
View file @
e0deb0c6
...
...
@@ -51,7 +51,7 @@ WINE REGISTRY Version 2
"Filesystem" = "win95"
[Drive F]
"Path" = "
${HOME}
"
"Path" = "
%HOME%
"
"Type" = "network"
"Label" = "Home"
"Filesystem" = "win95"
...
...
files/directory.c
View file @
e0deb0c6
...
...
@@ -69,14 +69,19 @@ inline static int FILE_contains_pathW (LPCWSTR name)
*
* Get a path name from the wine.ini file and make sure it is valid.
*/
static
int
DIR_GetPath
(
LPCWSTR
keyname
,
LPCWSTR
defval
,
DOS_FULL_NAME
*
full_name
,
static
int
DIR_GetPath
(
HKEY
hkey
,
LPCWSTR
keyname
,
LPCWSTR
defval
,
DOS_FULL_NAME
*
full_name
,
LPWSTR
longname
,
INT
longname_len
,
BOOL
warn
)
{
WCHAR
path
[
MAX_PATHNAME_LEN
];
UNICODE_STRING
nameW
;
DWORD
dummy
;
WCHAR
tmp
[
MAX_PATHNAME_LEN
];
BY_HANDLE_FILE_INFORMATION
info
;
const
WCHAR
*
path
=
defval
;
const
char
*
mess
=
"does not exist"
;
PROFILE_GetWineIniString
(
wineW
,
keyname
,
defval
,
path
,
MAX_PATHNAME_LEN
);
RtlInitUnicodeString
(
&
nameW
,
keyname
);
if
(
hkey
&&
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
path
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
if
(
!
DOSFS_GetFullName
(
path
,
TRUE
,
full_name
)
||
(
!
FILE_Stat
(
full_name
->
long_name
,
&
info
,
NULL
)
&&
(
mess
=
strerror
(
errno
)))
||
...
...
@@ -97,11 +102,18 @@ static int DIR_GetPath( LPCWSTR keyname, LPCWSTR defval, DOS_FULL_NAME *full_nam
*/
int
DIR_Init
(
void
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
HKEY
hkey
;
char
path
[
MAX_PATHNAME_LEN
];
WCHAR
longpath
[
MAX_PATHNAME_LEN
];
DOS_FULL_NAME
tmp_dir
,
profile_dir
;
int
drive
;
const
char
*
cwd
;
static
const
WCHAR
wineW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
windowsW
[]
=
{
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
0
};
static
const
WCHAR
systemW
[]
=
{
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
static
const
WCHAR
tempW
[]
=
{
't'
,
'e'
,
'm'
,
'p'
,
0
};
...
...
@@ -144,11 +156,22 @@ int DIR_Init(void)
chdir
(
"/"
);
/* change to root directory so as not to lock cdroms */
}
if
(
!
(
DIR_GetPath
(
windowsW
,
windows_dirW
,
&
DIR_Windows
,
longpath
,
MAX_PATHNAME_LEN
,
TRUE
))
||
!
(
DIR_GetPath
(
systemW
,
system_dirW
,
&
DIR_System
,
longpath
,
MAX_PATHNAME_LEN
,
TRUE
))
||
!
(
DIR_GetPath
(
tempW
,
windows_dirW
,
&
tmp_dir
,
longpath
,
MAX_PATHNAME_LEN
,
TRUE
)))
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
wineW
);
if
(
NtCreateKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
hkey
=
0
;
if
(
!
(
DIR_GetPath
(
hkey
,
windowsW
,
windows_dirW
,
&
DIR_Windows
,
longpath
,
MAX_PATHNAME_LEN
,
TRUE
))
||
!
(
DIR_GetPath
(
hkey
,
systemW
,
system_dirW
,
&
DIR_System
,
longpath
,
MAX_PATHNAME_LEN
,
TRUE
))
||
!
(
DIR_GetPath
(
hkey
,
tempW
,
windows_dirW
,
&
tmp_dir
,
longpath
,
MAX_PATHNAME_LEN
,
TRUE
)))
{
PROFILE_UsageWineIni
();
if
(
hkey
)
NtClose
(
hkey
);
return
0
;
}
if
(
-
1
==
access
(
tmp_dir
.
long_name
,
W_OK
))
...
...
@@ -181,16 +204,27 @@ int DIR_Init(void)
}
/* set PATH only if not set already */
if
(
!
GetEnvironmentVariableW
(
path_capsW
,
longpath
,
MAX_PATHNAME_LEN
))
if
(
!
GetEnvironmentVariableW
(
path_capsW
,
NULL
,
0
))
{
PROFILE_GetWineIniString
(
wineW
,
pathW
,
path_dirW
,
longpath
,
MAX_PATHNAME_LEN
);
if
(
strchrW
(
longpath
,
'/'
))
WCHAR
tmp
[
MAX_PATHNAME_LEN
];
DWORD
dummy
;
const
WCHAR
*
path
=
path_dirW
;
RtlInitUnicodeString
(
&
nameW
,
pathW
);
if
(
hkey
&&
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
path
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
}
if
(
strchrW
(
path
,
'/'
))
{
MESSAGE
(
"Fix your wine config to use DOS drive syntax in [wine] 'Path=' statement! (no '/' allowed)
\n
"
);
PROFILE_UsageWineIni
();
ExitProcess
(
1
);
}
SetEnvironmentVariableW
(
path_capsW
,
longpath
);
SetEnvironmentVariableW
(
path_capsW
,
path
);
TRACE
(
"Path = %s
\n
"
,
debugstr_w
(
path
)
);
}
SetEnvironmentVariableW
(
temp_capsW
,
tmp_dir
.
short_name
);
...
...
@@ -204,11 +238,10 @@ int DIR_Init(void)
debugstr_w
(
DIR_System
.
short_name
),
DIR_System
.
long_name
);
TRACE
(
"TempDir = %s (%s)
\n
"
,
debugstr_w
(
tmp_dir
.
short_name
),
tmp_dir
.
long_name
);
TRACE
(
"Path = %s
\n
"
,
debugstr_w
(
longpath
)
);
TRACE
(
"Cwd = %c:
\\
%s
\n
"
,
'A'
+
drive
,
debugstr_w
(
DRIVE_GetDosCwd
(
drive
))
);
if
(
DIR_GetPath
(
profileW
,
empty_strW
,
&
profile_dir
,
longpath
,
MAX_PATHNAME_LEN
,
FALSE
))
if
(
DIR_GetPath
(
hkey
,
profileW
,
empty_strW
,
&
profile_dir
,
longpath
,
MAX_PATHNAME_LEN
,
FALSE
))
{
TRACE
(
"USERPROFILE= %s
\n
"
,
debugstr_w
(
longpath
)
);
SetEnvironmentVariableW
(
userprofileW
,
longpath
);
...
...
@@ -216,6 +249,7 @@ int DIR_Init(void)
TRACE
(
"SYSTEMROOT = %s
\n
"
,
debugstr_w
(
DIR_Windows
.
short_name
)
);
SetEnvironmentVariableW
(
systemrootW
,
DIR_Windows
.
short_name
);
if
(
hkey
)
NtClose
(
hkey
);
return
1
;
}
...
...
files/dos_fs.c
View file @
e0deb0c6
...
...
@@ -84,6 +84,8 @@ typedef struct
#undef VFAT_IOCTL_READDIR_BOTH
/* just in case... */
#endif
/* linux */
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
/* Chars we don't want to see in DOS file names */
#define INVALID_DOS_CHARS "*?<>|\"+=,;[] \345"
...
...
@@ -854,17 +856,41 @@ const DOS_DEVICE *DOSFS_GetDeviceByHandle( HANDLE hFile )
static
HANDLE
DOSFS_CreateCommPort
(
LPCWSTR
name
,
DWORD
access
,
DWORD
attributes
,
LPSECURITY_ATTRIBUTES
sa
)
{
HANDLE
ret
;
HKEY
hkey
;
DWORD
dummy
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
WCHAR
*
devnameW
;
char
tmp
[
128
];
char
devname
[
40
];
WCHAR
devnameW
[
40
];
static
const
WCHAR
serialportsW
[]
=
{
's'
,
'e'
,
'r'
,
'i'
,
'a'
,
'l'
,
'p'
,
'o'
,
'r'
,
't'
,
's'
,
0
};
static
const
WCHAR
empty_strW
[]
=
{
0
};
static
const
WCHAR
serialportsW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'S'
,
'e'
,
'r'
,
'i'
,
'a'
,
'l'
,
'P'
,
'o'
,
'r'
,
't'
,
's'
,
0
};
TRACE_
(
file
)(
"%s %lx %lx
\n
"
,
debugstr_w
(
name
),
access
,
attributes
);
PROFILE_GetWineIniString
(
serialportsW
,
name
,
empty_strW
,
devnameW
,
40
);
if
(
!
devnameW
[
0
])
return
0
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
serialportsW
);
if
(
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
))
return
0
;
RtlInitUnicodeString
(
&
nameW
,
name
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
devnameW
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
else
devnameW
=
NULL
;
NtClose
(
hkey
);
if
(
!
devnameW
)
return
0
;
WideCharToMultiByte
(
CP_ACP
,
0
,
devnameW
,
-
1
,
devname
,
sizeof
(
devname
),
NULL
,
NULL
);
TRACE
(
"opening %s as %s
\n
"
,
devname
,
debugstr_w
(
name
));
...
...
@@ -1693,6 +1719,46 @@ BOOL WINAPI wine_get_unix_file_name( LPCSTR dos, LPSTR buffer, DWORD len )
/***********************************************************************
* get_show_dir_symlinks_option
*/
static
BOOL
get_show_dir_symlinks_option
(
void
)
{
static
const
WCHAR
WineW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
ShowDirSymlinksW
[]
=
{
'S'
,
'h'
,
'o'
,
'w'
,
'D'
,
'i'
,
'r'
,
'S'
,
'y'
,
'm'
,
'l'
,
'i'
,
'n'
,
'k'
,
's'
,
0
};
char
tmp
[
80
];
HKEY
hkey
;
DWORD
dummy
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
BOOL
ret
=
FALSE
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
WineW
);
if
(
!
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
))
{
RtlInitUnicodeString
(
&
nameW
,
ShowDirSymlinksW
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
WCHAR
*
str
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
ret
=
IS_OPTION_TRUE
(
str
[
0
]
);
}
NtClose
(
hkey
);
}
return
ret
;
}
/***********************************************************************
* DOSFS_FindNextEx
*/
static
int
DOSFS_FindNextEx
(
FIND_FIRST_INFO
*
info
,
WIN32_FIND_DATAW
*
entry
)
...
...
@@ -1774,11 +1840,9 @@ static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATAW *entry )
}
if
(
is_symlink
&&
(
fileinfo
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
))
{
static
const
WCHAR
wineW
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
ShowDirSymlinksW
[]
=
{
'S'
,
'h'
,
'o'
,
'w'
,
'D'
,
'i'
,
'r'
,
'S'
,
'y'
,
'm'
,
'l'
,
'i'
,
'n'
,
'k'
,
's'
,
0
};
static
int
show_dir_symlinks
=
-
1
;
if
(
show_dir_symlinks
==
-
1
)
show_dir_symlinks
=
PROFILE_GetWineIniBool
(
wineW
,
ShowDirSymlinksW
,
0
);
show_dir_symlinks
=
get_show_dir_symlinks_option
(
);
if
(
!
show_dir_symlinks
)
continue
;
}
...
...
files/drive.c
View file @
e0deb0c6
This diff is collapsed.
Click to expand it.
files/file.c
View file @
e0deb0c6
...
...
@@ -81,6 +81,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(file);
#define MAP_ANON MAP_ANONYMOUS
#endif
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
HANDLE
dos_handles
[
DOS_TABLE_SIZE
];
mode_t
FILE_umask
;
...
...
@@ -707,6 +709,46 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info )
/***********************************************************************
* get_show_dot_files_option
*/
static
BOOL
get_show_dot_files_option
(
void
)
{
static
const
WCHAR
WineW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
ShowDotFilesW
[]
=
{
'S'
,
'h'
,
'o'
,
'w'
,
'D'
,
'o'
,
't'
,
'F'
,
'i'
,
'l'
,
'e'
,
's'
,
0
};
char
tmp
[
80
];
HKEY
hkey
;
DWORD
dummy
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
BOOL
ret
=
FALSE
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
WineW
);
if
(
!
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
))
{
RtlInitUnicodeString
(
&
nameW
,
ShowDotFilesW
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
WCHAR
*
str
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
ret
=
IS_OPTION_TRUE
(
str
[
0
]
);
}
NtClose
(
hkey
);
}
return
ret
;
}
/***********************************************************************
* FILE_Stat
*
* Stat a Unix path name. Return TRUE if OK.
...
...
@@ -742,11 +784,9 @@ BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_syml
p
=
p
?
p
+
1
:
unixName
;
if
(
*
p
==
'.'
&&
*
(
p
+
1
)
&&
(
*
(
p
+
1
)
!=
'.'
||
*
(
p
+
2
)))
{
static
const
WCHAR
wineW
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
ShowDotFilesW
[]
=
{
'S'
,
'h'
,
'o'
,
'w'
,
'D'
,
'o'
,
't'
,
'F'
,
'i'
,
'l'
,
'e'
,
's'
,
0
};
static
int
show_dot_files
=
-
1
;
if
(
show_dot_files
==
-
1
)
show_dot_files
=
PROFILE_GetWineIniBool
(
wineW
,
ShowDotFilesW
,
0
);
show_dot_files
=
get_show_dot_files_option
(
);
if
(
!
show_dot_files
)
info
->
dwFileAttributes
|=
FILE_ATTRIBUTE_HIDDEN
;
}
...
...
files/profile.c
View file @
e0deb0c6
...
...
@@ -905,133 +905,6 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name,
/***********************************************************************
* get_profile_key
*/
static
HKEY
get_profile_key
(
void
)
{
static
HKEY
profile_key
;
if
(
!
profile_key
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
HKEY
hkey
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
if
(
!
RtlCreateUnicodeStringFromAsciiz
(
&
nameW
,
"Machine
\\
Software
\\
Wine
\\
Wine
\\
Config"
)
||
NtCreateKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
REG_OPTION_VOLATILE
,
NULL
))
{
ERR
(
"Cannot create config registry key
\n
"
);
ExitProcess
(
1
);
}
RtlFreeUnicodeString
(
&
nameW
);
if
(
InterlockedCompareExchangePointer
(
(
void
**
)
&
profile_key
,
hkey
,
0
))
NtClose
(
hkey
);
/* somebody beat us to it */
}
return
profile_key
;
}
/***********************************************************************
* PROFILE_GetWineIniString
*
* Get a config string from the wine.ini file.
*/
int
PROFILE_GetWineIniString
(
LPCWSTR
section
,
LPCWSTR
key_name
,
LPCWSTR
def
,
LPWSTR
buffer
,
int
len
)
{
HKEY
hkey
;
NTSTATUS
err
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
get_profile_key
();
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
section
);
if
(
!
(
err
=
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
)))
{
char
tmp
[
PROFILE_MAX_LINE_LEN
*
sizeof
(
WCHAR
)
+
sizeof
(
KEY_VALUE_PARTIAL_INFORMATION
)];
DWORD
count
;
RtlInitUnicodeString
(
&
nameW
,
key_name
);
if
(
!
(
err
=
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
count
)))
{
WCHAR
*
str
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
PROFILE_CopyEntry
(
buffer
,
str
,
len
,
TRUE
,
TRUE
);
}
NtClose
(
hkey
);
}
if
(
err
)
PROFILE_CopyEntry
(
buffer
,
def
,
len
,
TRUE
,
TRUE
);
TRACE
(
"(%s,%s,%s): returning %s
\n
"
,
debugstr_w
(
section
),
debugstr_w
(
key_name
),
debugstr_w
(
def
),
debugstr_w
(
buffer
)
);
return
strlenW
(
buffer
);
}
/******************************************************************************
*
* PROFILE_GetWineIniBool
*
* Reads a boolean value from the wine.ini file. This function attempts to
* be user-friendly by accepting 'n', 'N' (no), 'f', 'F' (false), or '0'
* (zero) for false, 'y', 'Y' (yes), 't', 'T' (true), or '1' (one) for
* true. Anything else results in the return of the default value.
*
* This function uses 1 to indicate true, and 0 for false. You can check
* for existence by setting def to something other than 0 or 1 and
* examining the return value.
*/
int
PROFILE_GetWineIniBool
(
LPCWSTR
section
,
LPCWSTR
key_name
,
int
def
)
{
static
const
WCHAR
def_valueW
[]
=
{
'~'
,
0
};
WCHAR
key_value
[
2
];
int
retval
;
PROFILE_GetWineIniString
(
section
,
key_name
,
def_valueW
,
key_value
,
2
);
switch
(
key_value
[
0
])
{
case
'n'
:
case
'N'
:
case
'f'
:
case
'F'
:
case
'0'
:
retval
=
0
;
break
;
case
'y'
:
case
'Y'
:
case
't'
:
case
'T'
:
case
'1'
:
retval
=
1
;
break
;
default:
retval
=
def
;
}
TRACE
(
"(%s, %s, %s), [%c], ret %s
\n
"
,
debugstr_w
(
section
),
debugstr_w
(
key_name
),
def
?
"TRUE"
:
"FALSE"
,
key_value
[
0
],
retval
?
"TRUE"
:
"FALSE"
);
return
retval
;
}
/***********************************************************************
* PROFILE_UsageWineIni
*
* Explain the wine.ini file to those who don't read documentation.
...
...
include/file.h
View file @
e0deb0c6
...
...
@@ -111,9 +111,6 @@ extern int DOSFS_FindNext( const char *path, const char *short_mask,
/* profile.c */
extern
void
PROFILE_UsageWineIni
(
void
);
extern
int
PROFILE_GetWineIniString
(
LPCWSTR
section
,
LPCWSTR
key_name
,
LPCWSTR
def
,
LPWSTR
buffer
,
int
len
);
extern
int
PROFILE_GetWineIniBool
(
LPCWSTR
section
,
LPCWSTR
key_name
,
int
def
);
/* win32/device.c */
extern
HANDLE
DEVICE_Open
(
LPCWSTR
filename
,
DWORD
access
,
LPSECURITY_ATTRIBUTES
sa
);
...
...
misc/registry.c
View file @
e0deb0c6
...
...
@@ -1406,11 +1406,15 @@ static void _load_windows_registry( HKEY hkey_local_machine, HKEY hkey_current_u
WCHAR
path
[
MAX_PATHNAME_LEN
];
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
HKEY
hkey
;
HKEY
hkey
,
profile_key
;
char
tmp
[
1024
];
DWORD
dummy
;
static
const
WCHAR
WineW
[]
=
{
'W'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
WineW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
0
};
static
const
WCHAR
ProfileW
[]
=
{
'P'
,
'r'
,
'o'
,
'f'
,
'i'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
empty_strW
[]
=
{
0
};
static
const
WCHAR
System
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
static
const
WCHAR
Software
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
0
};
static
const
WCHAR
Clone
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
...
...
@@ -1424,12 +1428,14 @@ static void _load_windows_registry( HKEY hkey_local_machine, HKEY hkey_current_u
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
WineW
);
if
(
NtCreateKey
(
&
profile_key
,
KEY_ALL_ACCESS
,
&
attr
,
0
,
NULL
,
0
,
NULL
))
profile_key
=
0
;
GetWindowsDirectoryW
(
windir
,
MAX_PATHNAME_LEN
);
reg_type
=
_get_reg_type
();
switch
(
reg_type
)
{
case
REG_WINNT
:
{
HKEY
hkey
;
static
const
WCHAR
ntuser_datW
[]
=
{
'\\'
,
'n'
,
't'
,
'u'
,
's'
,
'e'
,
'r'
,
'.'
,
'd'
,
'a'
,
't'
,
0
};
static
const
WCHAR
defaultW
[]
=
{
'\\'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'3'
,
'2'
,
'\\'
,
'c'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'd'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
0
};
static
const
WCHAR
systemW
[]
=
{
'\\'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'3'
,
'2'
,
'\\'
,
'c'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
...
...
@@ -1438,7 +1444,11 @@ static void _load_windows_registry( HKEY hkey_local_machine, HKEY hkey_current_u
static
const
WCHAR
securityW
[]
=
{
'\\'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'3'
,
'2'
,
'\\'
,
'c'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
's'
,
'e'
,
'c'
,
'u'
,
'r'
,
'i'
,
't'
,
'y'
,
0
};
/* user specific ntuser.dat */
if
(
PROFILE_GetWineIniString
(
WineW
,
ProfileW
,
empty_strW
,
path
,
MAX_PATHNAME_LEN
))
{
RtlInitUnicodeString
(
&
nameW
,
ProfileW
);
if
(
profile_key
&&
!
NtQueryValueKey
(
profile_key
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
strcpyW
(
path
,
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
);
strcatW
(
path
,
ntuser_datW
);
_convert_and_load_native_registry
(
path
,
hkey_current_user
,
REG_WINNT
,
1
);
}
...
...
@@ -1514,9 +1524,13 @@ static void _load_windows_registry( HKEY hkey_local_machine, HKEY hkey_current_u
NtClose
(
hkey
);
}
if
(
PROFILE_GetWineIniString
(
WineW
,
ProfileW
,
empty_strW
,
path
,
MAX_PATHNAME_LEN
))
{
/* user specific user.dat */
strcatW
(
path
,
user_datW
);
RtlInitUnicodeString
(
&
nameW
,
ProfileW
);
if
(
profile_key
&&
!
NtQueryValueKey
(
profile_key
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
/* user specific user.dat */
strcpyW
(
path
,
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
);
strcatW
(
path
,
user_datW
);
_convert_and_load_native_registry
(
path
,
hkey_current_user
,
REG_WIN95
,
1
);
/* default user.dat */
...
...
@@ -1547,6 +1561,7 @@ static void _load_windows_registry( HKEY hkey_local_machine, HKEY hkey_current_u
break
;
}
if
(
profile_key
)
NtClose
(
profile_key
);
}
/* load home registry files (stored in ~/.wine) [Internal] */
...
...
msdos/ioports.c
View file @
e0deb0c6
...
...
@@ -38,9 +38,10 @@
#endif
#include "windef.h"
#include "winnls.h"
#include "winternl.h"
#include "callback.h"
#include "file.h"
#include "miscemu.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
int
);
...
...
@@ -162,54 +163,54 @@ static void set_IO_permissions(int val1, int val, char rw)
* Helper function for IO_port_init
*/
static
void
do_IO_port_init_read_or_write
(
c
har
*
temp
,
char
rw
)
static
void
do_IO_port_init_read_or_write
(
c
onst
WCHAR
*
str
,
char
rw
)
{
int
val
,
val1
,
i
,
len
;
if
(
!
strcasecmp
(
temp
,
"all"
))
{
MESSAGE
(
"Warning!!! Granting FULL IO port access to"
" windoze programs!
\n
Warning!!! "
"*** THIS IS NOT AT ALL "
"RECOMMENDED!!! ***
\n
"
);
for
(
i
=
0
;
i
<
sizeof
(
port_permissions
);
i
++
)
port_permissions
[
i
]
|=
rw
;
}
else
if
(
!
(
!
strcmp
(
temp
,
"*"
)
||
*
temp
==
'\0'
))
{
len
=
strlen
(
temp
);
val
=
-
1
;
val1
=
-
1
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
switch
(
temp
[
i
])
{
case
'0'
:
if
(
temp
[
i
+
1
]
==
'x'
||
temp
[
i
+
1
]
==
'X'
)
{
sscanf
(
temp
+
i
,
"%x"
,
&
val
);
i
+=
2
;
}
else
{
sscanf
(
temp
+
i
,
"%d"
,
&
val
);
}
while
(
isxdigit
(
temp
[
i
]))
i
++
;
i
--
;
break
;
case
','
:
case
' '
:
case
'\t'
:
set_IO_permissions
(
val1
,
val
,
rw
)
;
val1
=
-
1
;
val
=
-
1
;
break
;
case
'-'
:
val1
=
val
;
if
(
val1
==
-
1
)
val1
=
0
;
break
;
default:
if
(
temp
[
i
]
>=
'0'
&&
temp
[
i
]
<=
'9'
)
{
sscanf
(
temp
+
i
,
"%d"
,
&
val
);
while
(
isdigit
(
temp
[
i
]))
i
++
;
}
}
}
set_IO_permissions
(
val1
,
val
,
rw
);
}
int
val
,
val1
,
i
;
WCHAR
*
end
;
static
const
WCHAR
allW
[]
=
{
'a'
,
'l'
,
'l'
,
0
};
if
(
!
strcmpiW
(
str
,
allW
))
{
for
(
i
=
0
;
i
<
sizeof
(
port_permissions
);
i
++
)
port_permissions
[
i
]
|=
rw
;
}
else
{
val
=
-
1
;
val1
=
-
1
;
while
(
*
str
)
{
switch
(
*
str
)
{
case
','
:
case
' '
:
case
'\t'
:
set_IO_permissions
(
val1
,
val
,
rw
);
val1
=
-
1
;
val
=
-
1
;
str
++
;
break
;
case
'-'
:
val1
=
val
;
if
(
val1
==
-
1
)
val1
=
0
;
str
++
;
break
;
default:
if
(
isdigitW
(
*
str
))
{
val
=
strtoulW
(
str
,
&
end
,
0
)
;
if
(
end
==
str
)
{
val
=
-
1
;
str
++
;
}
else
str
=
end
;
}
break
;
}
}
set_IO_permissions
(
val1
,
val
,
rw
);
}
}
static
inline
BYTE
inb
(
WORD
port
)
...
...
@@ -250,25 +251,50 @@ static inline void outl( DWORD value, WORD port )
static
void
IO_port_init
(
void
)
{
char
temp
[
1024
];
WCHAR
tempW
[
1024
];
static
const
WCHAR
portsW
[]
=
{
'p'
,
'o'
,
'r'
,
't'
,
's'
,
0
};
static
const
WCHAR
readW
[]
=
{
'r'
,
'e'
,
'a'
,
'd'
,
0
};
static
const
WCHAR
writeW
[]
=
{
'w'
,
'r'
,
'i'
,
't'
,
'e'
,
0
};
static
const
WCHAR
asteriskW
[]
=
{
'*'
,
0
};
do_direct_port_access
=
0
;
/* Can we do that? */
if
(
!
iopl
(
3
))
{
iopl
(
0
);
PROFILE_GetWineIniString
(
portsW
,
readW
,
asteriskW
,
tempW
,
1024
);
WideCharToMultiByte
(
CP_ACP
,
0
,
tempW
,
-
1
,
temp
,
1024
,
NULL
,
NULL
);
do_IO_port_init_read_or_write
(
temp
,
IO_READ
);
PROFILE_GetWineIniString
(
portsW
,
writeW
,
asteriskW
,
tempW
,
1024
);
WideCharToMultiByte
(
CP_ACP
,
0
,
tempW
,
-
1
,
temp
,
1024
,
NULL
,
NULL
);
do_IO_port_init_read_or_write
(
temp
,
IO_WRITE
);
}
char
tmp
[
1024
];
HKEY
hkey
;
DWORD
dummy
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
static
const
WCHAR
portsW
[]
=
{
'M'
,
'a'
,
'c'
,
'h'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'\\'
,
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'\\'
,
'P'
,
'o'
,
'r'
,
't'
,
's'
,
0
};
static
const
WCHAR
readW
[]
=
{
'r'
,
'e'
,
'a'
,
'd'
,
0
};
static
const
WCHAR
writeW
[]
=
{
'w'
,
'r'
,
'i'
,
't'
,
'e'
,
0
};
do_direct_port_access
=
0
;
/* Can we do that? */
if
(
!
iopl
(
3
))
{
iopl
(
0
);
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
RtlInitUnicodeString
(
&
nameW
,
portsW
);
if
(
!
NtOpenKey
(
&
hkey
,
KEY_ALL_ACCESS
,
&
attr
))
{
RtlInitUnicodeString
(
&
nameW
,
readW
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
WCHAR
*
str
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
do_IO_port_init_read_or_write
(
str
,
IO_READ
);
}
RtlInitUnicodeString
(
&
nameW
,
writeW
);
if
(
!
NtQueryValueKey
(
hkey
,
&
nameW
,
KeyValuePartialInformation
,
tmp
,
sizeof
(
tmp
),
&
dummy
))
{
WCHAR
*
str
=
(
WCHAR
*
)((
KEY_VALUE_PARTIAL_INFORMATION
*
)
tmp
)
->
Data
;
do_IO_port_init_read_or_write
(
str
,
IO_WRITE
);
}
NtClose
(
hkey
);
}
}
IO_FixCMOSCheckSum
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment