I have given up tryng to figure out the reason of this issue, but here is the story and hope you could give a tip...
As I develop unique app ( http://code.google.com/p/sedev ) and therefore I need to polish it.
I have to add File Summary ( very useful info in my opinion ) to any created files by the app, so I decided to go with NTFS compatible structure
edit: code snippet in which problem occurs:
if (FileExists(BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
- 1) + '.vkp') = True) then // add NTFS descriptive information to output file
try
SetFileSummaryInfo
(PWideChar(BaseLocation + LeftStr(GetSSWData, Length
(GetSSWData) - 1) + '.vkp')); // in my testcase files full path is: C:\Documents and Settings\Kludge\Desktop\sedevrpg\SEDEV_RPG_O_710.vkp
ShowMessagePos('Patch Created successfuly!' + #13#13 +
'Please verify created data to www.se-developers.net.',
ParamStr2X, ParamStr3Y);
MessageBeep(0);
except // exception handler does not even fire on exception ...
on Exception do
begin
if (WarningChBx.Checked = True) then
ShowMessagePos
('Unable to add Description to Output file (' +
BaseLocation + LeftStr(GetSSWData, Length(GetSSWData)
- 1) + '.vkp )', ParamStr2X, ParamStr3Y);
MessageBeep(0);
end;
end
final edit by author: Problem was in SetFileSummaryInfo(PWideChar('')) because after PWideChar conversion you got CHARACTER, not Array of Characters ( aka Strings ) therefore it is not valid path anymore!
Here is main tutorial: http://www.delphipages.com/articles/setting_file_summary_information-9228.html
edit: a better formatted tutorial is here.
BUT, the thing is that I just cannot get that damned FileName param to accept any string ... I have EOleSysError exception: "%1 cannot be found" no matter what.
Faulting operand is:
OleCheck(StgOpenStorageEx(PWideChar(FileName),
STGM_SHARE_EXCLUSIVE or STGM_READWRITE,
STGFMT_ANY,
0, nil, nil, #IID_IPropertySetStorage, stg));
What I do not understand is why it actually wants %1 MSDOS file name input.
I am not launching app from CMD therefore I highly doubt it needs additional param for File path ...
I have tried all possible String and PString conversions, also tried various param passing methods ... It just does not work ...
Any help appreciated!
I can only reproduce your case by specifying an invalid filename. Make sure that you include the full path in your filename.
Related
I've been struggling with how to fix a SpreadsheetML file being written by a 3rd party library. After some poking about I came across this blog post on OpenXMLValidator. The code is very simple:
Using testdoc As SpreadsheetDocument = SpreadsheetDocument.Open(filepath, False)
Try
Dim validator As New OpenXmlValidator()
Dim count As Integer = 0
For Each [error] As ValidationErrorInfo In validator.Validate(testdoc)
count += 1
Console.WriteLine("Error " & count)
Console.WriteLine("Description: " & [error].Description)
Console.WriteLine("ErrorType: " & [error].ErrorType)
Console.WriteLine("Node: " & [error].Node.ToString())
Console.WriteLine("Path: " & [error].Path.XPath)
Console.WriteLine("Part: " & [error].Part.Uri.ToString())
Console.WriteLine("-------------------------------------------")
Next
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
testdoc.Close()
End Using
One teenie problem, however. When SpreadsheetDocument.Open runs, it throws an error, System.InvalidOperationException: 'Specified part does not exist in the package.' and thus the Validator can't examine it. This is... odd, given that not being able to open the package is precisely the problem I'm trying to solve!
Does anyone have any hints or tricks here? Or perhaps an alternate solution to tracking down OpenXML errors?
When trying to access a WSDL service, I get the following error:
ValueError: Invalid tag name 'Foo\\Bar\\Baz\\Etc\\V3Port'
The port which is provided through the WSDL-link actually has single backslashes: 'Foo\Bar\Baz\Etc\V3Port'
The ValueError gets raised when zeep calls the apihelpers.pxi method in the lxml library.
Any idea how I can fix this?
(BTW: the script worked fine when I used it 2 months ago. The WSDL-link hasn't changed)
I have found a solution
Before, it was sufficient to do:
from zeep import Client
Now, apparently, I need to explicitly add:
from lxml import etree
Everything works as before now.
Zeep does not like like "/" in values also. It gives invalid tag name error any time it finds any character in value that it does not like. For all such errors, you need to modify as_qname function in utils.py located in root folder of zeep library.
In my case, it was complaining for "/" in value, which is a valid value. I had to add below line to as_qname function.
value = value.replace("/", "-")
Below are first few lines of as_qname after modification
def as_qname(value: str, nsmap, target_namespace=None) -> etree.QName:
"""Convert the given value to a QName"""
value = value.strip() # some xsd's contain leading/trailing spaces
value = value.replace("/", "-") # Added by me.
if ":" in value:
prefix, local = value.split(":")
I am using the wave audio component in my project and I run into a problem that I am unable to resolve.
I am using Delphi XE 5 and my operating system is Windows 8. When I am trying to the run the project and active the liveaudio recorder on Windows 7, I got this: error Exception EOSError in module Chatproject.exe at 00029633. System Error. Code: 123. The filename, directory name, or volume label syntax is incorrect. But its working normal on Windows 8,. I tried to debug and figure out the problem I got this error message when I am activating the recorder
Update of the question :
i debugged each of sendtocl , sendbuffer ,buffer^, buffersize and here is result in the image ,, but i have no idea how to fix sendbuffer and buffer^ and sendtocl
http://i.stack.imgur.com/5sZ05.jpg
You have four references to sendtocl:
#56: sendtocl: TIdUDPClient;
#235: if sendtocl.active then
#236: sendtocl.SendBuffer(RawToBytes(Buffer^, Buffersize))
#260: sendtocl.Broadcast(usertype.Text, 12000);
It should be getting created when the form is created, assuming it's a component dropped on the form. But for whatever reason, it isn't instantiated at some point.
This is consistent with the exception message you're getting.
The ERROR_INVALID_NAME is probably pointing to an invalid URI, path, or filename -- it's entirely possible that it's valid in Win 8 but not Win 7. So when you try to invoke .Active, it fails. But why sendtocl woudl be set to NIL doesn't make sense. Mabye the exception is on the SendBuffer method?
As Ken suggests, you just need to go in with the debugger and figure out what's going on. I'm not sure there's much more us "out here" can do for you other than comment on how the code appears.
In a delphi Application, When I move mouse to a component that has Hint I see this error :
" Access violation at address 00484F3B in module 'Plibrary.exe'. Read of address 0000026C"
Why this happen?
Call Stack:
:758e9617 KERNELBASE.RaiseException + 0x54
:458bf456 System.#UStrCmp
:00407558 #UStrCmp + $2C
Forms.TApplication.SetHint(???)
Forms.TApplication.Idle(???)
Forms.TApplication.HandleMessage
Forms.TApplication.Run Plibrary.Plibrary
:75ca1194 kernel32.BaseThreadInitThunk + 0x12
:7752b3f5 ntdll.RtlInitializeExceptionChain + 0x63
:7752b3c8 ntdll.RtlInitializeExceptionChain + 0x36"
And failing code is in System.pas file at line 17732 : "MOV ESI,[ESP]"
Edit (from comment):
In the remain.pas file at this procedure :
procedure TMainForm.ShowHint(Sender: TObject);
begin
if Length(Application.Hint) > 0 then begin
StatusBar.SimplePanel := True;
StatusBar.SimpleText := Application.Hint; //this line gives error
end else
StatusBar.SimplePanel := False;
end;
Read of address 0000026C
This very low address is indicative of an offset to a member field of a nil object reference. Run under the debugger and make sure the debugger is set to break on exceptions. When it does, you should be able to work out which object reference is nil.
Quite possibly the AV happens in VCL code although it will almost certainly be due to an error in your code. If the debugger doesn't break at a very helpful location, enable Debug DCUs in the project options in order to see the VCL source code at the point where the exception is raised.
The stack trace you provide suggests that the error is in TApplication.SetHint, whilst performing a string comparison. The first line of TApplication.SetHint reads:
if FHint <> Value then
I bet the offset to the FHint of TApplication is $026C and that, somehow, your Application variable is set to nil. That said, I don't understand why the error would not have been raised earlier at Length(Application.Hint). It's quite hard to debug this remotely!
Having looked at the layout of TApplication, I think we can rule out Application being nil. Perhaps FHint itself has somehow been corrupted, or perhaps even Value. I think it's going to take access to the actual code and a debugging environment to track this down.
Based on the information provided in the stacktrace:
TApplication.Idle:
Control := DoMouseIdle;
if FShowHint and (FMouseControl = nil) then
CancelHint;
Application.Hint := GetLongHint(GetHint(Control)); // SetHint is called next:
TApplication.SetHint:
if FHint <> Value then // This is the UStrCmp which fails with a Int overflow
String + IntOverflow -> non terminating string. So the most probable cause is a string without a terminator.
So where does the string come from...
GetHint(Control) searches the control (which is at the places you clicked with the cursor) and its parent for a hint that is not empty.
GetLongHint searches the string for a | and if found, uses the part following the | else it uses the complete string.
UStrCmp, is a long pieces of assembler code, that calls other pieces of assembler code. Some of them can raise the EIntegerOverflow error.
Advise
Use the debugger (with debug dcu's on) to see which string has no terminator (0 character at the end). And if you find it, try to solve it or expand the question if you want some more help from us.
I have a rc entry:
{CC6C210B-2EAC-4F6C-89E7-0D2FEFFCE278} 8000 "MyFile.txt"
When I compile the rc file with cgrc.exe or brcc32.exe, I encounter this error:
[BRCC32 Error] system.core.rc(1): expected exponent value, not 'a'
This is due to the resource name "CC6C210B-2EAC" was interpreted as exponent value (-2EA). The A character after -2E is not valid exponent value.
If I change the rc entry to something like
{CC6C210B-2E2C-4F6C-89E7-0D2FEFFCE278} 8000 "MyFile.txt"
The resource compile without any error.
Unfortunately, I can't simply change the resource name as it has been widely used. Is there any ways to make rc do not interpret resource name as exponent value?
I'm not so sure it was a good idea to use a GUID as resource name. If you really want to do that, you might want to "encode" it as a "normal" identifier, e.g.
_CC6C210B_2EAC_4F6C_89E7_0D2FEFFCE278 8000 "MyFile.txt"
You just write a set of simple routines to "encode" and "decode" such a value between a normal GUID string and the "encoded" form.
function DecodeToGUID(const renamedGUID: string): string;
begin
Result := '{' + Copy(ReplaceString(renamedGUID, '_', '-', [rfReplaceAll]), 2, MaxInt)) + '}';
end;
I'll leave the implementation of the other routine to your imagination. ;-)
Update
If you put the ID in quotes, it should compile, with rc.exe. Without the quotes, the resource compiler will treat it as a preprocessor directive and get terribly confused:
"{CC6C210B-2EAC-4F6C-89E7-0D2FEFFCE278}" 8000 "MyFile.txt"
I tested this with Microsoft's rc.exe. Embarcadero's brcc32.exe will still give an error:
Error resrc.rc 1 1: Expecting resource name or resource type name
So if you want to use that, or the built in resource compiler of the IDE, you'll have to use something like the renamed GUIDs as described above.
I recommend that you use the Microsoft resource compiler rc. According to the documentation for rc, the first token of a resource definition should be a name or a 16 bit integer. Why brcc32 wants to interpret this as a real value is quite beyond me.
If this doesn't work try enclosing the GUID in quotes, " rather than '.