Displaying 20 results from an estimated 63 matches for "invalid_handle_value".
2008 Sep 09
1
FindFirstFileA win32 API function return value
I've a windows application that calls the win32 API function FindFirstFileA on a non-existent file. As stated in microsoft windows SDK documentation at http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx, the function should return INVALID_HANDLE_VALUE, which is equivalent to 0xFFFFFFFF, when the file interrogated doesn't exist.
Under windows, the function doesn't return INVALID_HANDLE_VALUE, even if the file doesn't exist. On the contrary, with wine under linux it successfully returns INVALID_HANDLE_VALUE.
Does anyone have an interpr...
2005 Nov 26
1
Another patch of win32-service for nice startup.
...atus(SERVICE_START_PENDING, 0, i, 1000);
+ }
+
// The service has started.
SetTheServiceStatus(SERVICE_RUNNING, NO_ERROR, 0, 0);
@@ -241,9 +252,9 @@
}
#endif
- // Create Thread for service main
- hThread = CreateThread(NULL,0,ThreadProc,0,0,&ThreadId);
- if(hThread == INVALID_HANDLE_VALUE){
+ // Create the event to signal the service to start.
+ hStartEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+ if(hStartEvent == NULL){
strcpy(error,ErrorDescription(GetLastError()));
ErrorStopService();
rb_raise(cDaemonError,error);
@@ -257,11 +268,20 @@
r...
2008 May 06
4
DeviceIoControl + IOCTL_DISK_GET_DRIVE_GEOMETRY problem
...ows/device_io''
require ''windows/handle''
require ''windows/error''
include Windows::DeviceIO
include Windows::Handle
include Windows::Error
fh = File.open(''test.txt'') # Assume you have this
handle = get_osfhandle(fh.fileno)
if handle == INVALID_HANDLE_VALUE
puts "get_osfhandle failed"
fh.close
exit
end
buf = 0.chr * 24 # sizeof(DISK_GEOMETRY)
bytes = [0].pack(''L'')
bool = DeviceIoControl(
handle,
IOCTL_DISK_GET_DRIVE_GEOMETRY(), # 458752
nil,
0,
buf,
buf.size,
bytes,
0
)
# Fails here
un...
2011 Sep 03
1
Patch to build hivex lib on Windows
Hi
I'm just posting this here in case someone is interested in building
hivex on Windows (mingw32). The attached patch allows building the lib
but not the tools (hivexsh etc..) as there are some more problems to solve.
In short terms, this patch replaces file i/o functions and mmap(),
munmap() with their win32api pendants.
cu
--
Unix _IS_ user friendly - it's just
selective about
2013 Apr 20
1
One tiny Windows Unicode patch
...D, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ h1 = CreateFile_utf8(f1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ h2 = CreateFile_utf8(f2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(h1 == INVALID_HANDLE_VALUE || h2 == INVALID_HANDLE_VALUE)
ok = 0;
ok &= GetFileInformationByHandle(h1, &info1);
diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c
index d7d1dbd..d2288d9 100644
--- a/src/share/win_utf8_io/win_utf8_io.c
+++ b/src/share/win_utf8_io/win_utf8_io.c...
2014 Sep 26
4
Patch to add buffering to decoding too
...; d->format != FORMAT_RAW) {
+#ifdef _WIN32
+ if(strcmp(outfilename, "-") && d->total_samples > 0) {
+ HANDLE fh = CreateFile_utf8(outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if(fh != INVALID_HANDLE_VALUE) {
+ if (GetFileType(fh) == FILE_TYPE_DISK) {
+ LARGE_INTEGER size;
+ size.QuadPart = d->total_samples * d->channels * ((d->bps+7)/8) + 512;
+ if(d->foreign_metadata) {
+ size_t i;
+ for(i = d->format==FORMAT_RF64?2:1; i < d->foreign_metadata->num_bl...
2009 Jul 17
1
[LLVMdev] [PATCH 2/2] Make Program::ExecuteNoWait return a process ID.
...= "program not executable";
- return;
+ return 0;
}
// Windows wants a command line, not an array of args, to pass to the new
@@ -388,13 +388,13 @@ Program::ExecuteNoWait(const Path& path,
si.hStdInput = RedirectIO(redirects[0], 0, ErrMsg);
if (si.hStdInput == INVALID_HANDLE_VALUE) {
MakeErrMsg(ErrMsg, "can't redirect stdin");
- return;
+ return 0;
}
si.hStdOutput = RedirectIO(redirects[1], 1, ErrMsg);
if (si.hStdOutput == INVALID_HANDLE_VALUE) {
CloseHandle(si.hStdInput);
MakeErrMsg(ErrMsg, "can't redirect...
2014 Sep 27
0
Patch to add buffering to decoding too
...+#ifdef _WIN32
+ if(!error_occurred) {
+ FLAC__off_t written_size = ftello(d->fout);
+ if(written_size > 0) {
+ HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if(fh != INVALID_HANDLE_VALUE) {
+ if(GetFileType(fh) == FILE_TYPE_DISK) {
+ LARGE_INTEGER size;
+ size.QuadPart = written_size;
+ if(SetFilePointerEx(fh, size, NULL, FILE_CURRENT)) /* correct the file size */
+ SetEndOfFile(fh);
+ }
+ CloseHandle(fh);
+ }
+ }
+ }
+#endif
fclose(d->...
2002 Apr 22
0
[Bug 101] session.c modifications for correct UNICOS behavior
...ng for the child (exec command etc). */
do_child(s, command);
/* NOTREACHED */
}
+#ifdef _CRAY
+ signal(WJSIGNAL, cray_job_termination_handler);
+#endif /* _CRAY */
#ifdef HAVE_CYGWIN
if (is_winnt)
cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);
@@ -517,7 +527,12 @@
/* record login, etc. similar to login(1) */
#ifndef HAVE_OSF_SIA
if (!(options.use_login && command == NULL))
+ {
+# ifdef _CRAY
+ cray_init_job(s->pw); /* set up cray jid and tmpdir */
+# endif...
2000 Jun 20
3
WinAmp Plugin
Hi,
I downloaded afew off files from the site (www.vorbis.com) and also
downloaded the winamp plugin (dll file), but I am unable to play the off files.
--
Ramakrishnan.M | Phone : (+91-80)-5099132
DSP Applications Group, Texas Instruments | email : rkrishnan@ti.com
Bangalore, India | rkrishnan_m@yahoo.com
---
2016 Feb 09
2
Compilation failure using mingw-w64 and gcc-5.3.0
...L' undeclared (first use in
this function)
HANDLE fh = CreateFile_utf8(d->outfilename,
GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
^
decode.c:271:14: error: 'INVALID_HANDLE_VALUE' undeclared (first use in
this function)
if(fh != INVALID_HANDLE_VALUE) {
^
decode.c:272:9: warning: implicit declaration of function 'GetFileType'
[-Wimplicit-function-declaration]
if(GetFileType(fh) == FILE_TYPE_DISK) {
^
decode.c:272:6: warning: nest...
2002 Feb 04
0
[Bug 101] New: session.c modifications for correct UNICOS behavior
...ng for the child (exec command etc). */
do_child(s, command);
/* NOTREACHED */
}
+#ifdef _CRAY
+ signal(WJSIGNAL, cray_job_termination_handler);
+#endif /* _CRAY */
#ifdef HAVE_CYGWIN
if (is_winnt)
cygwin_set_impersonation_token(INVALID_HANDLE_VALUE);
@@ -586,7 +595,12 @@
/* record login, etc. similar to login(1) */
#ifndef HAVE_OSF_SIA
if (!(options.use_login && command == NULL))
+ {
+# ifdef _CRAY
+ cray_init_job(s->pw); /* set up cray jid and tmpdir */
+# endif...
2016 Feb 08
2
Compilation failure using mingw-w64 and gcc-5.3.0
Hello,
Upon compiling the flac tree today, after many successful compilations over
the last few weeks, a new error is appearing before compilation bails out.
This is a cross-compilation using gcc-5.3.0 running on GNU/Linux, with the
objects being built for a mingw-w64-x86_64 host.
Among other things, the compiler is looking for windows_unicode_filenames.h
but it isn't there. Also, I'm
2002 Jul 30
0
patch: disable credential forwarding after password auth.
...t, password);
- if (ret == 1 || ret == 0)
- return ret;
+ if (ret == 1 || ret == 0) {
+ retval=ret ; goto out;
+ }
/* Fall back to ordinary passwd authentication. */
}
#endif
@@ -138,29 +147,34 @@
if (is_winnt) {
HANDLE hToken = cygwin_logon_user(pw, password);
- if (hToken == INVALID_HANDLE_VALUE)
- return 0;
+ if (hToken == INVALID_HANDLE_VALUE) {
+ retval=0 ; goto out;
+ }
cygwin_set_impersonation_token(hToken);
- return 1;
+ retval=1;
+ goto out;
}
#endif
#ifdef WITH_AIXAUTHENTICATE
- return (authenticate(pw->pw_name,password,&reenter,&authmsg) == 0);
+ retval...
2017 Jan 06
1
[PATCH 5/5] win_utf8_io: Avoid forbidden functions when building for WinRT/UWP
...int width = 80;
> +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
Apparently these preprocessor defines are from winapifamily.h
so it won't work in older MSVS and MinGW.
> CONSOLE_SCREEN_BUFFER_INFO csbi;
> HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
> if(hOut != INVALID_HANDLE_VALUE && hOut != NULL)
> if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0)
> width = csbi.dwSize.X;
> +#endif
> return width;
> }
> @@ -176,6 +179,7 @@ int win_get_console_width(void)
> static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
>...
2007 Oct 04
0
Prototyping the Dir class
...Error, get_last_error
end
end
# Blend entries and foreach into one method
def self.entries(dirname)
dirname += "\\*"
fdata = 0.chr * 320 # 580 if wide
array = block_given? ? [] : nil
hfind = FindFirstFile(dirname, fdata)
if hfind == INVALID_HANDLE_VALUE
raise ArgumentError, get_last_error
end
file = fdata[44, MAX_PATH].unpack("Z*")[0]
if block_given?
yield file
else
array << file
end
while FindNextFile(hfind, fdata)
file = fdata[44, MAX_PATH].unpac...
2004 Nov 06
3
Calling CreateFile on an instance of File - possible?
...rbPath = rb_funcall(self,rb_intern("path"),0,0);
dwAttr = GetFileAttributes(StringValuePtr(rbPath));
h = CreateFile(
(LPCTSTR)StringValuePtr(rbPath),
FILE_ALL_ACCESS,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
dwAttr,
NULL
);
if(h == INVALID_HANDLE_VALUE){
printf("Error opening file: %s\n",ErrorDescription(GetLastError()));
return Qnil;
}
...
}
I''ve tried various flags for the different arguments, all to no avail. I
either get "permission denied" or "Error opening file: The process cannot
acc...
2009 Jul 17
0
[LLVMdev] [PATCH 2/2] Make Program::ExecuteNoWait return a process ID.
...ot;;
> - return;
> + return 0;
> }
>
> // Windows wants a command line, not an array of args, to pass to the new
> @@ -388,13 +388,13 @@ Program::ExecuteNoWait(const Path& path,
> si.hStdInput = RedirectIO(redirects[0], 0, ErrMsg);
> if (si.hStdInput == INVALID_HANDLE_VALUE) {
> MakeErrMsg(ErrMsg, "can't redirect stdin");
> - return;
> + return 0;
> }
> si.hStdOutput = RedirectIO(redirects[1], 1, ErrMsg);
> if (si.hStdOutput == INVALID_HANDLE_VALUE) {
> CloseHandle(si.hStdInput);
> MakeErrMs...
2009 Jul 17
3
[LLVMdev] [PATCH 1/2] Trailing whitespace.
---
include/llvm/System/Program.h | 8 ++++----
lib/System/Unix/Program.inc | 30 +++++++++++++++---------------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/include/llvm/System/Program.h b/include/llvm/System/Program.h
index 49de7cf..14f9e9e 100644
--- a/include/llvm/System/Program.h
+++ b/include/llvm/System/Program.h
@@ -97,12 +97,12 @@ namespace sys {
///
2008 Apr 30
8
Playing with NtQueryInformationFile
...dll'')
# http://msdn.microsoft.com/en-us/library/cc232064.aspx
FileNameInformation = 9
FileStandardInformation = 5
STATUS_SUCCESS = 0
fh = File.open(''test.txt'', ''w'')
fh.puts "hello"
handle = get_osfhandle(fh.fileno)
if handle == INVALID_HANDLE_VALUE
puts "ERROR, get_osfhandle() : " + get_last_error
fh.close rescue nil
File.delete(''test.txt'')
exit
end
# Excessive but harmless (?)
io_status_block = 0.chr * 512
file_information = 0.chr * 512
status = NtQueryInformationFile.call(
handle,
io_status_b...