Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
e732fc02
Commit
e732fc02
authored
Mar 28, 2005
by
Peter Berg Larsen
Committed by
Alexandre Julliard
Mar 28, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Janitorial: Get rid of strncpy/strncpyW.
parent
65e4d345
Hide whitespace changes
Inline
Side-by-side
Showing
50 changed files
with
139 additions
and
179 deletions
+139
-179
filedlg.c
dlls/commdlg/filedlg.c
+7
-6
dbghelp.c
dlls/dbghelp/dbghelp.c
+1
-2
module.c
dlls/dbghelp/module.c
+5
-13
symbol.c
dlls/dbghelp/symbol.c
+3
-5
band.c
dlls/dmband/band.c
+2
-2
chordmap.c
dlls/dmcompos/chordmap.c
+2
-2
audiopath.c
dlls/dmime/audiopath.c
+2
-2
graph.c
dlls/dmime/graph.c
+2
-2
segment.c
dlls/dmime/segment.c
+2
-2
capture.c
dlls/dsound/capture.c
+2
-2
dsound_main.c
dlls/dsound/dsound_main.c
+1
-2
propset.c
dlls/dsound/propset.c
+12
-12
dswave.c
dlls/dswave/dswave.c
+3
-3
env.c
dlls/gdi/env.c
+1
-2
ifenum.c
dlls/iphlpapi/ifenum.c
+9
-18
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+2
-3
atom16.c
dlls/kernel/atom16.c
+7
-6
profile.c
dlls/kernel/profile.c
+11
-11
process.c
dlls/kernel/tests/process.c
+1
-2
action.c
dlls/msi/action.c
+2
-2
appsearch.c
dlls/msi/appsearch.c
+2
-2
dialog.c
dlls/msi/dialog.c
+1
-1
format.c
dlls/msi/format.c
+1
-1
dir.c
dlls/msvcrt/dir.c
+1
-1
msvideo16.c
dlls/msvideo/msvideo16.c
+2
-4
wgl.c
dlls/opengl32/wgl.c
+1
-1
dsoundrender.c
dlls/quartz/dsoundrender.c
+1
-1
parser.c
dlls/quartz/parser.c
+1
-1
transform.c
dlls/quartz/transform.c
+2
-2
videorenderer.c
dlls/quartz/videorenderer.c
+1
-1
waveparser.c
dlls/quartz/waveparser.c
+1
-1
rsaenh.c
dlls/rsaenh/rsaenh.c
+2
-4
devinst.c
dlls/setupapi/devinst.c
+1
-1
setupcab.c
dlls/setupapi/setupcab.c
+1
-3
path.c
dlls/shlwapi/path.c
+7
-7
string.c
dlls/shlwapi/string.c
+4
-7
url.c
dlls/shlwapi/url.c
+10
-8
assisted.c
dlls/tapi32/assisted.c
+1
-2
afm2c.c
dlls/wineps/afm2c.c
+1
-2
cookie.c
dlls/wininet/cookie.c
+2
-1
ftp.c
dlls/wininet/ftp.c
+1
-1
http.c
dlls/wininet/http.c
+4
-8
internet.c
dlls/wininet/internet.c
+1
-2
socket.c
dlls/winsock/socket.c
+1
-2
msiexec.c
programs/msiexec/msiexec.c
+2
-2
regproc.c
programs/regedit/regproc.c
+3
-5
drive.c
programs/winecfg/drive.c
+3
-3
memory.c
programs/winedbg/memory.c
+1
-2
main.c
programs/winemine/main.c
+1
-1
spy.c
windows/spy.c
+2
-3
No files found.
dlls/commdlg/filedlg.c
View file @
e732fc02
...
...
@@ -462,16 +462,17 @@ BOOL WINAPI GetFileDialog95W(LPOPENFILENAMEW ofn,UINT iDlgType)
if
(
ofn
->
lpstrFile
)
{
fodInfos
.
filename
=
MemAlloc
(
ofn
->
nMaxFile
*
sizeof
(
WCHAR
));
strncpy
W
(
fodInfos
.
filename
,
ofn
->
lpstrFile
,
ofn
->
nMaxFile
);
lstrcpyn
W
(
fodInfos
.
filename
,
ofn
->
lpstrFile
,
ofn
->
nMaxFile
);
}
else
fodInfos
.
filename
=
NULL
;
if
(
ofn
->
lpstrInitialDir
)
{
DWORD
len
=
strlenW
(
ofn
->
lpstrInitialDir
);
fodInfos
.
initdir
=
MemAlloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
fodInfos
.
initdir
,
ofn
->
lpstrInitialDir
);
/* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */
DWORD
len
=
strlenW
(
ofn
->
lpstrInitialDir
)
+
1
;
fodInfos
.
initdir
=
MemAlloc
(
len
*
sizeof
(
WCHAR
));
memcpy
(
fodInfos
.
initdir
,
ofn
->
lpstrInitialDir
,
len
*
sizeof
(
WCHAR
));
}
else
fodInfos
.
initdir
=
NULL
;
...
...
@@ -853,7 +854,7 @@ HRESULT FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID buffer)
/* Prepend the current path */
n
=
strlenW
(
lpstrCurrentDir
)
+
1
;
strncpyW
(
bufW
,
lpstrCurrentDir
,
size
);
memcpy
(
bufW
,
lpstrCurrentDir
,
min
(
n
,
size
)
*
sizeof
(
WCHAR
)
);
if
(
n
<
size
)
{
/* 'n' includes trailing \0 */
...
...
@@ -2034,7 +2035,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{
LPOPENFILENAMEW
ofn
=
fodInfos
->
ofnInfos
;
strncpy
W
(
ofn
->
lpstrFile
,
lpstrPathAndFile
,
ofn
->
nMaxFile
);
lstrcpyn
W
(
ofn
->
lpstrFile
,
lpstrPathAndFile
,
ofn
->
nMaxFile
);
if
(
ofn
->
Flags
&
OFN_ALLOWMULTISELECT
)
ofn
->
lpstrFile
[
lstrlenW
(
ofn
->
lpstrFile
)
+
1
]
=
'\0'
;
}
...
...
dlls/dbghelp/dbghelp.c
View file @
e732fc02
...
...
@@ -126,8 +126,7 @@ BOOL WINAPI SymGetSearchPath(HANDLE hProcess, LPSTR szSearchPath,
struct
process
*
pcs
=
process_find_by_handle
(
hProcess
);
if
(
!
pcs
)
return
FALSE
;
strncpy
(
szSearchPath
,
pcs
->
search_path
,
SearchPathLength
);
szSearchPath
[
SearchPathLength
-
1
]
=
'\0'
;
lstrcpynA
(
szSearchPath
,
pcs
->
search_path
,
SearchPathLength
);
return
TRUE
;
}
...
...
dlls/dbghelp/module.c
View file @
e732fc02
...
...
@@ -42,8 +42,7 @@ static void module_fill_module(const char* in, char* out, unsigned size)
*
ptr
!=
'/'
&&
*
ptr
!=
'\\'
&&
ptr
>=
in
;
ptr
--
);
if
(
ptr
<
in
||
*
ptr
==
'/'
||
*
ptr
==
'\\'
)
ptr
++
;
strncpy
(
out
,
ptr
,
size
);
out
[
size
-
1
]
=
'\0'
;
lstrcpynA
(
out
,
ptr
,
size
);
len
=
strlen
(
out
);
if
(
len
>
4
&&
(
!
strcasecmp
(
&
out
[
len
-
4
],
".dll"
)
||
!
strcasecmp
(
&
out
[
len
-
4
],
".exe"
)))
...
...
@@ -51,7 +50,7 @@ static void module_fill_module(const char* in, char* out, unsigned size)
else
if
(((
len
>
12
&&
out
[
len
-
13
]
==
'/'
)
||
len
==
12
)
&&
(
!
strcasecmp
(
out
+
len
-
12
,
"wine-pthread"
)
||
!
strcasecmp
(
out
+
len
-
12
,
"wine-kthread"
)))
strcpy
(
out
,
"<wine-loader>"
);
lstrcpynA
(
out
,
"<wine-loader>"
,
size
);
else
{
if
(
len
>
7
&&
...
...
@@ -96,9 +95,7 @@ struct module* module_new(struct process* pcs, const char* name,
module
->
module
.
ImageSize
=
size
;
module_fill_module
(
name
,
module
->
module
.
ModuleName
,
sizeof
(
module
->
module
.
ModuleName
));
module
->
module
.
ImageName
[
0
]
=
'\0'
;
strncpy
(
module
->
module
.
LoadedImageName
,
name
,
sizeof
(
module
->
module
.
LoadedImageName
));
module
->
module
.
LoadedImageName
[
sizeof
(
module
->
module
.
LoadedImageName
)
-
1
]
=
'\0'
;
lstrcpynA
(
module
->
module
.
LoadedImageName
,
name
,
sizeof
(
module
->
module
.
LoadedImageName
));
module
->
module
.
SymType
=
SymNone
;
module
->
module
.
NumSyms
=
0
;
module
->
module
.
TimeDateStamp
=
stamp
;
...
...
@@ -360,13 +357,8 @@ done:
* of ImageName. Overwrite it, if we have better information
*/
if
(
ModuleName
)
{
strncpy
(
module
->
module
.
ModuleName
,
ModuleName
,
sizeof
(
module
->
module
.
ModuleName
));
module
->
module
.
ModuleName
[
sizeof
(
module
->
module
.
ModuleName
)
-
1
]
=
'\0'
;
}
strncpy
(
module
->
module
.
ImageName
,
ImageName
,
sizeof
(
module
->
module
.
ImageName
));
module
->
module
.
ImageName
[
sizeof
(
module
->
module
.
ImageName
)
-
1
]
=
'\0'
;
lstrcpynA
(
module
->
module
.
ModuleName
,
ModuleName
,
sizeof
(
module
->
module
.
ModuleName
));
lstrcpynA
(
module
->
module
.
ImageName
,
ImageName
,
sizeof
(
module
->
module
.
ImageName
));
return
module
->
module
.
BaseOfImage
;
}
...
...
dlls/dbghelp/symbol.c
View file @
e732fc02
...
...
@@ -536,7 +536,7 @@ static void symt_fill_sym_info(const struct module* module,
sym_info
->
MaxNameLen
,
UNDNAME_COMPLETE
)
==
0
))
{
sym_info
->
NameLen
=
min
(
strlen
(
name
),
sym_info
->
MaxNameLen
-
1
);
strn
cpy
(
sym_info
->
Name
,
name
,
sym_info
->
NameLen
);
mem
cpy
(
sym_info
->
Name
,
name
,
sym_info
->
NameLen
);
sym_info
->
Name
[
sym_info
->
NameLen
]
=
'\0'
;
}
}
...
...
@@ -916,8 +916,7 @@ BOOL WINAPI SymGetSymFromAddr(HANDLE hProcess, DWORD Address,
Symbol
->
Size
=
si
->
Size
;
Symbol
->
Flags
=
si
->
Flags
;
len
=
min
(
Symbol
->
MaxNameLength
,
si
->
MaxNameLen
);
strncpy
(
Symbol
->
Name
,
si
->
Name
,
len
);
Symbol
->
Name
[
len
-
1
]
=
'\0'
;
lstrcpynA
(
Symbol
->
Name
,
si
->
Name
,
len
);
return
TRUE
;
}
...
...
@@ -992,8 +991,7 @@ BOOL WINAPI SymGetSymFromName(HANDLE hProcess, LPSTR Name, PIMAGEHLP_SYMBOL Symb
Symbol
->
Size
=
si
->
Size
;
Symbol
->
Flags
=
si
->
Flags
;
len
=
min
(
Symbol
->
MaxNameLength
,
si
->
MaxNameLen
);
strncpy
(
Symbol
->
Name
,
si
->
Name
,
len
);
Symbol
->
Name
[
len
-
1
]
=
'\0'
;
lstrcpynA
(
Symbol
->
Name
,
si
->
Name
,
len
);
return
TRUE
;
}
...
...
dlls/dmband/band.c
View file @
e732fc02
...
...
@@ -165,9 +165,9 @@ HRESULT WINAPI IDirectMusicBandImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMU
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_NAME
)
strncpyW
(
This
->
pDesc
->
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_VERSION
)
memcpy
(
&
This
->
pDesc
->
vVersion
,
&
pDesc
->
vVersion
,
sizeof
(
pDesc
->
vVersion
));
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_DATE
)
...
...
dlls/dmcompos/chordmap.c
View file @
e732fc02
...
...
@@ -149,9 +149,9 @@ HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_SetDescriptor (LPDIRE
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_NAME
)
strncpyW
(
This
->
pDesc
->
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_VERSION
)
memcpy
(
&
This
->
pDesc
->
vVersion
,
&
pDesc
->
vVersion
,
sizeof
(
pDesc
->
vVersion
));
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_DATE
)
...
...
dlls/dmime/audiopath.c
View file @
e732fc02
...
...
@@ -264,9 +264,9 @@ HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_SetDescriptor (LPDIR
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_NAME
)
strncpyW
(
This
->
pDesc
->
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_VERSION
)
memcpy
(
&
This
->
pDesc
->
vVersion
,
&
pDesc
->
vVersion
,
sizeof
(
pDesc
->
vVersion
));
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_DATE
)
...
...
dlls/dmime/graph.c
View file @
e732fc02
...
...
@@ -230,9 +230,9 @@ HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_SetDescriptor (LPDIRECTM
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_NAME
)
strncpyW
(
This
->
pDesc
->
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_VERSION
)
memcpy
(
&
This
->
pDesc
->
vVersion
,
&
pDesc
->
vVersion
,
sizeof
(
pDesc
->
vVersion
));
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_DATE
)
...
...
dlls/dmime/segment.c
View file @
e732fc02
...
...
@@ -550,9 +550,9 @@ HRESULT WINAPI IDirectMusicSegment8Impl_IDirectMusicObject_SetDescriptor (LPDIRE
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_NAME
)
strncpyW
(
This
->
pDesc
->
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_VERSION
)
memcpy
(
&
This
->
pDesc
->
vVersion
,
&
pDesc
->
vVersion
,
sizeof
(
pDesc
->
vVersion
));
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_DATE
)
...
...
dlls/dsound/capture.c
View file @
e732fc02
...
...
@@ -567,8 +567,8 @@ IDirectSoundCaptureImpl_Initialize(
if
(
err
==
DS_OK
)
{
This
->
drvcaps
.
dwFlags
=
0
;
strncpy
(
This
->
drvdesc
.
szDrvname
,
wic
.
szPname
,
sizeof
(
This
->
drvdesc
.
szDrvname
));
lstrcpynA
(
This
->
drvdesc
.
szDrvname
,
wic
.
szPname
,
sizeof
(
This
->
drvdesc
.
szDrvname
));
This
->
drvcaps
.
dwFlags
|=
DSCCAPS_EMULDRIVER
;
This
->
drvcaps
.
dwFormats
=
wic
.
dwFormats
;
...
...
dlls/dsound/dsound_main.c
View file @
e732fc02
...
...
@@ -149,8 +149,7 @@ void setup_dsound_options(void)
char
appname
[
MAX_PATH
+
16
];
char
*
p
=
strrchr
(
buffer
,
'\\'
);
if
(
p
!=
NULL
)
{
appname
[
MAX_PATH
]
=
'\0'
;
strncpy
(
appname
,
p
+
1
,
MAX_PATH
);
lstrcpynA
(
appname
,
p
+
1
,
MAX_PATH
);
strcat
(
appname
,
"
\\
dsound"
);
TRACE
(
"appname = [%s]
\n
"
,
appname
);
if
(
RegOpenKeyA
(
tmpkey
,
appname
,
&
appkey
))
appkey
=
0
;
...
...
dlls/dsound/propset.c
View file @
e732fc02
...
...
@@ -384,8 +384,8 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err
=
mmErr
(
waveOutMessage
((
HWAVEOUT
)
wod
,
DRV_QUERYDSOUNDDESC
,(
DWORD
)
&
(
desc
),
0
));
if
(
err
==
DS_OK
)
{
PIDSDRIVER
drv
=
NULL
;
strncpy
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
-
1
);
strncpy
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
-
1
);
lstrcpynA
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
);
lstrcpynA
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDesc
,
-
1
,
ppd
->
DescriptionW
,
sizeof
(
ppd
->
DescriptionW
)
/
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDrvname
,
-
1
,
ppd
->
ModuleW
,
sizeof
(
ppd
->
ModuleW
)
/
sizeof
(
WCHAR
)
);
err
=
mmErr
(
waveOutMessage
((
HWAVEOUT
)
wod
,
DRV_QUERYDSOUNDIFACE
,
(
DWORD
)
&
drv
,
0
));
...
...
@@ -415,8 +415,8 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err
=
mmErr
(
waveInMessage
((
HWAVEIN
)
wid
,
DRV_QUERYDSOUNDDESC
,(
DWORD
)
&
(
desc
),
0
));
if
(
err
==
DS_OK
)
{
PIDSCDRIVER
drv
;
strncpy
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
-
1
);
strncpy
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
-
1
);
lstrcpynA
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
);
lstrcpynA
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDesc
,
-
1
,
ppd
->
DescriptionW
,
sizeof
(
ppd
->
DescriptionW
)
/
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDrvname
,
-
1
,
ppd
->
ModuleW
,
sizeof
(
ppd
->
ModuleW
)
/
sizeof
(
WCHAR
)
);
err
=
mmErr
(
waveInMessage
((
HWAVEIN
)
wid
,
DRV_QUERYDSOUNDIFACE
,(
DWORD
)
&
drv
,
0
));
...
...
@@ -447,8 +447,8 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err
=
mmErr
(
waveOutMessage
((
HWAVEOUT
)
wod
,
DRV_QUERYDSOUNDDESC
,(
DWORD
)
&
(
desc
),
0
));
if
(
err
==
DS_OK
)
{
PIDSDRIVER
drv
=
NULL
;
strncpy
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
-
1
);
strncpy
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
-
1
);
lstrcpynA
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
);
lstrcpynA
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDesc
,
-
1
,
ppd
->
DescriptionW
,
sizeof
(
ppd
->
DescriptionW
)
/
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDrvname
,
-
1
,
ppd
->
ModuleW
,
sizeof
(
ppd
->
ModuleW
)
/
sizeof
(
WCHAR
)
);
err
=
mmErr
(
waveOutMessage
((
HWAVEOUT
)
wod
,
DRV_QUERYDSOUNDIFACE
,
(
DWORD
)
&
drv
,
0
));
...
...
@@ -480,8 +480,8 @@ static HRESULT WINAPI DSPROPERTY_Description1(
err
=
mmErr
(
waveInMessage
((
HWAVEIN
)
wod
,
DRV_QUERYDSOUNDDESC
,(
DWORD
)
&
(
desc
),
0
));
if
(
err
==
DS_OK
)
{
PIDSDRIVER
drv
=
NULL
;
strncpy
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
-
1
);
strncpy
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
-
1
);
lstrcpynA
(
ppd
->
DescriptionA
,
desc
.
szDesc
,
sizeof
(
ppd
->
DescriptionA
)
);
lstrcpynA
(
ppd
->
ModuleA
,
desc
.
szDrvname
,
sizeof
(
ppd
->
ModuleA
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDesc
,
-
1
,
ppd
->
DescriptionW
,
sizeof
(
ppd
->
DescriptionW
)
/
sizeof
(
WCHAR
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
desc
.
szDrvname
,
-
1
,
ppd
->
ModuleW
,
sizeof
(
ppd
->
ModuleW
)
/
sizeof
(
WCHAR
)
);
err
=
mmErr
(
waveInMessage
((
HWAVEIN
)
wod
,
DRV_QUERYDSOUNDIFACE
,
(
DWORD
)
&
drv
,
0
));
...
...
@@ -1005,8 +1005,8 @@ static HRESULT WINAPI DSPROPERTY_Enumerate1(
data
.
DataFlow
=
DIRECTSOUNDDEVICE_DATAFLOW_RENDER
;
data
.
WaveDeviceId
=
wod
;
data
.
DeviceId
=
DSOUND_renderer_guids
[
wod
];
strncpy
(
data
.
DescriptionA
,
desc
.
szDesc
,
sizeof
(
data
.
DescriptionA
));
strncpy
(
data
.
ModuleA
,
desc
.
szDrvname
,
sizeof
(
data
.
ModuleA
));
lstrcpynA
(
data
.
DescriptionA
,
desc
.
szDesc
,
sizeof
(
data
.
DescriptionA
));
lstrcpynA
(
data
.
ModuleA
,
desc
.
szDrvname
,
sizeof
(
data
.
ModuleA
));
MultiByteToWideChar
(
CP_ACP
,
0
,
data
.
DescriptionA
,
-
1
,
data
.
DescriptionW
,
sizeof
(
data
.
DescriptionW
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
data
.
ModuleA
,
-
1
,
data
.
ModuleW
,
sizeof
(
data
.
ModuleW
)
);
...
...
@@ -1024,8 +1024,8 @@ static HRESULT WINAPI DSPROPERTY_Enumerate1(
data
.
DataFlow
=
DIRECTSOUNDDEVICE_DATAFLOW_RENDER
;
data
.
WaveDeviceId
=
wod
;
data
.
DeviceId
=
DSOUND_renderer_guids
[
wod
];
strncpy
(
data
.
DescriptionA
,
desc
.
szDesc
,
sizeof
(
data
.
DescriptionA
));
strncpy
(
data
.
ModuleA
,
desc
.
szDrvname
,
sizeof
(
data
.
ModuleA
));
lstrcpynA
(
data
.
DescriptionA
,
desc
.
szDesc
,
sizeof
(
data
.
DescriptionA
));
lstrcpynA
(
data
.
ModuleA
,
desc
.
szDrvname
,
sizeof
(
data
.
ModuleA
));
MultiByteToWideChar
(
CP_ACP
,
0
,
data
.
DescriptionA
,
-
1
,
data
.
DescriptionW
,
sizeof
(
data
.
DescriptionW
)
);
MultiByteToWideChar
(
CP_ACP
,
0
,
data
.
ModuleA
,
-
1
,
data
.
ModuleW
,
sizeof
(
data
.
ModuleW
)
);
...
...
dlls/dswave/dswave.c
View file @
e732fc02
...
...
@@ -346,11 +346,11 @@ HRESULT WINAPI IDirectMusicWaveImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMU
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CLASS
)
memcpy
(
&
This
->
pDesc
->
guidClass
,
&
pDesc
->
guidClass
,
sizeof
(
pDesc
->
guidClass
));
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_NAME
)
strncpy
W
(
This
->
pDesc
->
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
lstrcpyn
W
(
This
->
pDesc
->
wszName
,
pDesc
->
wszName
,
DMUS_MAX_NAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_CATEGORY
)
strncpyW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
lstrcpynW
(
This
->
pDesc
->
wszCategory
,
pDesc
->
wszCategory
,
DMUS_MAX_CATEGORY
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_FILENAME
)
strncpyW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
lstrcpynW
(
This
->
pDesc
->
wszFileName
,
pDesc
->
wszFileName
,
DMUS_MAX_FILENAME
);
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_VERSION
)
memcpy
(
&
This
->
pDesc
->
vVersion
,
&
pDesc
->
vVersion
,
sizeof
(
pDesc
->
vVersion
));
if
(
pDesc
->
dwValidData
&
DMUS_OBJ_DATE
)
...
...
dlls/gdi/env.c
View file @
e732fc02
...
...
@@ -67,8 +67,7 @@ static ATOM PortNameToAtom(LPCSTR lpPortName, BOOL16 add)
{
char
buffer
[
256
];
strncpy
(
buffer
,
lpPortName
,
sizeof
(
buffer
)
);
buffer
[
sizeof
(
buffer
)
-
1
]
=
0
;
lstrcpynA
(
buffer
,
lpPortName
,
sizeof
(
buffer
)
);
if
(
buffer
[
0
]
&&
buffer
[
strlen
(
buffer
)
-
1
]
==
':'
)
buffer
[
strlen
(
buffer
)
-
1
]
=
0
;
...
...
dlls/iphlpapi/ifenum.c
View file @
e732fc02
...
...
@@ -191,8 +191,7 @@ static int isLoopbackInterface(int fd, const char *name)
if
(
name
)
{
struct
ifreq
ifr
;
strncpy
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
if
(
ioctl
(
fd
,
SIOCGIFFLAGS
,
&
ifr
)
==
0
)
ret
=
ifr
.
ifr_flags
&
IFF_LOOPBACK
;
}
...
...
@@ -245,8 +244,7 @@ static void storeInterfaceInMap(InterfaceNameMap *map, const char *name)
/* look for new slot */
for
(
ndx
=
0
;
!
stored
&&
ndx
<
map
->
numAllocated
;
ndx
++
)
{
if
(
!
map
->
table
[
ndx
].
inUse
)
{
strncpy
(
map
->
table
[
ndx
].
name
,
name
,
IFNAMSIZ
);
map
->
table
[
ndx
].
name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
map
->
table
[
ndx
].
name
,
name
,
IFNAMSIZ
);
map
->
table
[
ndx
].
inUse
=
TRUE
;
stored
=
TRUE
;
if
(
ndx
>=
map
->
nextAvailable
)
...
...
@@ -467,8 +465,7 @@ DWORD getInterfaceIPAddrByName(const char *name)
if
(
fd
!=
-
1
)
{
struct
ifreq
ifr
;
strncpy
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
&
ifr
)
==
0
)
memcpy
(
&
ret
,
ifr
.
ifr_addr
.
sa_data
+
2
,
sizeof
(
DWORD
));
close
(
fd
);
...
...
@@ -499,8 +496,7 @@ DWORD getInterfaceBCastAddrByName(const char *name)
if
(
fd
!=
-
1
)
{
struct
ifreq
ifr
;
strncpy
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
if
(
ioctl
(
fd
,
SIOCGIFBRDADDR
,
&
ifr
)
==
0
)
memcpy
(
&
ret
,
ifr
.
ifr_addr
.
sa_data
+
2
,
sizeof
(
DWORD
));
close
(
fd
);
...
...
@@ -531,8 +527,7 @@ DWORD getInterfaceMaskByName(const char *name)
if
(
fd
!=
-
1
)
{
struct
ifreq
ifr
;
strncpy
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
if
(
ioctl
(
fd
,
SIOCGIFNETMASK
,
&
ifr
)
==
0
)
memcpy
(
&
ret
,
ifr
.
ifr_addr
.
sa_data
+
2
,
sizeof
(
DWORD
));
close
(
fd
);
...
...
@@ -568,8 +563,7 @@ DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr,
struct
ifreq
ifr
;
memset
(
&
ifr
,
0
,
sizeof
(
struct
ifreq
));
strncpy
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
if
((
ioctl
(
fd
,
SIOCGIFHWADDR
,
&
ifr
)))
ret
=
ERROR_INVALID_DATA
;
else
{
...
...
@@ -813,8 +807,7 @@ DWORD getInterfaceMtuByName(const char *name, PDWORD mtu)
if
(
fd
!=
-
1
)
{
struct
ifreq
ifr
;
strncpy
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
if
((
ioctl
(
fd
,
SIOCGIFMTU
,
&
ifr
)))
ret
=
ERROR_INVALID_DATA
;
else
{
...
...
@@ -855,8 +848,7 @@ DWORD getInterfaceStatusByName(const char *name, PDWORD status)
if
(
fd
!=
-
1
)
{
struct
ifreq
ifr
;
strncpy
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
ifr
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifr
.
ifr_name
,
name
,
IFNAMSIZ
);
if
((
ioctl
(
fd
,
SIOCGIFFLAGS
,
&
ifr
)))
ret
=
ERROR_INVALID_DATA
;
else
{
...
...
@@ -940,8 +932,7 @@ char *toIPAddressString(unsigned int addr, char string[16])
iAddr
.
s_addr
=
addr
;
/* extra-anal, just to make auditors happy */
strncpy
(
string
,
inet_ntoa
(
iAddr
),
16
);
string
[
16
]
=
'\0'
;
lstrcpynA
(
string
,
inet_ntoa
(
iAddr
),
sizeof
(
string
));
}
return
string
;
}
dlls/iphlpapi/iphlpapi_main.c
View file @
e732fc02
...
...
@@ -643,10 +643,9 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
DWORD
addrLen
=
sizeof
(
ptr
->
Address
),
type
;
/* on Win98 this is left empty, but whatever */
strncpy
(
ptr
->
AdapterName
,
lstrcpynA
(
ptr
->
AdapterName
,
getInterfaceNameByIndex
(
table
->
indexes
[
ndx
]),
sizeof
(
ptr
->
AdapterName
));
ptr
->
AdapterName
[
MAX_ADAPTER_NAME_LENGTH
]
=
'\0'
;
MAX_ADAPTER_NAME_LENGTH
+
1
);
getInterfacePhysicalByIndex
(
table
->
indexes
[
ndx
],
&
addrLen
,
ptr
->
Address
,
&
type
);
/* MS defines address length and type as UINT in some places and
...
...
dlls/kernel/atom16.c
View file @
e732fc02
...
...
@@ -210,14 +210,14 @@ ATOM WINAPI AddAtom16( LPCSTR str )
if
(
ATOM_IsIntAtomA
(
str
,
&
iatom
))
return
iatom
;
TRACE
(
"%s
\n
"
,
debugstr_a
(
buffer
));
TRACE
(
"%s
\n
"
,
debugstr_a
(
str
));
if
(
!
(
table
=
ATOM_GetTable
(
TRUE
)))
return
0
;
/* Make a copy of the string to be sure it doesn't move in linear memory. */
lstrcpynA
(
buffer
,
str
,
sizeof
(
buffer
)
);
len
=
strlen
(
buffer
);
if
(
!
(
table
=
ATOM_GetTable
(
TRUE
)))
return
0
;
hash
=
ATOM_Hash
(
table
->
size
,
buffer
,
len
);
entry
=
table
->
entries
[
hash
];
while
(
entry
)
...
...
@@ -242,9 +242,10 @@ ATOM WINAPI AddAtom16( LPCSTR str )
entryPtr
->
next
=
table
->
entries
[
hash
];
entryPtr
->
refCount
=
1
;
entryPtr
->
length
=
len
;
/* Some applications _need_ the '\0' padding provided by this strncpy */
strncpy
(
entryPtr
->
str
,
buffer
,
ae_len
-
sizeof
(
ATOMENTRY
)
+
1
);
entryPtr
->
str
[
ae_len
-
sizeof
(
ATOMENTRY
)]
=
'\0'
;
memcpy
(
entryPtr
->
str
,
buffer
,
len
);
/* Some applications _need_ the '\0' padding provided by memset */
/* Note that 1 byte of the str is accounted for in the ATOMENTRY struct */
memset
(
entryPtr
->
str
+
len
,
0
,
ae_len
-
sizeof
(
ATOMENTRY
)
-
(
len
-
1
));
table
->
entries
[
hash
]
=
entry
;
TRACE
(
"-- new 0x%x
\n
"
,
entry
);
return
HANDLETOATOM
(
entry
);
...
...
dlls/kernel/profile.c
View file @
e732fc02
...
...
@@ -899,7 +899,7 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name,
static
INT
PROFILE_GetSectionNames
(
LPWSTR
buffer
,
UINT
len
)
{
LPWSTR
buf
;
UINT
f
,
l
;
UINT
buflen
,
tmplen
;
PROFILESECTION
*
section
;
TRACE
(
"(%p, %d)
\n
"
,
buffer
,
len
);
...
...
@@ -911,24 +911,24 @@ static INT PROFILE_GetSectionNames( LPWSTR buffer, UINT len )
return
0
;
}
f
=
len
-
1
;
buflen
=
len
-
1
;
buf
=
buffer
;
section
=
CurProfile
->
section
;
while
((
section
!=
NULL
))
{
if
(
section
->
name
[
0
])
{
l
=
strlenW
(
section
->
name
)
+
1
;
if
(
l
>
f
)
{
if
(
f
>
0
)
{
strncpyW
(
buf
,
section
->
name
,
f
-
1
);
buf
+=
f
-
1
;
tmplen
=
strlenW
(
section
->
name
)
+
1
;
if
(
tmplen
>
buflen
)
{
if
(
buflen
>
0
)
{
memcpy
(
buf
,
section
->
name
,
(
buflen
-
1
)
*
sizeof
(
WCHAR
)
);
buf
+=
buflen
-
1
;
*
buf
++=
'\0'
;
}
*
buf
=
'\0'
;
return
len
-
2
;
}
strcpyW
(
buf
,
section
->
name
);
buf
+=
l
;
f
-=
l
;
memcpy
(
buf
,
section
->
name
,
tmplen
*
sizeof
(
WCHAR
)
);
buf
+=
tmplen
;
buflen
-=
tmplen
;
}
section
=
section
->
next
;
}
...
...
@@ -1109,7 +1109,7 @@ static int PROFILE_GetPrivateProfileString( LPCWSTR section, LPCWSTR entry,
LPWSTR
p
;
p
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
p
,
def_val
,
len
);
memcpy
(
p
,
def_val
,
len
*
sizeof
(
WCHAR
)
);
p
[
len
]
=
'\0'
;
pDefVal
=
p
;
}
...
...
dlls/kernel/tests/process.c
View file @
e732fc02
...
...
@@ -268,8 +268,7 @@ static void doChild(const char* file, const char* option)
i
=
0
;
while
(
*
ptrA
)
{
strncpy
(
env_var
,
ptrA
,
MAX_LISTED_ENV_VAR
-
1
);
env_var
[
MAX_LISTED_ENV_VAR
-
1
]
=
'\0'
;
lstrcpynA
(
env_var
,
ptrA
,
MAX_LISTED_ENV_VAR
);
childPrintf
(
hFile
,
"env%d=%s
\n
"
,
i
,
encodeA
(
env_var
));
i
++
;
ptrA
+=
strlen
(
ptrA
)
+
1
;
...
...
dlls/msi/action.c
View file @
e732fc02
...
...
@@ -922,7 +922,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
while
(
*
ptr
==
' '
)
ptr
++
;
len
=
ptr2
-
ptr
;
prop
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
len
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
prop
,
ptr
,
len
);
memcpy
(
prop
,
ptr
,
len
*
sizeof
(
WCHAR
)
);
prop
[
len
]
=
0
;
ptr2
++
;
...
...
@@ -942,7 +942,7 @@ UINT ACTION_DoTopLevelINSTALL(MSIPACKAGE *package, LPCWSTR szPackagePath,
len
-=
2
;
}
val
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
len
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
val
,
ptr2
,
len
);
memcpy
(
val
,
ptr2
,
len
*
sizeof
(
WCHAR
)
);
val
[
len
]
=
0
;
if
(
strlenW
(
prop
)
>
0
)
...
...
dlls/msi/appsearch.c
View file @
e732fc02
...
...
@@ -672,8 +672,8 @@ static UINT ACTION_SearchDirectory(MSIPACKAGE *package, MSISIGNATURE *sig,
pathWithDrive
[
0
]
=
'A'
+
i
;
if
(
GetDriveTypeW
(
pathWithDrive
)
==
DRIVE_FIXED
)
{
strncpy
W
(
pathWithDrive
+
3
,
expanded
,
sizeof
(
pathWithDrive
)
/
sizeof
(
pathWithDrive
[
0
])
-
3
);
lstrcpyn
W
(
pathWithDrive
+
3
,
expanded
,
sizeof
(
pathWithDrive
)
/
sizeof
(
pathWithDrive
[
0
])
-
3
);
if
(
sig
->
File
)
rc
=
ACTION_RecurseSearchDirectory
(
package
,
&
found
,
sig
,
pathWithDrive
,
depth
);
...
...
dlls/msi/dialog.c
View file @
e732fc02
...
...
@@ -131,7 +131,7 @@ static LPWSTR msi_dialog_get_style( LPCWSTR *text )
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
);
if
(
!
ret
)
return
ret
;
strncpyW
(
ret
,
p
,
len
);
memcpy
(
ret
,
p
,
len
*
sizeof
(
WCHAR
)
);
ret
[
len
-
1
]
=
0
;
return
ret
;
}
...
...
dlls/msi/format.c
View file @
e732fc02
...
...
@@ -252,7 +252,7 @@ static BOOL find_next_outermost_key(LPCWSTR source, DWORD len_remaining,
*
key
=
HeapAlloc
(
GetProcessHeap
(),
0
,
i
*
sizeof
(
WCHAR
));
/* do not have the [] in the key */
i
-=
1
;
strncpyW
(
*
key
,
&
(
*
mark
)[
1
],
i
);
memcpy
(
*
key
,
&
(
*
mark
)[
1
],
i
*
sizeof
(
WCHAR
)
);
(
*
key
)[
i
]
=
0
;
TRACE
(
"Found Key %s
\n
"
,
debugstr_w
(
*
key
));
...
...
dlls/msvcrt/dir.c
View file @
e732fc02
...
...
@@ -1233,7 +1233,7 @@ void _searchenv(const char* file, const char* env, char *buf)
msvcrt_set_errno
(
ERROR_FILE_NOT_FOUND
);
return
;
}
strn
cpy
(
curPath
,
penv
,
end
-
penv
);
mem
cpy
(
curPath
,
penv
,
end
-
penv
);
if
(
curPath
[
end
-
penv
]
!=
'/'
||
curPath
[
end
-
penv
]
!=
'\\'
)
{
curPath
[
end
-
penv
]
=
'\\'
;
...
...
dlls/msvideo/msvideo16.c
View file @
e732fc02
...
...
@@ -821,17 +821,15 @@ DWORD WINAPI VideoCapDriverDescAndVer16(WORD nr, LPSTR buf1, WORD buf1len,
infobuf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
infosize
);
if
(
GetFileVersionInfoA
(
fn
,
verhandle
,
infosize
,
infobuf
))
{
char
vbuf
[
200
];
/* Yes, two space behind : */
/* FIXME: test for buflen */
s
printf
(
vbuf
,
"Version: %d.%d.%d.%d
\n
"
,
s
nprintf
(
buf2
,
buf2len
,
"Version: %d.%d.%d.%d
\n
"
,
((
WORD
*
)
infobuf
)[
0x0f
],
((
WORD
*
)
infobuf
)[
0x0e
],
((
WORD
*
)
infobuf
)[
0x11
],
((
WORD
*
)
infobuf
)[
0x10
]
);
TRACE
(
"version of %s is %s
\n
"
,
fn
,
vbuf
);
strncpy
(
buf2
,
vbuf
,
buf2len
);
TRACE
(
"version of %s is %s
\n
"
,
fn
,
buf2
);
}
else
{
...
...
dlls/opengl32/wgl.c
View file @
e732fc02
...
...
@@ -390,7 +390,7 @@ void* WINAPI wglGetProcAddress(LPCSTR lpszProc) {
OpenGL drivers (moreover, it is only useful for old 1.0 apps
that query the glBindTextureEXT extension).
*/
strn
cpy
(
buf
,
ext_ret
->
glx_name
,
strlen
(
ext_ret
->
glx_name
)
-
3
);
mem
cpy
(
buf
,
ext_ret
->
glx_name
,
strlen
(
ext_ret
->
glx_name
)
-
3
);
buf
[
strlen
(
ext_ret
->
glx_name
)
-
3
]
=
'\0'
;
TRACE
(
" extension not found in the Linux OpenGL library, checking against libGL bug with %s..
\n
"
,
buf
);
...
...
dlls/quartz/dsoundrender.c
View file @
e732fc02
...
...
@@ -307,7 +307,7 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
/* construct input pin */
piInput
.
dir
=
PINDIR_INPUT
;
piInput
.
pFilter
=
(
IBaseFilter
*
)
pDSoundRender
;
strncpy
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
lstrcpyn
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
hr
=
DSoundRender_InputPin_Construct
(
&
piInput
,
DSoundRender_Sample
,
(
LPVOID
)
pDSoundRender
,
DSoundRender_QueryAccept
,
&
pDSoundRender
->
csFilter
,
(
IPin
**
)
&
pDSoundRender
->
pInputPin
);
if
(
SUCCEEDED
(
hr
))
...
...
dlls/quartz/parser.c
View file @
e732fc02
...
...
@@ -78,7 +78,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const CLSID* pClsid, PFN_PROCESS_SAMP
/* construct input pin */
piInput
.
dir
=
PINDIR_INPUT
;
piInput
.
pFilter
=
(
IBaseFilter
*
)
pParser
;
strncpy
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
lstrcpyn
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
hr
=
Parser_InputPin_Construct
(
&
piInput
,
fnProcessSample
,
(
LPVOID
)
pParser
,
fnQueryAccept
,
&
pParser
->
csFilter
,
(
IPin
**
)
&
pParser
->
pInputPin
);
...
...
dlls/quartz/transform.c
View file @
e732fc02
...
...
@@ -196,10 +196,10 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
/* construct input pin */
piInput
.
dir
=
PINDIR_INPUT
;
piInput
.
pFilter
=
(
IBaseFilter
*
)
pTransformFilter
;
strncpy
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
lstrcpyn
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
piOutput
.
dir
=
PINDIR_OUTPUT
;
piOutput
.
pFilter
=
(
IBaseFilter
*
)
pTransformFilter
;
strncpy
W
(
piOutput
.
achName
,
wcsOutputPinName
,
sizeof
(
piOutput
.
achName
)
/
sizeof
(
piOutput
.
achName
[
0
]));
lstrcpyn
W
(
piOutput
.
achName
,
wcsOutputPinName
,
sizeof
(
piOutput
.
achName
)
/
sizeof
(
piOutput
.
achName
[
0
]));
hr
=
TransformFilter_InputPin_Construct
(
&
piInput
,
TransformFilter_Sample
,
(
LPVOID
)
pTransformFilter
,
TransformFilter_Input_QueryAccept
,
&
pTransformFilter
->
csFilter
,
&
pTransformFilter
->
ppPins
[
0
]);
...
...
dlls/quartz/videorenderer.c
View file @
e732fc02
...
...
@@ -352,7 +352,7 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
/* construct input pin */
piInput
.
dir
=
PINDIR_INPUT
;
piInput
.
pFilter
=
(
IBaseFilter
*
)
pVideoRenderer
;
strncpy
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
lstrcpyn
W
(
piInput
.
achName
,
wcsInputPinName
,
sizeof
(
piInput
.
achName
)
/
sizeof
(
piInput
.
achName
[
0
]));
hr
=
VideoRenderer_InputPin_Construct
(
&
piInput
,
VideoRenderer_Sample
,
(
LPVOID
)
pVideoRenderer
,
VideoRenderer_QueryAccept
,
&
pVideoRenderer
->
csFilter
,
(
IPin
**
)
&
pVideoRenderer
->
pInputPin
);
...
...
dlls/quartz/waveparser.c
View file @
e732fc02
...
...
@@ -228,7 +228,7 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin)
piOutput
.
dir
=
PINDIR_OUTPUT
;
piOutput
.
pFilter
=
(
IBaseFilter
*
)
This
;
strncpy
W
(
piOutput
.
achName
,
wcsOutputPinName
,
sizeof
(
piOutput
.
achName
)
/
sizeof
(
piOutput
.
achName
[
0
]));
lstrcpyn
W
(
piOutput
.
achName
,
wcsOutputPinName
,
sizeof
(
piOutput
.
achName
)
/
sizeof
(
piOutput
.
achName
[
0
]));
hr
=
IAsyncReader_SyncRead
(
This
->
pReader
,
pos
,
sizeof
(
list
),
(
BYTE
*
)
&
list
);
pos
+=
sizeof
(
list
);
...
...
dlls/rsaenh/rsaenh.c
View file @
e732fc02
...
...
@@ -959,15 +959,13 @@ static HCRYPTPROV new_key_container(PCHAR pszContainerName, DWORD dwFlags, PVTab
destroy_key_container
,
(
OBJECTHDR
**
)
&
pKeyContainer
);
if
(
hKeyContainer
!=
(
HCRYPTPROV
)
INVALID_HANDLE_VALUE
)
{
strncpy
(
pKeyContainer
->
szName
,
pszContainerName
,
MAX_PATH
);
pKeyContainer
->
szName
[
MAX_PATH
-
1
]
=
'\0'
;
lstrcpynA
(
pKeyContainer
->
szName
,
pszContainerName
,
MAX_PATH
);
pKeyContainer
->
dwFlags
=
dwFlags
;
pKeyContainer
->
dwEnumAlgsCtr
=
0
;
pKeyContainer
->
hKeyExchangeKeyPair
=
(
HCRYPTKEY
)
INVALID_HANDLE_VALUE
;
pKeyContainer
->
hSignatureKeyPair
=
(
HCRYPTKEY
)
INVALID_HANDLE_VALUE
;
if
(
pVTable
&&
pVTable
->
pszProvName
)
{
strncpy
(
pKeyContainer
->
szProvName
,
pVTable
->
pszProvName
,
MAX_PATH
);
pKeyContainer
->
szProvName
[
MAX_PATH
-
1
]
=
'\0'
;
lstrcpynA
(
pKeyContainer
->
szProvName
,
pVTable
->
pszProvName
,
MAX_PATH
);
if
(
!
strcmp
(
pVTable
->
pszProvName
,
MS_DEF_PROV_A
))
{
pKeyContainer
->
dwPersonality
=
RSAENH_PERSONALITY_BASE
;
}
else
if
(
!
strcmp
(
pVTable
->
pszProvName
,
MS_ENHANCED_PROV_A
))
{
...
...
dlls/setupapi/devinst.c
View file @
e732fc02
...
...
@@ -891,7 +891,7 @@ static HDEVINFO SETUP_CreateSerialDeviceList(void)
{
if
(
!
strncmpW
(
comW
,
ptr
,
sizeof
(
comW
)
/
sizeof
(
comW
[
0
])
-
1
))
{
strncpy
W
(
list
->
names
[
list
->
numPorts
].
name
,
ptr
,
lstrcpyn
W
(
list
->
names
[
list
->
numPorts
].
name
,
ptr
,
sizeof
(
list
->
names
[
list
->
numPorts
].
name
)
/
sizeof
(
list
->
names
[
list
->
numPorts
].
name
[
0
]));
TRACE
(
"Adding %s to list
\n
"
,
...
...
dlls/setupapi/setupcab.c
View file @
e732fc02
...
...
@@ -363,9 +363,7 @@ static INT_PTR sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
}
else
{
if
(
mysterio
[
0
])
{
/* some easy paranoia. no such carefulness exists on the wide API IIRC */
mysterio
[
SIZEOF_MYSTERIO
-
1
]
=
'\0'
;
strncpy
(
pfdin
->
psz3
,
&
(
mysterio
[
0
]),
255
);
mysterio
[
255
]
=
'\0'
;
lstrcpynA
(
pfdin
->
psz3
,
&
(
mysterio
[
0
]),
SIZEOF_MYSTERIO
);
}
return
0
;
}
...
...
dlls/shlwapi/path.c
View file @
e732fc02
...
...
@@ -168,14 +168,14 @@ LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
if
(
!
lpszFile
||
!*
lpszFile
)
{
/* Use dir only */
strncpy
W
(
szTemp
,
lpszDir
,
MAX_PATH
);
lstrcpyn
W
(
szTemp
,
lpszDir
,
MAX_PATH
);
}
else
if
(
!
lpszDir
||
!*
lpszDir
||
!
PathIsRelativeW
(
lpszFile
))
{
if
(
!
lpszDir
||
!*
lpszDir
||
*
lpszFile
!=
'\\'
||
PathIsUNCW
(
lpszFile
))
{
/* Use file only */
strncpy
W
(
szTemp
,
lpszFile
,
MAX_PATH
);
lstrcpyn
W
(
szTemp
,
lpszFile
,
MAX_PATH
);
}
else
{
...
...
@@ -188,7 +188,7 @@ LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
if
(
bUseBoth
)
{
strncpy
W
(
szTemp
,
lpszDir
,
MAX_PATH
);
lstrcpyn
W
(
szTemp
,
lpszDir
,
MAX_PATH
);
if
(
bStrip
)
{
PathStripToRootW
(
szTemp
);
...
...
@@ -2845,7 +2845,7 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx)
* the file name as possible, allowing for the ellipses, e.g:
* c:\some very long path\filename ==> c:\some v...\filename
*/
strncpy
W
(
buff
,
sFile
,
MAX_PATH
);
lstrcpyn
W
(
buff
,
sFile
,
MAX_PATH
);
do
{
...
...
@@ -3397,8 +3397,8 @@ BOOL WINAPI PathRelativePathToW(LPWSTR lpszPath, LPCWSTR lpszFrom, DWORD dwAttrF
return
FALSE
;
*
lpszPath
=
'\0'
;
strncpy
W
(
szFrom
,
lpszFrom
,
MAX_PATH
);
strncpy
W
(
szTo
,
lpszTo
,
MAX_PATH
);
lstrcpyn
W
(
szFrom
,
lpszFrom
,
MAX_PATH
);
lstrcpyn
W
(
szTo
,
lpszTo
,
MAX_PATH
);
if
(
!
(
dwAttrFrom
&
FILE_ATTRIBUTE_DIRECTORY
))
PathRemoveFileSpecW
(
szFrom
);
...
...
@@ -3746,7 +3746,7 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
if
(
!
lpszPath
||
!
PathIsDirectoryW
(
lpszPath
))
return
FALSE
;
strncpy
W
(
szSearch
,
lpszPath
,
MAX_PATH
);
lstrcpyn
W
(
szSearch
,
lpszPath
,
MAX_PATH
);
PathAddBackslashW
(
szSearch
);
dwLen
=
strlenW
(
szSearch
);
if
(
dwLen
>
MAX_PATH
-
4
)
...
...
dlls/shlwapi/string.c
View file @
e732fc02
...
...
@@ -1577,7 +1577,7 @@ LPSTR WINAPI StrFormatKBSizeA(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
ulKB
=
(
ulKB
-
ulNextDigit
)
/
10
;
}
while
(
ulKB
>
0
);
strncpy
(
lpszDest
,
szOut
+
1
,
cchMax
);
lstrcpynA
(
lpszDest
,
szOut
+
1
,
cchMax
);
return
lpszDest
;
}
...
...
@@ -1605,7 +1605,7 @@ LPWSTR WINAPI StrFormatKBSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
ulKB
=
(
ulKB
-
ulNextDigit
)
/
10
;
}
while
(
ulKB
>
0
);
strncpy
W
(
lpszDest
,
szOut
+
1
,
cchMax
);
lstrcpyn
W
(
lpszDest
,
szOut
+
1
,
cchMax
);
return
lpszDest
;
}
...
...
@@ -2027,7 +2027,7 @@ INT WINAPI StrFromTimeIntervalW(LPWSTR lpszStr, UINT cchMax, DWORD dwMS,
if
(
iDigits
)
/* Always write seconds if we have significant digits */
SHLWAPI_WriteTimeClass
(
szCopy
,
dwMS
,
szSec
,
iDigits
);
strncpy
W
(
lpszStr
,
szCopy
,
cchMax
);
lstrcpyn
W
(
lpszStr
,
szCopy
,
cchMax
);
iRet
=
strlenW
(
lpszStr
);
}
return
iRet
;
...
...
@@ -2301,7 +2301,7 @@ LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
sprintfW
(
wszBuff
,
bfFormats
[
i
].
lpwszFormat
,
dBytes
);
wszAdd
[
1
]
=
bfFormats
[
i
].
wPrefix
;
strcatW
(
wszBuff
,
wszAdd
);
strncpy
W
(
lpszDest
,
wszBuff
,
cchMax
);
lstrcpyn
W
(
lpszDest
,
wszBuff
,
cchMax
);
return
lpszDest
;
}
...
...
@@ -2638,9 +2638,6 @@ DWORD WINAPI SHAnsiToAnsi(LPCSTR lpszSrc, LPSTR lpszDst, int iLen)
TRACE
(
"(%s,%p,0x%08x)
\n
"
,
debugstr_a
(
lpszSrc
),
lpszDst
,
iLen
);
/* Our original version used lstrncpy/lstrlen, incorrectly filling up all
* of lpszDst with extra NULs. This version is correct, and faster too.
*/
lpszRet
=
StrCpyNXA
(
lpszDst
,
lpszSrc
,
iLen
);
return
lpszRet
-
lpszDst
+
1
;
}
...
...
dlls/shlwapi/url.c
View file @
e732fc02
...
...
@@ -329,7 +329,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
DWORD
EscapeFlags
;
LPWSTR
lpszUrlCpy
,
wk1
,
wk2
,
mp
,
root
;
INT
nByteLen
,
state
;
DWORD
nLen
;
DWORD
nLen
,
nWkLen
;
TRACE
(
"(%s %p %p 0x%08lx)
\n
"
,
debugstr_w
(
pszUrl
),
pszCanonicalized
,
pcchCanonicalized
,
dwFlags
);
...
...
@@ -379,9 +379,10 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
state
=
4
;
break
;
case
3
:
strcpyW
(
wk2
,
wk1
);
wk1
+=
strlenW
(
wk1
);
wk2
+=
strlenW
(
wk2
);
nWkLen
=
strlenW
(
wk1
);
memcpy
(
wk2
,
wk1
,
(
nWkLen
+
1
)
*
sizeof
(
WCHAR
));
wk1
+=
nWkLen
;
wk2
+=
nWkLen
;
break
;
case
4
:
if
(
!
isalnumW
(
*
wk1
)
&&
(
*
wk1
!=
L'-'
)
&&
(
*
wk1
!=
L'.'
))
{
state
=
3
;
break
;}
...
...
@@ -401,13 +402,14 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
TRACE
(
"wk1=%c
\n
"
,
(
CHAR
)
*
wk1
);
mp
=
strchrW
(
wk1
,
L'/'
);
if
(
!
mp
)
{
strcpyW
(
wk2
,
wk1
);
wk1
+=
strlenW
(
wk1
);
wk2
+=
strlenW
(
wk2
);
nWkLen
=
strlenW
(
wk1
);
memcpy
(
wk2
,
wk1
,
(
nWkLen
+
1
)
*
sizeof
(
WCHAR
));
wk1
+=
nWkLen
;
wk2
+=
nWkLen
;
continue
;
}
nLen
=
mp
-
wk1
+
1
;
strncpyW
(
wk2
,
wk1
,
nLen
);
memcpy
(
wk2
,
wk1
,
nLen
*
sizeof
(
WCHAR
)
);
wk2
+=
nLen
;
wk1
+=
nLen
;
if
(
*
wk1
==
L'.'
)
{
...
...
dlls/tapi32/assisted.c
View file @
e732fc02
...
...
@@ -53,8 +53,7 @@ DWORD WINAPI tapiGetLocationInfoA(LPSTR lpszCountryCode, LPSTR lpszCityCode)
bufsize
=
sizeof
(
buf
);
if
(
!
RegQueryValueExA
(
hsubkey
,
"AreaCode"
,
0
,
&
type
,
buf
,
&
bufsize
)
&&
type
==
REG_SZ
)
{
strncpy
(
lpszCityCode
,
(
char
*
)
buf
,
8
);
if
(
bufsize
>
8
)
lpszCityCode
[
7
]
=
'\0'
;
lstrcpynA
(
lpszCityCode
,
(
char
*
)
buf
,
8
);
}
else
lpszCityCode
[
0
]
=
'\0'
;
}
...
...
dlls/wineps/afm2c.c
View file @
e732fc02
...
...
@@ -189,8 +189,7 @@ void PSDRV_AFM2C(const AFM *afm)
FILE
*
of
;
int
i
;
strncpy
(
buffer
,
afm
->
FontName
,
sizeof
(
buffer
)
-
3
);
buffer
[
sizeof
(
buffer
)
-
3
]
=
'\0'
;
lstrcpynA
(
buffer
,
afm
->
FontName
,
sizeof
(
buffer
)
-
2
);
for
(
i
=
0
;
i
<
strlen
(
buffer
);
++
i
)
if
(
buffer
[
i
]
==
'-'
)
...
...
dlls/wininet/cookie.c
View file @
e732fc02
...
...
@@ -410,6 +410,7 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
WCHAR
*
ourCookieName
,
*
ourCookieData
;
int
ourCookieNameSize
;
BOOL
ret
;
if
(
!
(
ourCookieData
=
strchrW
(
lpCookieData
,
'='
)))
{
TRACE
(
"something terribly wrong with cookie data %s
\n
"
,
...
...
@@ -420,7 +421,7 @@ BOOL WINAPI InternetSetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
ourCookieData
+=
1
;
ourCookieName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
ourCookieNameSize
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
ourCookieName
,
ourCookieData
,
ourCookieNameSize
);
memcpy
(
ourCookieName
,
ourCookieData
,
ourCookieNameSize
*
sizeof
(
WCHAR
)
);
ourCookieName
[
ourCookieNameSize
]
=
'\0'
;
TRACE
(
"setting (hacked) cookie of %s, %s
\n
"
,
debugstr_w
(
ourCookieName
),
debugstr_w
(
ourCookieData
));
...
...
dlls/wininet/ftp.c
View file @
e732fc02
...
...
@@ -2777,7 +2777,7 @@ BOOL FTP_ConvertFileProp(LPFILEPROPERTIESW lpafp, LPWIN32_FIND_DATAW lpFindFileD
lpFindFileData
->
dwFileAttributes
|=
FILE_ATTRIBUTE_DIRECTORY
;
if
(
lpafp
->
lpszName
)
strncpy
W
(
lpFindFileData
->
cFileName
,
lpafp
->
lpszName
,
MAX_PATH
);
lstrcpyn
W
(
lpFindFileData
->
cFileName
,
lpafp
->
lpszName
,
MAX_PATH
);
bSuccess
=
TRUE
;
}
...
...
dlls/wininet/http.c
View file @
e732fc02
...
...
@@ -178,8 +178,7 @@ static BOOL WINAPI HTTP_HttpAddRequestHeadersW(LPWININETHTTPREQW lpwhr,
else
len
=
dwHeaderLength
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
(
len
+
1
)
);
strncpyW
(
buffer
,
lpszHeader
,
len
);
buffer
[
len
]
=
0
;
lstrcpynW
(
buffer
,
lpszHeader
,
len
+
1
);
lpszStart
=
buffer
;
...
...
@@ -1722,14 +1721,12 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
nDomainPosStart
=
strlenW
(
szDomain
);
nDomainLength
=
(
nDomainPosEnd
-
nDomainPosStart
)
+
1
;
domain
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
nDomainLength
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
domain
,
&
lpszDomain
[
nDomainPosStart
],
nDomainLength
);
domain
[
nDomainLength
]
=
'\0'
;
lstrcpynW
(
domain
,
&
lpszDomain
[
nDomainPosStart
],
nDomainLength
+
1
);
}
}
if
(
setCookieHeader
->
lpszValue
[
nPosEnd
]
==
'\0'
)
break
;
buf_cookie
=
HeapAlloc
(
GetProcessHeap
(),
0
,
((
nPosEnd
-
nPosStart
)
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
buf_cookie
,
&
setCookieHeader
->
lpszValue
[
nPosStart
],
(
nPosEnd
-
nPosStart
));
buf_cookie
[(
nPosEnd
-
nPosStart
)]
=
'\0'
;
lstrcpynW
(
buf_cookie
,
&
setCookieHeader
->
lpszValue
[
nPosStart
],
(
nPosEnd
-
nPosStart
)
+
1
);
TRACE
(
"%s
\n
"
,
debugstr_w
(
buf_cookie
));
while
(
buf_cookie
[
nEqualPos
]
!=
'='
&&
buf_cookie
[
nEqualPos
]
!=
'\0'
)
{
...
...
@@ -1742,8 +1739,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
}
cookie_name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
nEqualPos
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
cookie_name
,
buf_cookie
,
nEqualPos
);
cookie_name
[
nEqualPos
]
=
'\0'
;
lstrcpynW
(
cookie_name
,
buf_cookie
,
nEqualPos
+
1
);
cookie_data
=
&
buf_cookie
[
nEqualPos
+
1
];
...
...
dlls/wininet/internet.c
View file @
e732fc02
...
...
@@ -1163,8 +1163,7 @@ static INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, DWORD nMaxCmp)
return
INTERNET_SCHEME_UNKNOWN
;
tempBuffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,(
nMaxCmp
+
1
)
*
sizeof
(
WCHAR
));
strncpyW
(
tempBuffer
,
lpszScheme
,
nMaxCmp
);
tempBuffer
[
nMaxCmp
]
=
0
;
lstrcpynW
(
tempBuffer
,
lpszScheme
,
nMaxCmp
+
1
);
strlwrW
(
tempBuffer
);
if
(
nMaxCmp
==
strlenW
(
lpszFtp
)
&&
!
strncmpW
(
lpszFtp
,
tempBuffer
,
nMaxCmp
))
iScheme
=
INTERNET_SCHEME_FTP
;
...
...
dlls/winsock/socket.c
View file @
e732fc02
...
...
@@ -1959,8 +1959,7 @@ INT WINAPI WSAIoctl(SOCKET s,
struct
ifreq
ifInfo
;
/* Socket Status Flags */
strncpy
(
ifInfo
.
ifr_name
,
ptr
->
AdapterName
,
IFNAMSIZ
);
ifInfo
.
ifr_name
[
IFNAMSIZ
-
1
]
=
'\0'
;
lstrcpynA
(
ifInfo
.
ifr_name
,
ptr
->
AdapterName
,
IFNAMSIZ
);
if
(
ioctl
(
fd
,
SIOCGIFFLAGS
,
&
ifInfo
)
<
0
)
{
ERR
(
"Error obtaining status flags for socket!
\n
"
);
...
...
programs/msiexec/msiexec.c
View file @
e732fc02
...
...
@@ -145,7 +145,7 @@ static LPWSTR build_properties(struct string_list *property_list)
continue
;
len
=
value
-
list
->
str
;
*
p
++
=
' '
;
strncpyW
(
p
,
list
->
str
,
len
);
memcpy
(
p
,
list
->
str
,
len
*
sizeof
(
WCHAR
)
);
p
+=
len
;
*
p
++
=
'='
;
...
...
@@ -155,7 +155,7 @@ static LPWSTR build_properties(struct string_list *property_list)
if
(
needs_quote
)
*
p
++
=
'"'
;
len
=
lstrlenW
(
value
);
strncpyW
(
p
,
value
,
len
);
memcpy
(
p
,
value
,
len
*
sizeof
(
WCHAR
)
);
p
+=
len
;
if
(
needs_quote
)
*
p
++
=
'"'
;
...
...
programs/regedit/regproc.c
View file @
e732fc02
...
...
@@ -528,7 +528,7 @@ HKEY getRegClass(LPSTR lpClass)
if
(
lpClass
==
NULL
)
return
(
HKEY
)
ERROR_INVALID_PARAMETER
;
strncpy
(
lpClassCopy
,
lpClass
,
KEY_MAX_LEN
);
lstrcpynA
(
lpClassCopy
,
lpClass
,
KEY_MAX_LEN
);
classNameEnd
=
strchr
(
lpClassCopy
,
'\\'
);
/* The class name ends by '\' */
if
(
!
classNameEnd
)
/* or the whole string */
...
...
@@ -792,8 +792,7 @@ void processQueryValue(LPSTR cmdline)
if (hRes == ERROR_SUCCESS) {
lpsRes = HeapAlloc( GetProcessHeap(), 0, lLen);
strncpy(lpsRes, lpsData, lLen);
lpsRes[lLen-1]='\0';
lstrcpynA(lpsRes, lpsData, lLen);
}
} else {
DWORD dwLen = KEY_MAX_LEN;
...
...
@@ -823,8 +822,7 @@ void processQueryValue(LPSTR cmdline)
case REG_SZ:
case REG_EXPAND_SZ: {
lpsRes = HeapAlloc( GetProcessHeap(), 0, dwLen);
strncpy(lpsRes, lpbData, dwLen);
lpsRes[dwLen-1]='\0';
lstrcpynA(lpsRes, lpbData, dwLen);
break;
}
case REG_DWORD: {
...
...
programs/winecfg/drive.c
View file @
e732fc02
...
...
@@ -230,7 +230,7 @@ void load_drives()
WINE_TRACE
(
"serial: '0x%lX'
\n
"
,
serial
);
/* build rootpath for GetDriveType() */
strncpy
(
rootpath
,
devices
,
sizeof
(
rootpath
));
lstrcpynA
(
rootpath
,
devices
,
sizeof
(
rootpath
));
pathlen
=
strlen
(
rootpath
);
/* ensure that we have a backslash on the root path */
...
...
@@ -240,8 +240,8 @@ void load_drives()
rootpath
[
pathlen
+
1
]
=
0
;
}
strncpy
(
simplepath
,
devices
,
2
);
/* QueryDosDevice() requires no trailing backslash */
simplepath
[
2
]
=
0
;
/* QueryDosDevice() requires no trailing backslash */
lstrcpynA
(
simplepath
,
devices
,
3
)
;
QueryDosDevice
(
simplepath
,
targetpath
,
sizeof
(
targetpath
));
/* targetpath may have forward slashes rather than backslashes, so correct */
...
...
programs/winedbg/memory.c
View file @
e732fc02
...
...
@@ -242,8 +242,7 @@ BOOL memory_get_string(HANDLE hp, void* addr, BOOL in_debuggee, BOOL unicode,
}
else
{
strncpy
(
buffer
,
addr
,
size
);
buffer
[
size
-
1
]
=
0
;
lstrcpynA
(
buffer
,
addr
,
size
);
}
return
TRUE
;
}
...
...
programs/winemine/main.c
View file @
e732fc02
...
...
@@ -390,7 +390,7 @@ void SaveBoard( BOARD *p_board )
for
(
i
=
0
;
i
<
3
;
i
++
)
{
wsprintf
(
key_name
,
"Name%u"
,
i
);
strncpy
(
data
,
p_board
->
best_name
[
i
],
sizeof
(
data
)
);
lstrcpyn
(
data
,
p_board
->
best_name
[
i
],
sizeof
(
data
)
);
RegSetValueEx
(
hkey
,
key_name
,
0
,
REG_SZ
,
(
LPBYTE
)
data
,
strlen
(
data
)
+
1
);
}
...
...
windows/spy.c
View file @
e732fc02
...
...
@@ -2047,7 +2047,7 @@ static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e )
p
=
SPY_Bsearch_Msg
(
cc_array
[
i
].
classmsg
,
cc_array
[
i
].
lastmsg
,
sp_e
->
msgnum
);
if
(
p
)
{
strncpy
(
sp_e
->
msg_name
,
p
->
name
,
sizeof
(
sp_e
->
msg_name
)
-
1
);
lstrcpynA
(
sp_e
->
msg_name
,
p
->
name
,
sizeof
(
sp_e
->
msg_name
)
);
sp_e
->
data_len
=
p
->
len
;
return
;
}
...
...
@@ -2059,8 +2059,7 @@ static void SPY_GetMsgStuff( SPY_INSTANCE *sp_e )
}
else
{
strncpy
(
sp_e
->
msg_name
,
msg_name
,
sizeof
(
sp_e
->
msg_name
)
-
1
);
sp_e
->
msg_name
[
sizeof
(
sp_e
->
msg_name
)
-
1
]
=
0
;
lstrcpynA
(
sp_e
->
msg_name
,
msg_name
,
sizeof
(
sp_e
->
msg_name
));
}
}
...
...
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