Hi guys, I think I'm going to lose my mind with this, I cant make my chunked transfer manager to work right. The problem I'm having is that reading the amount of data specified in the chunk-size, I end up having the next chunk size inside the body, so, when I call the next getchunksize, it fails. The first call to getChunkSize() works great and I get the size value as expected. The BufferedReader is connected to the sock s = new Socket(connectTo, portNum); sIn = new BufferedReader(new InputStreamReader(s.getInputStream()) );
Thanks a lot guys, I hope any of you understands what's going on... private String processChunked(BufferedReader sIn, String newData) throws IOException { newData += LINEBREAK; // Let's separate header form body int size = 0; String body = new String(); size = getChunkSize(sIn); while(size > 0) { body = getChunkData(sIn, size); size = getChunkSize(sIn); newData += body; body = ""; } return newData; } private String getChunkData(BufferedReader sIn, int lenght) throws IOException { int val = 0; String res = new String(); char chr = ' '; for(int i= 0; i val = sIn.read(); if(val == -1) break; chr = (char)val; res += Character.valueOf(chr).toString(); } return res; } private int getChunkSize(BufferedReader sIn) throws IOException { char chr = ' ', prvChr = ' '; int val = 0; String tmpSize = new String(); int size = 0; int readed = 0; do { //Read chunk size prvChr = chr; val = sIn.read(); if (val == -1) { break; } readed++; chr = (char) val; tmpSize += Character.valueOf(chr).toString(); } while (prvChr != '\r' && chr != '\n'); // calculate chunk size if(tmpSize.indexOf(";") != -1) { //remove chunk extension tmpSize = tmpSize.substring(0, tmpSi
Kharfax
Posts
-
Chunked transfer encoding problem -
problem in copying fileMaybe the operation is beign virtualized, thats why you dont get any error, but the file isn't copied. You'll need to elevate your app to copy the file, or find a non protected place to copy your file. Sysinternals haves a free application, process explorer that you can use to see the security attributes of your app, and if is running virtualized. Also I sugest you to include the UAC manifest in your .exe, Vista heuristics are a pain in the ass.
-
Installers and UAC "heuristics"My app after beign elevated was running with vitualization turned off. I don't know the difference among a normal elevated app, an unsigned installer and a signed installer. Is pretty obvious there are differences, but people from MS dont want to explain them it seems.
-
Installers and UAC "heuristics"Thanks, I added the manifest and now it seems to work fine. The UAC heuristics was detecting my app as an installer but I don't know why if my app had an "installer name" it failed. Some guy told me that the problem probably was originated by the compatibility heuristics that simulate an older Win version.
-
Installers and UAC "heuristics"yeap, i knew about that, is used to support legacy installers... But the strange thing is that my installer works if the name is different from the "installer keywords" I dont understand...
-
Installers and UAC "heuristics"Check this, I have a custom installer I made, it worked great in all win OSs, until Vista. With Vista, it works great with UAC turned off. If I turn on UAC, the heuristics detects that my program needs elevation, ok I understand that. Now, the big question is, what is the difference between my installer called pete.exe or caller instalar.exe? Well, If my installer is called "instalar" (install in spanish), it hangs up in the middle of the instalation, in different places, like getting an already installed component version, or creating a desktop shortcut. If my installer is called "pete", it works great, I dont see any problem. I dont know what to think... My installer isn't signed. Something is changing depending the .exe name. Anyone saw something like this? Should I use exe names Hax0r style to avoid this? my .exe should be called 1nst4l4r?
-
Lowering resource Integrity LevelDidn't work either :S I don't know what else to do. If I open the controller app first, my BHO cant communicate. Worst of all, when I use setsecurityinfo, I get no errors. And my app works, because if I turn off protected mode or open IE before my controller app it works fine. A lot of BHO developers are asking their clients to turn off protected mode in order to use their soft, I think I'll need to do the same :( -- modified at 9:42 Monday 30th April, 2007 I FIXED IT!! Thanks mate, using SE_KERNEL_OBJECT and don't allowing the BHO dll to init if is in the controller app address space it started to work :D
-
Lowering resource Integrity LevelThanks a lot Michael, I'll check it and post the results :D
-
Lowering resource Integrity LevelHi, I'm working in a Single Sign On App, and I need to comunicate a BHO with it's controller App, I'm using a memory mapped file for that. If the BHO is the one who creates the mapped file, everything works fine (The mapped file is LI) If the controller app creates the mapped file, the BHO fails to open the mapped file (The Mapped file is MI ) So I decided to lower the maped file integrity using the code provided by MS in the paper "Understanding and working in protected mode internet explorer". But that code doesnt work, and I have seen in this forum that a lot of people is having problems with that code, and I can't find any documentation about this at MSDN In resume: How can I lower a resource integrity level? Can someone help me or give me a hint? Here is the code I'm using to create the mapped file and lower the it's Integrity level: Notice that I replaced the values SDDL_REVISION_1 by 1 and LABEL_SECURITY_INFORMATION by 0x00000010L because I cant find where are defined. Thanks in advance
HANDLE m_hMapVars = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, //&sa, PAGE_READWRITE, 0, 1024, "F31B3896-3455-4d0d-1234-2389346239874"); //Security Descriptor #define LOW_INTEGRITY_SDDL_SACL "S:(ML;;NW;;;LW)" PSECURITY_DESCRIPTOR pSd = NULL; PACL pSacl = NULL; BOOL fSaclPresent = FALSE; BOOL fSaclDefaulted = FALSE; if(ConvertStringSecurityDescriptorToSecurityDescriptor(LOW_INTEGRITY_SDDL_SACL, 1, &pSd , NULL)) { if(GetSecurityDescriptorSacl(pSd, &fSaclPresent, &pSacl, &fSaclDefaulted)) { if(ERROR_SUCCESS != SetSecurityInfo(m_hMapVars, SE_FILE_OBJECT, 0x00000010L , NULL,NULL,NULL, pSacl)) } } }
-
On paint calling orderThanks for the quick reply people :D
-
PostMessage and Send MessageI think the problem isn't the message you are sending but your painting rutines that maybe are not freeing the allocated resources.
-
On paint calling orderHi I have a picture box in my dialog, but I need to write something on top of it. The problem is that the onPaint dialog method is getting called before the control repaints itself, so I can never see the text. Someone knows what can I do to avoid this, and be able to write on top of the picture box? Thanks in advance
-
Signing executables for VistaHi I had made my own installer for my app. The installer needs to rise is rights to administrator, and Vista ask permision to the user. In the dialog shown in that case, how can I do to show the name of my company instead of "Editor no identificado" or "Unknow developer"? (I dont know what does it says in english because i have an Spanish Vista). Thanks
-
USES_CONVERSIONUSES_CONVERSION is a macro that allows to use BSTR string conversion functions like OLE2T and T2OLE, at least thats why I used it, but never gave me any problem... Is defined in atlconv.h #define USES_CONVERSION int _convert = 0; (_convert); UINT _acp = ATL::_AtlGetConversionACP() /*CP_THREAD_ACP*/; (_acp); LPCWSTR _lpw = NULL; (_lpw); LPCSTR _lpa = NULL; (_lpa) I don't know man, no idea what could be the problem
-
Making strong passwords readeableHey thanks a lot for the links :D
-
Making strong passwords readeablenoooooooo, I'm not paranoid, I use PGP with 1024 bit keys just to be 133t ;) I just needed something to make easier to the user the task of sharing passwords via phone. Lets supose the pass is "a&RT2"/(=fbTR16bJ" is really hard to say all that by phone, the idea is to transform that in something like "LU8C-RA7Z-12MVR-97YB" thats a lot easier to tell. I already found the answer to my problems, and is called Base32. Thanks a lot for the feedback anyway Maximilien :D
-
Making strong passwords readeableHi I'm working in a simple mail encryption system with random generated passwords. What I would like is to make some kind of encoding to the password in order to allow the user to share the password via phone. I tried replacing every char in the pass by its hexa ascii code, but the resulting number is too long, I'm using 32 chars keys. Any ideas on how could I solve this problem? Thanks a lot :D
-
CreateFile fails to open temp fileSolved Damn!, the path had " at the beginning and in the end, I trimed the " and now is working fine Thanks a lot for the help :D
-
CreateFile fails to open temp fileOK, I did this, I called shellexecute with notepad, and the file openned. ShellExecute(NULL, "open", "notepad.exe", param, NULL,SW_SHOW); So, I dont know :( Help please :D
-
CreateFile fails to open temp fileHi I have a program asociated with a file extension, when I open the file via Outlook, it creates a temp file in: Documents and Settings/sebastian/Local Settings/Temporary Internet Files/OLK37/file.mio My app receives the path, but CreateFile fails with error 123: File not exist The file exist, but that is a system/hidden folder. Why is failing to open the file?? This is my call to create file:
HANDLE hFile = CreateFile(param, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
Thanks in advance :D