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
44570c11
Commit
44570c11
authored
Jan 16, 2007
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Jan 17, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
localspl: Implement PortIsValid for XcvDataPort.
parent
37771632
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
0 deletions
+83
-0
localmon.c
dlls/localspl/localmon.c
+67
-0
localspl_private.h
dlls/localspl/localspl_private.h
+16
-0
No files found.
dlls/localspl/localmon.c
View file @
44570c11
...
...
@@ -37,6 +37,7 @@
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
localspl
);
...
...
@@ -65,8 +66,15 @@ static struct list xcv_handles = LIST_INIT( xcv_handles );
/* ############################### */
static
const
WCHAR
cmd_MonitorUIW
[]
=
{
'M'
,
'o'
,
'n'
,
'i'
,
't'
,
'o'
,
'r'
,
'U'
,
'I'
,
0
};
static
const
WCHAR
cmd_PortIsValidW
[]
=
{
'P'
,
'o'
,
'r'
,
't'
,
'I'
,
's'
,
'V'
,
'a'
,
'l'
,
'i'
,
'd'
,
0
};
static
const
WCHAR
dllnameuiW
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'u'
,
'i'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
static
const
WCHAR
portname_LPT
[]
=
{
'L'
,
'P'
,
'T'
,
0
};
static
const
WCHAR
portname_COM
[]
=
{
'C'
,
'O'
,
'M'
,
0
};
static
const
WCHAR
portname_FILE
[]
=
{
'F'
,
'I'
,
'L'
,
'E'
,
':'
,
0
};
static
const
WCHAR
portname_CUPS
[]
=
{
'C'
,
'U'
,
'P'
,
'S'
,
':'
,
0
};
static
const
WCHAR
portname_LPR
[]
=
{
'L'
,
'P'
,
'R'
,
':'
,
0
};
static
const
WCHAR
WinNT_CV_PortsW
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
' '
,
'N'
,
'T'
,
'\\'
,
...
...
@@ -198,6 +206,52 @@ getports_cleanup:
}
/*****************************************************
* get_type_from_name (internal)
*
*/
static
DWORD
get_type_from_name
(
LPCWSTR
name
)
{
HANDLE
hfile
;
if
(
!
strncmpW
(
name
,
portname_LPT
,
sizeof
(
portname_LPT
)
/
sizeof
(
WCHAR
)
-
1
))
return
PORT_IS_LPT
;
if
(
!
strncmpW
(
name
,
portname_COM
,
sizeof
(
portname_COM
)
/
sizeof
(
WCHAR
)
-
1
))
return
PORT_IS_COM
;
if
(
!
strcmpW
(
name
,
portname_FILE
))
return
PORT_IS_FILE
;
if
(
name
[
0
]
==
'/'
)
return
PORT_IS_UNIXNAME
;
if
(
name
[
0
]
==
'|'
)
return
PORT_IS_PIPE
;
if
(
!
strncmpW
(
name
,
portname_CUPS
,
sizeof
(
portname_CUPS
)
/
sizeof
(
WCHAR
)
-
1
))
return
PORT_IS_CUPS
;
if
(
!
strncmpW
(
name
,
portname_LPR
,
sizeof
(
portname_LPR
)
/
sizeof
(
WCHAR
)
-
1
))
return
PORT_IS_LPR
;
/* Must be a file or a directory. Does the file exist ? */
hfile
=
CreateFileW
(
name
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
TRACE
(
"%p for OPEN_EXISTING on %s
\n
"
,
hfile
,
debugstr_w
(
name
));
if
(
hfile
==
INVALID_HANDLE_VALUE
)
{
/* Can we create the file? */
hfile
=
CreateFileW
(
name
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
TRACE
(
"%p for OPEN_ALWAYS
\n
"
,
hfile
);
}
if
(
hfile
!=
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hfile
);
return
PORT_IS_FILENAME
;
}
/* We can't use the name. use GetLastError() for the reason */
return
PORT_IS_UNKNOWN
;
}
/*****************************************************
* localmon_ConfigurePortW [exported through MONITOREX]
*
* Display the Configuration-Dialog for a specific Port
...
...
@@ -370,6 +424,7 @@ BOOL WINAPI localmon_XcvClosePort(HANDLE hXcv)
DWORD
WINAPI
localmon_XcvDataPort
(
HANDLE
hXcv
,
LPCWSTR
pszDataName
,
PBYTE
pInputData
,
DWORD
cbInputData
,
PBYTE
pOutputData
,
DWORD
cbOutputData
,
PDWORD
pcbOutputNeeded
)
{
DWORD
res
;
TRACE
(
"(%p, %s, %p, %d, %p, %d, %p)
\n
"
,
hXcv
,
debugstr_w
(
pszDataName
),
pInputData
,
cbInputData
,
pOutputData
,
cbOutputData
,
pcbOutputNeeded
);
...
...
@@ -383,6 +438,18 @@ DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE pInput
}
return
ERROR_INSUFFICIENT_BUFFER
;
}
if
(
!
lstrcmpW
(
pszDataName
,
cmd_PortIsValidW
))
{
TRACE
(
"InputData (%d): %s
\n
"
,
cbInputData
,
debugstr_w
(
(
LPWSTR
)
pInputData
));
res
=
get_type_from_name
((
LPCWSTR
)
pInputData
);
TRACE
(
"detected as %u
\n
"
,
res
);
/* names, that we have recognized, are valid */
if
(
res
)
return
ERROR_SUCCESS
;
/* ERROR_ACCESS_DENIED, ERROR_PATH_NOT_FOUND ore something else */
return
GetLastError
();
}
FIXME
(
"command not supported: %s
\n
"
,
debugstr_w
(
pszDataName
));
return
ERROR_INVALID_PARAMETER
;
}
...
...
dlls/localspl/localspl_private.h
View file @
44570c11
...
...
@@ -35,6 +35,22 @@ extern HINSTANCE LOCALSPL_hInstance;
#define IDS_LOCALPORT_MAXLEN 32
#define IDS_NOTHINGTOCONFIG_MAXLEN 80
/* ## Type of Ports ## */
/* windows types */
#define PORT_IS_UNKNOWN 0
#define PORT_IS_LPT 1
#define PORT_IS_COM 2
#define PORT_IS_FILE 3
#define PORT_IS_FILENAME 4
/* wine extensions */
#define PORT_IS_WINE 5
#define PORT_IS_UNIXNAME 5
#define PORT_IS_PIPE 6
#define PORT_IS_CUPS 7
#define PORT_IS_LPR 8
/* ## Memory allocation macros ## */
static
inline
void
*
spl_alloc
(
size_t
len
)
...
...
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